cortexm0.pp 2.1 KB

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