arm_cm0.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /******************************************************************************
  2. *
  3. * @brief provide generic high-level routines for ARM Cortex M0/M0+ processors.
  4. *
  5. *******************************************************************************/
  6. #ifndef _CPU_ARM_CM0_H
  7. #define _CPU_ARM_CM0_H
  8. /*ARM Cortex M0 implementation for interrupt priority shift*/
  9. #define ARM_INTERRUPT_LEVEL_BITS 2
  10. /***********************************************************************/
  11. /*!< Macro to enable all interrupts. */
  12. #ifndef KEIL
  13. #define EnableInterrupts asm(" CPSIE i");
  14. #else
  15. #define EnableInterrupts __enable_irq()
  16. #endif
  17. /*!< Macro to disable all interrupts. */
  18. #ifndef KEIL
  19. #define DisableInterrupts asm(" CPSID i");
  20. #else
  21. #define DisableInterrupts __disable_irq()
  22. #endif
  23. #define disable_irq(irq) NVIC_DisableIRQ(irq)
  24. #define enable_irq(irq) NVIC_EnableIRQ(irq)
  25. #define set_irq_priority(irq, prio) NVIC_SetPriority(irq, prio)
  26. /***********************************************************************/
  27. /*
  28. * Misc. Defines
  29. */
  30. #ifdef FALSE
  31. #undef FALSE
  32. #endif
  33. #define FALSE (0)
  34. #ifdef TRUE
  35. #undef TRUE
  36. #endif
  37. #define TRUE (1)
  38. #ifdef NULL
  39. #undef NULL
  40. #endif
  41. #define NULL (0)
  42. #ifdef ON
  43. #undef ON
  44. #endif
  45. #define ON (1)
  46. #ifdef OFF
  47. #undef OFF
  48. #endif
  49. #define OFF (0)
  50. #undef ENABLE
  51. #define ENABLE (1)
  52. #undef DISABLE
  53. #define DISABLE (0)
  54. /***********************************************************************/
  55. /*
  56. * The basic data types
  57. */
  58. typedef unsigned char uint8; /* 8 bits */
  59. typedef unsigned short int uint16; /* 16 bits */
  60. typedef unsigned long int uint32; /* 32 bits */
  61. typedef char int8; /* 8 bits */
  62. typedef short int int16; /* 16 bits */
  63. typedef int int32; /* 32 bits */
  64. typedef volatile int8 vint8; /* 8 bits */
  65. typedef volatile int16 vint16; /* 16 bits */
  66. typedef volatile int32 vint32; /* 32 bits */
  67. typedef volatile uint8 vuint8; /* 8 bits */
  68. typedef volatile uint16 vuint16; /* 16 bits */
  69. typedef volatile uint32 vuint32; /* 32 bits */
  70. // function prototype for main function
  71. int main(void);
  72. /***********************************************************************/
  73. // function prototypes for arm_cm0.c
  74. void stop (void);
  75. void wait (void);
  76. void write_vtor (int);
  77. /***********************************************************************/
  78. #endif /* _CPU_ARM_CM4_H */