romimage-macros.h 1.1 KB

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