contrib: replace the GPLv2-or-later license tag
[fw/openocd] / contrib / loaders / flash / str9x.s
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /***************************************************************************
4  *   Copyright (C) 2010 by Spencer Oliver                                  *
5  *   spen@spen-soft.co.uk                                                  *
6  ***************************************************************************/
7
8         .text
9         .arm
10         .arch armv5t
11
12         .section .init
13 /*
14         r0 source address (in)
15         r1 target address (in)
16         r2 word count (in)
17         r3 result (out)
18 */
19
20 write:
21         bic             r4, r1, #3                      /* word address */
22         mov             r3, #0x40                       /* write command */
23         strh    r3, [r4, #0]
24         ldrh    r3, [r0], #2            /* read data */
25         strh    r3, [r1], #2            /* write data */
26         mov             r3, #0x70                       /* status command */
27         strh    r3, [r4, #0]
28 busy:
29         ldrb    r3, [r4, #0]            /* status */
30         tst     r3, #0x80
31         beq     busy
32         mov             r5, #0x50                       /* clear status command */
33         strh    r5, [r4, #0]
34         mov             r5, #0xFF                       /* read array */
35         strh    r5, [r4, #0]
36         tst             r3, #0x12
37         bne             exit
38         subs    r2, r2, #1                      /* decrement word count */
39         bne     write
40 exit:
41         bkpt    #0
42
43         .end