A31R71x F/W Packages  1.5.0
ABOV Cortex-M0+ Core based MCUs Integrated Driver
A31R71x_hal_intc.h
Go to the documentation of this file.
1 /***************************************************************************//****************************************************************************/
34 
35 #ifndef _INTC_H_
36 #define _INTC_H_
37 
38 #include "A31R71x.h"
39 #include "A31R71x_hal_aa_types.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 //******************************************************************************
46 // Constant
47 //******************************************************************************
48 
49 // External Interrupt Port Number
50 #define PORTA (0x0uL)
51 #define PORTB (0x1uL)
52 // #define PORTC (0x2uL)
53 // #define PORTD (0x3uL)
54 #define PORTE (0x4uL)
55 // #define PORTF (0x5uL)
57 // External Interrupt Number
58 /*
59 #define EINT0_SEL (0x0uL)
60 #define EINT1_SEL (0x1uL)
61 #define EINT2_SEL (0x2uL)
62 #define EINT3_SEL (0x3uL)
63 */
64 #define EINT0 (0x0uL)
65 #define EINT1 (0x1uL)
66 #define EINT2 (0x2uL)
67 #define EINT3 (0x3uL)
68 
69 // External Interrupt Trigger Selection Control
70 /*
71 #define TRG_EDGE (0x0uL)
72 #define TRG_LEVEL (0x1uL)
73 */
74 #define ITRIGx_Edge INTC_PETRIG_ITRIG15_Edge
75 #define ITRIGx_Level INTC_PETRIG_ITRIG15_Level
76 
77 // External Interrupt Enable Control
78 /*
79 #define EInt_DISABLE (0x0uL)
80 #define EInt_LOW_LEVEL_INT (0x1uL)
81 #define EInt_HIGH_LEVEL_INT (0x2uL)
82 #define EInt_FALLING_EDGE_INT (0x1uL)
83 #define EInt_RISING_EDGE_INT (0x2uL)
84 #define EInt_BOTH_EDGE_INT (0x3uL)
85 */
86 #define INTCTLx_Disable INTC_PECR_INTCTL15_Disable
87 #define INTCTLx_LowLevel INTC_PECR_INTCTL15_FallingEdgeLowLevel
88 #define INTCTLx_HighLevel INTC_PECR_INTCTL15_RisingEdgeHighLevel
89 #define INTCTLx_FallingEdge INTC_PECR_INTCTL15_FallingEdgeLowLevel
90 #define INTCTLx_RisingEdge INTC_PECR_INTCTL15_RisingEdgeHighLevel
91 #define INTCTLx_BothEdge INTC_PECR_INTCTL15_BothEdgeNoLevel
92 
93 // External Interrupt Flag Clear Control
94 /*
95 #define EFLAG0 (0x1uL << 0)
96 #define EFLAG1 (0x1uL << 1)
97 #define EFLAG2 (0x1uL << 2)
98 #define EFLAG3 (0x1uL << 3)
99 #define EFLAG4 (0x1uL << 4)
100 #define EFLAG5 (0x1uL << 5)
101 #define EFLAG6 (0x1uL << 6)
102 #define EFLAG7 (0x1uL << 7)
103 */
104 #define PnFLAG_FLAG15 (0x1uL << INTC_PEFLAG_FLAG15_Pos)
105 #define PnFLAG_FLAG14 (0x1uL << INTC_PEFLAG_FLAG14_Pos)
106 #define PnFLAG_FLAG13 (0x1uL << INTC_PEFLAG_FLAG13_Pos)
107 #define PnFLAG_FLAG12 (0x1uL << INTC_PEFLAG_FLAG12_Pos)
108 #define PnFLAG_FLAG11 (0x1uL << INTC_PEFLAG_FLAG11_Pos)
109 #define PnFLAG_FLAG10 (0x1uL << INTC_PEFLAG_FLAG10_Pos)
110 #define PnFLAG_FLAG9 (0x1uL << INTC_PEFLAG_FLAG9_Pos)
111 #define PnFLAG_FLAG8 (0x1uL << INTC_PEFLAG_FLAG8_Pos)
112 #define PnFLAG_FLAG7 (0x1uL << INTC_PEFLAG_FLAG7_Pos)
113 #define PnFLAG_FLAG6 (0x1uL << INTC_PEFLAG_FLAG6_Pos)
114 #define PnFLAG_FLAG5 (0x1uL << INTC_PEFLAG_FLAG5_Pos)
115 #define PnFLAG_FLAG4 (0x1uL << INTC_PEFLAG_FLAG4_Pos)
116 #define PnFLAG_FLAG3 (0x1uL << INTC_PEFLAG_FLAG3_Pos)
117 #define PnFLAG_FLAG2 (0x1uL << INTC_PEFLAG_FLAG2_Pos)
118 #define PnFLAG_FLAG1 (0x1uL << INTC_PEFLAG_FLAG1_Pos)
119 #define PnFLAG_FLAG0 (0x1uL << INTC_PEFLAG_FLAG0_Pos)
120 
121 // External Interrupt Configuration Selection Control
122 #ifdef PORTA
123 #define CONFx_PA INTC_EINT0CONF1_CONF0_PA
124 #endif
125 #ifdef PORTB
126 #define CONFx_PB INTC_EINT0CONF1_CONF0_PB
127 #endif
128 #ifdef PORTC
129 #define CONFx_PC INTC_EINT0CONF1_CONF0_PC
130 #endif
131 #ifdef PORTD
132 #define CONFx_PD INTC_EINT0CONF1_CONF0_PD
133 #endif
134 #ifdef PORTE
135 #define CONFx_PE INTC_EINT0CONF1_CONF0_PE
136 #endif
137 #ifdef PORTF
138 #define CONFx_PF INTC_EINT0CONF1_CONF0_PF
139 #endif
140 
141 // Interrupt Source Mask Control
142 /*
143 #define LVI_MASK (0x1uL << 0)
144 #define WUT_MASK (0x1uL << 1)
145 #define WDT_MASK (0x1uL << 2)
146 #define EINT0_MASK (0x1uL << 3)
147 #define EINT1_MASK (0x1uL << 4)
148 #define EINT2_MASK (0x1uL << 5)
149 #define EINT3_MASK (0x1uL << 6)
150 #define TIMER10_MASK (0x1uL << 7)
151 #define TIMER11_MASK (0x1uL << 8)
152 #define TIMER12_MASK (0x1uL << 9)
153 #define USART10_MASK (0x1uL << 11)
154 #define WT_MASK (0x1uL << 12)
155 #define I2C1_MASK (0x1uL << 14)
156 #define TIMER20_MASK (0x1uL << 15)
157 #define TIMER21_MASK (0x1uL << 16)
158 #define USART11_MASK (0x1uL << 17)
159 #define ADC_MASK (0x1uL << 18)
160 #define UART1_MASK (0x1uL << 20)
161 #define TIMER13_MASK (0x1uL << 21)
162 #define TIMER14_MASK (0x1uL << 22)
163 #define TIMER15_MASK (0x1uL << 23)
164 */
165 #define MSK_IMSK31 (0x1uL << INTC_MSK_IMSK31_NULL_Pos)
166 #define MSK_IMSK30 (0x1uL << INTC_MSK_IMSK30_NULL_Pos)
167 #define MSK_IMSK29 (0x1uL << INTC_MSK_IMSK29_NULL_Pos)
168 #define MSK_IMSK28 (0x1uL << INTC_MSK_IMSK28_NULL_Pos)
169 #define MSK_IMSK27 (0x1uL << INTC_MSK_IMSK27_NULL_Pos)
170 #define MSK_IMSK26 (0x1uL << INTC_MSK_IMSK26_NULL_Pos)
171 #define MSK_IMSK25 (0x1uL << INTC_MSK_IMSK25_NULL_Pos)
172 #define MSK_IMSK24 (0x1uL << INTC_MSK_IMSK24_NULL_Pos)
173 #define MSK_TIMER15 (0x1uL << INTC_MSK_IMSK23_TIMER15_Pos)
174 #define MSK_TIMER14 (0x1uL << INTC_MSK_IMSK22_TIMER14_Pos)
175 #define MSK_TIMER13 (0x1uL << INTC_MSK_IMSK21_TIMER13_Pos)
176 #define MSK_UART1 (0x1uL << INTC_MSK_IMSK20_UART1_Pos)
177 #define MSK_IMSK19 (0x1uL << INTC_MSK_IMSK19_NULL_Pos)
178 #define MSK_ADC (0x1uL << INTC_MSK_IMSK18_ADC_Pos)
179 #define MSK_USART11 (0x1uL << INTC_MSK_IMSK17_USART11_Pos)
180 #define MSK_TIMER21 (0x1uL << INTC_MSK_IMSK16_TIMER21_Pos)
181 #define MSK_TIMER20 (0x1uL << INTC_MSK_IMSK15_TIMER20_Pos)
182 #define MSK_I2C1 (0x1uL << INTC_MSK_IMSK14_I2C1_Pos)
183 #define MSK_IMSK13 (0x1uL << INTC_MSK_IMSK13_NULL_Pos)
184 #define MSK_WT (0x1uL << INTC_MSK_IMSK12_WT_Pos)
185 #define MSK_USART10 (0x1uL << INTC_MSK_IMSK11_USART10_Pos)
186 #define MSK_IMSK10 (0x1uL << INTC_MSK_IMSK10_NULL_Pos)
187 #define MSK_TIMER12 (0x1uL << INTC_MSK_IMSK9_TIMER12_Pos)
188 #define MSK_TIMER11 (0x1uL << INTC_MSK_IMSK8_TIMER11_Pos)
189 #define MSK_TIMER10 (0x1uL << INTC_MSK_IMSK7_TIMER10_Pos)
190 #define MSK_EINT3 (0x1uL << INTC_MSK_IMSK6_EINT3_Pos)
191 #define MSK_EINT2 (0x1uL << INTC_MSK_IMSK5_EINT2_Pos)
192 #define MSK_EINT1 (0x1uL << INTC_MSK_IMSK4_EINT1_Pos)
193 #define MSK_EINT0 (0x1uL << INTC_MSK_IMSK3_EINT0_Pos)
194 #define MSK_WDT (0x1uL << INTC_MSK_IMSK2_WDT_Pos)
195 #define MSK_WUT (0x1uL << INTC_MSK_IMSK1_WUT_Pos)
196 #define MSK_LVI (0x1uL << INTC_MSK_IMSK0_LVI_Pos)
197 
198 //******************************************************************************
199 // Macro
200 //******************************************************************************
201 
202 #ifdef PORTA
203 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
208 #define EIntPA_GetFg() (INTC->PAFLAG)
209 #endif
210 
211 #ifdef PORTB
212 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
217 #define EIntPB_GetFg() (INTC->PBFLAG)
218 #endif
219 
220 #ifdef PORTC
221 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
226 #define EIntPC_GetFg() (INTC->PCFLAG)
227 #endif
228 
229 #ifdef PORTD
230 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
235 #define EIntPD_GetFg() (INTC->PDFLAG)
236 #endif
237 
238 #ifdef PORTE
239 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
244 #define EIntPE_GetFg() (INTC->PEFLAG)
245 #endif
246 
247 #ifdef PORTF
248 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
253 #define EIntPF_GetFg() (INTC->PFFLAG)
254 #endif
255 
256 #ifdef PORTA
257 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
265 #define EIntPA_ClrFgBits( u32Bit ) (INTC->PAFLAG = u32Bit)
266 #endif
267 
268 #ifdef PORTB
269 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
277 #define EIntPB_ClrFgBits( u32Bit ) (INTC->PBFLAG = u32Bit)
278 #endif
279 
280 #ifdef PORTC
281 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
289 #define EIntPC_ClrFgBits( u32Bit ) (INTC->PCFLAG = u32Bit)
290 #endif
291 
292 #ifdef PORTD
293 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
301 #define EIntPD_ClrFgBits( u32Bit ) (INTC->PDFLAG = u32Bit)
302 #endif
303 
304 #ifdef PORTE
305 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
313 #define EIntPE_ClrFgBits( u32Bit ) (INTC->PEFLAG = u32Bit)
314 #endif
315 
316 #ifdef PORTF
317 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
325 #define EIntPF_ClrFgBits( u32Bit ) (INTC->PFFLAG = u32Bit)
326 #endif
327 
328 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
336 #define Int_Mask( u32Msk ) (INTC->MSK = (INTC->MSK) & ~u32Msk)
337 
338 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
346 #define Int_UnMask( u32UnMsk ) (INTC->MSK = (INTC->MSK) | u32UnMsk)
347 
348 //******************************************************************************
349 // Function
350 //******************************************************************************
351 
352 void HAL_INT_EIntPx_SetReg( uint32_t u32Px, uint32_t u32pin, uint32_t u32Trig, uint32_t u32Con );
353 void HAL_INT_EIntCfg( uint32_t u32TarIntNum, uint32_t u32SrcPort, uint32_t u32SrcPin );
354 void HAL_INT_EInt_MaskEnable( uint32_t u32Src );
355 void HAL_INT_EInt_MaskDisable( uint32_t u32Src );
356 
357 #ifdef PORTA
358 void HAL_INT_EIntPA_ClearIntStatus( uint32_t u32Value );
359 #endif
360 #ifdef PORTB
361 void HAL_INT_EIntPB_ClearIntStatus( uint32_t u32Value );
362 #endif
363 #ifdef PORTC
364 void HAL_INT_EIntPC_ClearIntStatus( uint32_t u32Value );
365 #endif
366 #ifdef PORTD
367 void HAL_INT_EIntPD_ClearIntStatus( uint32_t u32Value );
368 #endif
369 #ifdef PORTE
370 void HAL_INT_EIntPE_ClearIntStatus( uint32_t u32Value );
371 #endif
372 #ifdef PORTF
373 void HAL_INT_EIntPF_ClearIntStatus( uint32_t u32Value );
374 #endif
375 
376 #ifdef PORTA
377 uint32_t HAL_INT_EIntPA_GetIntStatus( void );
378 #endif
379 #ifdef PORTB
380 uint32_t HAL_INT_EIntPB_GetIntStatus( void );
381 #endif
382 #ifdef PORTC
383 uint32_t HAL_INT_EIntPC_GetIntStatus( void );
384 #endif
385 #ifdef PORTD
386 uint32_t HAL_INT_EIntPD_GetIntStatus( void );
387 #endif
388 #ifdef PORTE
389 uint32_t HAL_INT_EIntPE_GetIntStatus( void );
390 #endif
391 #ifdef PORTF
392 uint32_t HAL_INT_EIntPF_GetIntStatus( void );
393 #endif
394 
395 #ifdef __cplusplus
396 }
397 #endif
398 
399 #endif /* _INTC_H_ */
400 
void HAL_INT_EIntPA_ClearIntStatus(uint32_t u32Value)
Clear PA Interrupt Flag.
void HAL_INT_EIntPC_ClearIntStatus(uint32_t u32Value)
Clear PC Interrupt Flag.
void HAL_INT_EInt_MaskEnable(uint32_t u32Src)
Enable Interrupt Source Mask.
uint32_t HAL_INT_EIntPB_GetIntStatus(void)
Get PB Interrupt Flag.
void HAL_INT_EIntCfg(uint32_t u32TarIntNum, uint32_t u32SrcPort, uint32_t u32SrcPin)
Configure External Interrupt Group.
void HAL_INT_EInt_MaskDisable(uint32_t u32Src)
Disable Interrupt Source Mask.
void HAL_INT_EIntPF_ClearIntStatus(uint32_t u32Value)
Clear PF Interrupt Flag.
uint32_t HAL_INT_EIntPD_GetIntStatus(void)
Get PD Interrupt Flag.
uint32_t HAL_INT_EIntPF_GetIntStatus(void)
Get PF Interrupt Flag.
uint32_t HAL_INT_EIntPC_GetIntStatus(void)
Get PC Interrupt Flag.
uint32_t HAL_INT_EIntPE_GetIntStatus(void)
Get PE Interrupt Flag.
uint32_t HAL_INT_EIntPA_GetIntStatus(void)
Get PA Interrupt Flag.
void HAL_INT_EIntPx_SetReg(uint32_t u32Px, uint32_t u32pin, uint32_t u32Trig, uint32_t u32Con)
Configure External Interrupt Trigger.
Contains the ABOV typedefs for C standard types. It is intended to be used in ISO C conforming develo...
void HAL_INT_EIntPD_ClearIntStatus(uint32_t u32Value)
Clear PD Interrupt Flag.
void HAL_INT_EIntPE_ClearIntStatus(uint32_t u32Value)
Clear PE Interrupt Flag.
void HAL_INT_EIntPB_ClearIntStatus(uint32_t u32Value)
Clear PB Interrupt Flag.