xref: /linux/arch/sh/include/asm/romimage-macros.h (revision 9e56ff53b4115875667760445b028357848b4748)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ROMIMAGE_MACRO_H
3 #define __ROMIMAGE_MACRO_H
4 
5 /* The LIST command is used to include comments in the script */
6 .macro	LIST comment
7 .endm
8 
9 /* The ED command is used to write a 32-bit word */
10 .macro  ED, addr, data
11 	mov.l 1f, r1
12 	mov.l 2f, r0
13 	mov.l r0, @r1
14 	bra 3f
15 	 nop
16 	.align 2
17 1 :	.long \addr
18 2 :	.long \data
19 3 :
20 .endm
21 
22 /* The EW command is used to write a 16-bit word */
23 .macro  EW, addr, data
24 	mov.l 1f, r1
25 	mov.l 2f, r0
26 	mov.w r0, @r1
27 	bra 3f
28 	 nop
29 	.align 2
30 1 :	.long \addr
31 2 :	.long \data
32 3 :
33 .endm
34 
35 /* The EB command is used to write an 8-bit word */
36 .macro  EB, addr, data
37 	mov.l 1f, r1
38 	mov.l 2f, r0
39 	mov.b r0, @r1
40 	bra 3f
41 	 nop
42 	.align 2
43 1 :	.long \addr
44 2 :	.long \data
45 3 :
46 .endm
47 
48 /* The WAIT command is used to delay the execution */
49 .macro  WAIT, time
50 	mov.l  2f, r3
51 1 :
52 	nop
53 	tst     r3, r3
54 	bf/s    1b
55 	dt      r3
56 	bra	3f
57 	 nop
58 	.align 2
59 2 :	.long \time * 100
60 3 :
61 .endm
62 
63 /* The DD command is used to read a 32-bit word */
64 .macro  DD, addr, addr2, nr
65 	mov.l 1f, r1
66 	mov.l @r1, r0
67 	bra 2f
68 	 nop
69 	.align 2
70 1 :	.long \addr
71 2 :
72 .endm
73 
74 #endif /* __ROMIMAGE_MACRO_H */
75