MSP430 DriverLib for MSP430FR2xx_4xx Devices  2.91.13.01
icc.h
1 //*****************************************************************************
2 //
3 // icc.h - Driver for the ICC Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_ICC_H__
8 #define __MSP430WARE_ICC_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_ICC__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 //*****************************************************************************
26 //
27 // The following are values that can be passed to the ILSRmask parameter for
28 // functions: ICC_setInterruptLevel(); the interruptSource parameter for
29 // functions: ICC_getInterruptLevel().
30 //
31 //*****************************************************************************
32 #define ICC_ILSR_P4 0x1
33 #define ICC_ILSR_P3 0x2
34 #define ICC_ILSR_P2 0x4
35 #define ICC_ILSR_P1 0x8
36 #define ICC_ILSR_SAC3DAC_SAC1DAC 0x10
37 #define ICC_ILSR_SAC2DAC_SAC0DAC 0x20
38 #define ICC_ILSR_ECOMP1_ECOMP0 0x40
39 #define ICC_ILSR_ADC 0x80
40 #define ICC_ILSR_EUSCI_B1 0x100
41 #define ICC_ILSR_EUSCI_B0 0x200
42 #define ICC_ILSR_EUSCI_A1 0x400
43 #define ICC_ILSR_EUSCI_A0 0x800
44 #define ICC_ILSR_WDT_INT 0x1000
45 #define ICC_ILSR_RTC_COUNTER 0x2000
46 #define ICC_ILSR_TIMER3_B1 0x4000
47 #define ICC_ILSR_TIMER3_B0 0x8000
48 #define ICC_ILSR_TIMER2_B1 0x10000
49 #define ICC_ILSR_TIMER2_B0 0x20000
50 #define ICC_ILSR_TIMER1_B1 0x40000
51 #define ICC_ILSR_TIMER1_B0 0x80000
52 #define ICC_ILSR_TIMER0_B1 0x100000
53 #define ICC_ILSR_TIMER0_B0 0x200000
54 
55 //*****************************************************************************
56 //
57 // The following are values that can be passed to the interruptLevel parameter
58 // for functions: ICC_setInterruptLevel() as well as returned by the
59 // ICC_getInterruptLevel() function, the ICC_getCurrentICM() function, the
60 // ICC_getICM3() function, the ICC_getICM2() function, the ICC_getICM1()
61 // function and the ICC_getICM0() function.
62 //
63 //*****************************************************************************
64 #define ICC_LEVEL_0 0x0
65 #define ICC_LEVEL_1 0x1
66 #define ICC_LEVEL_2 0x2
67 #define ICC_LEVEL_3 0x3
68 #define ICC_LEVEL_ERROR 0x4
69 
70 //*****************************************************************************
71 //
72 // The following are values that can be passed toThe following are values that
73 // can be returned by the ICC_getMVSStackPointer() function.
74 //
75 //*****************************************************************************
76 #define ICC_MVS_STACK_EMPTY 0x0
77 #define ICC_MVS_STACK_ICM0 0x1
78 #define ICC_MVS_STACK_ICM0_ICM1 0x2
79 #define ICC_MVS_STACK_ICM0_ICM1_ICM2 0x3
80 #define ICC_MVS_STACK_FULL 0x4
81 
82 //*****************************************************************************
83 //
84 // Prototypes for the APIs.
85 //
86 //*****************************************************************************
87 
88 //*****************************************************************************
89 //
90 //! \brief Enables ICC module
91 //!
92 //! This function enables ICC.
93 //!
94 //!
95 //! \return None
96 //
97 //*****************************************************************************
98 extern void ICC_enable(void);
99 
100 //*****************************************************************************
101 //
102 //! \brief Disables ICC module
103 //!
104 //! This function disables ICC.
105 //!
106 //!
107 //! \return None
108 //
109 //*****************************************************************************
110 extern void ICC_disable(void);
111 
112 //*****************************************************************************
113 //
114 //! \brief Sets ICC interrupt level for selected source
115 //!
116 //! This function sets ICC interrupt level given a maskable interrupt source.
117 //!
118 //! \param ILSRmask is a 32-bit unsigned integer in which bit position (31 to
119 //! 0) determines which interrupt source is set.
120 //! Mask value is the logical OR of any of the following:
121 //! - \b ICC_ILSR_P4
122 //! - \b ICC_ILSR_P3
123 //! - \b ICC_ILSR_P2
124 //! - \b ICC_ILSR_P1
125 //! - \b ICC_ILSR_SAC3DAC_SAC1DAC
126 //! - \b ICC_ILSR_SAC2DAC_SAC0DAC
127 //! - \b ICC_ILSR_ECOMP1_ECOMP0
128 //! - \b ICC_ILSR_ADC
129 //! - \b ICC_ILSR_EUSCI_B1
130 //! - \b ICC_ILSR_EUSCI_B0
131 //! - \b ICC_ILSR_EUSCI_A1
132 //! - \b ICC_ILSR_EUSCI_A0
133 //! - \b ICC_ILSR_WDT_INT
134 //! - \b ICC_ILSR_RTC_COUNTER
135 //! - \b ICC_ILSR_TIMER3_B1
136 //! - \b ICC_ILSR_TIMER3_B0
137 //! - \b ICC_ILSR_TIMER2_B1
138 //! - \b ICC_ILSR_TIMER2_B0
139 //! - \b ICC_ILSR_TIMER1_B1
140 //! - \b ICC_ILSR_TIMER1_B0
141 //! - \b ICC_ILSR_TIMER0_B1
142 //! - \b ICC_ILSR_TIMER0_B0
143 //! \param interruptLevel determines what interrupt level to set to.
144 //! Valid values are:
145 //! - \b ICC_LEVEL_0
146 //! - \b ICC_LEVEL_1
147 //! - \b ICC_LEVEL_2
148 //! - \b ICC_LEVEL_3
149 //! - \b ICC_LEVEL_ERROR
150 //!
151 //! \return None
152 //
153 //*****************************************************************************
154 extern void ICC_setInterruptLevel(uint32_t ILSRmask,
155  uint8_t interruptLevel);
156 
157 //*****************************************************************************
158 //
159 //! \brief Gets ICC interrupt level for selected source
160 //!
161 //! This function gets ICC interrupt level given a maskable interrupt source.
162 //!
163 //! \param interruptSource is a 32-bit unsigned integer in which bit position
164 //! (31 to 0) determines which interrupt source to read level from.
165 //! Valid values are:
166 //! - \b ICC_ILSR_P4
167 //! - \b ICC_ILSR_P3
168 //! - \b ICC_ILSR_P2
169 //! - \b ICC_ILSR_P1
170 //! - \b ICC_ILSR_SAC3DAC_SAC1DAC
171 //! - \b ICC_ILSR_SAC2DAC_SAC0DAC
172 //! - \b ICC_ILSR_ECOMP1_ECOMP0
173 //! - \b ICC_ILSR_ADC
174 //! - \b ICC_ILSR_EUSCI_B1
175 //! - \b ICC_ILSR_EUSCI_B0
176 //! - \b ICC_ILSR_EUSCI_A1
177 //! - \b ICC_ILSR_EUSCI_A0
178 //! - \b ICC_ILSR_WDT_INT
179 //! - \b ICC_ILSR_RTC_COUNTER
180 //! - \b ICC_ILSR_TIMER3_B1
181 //! - \b ICC_ILSR_TIMER3_B0
182 //! - \b ICC_ILSR_TIMER2_B1
183 //! - \b ICC_ILSR_TIMER2_B0
184 //! - \b ICC_ILSR_TIMER1_B1
185 //! - \b ICC_ILSR_TIMER1_B0
186 //! - \b ICC_ILSR_TIMER0_B1
187 //! - \b ICC_ILSR_TIMER0_B0
188 //!
189 //! \return Interrupt level of a given maskable interrupt source.
190 //! Return one of the following:
191 //! - \b ICC_LEVEL_0
192 //! - \b ICC_LEVEL_1
193 //! - \b ICC_LEVEL_2
194 //! - \b ICC_LEVEL_3
195 //! - \b ICC_LEVEL_ERROR
196 //! \n returns interrupt level of given interrupt source.
197 //
198 //*****************************************************************************
199 extern uint8_t ICC_getInterruptLevel(uint32_t interruptSource);
200 
201 //*****************************************************************************
202 //
203 //! \brief Returns true if virtual stack is empty, false if not
204 //!
205 //! This function returns true(1) if virtual stack is empty, false(0) if not.
206 //!
207 //!
208 //! \return 1 if virtual stack is empty, 0 if not
209 //
210 //*****************************************************************************
211 extern bool ICC_isVirtualStackEmpty(void);
212 
213 //*****************************************************************************
214 //
215 //! \brief Returns true if virtual stack is full, false if not
216 //!
217 //! This function returns true(1) if virtual stack is full, false(0) if not.
218 //!
219 //!
220 //! \return 1 if virtual stack is full, 0 if not
221 //
222 //*****************************************************************************
223 extern bool ICC_isVirtualStackFull(void);
224 
225 //*****************************************************************************
226 //
227 //! \brief Gets the current interrupt compare mask
228 //!
229 //! Returns a 2-bit value that specifies the minimum interrupt priority level
230 //! that will be sent for service. If ICM[1:0] is less than the priority level
231 //! (ILSRx[1:0]) of the new interrupt, the corresponding source is sent to the
232 //! CPU. Note that the ICMC is the element stack that the stack pointer is
233 //! pointing to.
234 //!
235 //!
236 //! \return Minimum ICC interrupt priority level that will be serviced.
237 //! Return one of the following:
238 //! - \b ICC_LEVEL_0
239 //! - \b ICC_LEVEL_1
240 //! - \b ICC_LEVEL_2
241 //! - \b ICC_LEVEL_3
242 //! - \b ICC_LEVEL_ERROR
243 //! \n returns minimum interrupt level.
244 //
245 //*****************************************************************************
246 extern uint8_t ICC_getCurrentICM(void);
247 
248 //*****************************************************************************
249 //
250 //! \brief Gets the ICC Mask Virtual Stack stack pointer
251 //!
252 //! Returns the stack pointer of the ICC Mask Virtual Stack.
253 //!
254 //!
255 //! \return 0 if stack is empty, 1 if ICM0 occupied, 2 if ICM0/ICM1, 3 if
256 //! ICM0/ICM1/ICM2, 4 if full.
257 //! Return one of the following:
258 //! - \b ICC_MVS_STACK_EMPTY
259 //! - \b ICC_MVS_STACK_ICM0
260 //! - \b ICC_MVS_STACK_ICM0_ICM1
261 //! - \b ICC_MVS_STACK_ICM0_ICM1_ICM2
262 //! - \b ICC_MVS_STACK_FULL
263 //! \n Determines how full MVS stack is
264 //
265 //*****************************************************************************
266 extern uint8_t ICC_getMVSStackPointer(void);
267 
268 //*****************************************************************************
269 //
270 //! \brief Gets the interrupt level at Interrupt compare mask virtual stack
271 //! position 3
272 //!
273 //! Returns interrupt level of ICM virtual stack position 3 as a ready-to-read
274 //! 8-bit integer value (automatically adjusted from original bit position.)
275 //!
276 //!
277 //! \return Interrupt level of ICM virtual stack position 3.
278 //! Return one of the following:
279 //! - \b ICC_LEVEL_0
280 //! - \b ICC_LEVEL_1
281 //! - \b ICC_LEVEL_2
282 //! - \b ICC_LEVEL_3
283 //! - \b ICC_LEVEL_ERROR
284 //! \n returns interrupt level of ICM virtual stack position 3.
285 //
286 //*****************************************************************************
287 extern uint8_t ICC_getICM3(void);
288 
289 //*****************************************************************************
290 //
291 //! \brief Gets the interrupt level at Interrupt compare mask virtual stack
292 //! position 2
293 //!
294 //! Returns interrupt level of ICM virtual stack position 2 as a ready-to-read
295 //! 8-bit integer value (automatically adjusted from original bit position.)
296 //!
297 //!
298 //! \return Interrupt level of ICM virtual stack position 2.
299 //! Return one of the following:
300 //! - \b ICC_LEVEL_0
301 //! - \b ICC_LEVEL_1
302 //! - \b ICC_LEVEL_2
303 //! - \b ICC_LEVEL_3
304 //! - \b ICC_LEVEL_ERROR
305 //! \n returns interrupt level of ICM virtual stack position 2.
306 //
307 //*****************************************************************************
308 extern uint8_t ICC_getICM2(void);
309 
310 //*****************************************************************************
311 //
312 //! \brief Gets the interrupt level at Interrupt compare mask virtual stack
313 //! position 1
314 //!
315 //! Returns interrupt level of ICM virtual stack position 1 as a ready-to-read
316 //! 8-bit integer value (automatically adjusted from original bit position.)
317 //!
318 //!
319 //! \return Interrupt level of ICM virtual stack position 1.
320 //! Return one of the following:
321 //! - \b ICC_LEVEL_0
322 //! - \b ICC_LEVEL_1
323 //! - \b ICC_LEVEL_2
324 //! - \b ICC_LEVEL_3
325 //! - \b ICC_LEVEL_ERROR
326 //! \n returns interrupt level of ICM virtual stack position 1.
327 //
328 //*****************************************************************************
329 extern uint8_t ICC_getICM1(void);
330 
331 //*****************************************************************************
332 //
333 //! \brief Gets the interrupt level at Interrupt compare mask virtual stack
334 //! position 0
335 //!
336 //! Returns interrupt level of ICM virtual stack position 0 as a ready-to-read
337 //! 8-bit integer value (automatically adjusted from original bit position.)
338 //!
339 //!
340 //! \return Interrupt level of ICM virtual stack position 0.
341 //! Return one of the following:
342 //! - \b ICC_LEVEL_0
343 //! - \b ICC_LEVEL_1
344 //! - \b ICC_LEVEL_2
345 //! - \b ICC_LEVEL_3
346 //! - \b ICC_LEVEL_ERROR
347 //! \n returns interrupt level of ICM virtual stack position 0.
348 //
349 //*****************************************************************************
350 extern uint8_t ICC_getICM0(void);
351 
352 //*****************************************************************************
353 //
354 // Mark the end of the C bindings section for C++ compilers.
355 //
356 //*****************************************************************************
357 #ifdef __cplusplus
358 }
359 #endif
360 
361 #endif
362 #endif // __MSP430WARE_ICC_H__
bool ICC_isVirtualStackFull(void)
Returns true if virtual stack is full, false if not.
Definition: icc.c:119
void ICC_enable(void)
Enables ICC module.
Definition: icc.c:21
uint8_t ICC_getICM3(void)
Gets the interrupt level at Interrupt compare mask virtual stack position 3.
Definition: icc.c:134
uint8_t ICC_getMVSStackPointer(void)
Gets the ICC Mask Virtual Stack stack pointer.
Definition: icc.c:129
uint8_t ICC_getCurrentICM(void)
Gets the current interrupt compare mask.
Definition: icc.c:124
uint8_t ICC_getICM2(void)
Gets the interrupt level at Interrupt compare mask virtual stack position 2.
Definition: icc.c:139
void ICC_disable(void)
Disables ICC module.
Definition: icc.c:26
uint8_t ICC_getInterruptLevel(uint32_t interruptSource)
Gets ICC interrupt level for selected source.
Definition: icc.c:73
void ICC_setInterruptLevel(uint32_t ILSRmask, uint8_t interruptLevel)
Sets ICC interrupt level for selected source.
Definition: icc.c:31
bool ICC_isVirtualStackEmpty(void)
Returns true if virtual stack is empty, false if not.
Definition: icc.c:114
uint8_t ICC_getICM1(void)
Gets the interrupt level at Interrupt compare mask virtual stack position 1.
Definition: icc.c:144
uint8_t ICC_getICM0(void)
Gets the interrupt level at Interrupt compare mask virtual stack position 0.
Definition: icc.c:149

Copyright 2020, Texas Instruments Incorporated