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