update files to correct FSF address
[openocd.git] / contrib / loaders / flash / str9x.s
blob4daac7731f9913a43fdbeff1d502c1764fb9ed3d
1 /***************************************************************************
2 * Copyright (C) 2010 by Spencer Oliver *
3 * spen@spen-soft.co.uk *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
19 ***************************************************************************/
21 .text
22 .arm
23 .arch armv5t
25 .section .init
27 r0 source address (in)
28 r1 target address (in)
29 r2 word count (in)
30 r3 result (out)
33 write:
34 bic r4, r1, #3 /* word address */
35 mov r3, #0x40 /* write command */
36 strh r3, [r4, #0]
37 ldrh r3, [r0], #2 /* read data */
38 strh r3, [r1], #2 /* write data */
39 mov r3, #0x70 /* status command */
40 strh r3, [r4, #0]
41 busy:
42 ldrb r3, [r4, #0] /* status */
43 tst r3, #0x80
44 beq busy
45 mov r5, #0x50 /* clear status command */
46 strh r5, [r4, #0]
47 mov r5, #0xFF /* read array */
48 strh r5, [r4, #0]
49 tst r3, #0x12
50 bne exit
51 subs r2, r2, #1 /* decremment word count */
52 bne write
53 exit:
54 bkpt #0
56 .end