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
171 :	.long \addr
182 :	.long \data
193 :
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
301 :	.long \addr
312 :	.long \data
323 :
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
431 :	.long \addr
442 :	.long \data
453 :
46.endm
47
48/* The WAIT command is used to delay the execution */
49.macro  WAIT, time
50	mov.l  2f, r3
511 :
52	nop
53	tst     r3, r3
54	bf/s    1b
55	dt      r3
56	bra	3f
57	 nop
58	.align 2
592 :	.long \time * 100
603 :
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
701 :	.long \addr
712 :
72.endm
73
74#endif /* __ROMIMAGE_MACRO_H */
75