uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lpc17xx_nvic.c
Go to the documentation of this file.
1 /***********************************************************************/
22 /* Peripheral group ----------------------------------------------------------- */
27 /* Includes ------------------------------------------------------------------- */
28 #include "lpc17xx_nvic.h"
29 
30 
31 /* Private Macros ------------------------------------------------------------- */
36 /* Vector table offset bit mask */
37 #define NVIC_VTOR_MASK 0x3FFFFF80
38 
44 /* Public Functions ----------------------------------------------------------- */
50 /*****************************************************************************/
61 void NVIC_DeInit(void)
62 {
63  uint8_t tmp;
64 
65  /* Disable all interrupts */
66  NVIC->ICER[0] = 0xFFFFFFFF;
67  NVIC->ICER[1] = 0x00000001;
68  /* Clear all pending interrupts */
69  NVIC->ICPR[0] = 0xFFFFFFFF;
70  NVIC->ICPR[1] = 0x00000001;
71 
72  /* Clear all interrupt priority */
73  for (tmp = 0; tmp < 32; tmp++) {
74  NVIC->IP[tmp] = 0x00;
75  }
76 }
77 
78 /*****************************************************************************/
96 void NVIC_SCBDeInit(void)
97 {
98  uint8_t tmp;
99 
100  SCB->ICSR = 0x0A000000;
101  SCB->VTOR = 0x00000000;
102  SCB->AIRCR = 0x05FA0000;
103  SCB->SCR = 0x00000000;
104  SCB->CCR = 0x00000000;
105 
106  for (tmp = 0; tmp < 32; tmp++) {
107  SCB->SHP[tmp] = 0x00;
108  }
109 
110  SCB->SHCSR = 0x00000000;
111  SCB->CFSR = 0xFFFFFFFF;
112  SCB->HFSR = 0xFFFFFFFF;
113  SCB->DFSR = 0xFFFFFFFF;
114 }
115 
116 
117 /*****************************************************************************/
122 void NVIC_SetVTOR(uint32_t offset)
123 {
124 // SCB->VTOR = (offset & NVIC_VTOR_MASK);
125  SCB->VTOR = offset;
126 }
127 
136 /* --------------------------------- End Of File ------------------------------ */