cortexm0.pp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. {
  2. System register definitions and utility code for Cortex-M0
  3. Created by Jeppe Johansen 2012 - [email protected]
  4. Modified for M0 by Michael Ring 2013 - [email protected]
  5. }
  6. unit cortexm0;
  7. interface
  8. {$PACKRECORDS 2}
  9. const
  10. SCS_BASE = $E000E000;
  11. SysTick_BASE = SCS_BASE+$0010;
  12. NVIC_BASE = SCS_BASE+$0100;
  13. SCB_BASE = SCS_BASE+$0D00;
  14. DWT_BASE = $E0001000;
  15. FP_BASE = $E0002000;
  16. ITM_BASE = $E0000000;
  17. TPIU_BASE = $E0040000;
  18. ETM_BASE = $E0041000;
  19. type
  20. TNVICRegisters = record
  21. ISER : dword;
  22. RESERVED0 : array[0..30] of dword;
  23. ICER : dword;
  24. RSERVED1 : array[0..30] of dword;
  25. ISPR : dword;
  26. RESERVED2 : array[0..30] of dword;
  27. ICPR : dword;
  28. RESERVED3 : array[0..30] of dword;
  29. RESERVED4 : array[0..63] of dword;
  30. IPR : array[0..7] of dword;
  31. end;
  32. TSCBRegisters = record
  33. CPUID, {!< CPU ID Base Register }
  34. ICSR, {!< Interrupt Control State Register }
  35. RESERVED0,
  36. AIRCR, {!< Application Interrupt / Reset Control Register }
  37. SCR, {!< System Control Register }
  38. CCR: dword; {!< Configuration Control Register }
  39. RESERVED1 : dword;
  40. SHP: array[0..1] of dword; {!< System Handlers Priority Registers (4-7, 8-11, 12-15) }
  41. end;
  42. TSysTickRegisters = record
  43. Ctrl,
  44. Load,
  45. Val,
  46. Calib: dword;
  47. end;
  48. TCoreDebugRegisters = record
  49. DHCSR,
  50. DCRSR,
  51. DCRDR,
  52. DEMCR: longword;
  53. end;
  54. var
  55. // System Control
  56. InterruptControlType: longword absolute (SCS_BASE+$0004);
  57. SCB: TSCBRegisters absolute (SCS_BASE+$0D00);
  58. SysTick: TSysTickRegisters absolute (SCS_BASE+$0010);
  59. NVIC: TNVICRegisters absolute (SCS_BASE+$0100);
  60. SoftwareTriggerInterrupt: longword absolute (SCS_BASE+$0000);
  61. // Core Debug
  62. CoreDebug: TCoreDebugRegisters absolute (SCS_BASE+$0DF0);
  63. implementation
  64. end.