zboot_macros.h 999 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef __ZBOOT_MACRO_H
  2. #define __ZBOOT_MACRO_H
  3. /* The LIST command is used to include comments in the script */
  4. .macro LIST comment
  5. .endm
  6. /* The ED command is used to write a 32-bit word */
  7. .macro ED, addr, data
  8. LDR r0, 1f
  9. LDR r1, 2f
  10. STR r1, [r0]
  11. B 3f
  12. 1 : .long \addr
  13. 2 : .long \data
  14. 3 :
  15. .endm
  16. /* The EW command is used to write a 16-bit word */
  17. .macro EW, addr, data
  18. LDR r0, 1f
  19. LDR r1, 2f
  20. STRH r1, [r0]
  21. B 3f
  22. 1 : .long \addr
  23. 2 : .long \data
  24. 3 :
  25. .endm
  26. /* The EB command is used to write an 8-bit word */
  27. .macro EB, addr, data
  28. LDR r0, 1f
  29. LDR r1, 2f
  30. STRB r1, [r0]
  31. B 3f
  32. 1 : .long \addr
  33. 2 : .long \data
  34. 3 :
  35. .endm
  36. /* The WAIT command is used to delay the execution */
  37. .macro WAIT, time, reg
  38. LDR r1, 1f
  39. LDR r0, 2f
  40. STR r0, [r1]
  41. 10 :
  42. LDR r0, [r1]
  43. CMP r0, #0x00000000
  44. BNE 10b
  45. NOP
  46. B 3f
  47. 1 : .long \reg
  48. 2 : .long \time * 100
  49. 3 :
  50. .endm
  51. /* The DD command is used to read a 32-bit word */
  52. .macro DD, start, end
  53. LDR r1, 1f
  54. B 2f
  55. 1 : .long \start
  56. 2 :
  57. .endm
  58. #endif /* __ZBOOT_MACRO_H */