MSP430 DriverLib for MSP430F5xx_6xx Devices  2.91.13.01
tec.h
1 //*****************************************************************************
2 //
3 // tec.h - Driver for the TEC Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_TEC_H__
8 #define __MSP430WARE_TEC_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_TEV0__
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 #include "inc/hw_memmap.h"
26 //*****************************************************************************
27 //
28 //! \brief Used in the TEC_initExternalFaultInput() function as the param
29 //! parameter.
30 //
31 //*****************************************************************************
33  //! Is the selected external fault
34  //! \n Valid values are:
35  //! - \b TEC_EXTERNAL_FAULT_0
36  //! - \b TEC_EXTERNAL_FAULT_1
37  //! - \b TEC_EXTERNAL_FAULT_2
38  //! - \b TEC_EXTERNAL_FAULT_3
39  //! - \b TEC_EXTERNAL_FAULT_4
40  //! - \b TEC_EXTERNAL_FAULT_5
41  //! - \b TEC_EXTERNAL_FAULT_6
43  //! Is the selected signal type
44  //! \n Valid values are:
45  //! - \b TEC_EXTERNAL_FAULT_SIGNALTYPE_EDGE_SENSITIVE [Default]
46  //! - \b TEC_EXTERNAL_FAULT_SIGNALTYPE_LEVEL_SENSITIVE
47  uint16_t signalType;
48  //! Is the selected signal hold
49  //! \n Valid values are:
50  //! - \b TEC_EXTERNAL_FAULT_SIGNAL_NOT_HELD [Default]
51  //! - \b TEC_EXTERNAL_FAULT_SIGNAL_HELD
52  uint8_t signalHold;
53  //! Is the selected signal type
54  //! \n Valid values are:
55  //! - \b TEC_EXTERNAL_FAULT_POLARITY_FALLING_EDGE_OR_LOW_LEVEL [Default]
56  //! - \b TEC_EXTERNAL_FAULT_POLARITY_RISING_EDGE_OR_HIGH_LEVEL
57  uint8_t polarityBit;
59 
60 
61 //*****************************************************************************
62 //
63 // The following are values that can be passed to the signalHold parameter for
64 // functions: TEC_initExternalClearInput().
65 //
66 //*****************************************************************************
67 #define TEC_EXTERNAL_CLEAR_SIGNAL_NOT_HELD 0x00
68 #define TEC_EXTERNAL_CLEAR_SIGNAL_HELD TECEXCLRHLD
69 
70 //*****************************************************************************
71 //
72 // The following are values that can be passed to the param parameter for
73 // functions: TEC_initExternalFaultInput().
74 //
75 //*****************************************************************************
76 #define TEC_EXTERNAL_FAULT_SIGNAL_NOT_HELD 0x00
77 #define TEC_EXTERNAL_FAULT_SIGNAL_HELD TECXFLTHLD0
78 
79 //*****************************************************************************
80 //
81 // The following are values that can be passed to the polarityBit parameter for
82 // functions: TEC_initExternalClearInput().
83 //
84 //*****************************************************************************
85 #define TEC_EXTERNAL_CLEAR_POLARITY_FALLING_EDGE_OR_LOW_LEVEL 0x00
86 #define TEC_EXTERNAL_CLEAR_POLARITY_RISING_EDGE_OR_HIGH_LEVEL TECEXCLRPOL
87 
88 //*****************************************************************************
89 //
90 // The following are values that can be passed to the param parameter for
91 // functions: TEC_initExternalFaultInput().
92 //
93 //*****************************************************************************
94 #define TEC_EXTERNAL_FAULT_POLARITY_FALLING_EDGE_OR_LOW_LEVEL 0x00
95 #define TEC_EXTERNAL_FAULT_POLARITY_RISING_EDGE_OR_HIGH_LEVEL TECXFLTPOL0
96 
97 //*****************************************************************************
98 //
99 // The following are values that can be passed to the signalType parameter for
100 // functions: TEC_initExternalClearInput().
101 //
102 //*****************************************************************************
103 #define TEC_EXTERNAL_CLEAR_SIGNALTYPE_EDGE_SENSITIVE 0x00
104 #define TEC_EXTERNAL_CLEAR_SIGNALTYPE_LEVEL_SENSITIVE TECEXCLRLVS
105 
106 //*****************************************************************************
107 //
108 // The following are values that can be passed to the param parameter for
109 // functions: TEC_initExternalFaultInput().
110 //
111 //*****************************************************************************
112 #define TEC_EXTERNAL_FAULT_SIGNALTYPE_EDGE_SENSITIVE 0x00
113 #define TEC_EXTERNAL_FAULT_SIGNALTYPE_LEVEL_SENSITIVE TECXFLTLVS0
114 
115 //*****************************************************************************
116 //
117 // The following are values that can be passed to the param parameter for
118 // functions: TEC_initExternalFaultInput().
119 //
120 //*****************************************************************************
121 #define TEC_EXTERNAL_FAULT_0 0
122 #define TEC_EXTERNAL_FAULT_1 1
123 #define TEC_EXTERNAL_FAULT_2 2
124 #define TEC_EXTERNAL_FAULT_3 3
125 #define TEC_EXTERNAL_FAULT_4 4
126 #define TEC_EXTERNAL_FAULT_5 5
127 #define TEC_EXTERNAL_FAULT_6 6
128 
129 //*****************************************************************************
130 //
131 // The following are values that can be passed to the channelEventBlock
132 // parameter for functions: TEC_enableExternalFaultInput(), and
133 // TEC_disableExternalFaultInput(); the mask parameter for functions:
134 // TEC_clearExternalFaultStatus(), and TEC_getExternalFaultStatus() as well as
135 // returned by the TEC_getExternalFaultStatus() function.
136 //
137 //*****************************************************************************
138 #define TEC_CE0 TECXFLT0STA
139 #define TEC_CE1 TECXFLT1STA
140 #define TEC_CE2 TECXFLT2STA
141 #define TEC_CE3 TECXFLT3STA
142 #define TEC_CE4 TECXFLT4STA
143 #define TEC_CE5 TECXFLT5STA
144 #define TEC_CE6 TECXFLT6STA
145 
146 //*****************************************************************************
147 //
148 // The following are values that can be passed to the mask parameter for
149 // functions: TEC_clearInterrupt(), TEC_getInterruptStatus(),
150 // TEC_enableInterrupt(), and TEC_disableInterrupt() as well as returned by the
151 // TEC_getInterruptStatus() function.
152 //
153 //*****************************************************************************
154 #define TEC_EXTERNAL_FAULT_INTERRUPT TECXFLTIFG
155 #define TEC_EXTERNAL_CLEAR_INTERRUPT TECEXCLRIFG
156 #define TEC_AUXILIARY_CLEAR_INTERRUPT TECAXCLRIFG
157 
158 //*****************************************************************************
159 //
160 // The following are values that can be passed toThe following are values that
161 // can be returned by the TEC_getExternalClearStatus() function.
162 //
163 //*****************************************************************************
164 #define TEC_EXTERNAL_CLEAR_DETECTED TECXCLRSTA
165 #define TEC_EXTERNAL_CLEAR_NOT_DETECTED 0x00
166 
167 //*****************************************************************************
168 //
169 // Prototypes for the APIs.
170 //
171 //*****************************************************************************
172 
173 //*****************************************************************************
174 //
175 //! \brief Configures the Timer Event Control External Clear Input
176 //!
177 //! \param baseAddress is the base address of the TEC module.
178 //! \param signalType is the selected signal type
179 //! Valid values are:
180 //! - \b TEC_EXTERNAL_CLEAR_SIGNALTYPE_EDGE_SENSITIVE [Default]
181 //! - \b TEC_EXTERNAL_CLEAR_SIGNALTYPE_LEVEL_SENSITIVE
182 //! \param signalHold is the selected signal hold
183 //! Valid values are:
184 //! - \b TEC_EXTERNAL_CLEAR_SIGNAL_NOT_HELD [Default]
185 //! - \b TEC_EXTERNAL_CLEAR_SIGNAL_HELD
186 //! \param polarityBit is the selected signal type
187 //! Valid values are:
188 //! - \b TEC_EXTERNAL_CLEAR_POLARITY_FALLING_EDGE_OR_LOW_LEVEL [Default]
189 //! - \b TEC_EXTERNAL_CLEAR_POLARITY_RISING_EDGE_OR_HIGH_LEVEL
190 //!
191 //! Modified bits of \b TECxCTL2 register.
192 //!
193 //! \return None
194 //
195 //*****************************************************************************
196 extern void TEC_initExternalClearInput(uint16_t baseAddress,
197  uint8_t signalType,
198  uint8_t signalHold,
199  uint8_t polarityBit);
200 
201 //*****************************************************************************
202 //
203 //! \brief Configures the Timer Event Control External Fault Input
204 //!
205 //! \param baseAddress is the base address of the TEC module.
206 //! \param param is the pointer to struct for external fault input
207 //! initialization.
208 //!
209 //! Modified bits of \b TECxCTL2 register.
210 //!
211 //! \return None
212 //
213 //*****************************************************************************
214 extern void TEC_initExternalFaultInput(uint16_t baseAddress,
216 
217 //*****************************************************************************
218 //
219 //! \brief Enable the Timer Event Control External fault input
220 //!
221 //! \param baseAddress is the base address of the TEC module.
222 //! \param channelEventBlock selects the channel event block
223 //! Valid values are:
224 //! - \b TEC_CE0
225 //! - \b TEC_CE1
226 //! - \b TEC_CE2
227 //! - \b TEC_CE3 - (available on TEC5 TEC7)
228 //! - \b TEC_CE4 - (available on TEC5 TEC7)
229 //! - \b TEC_CE5 - (only available on TEC7)
230 //! - \b TEC_CE6 - (only available on TEC7)
231 //!
232 //! Modified bits of \b TECxCTL0 register.
233 //!
234 //! \return None
235 //
236 //*****************************************************************************
237 extern void TEC_enableExternalFaultInput(uint16_t baseAddress,
238  uint8_t channelEventBlock);
239 
240 //*****************************************************************************
241 //
242 //! \brief Disable the Timer Event Control External fault input
243 //!
244 //! \param baseAddress is the base address of the TEC module.
245 //! \param channelEventBlock selects the channel event block
246 //! Valid values are:
247 //! - \b TEC_CE0
248 //! - \b TEC_CE1
249 //! - \b TEC_CE2
250 //! - \b TEC_CE3 - (available on TEC5 TEC7)
251 //! - \b TEC_CE4 - (available on TEC5 TEC7)
252 //! - \b TEC_CE5 - (only available on TEC7)
253 //! - \b TEC_CE6 - (only available on TEC7)
254 //!
255 //! Modified bits of \b TECxCTL0 register.
256 //!
257 //! \return None
258 //
259 //*****************************************************************************
260 extern void TEC_disableExternalFaultInput(uint16_t baseAddress,
261  uint8_t channelEventBlock);
262 
263 //*****************************************************************************
264 //
265 //! \brief Enable the Timer Event Control External Clear Input
266 //!
267 //! \param baseAddress is the base address of the TEC module.
268 //!
269 //! Modified bits of \b TECxCTL2 register.
270 //!
271 //! \return None
272 //
273 //*****************************************************************************
274 extern void TEC_enableExternalClearInput(uint16_t baseAddress);
275 
276 //*****************************************************************************
277 //
278 //! \brief Disable the Timer Event Control External Clear Input
279 //!
280 //! \param baseAddress is the base address of the TEC module.
281 //!
282 //! Modified bits of \b TECxCTL2 register.
283 //!
284 //! \return None
285 //
286 //*****************************************************************************
287 extern void TEC_disableExternalClearInput(uint16_t baseAddress);
288 
289 //*****************************************************************************
290 //
291 //! \brief Enable the Timer Event Control Auxiliary Clear Signal
292 //!
293 //! \param baseAddress is the base address of the TEC module.
294 //!
295 //! Modified bits of \b TECxCTL2 register.
296 //!
297 //! \return None
298 //
299 //*****************************************************************************
300 extern void TEC_enableAuxiliaryClearSignal(uint16_t baseAddress);
301 
302 //*****************************************************************************
303 //
304 //! \brief Disable the Timer Event Control Auxiliary Clear Signal
305 //!
306 //! \param baseAddress is the base address of the TEC module.
307 //!
308 //! Modified bits of \b TECxCTL2 register.
309 //!
310 //! \return None
311 //
312 //*****************************************************************************
313 extern void TEC_disableAuxiliaryClearSignal(uint16_t baseAddress);
314 
315 //*****************************************************************************
316 //
317 //! \brief Clears the Timer Event Control Interrupt flag
318 //!
319 //! \param baseAddress is the base address of the TEC module.
320 //! \param mask is the masked interrupt flag to be cleared.
321 //! Mask value is the logical OR of any of the following:
322 //! - \b TEC_EXTERNAL_FAULT_INTERRUPT - External fault interrupt flag
323 //! - \b TEC_EXTERNAL_CLEAR_INTERRUPT - External clear interrupt flag
324 //! - \b TEC_AUXILIARY_CLEAR_INTERRUPT - Auxiliary clear interrupt flag
325 //!
326 //! Modified bits of \b TECxINT register.
327 //!
328 //! \return None
329 //
330 //*****************************************************************************
331 extern void TEC_clearInterrupt(uint16_t baseAddress,
332  uint8_t mask);
333 
334 //*****************************************************************************
335 //
336 //! \brief Gets the current Timer Event Control interrupt status.
337 //!
338 //! This returns the interrupt status for the module based on which flag is
339 //! passed.
340 //!
341 //! \param baseAddress is the base address of the TEC module.
342 //! \param mask is the masked interrupt flag status to be returned.
343 //! Mask value is the logical OR of any of the following:
344 //! - \b TEC_EXTERNAL_FAULT_INTERRUPT - External fault interrupt flag
345 //! - \b TEC_EXTERNAL_CLEAR_INTERRUPT - External clear interrupt flag
346 //! - \b TEC_AUXILIARY_CLEAR_INTERRUPT - Auxiliary clear interrupt flag
347 //!
348 //! \return Logical OR of any of the following:
349 //! - \b TEC_EXTERNAL_FAULT_INTERRUPT External fault interrupt flag
350 //! - \b TEC_EXTERNAL_CLEAR_INTERRUPT External clear interrupt flag
351 //! - \b TEC_AUXILIARY_CLEAR_INTERRUPT Auxiliary clear interrupt flag
352 //! \n indicating the status of the masked interrupts
353 //
354 //*****************************************************************************
355 extern uint8_t TEC_getInterruptStatus(uint16_t baseAddress,
356  uint8_t mask);
357 
358 //*****************************************************************************
359 //
360 //! \brief Enables individual Timer Event Control interrupt sources.
361 //!
362 //! Enables the indicated Timer Event Control interrupt sources. Only the
363 //! sources that are enabled can be reflected to the processor interrupt;
364 //! disabled sources have no effect on the processor. Does not clear interrupt
365 //! flags.
366 //!
367 //! \param baseAddress is the base address of the TEC module.
368 //! \param mask is the bit mask of the interrupt sources to be enabled.
369 //! Mask value is the logical OR of any of the following:
370 //! - \b TEC_EXTERNAL_FAULT_INTERRUPT - External fault interrupt flag
371 //! - \b TEC_EXTERNAL_CLEAR_INTERRUPT - External clear interrupt flag
372 //! - \b TEC_AUXILIARY_CLEAR_INTERRUPT - Auxiliary clear interrupt flag
373 //!
374 //! Modified bits of \b TECxINT register.
375 //!
376 //! \return None
377 //
378 //*****************************************************************************
379 extern void TEC_enableInterrupt(uint16_t baseAddress,
380  uint8_t mask);
381 
382 //*****************************************************************************
383 //
384 //! \brief Disables individual Timer Event Control interrupt sources.
385 //!
386 //! Disables the indicated Timer Event Control interrupt sources. Only the
387 //! sources that are enabled can be reflected to the processor interrupt;
388 //! disabled sources have no effect on the processor.
389 //!
390 //! \param baseAddress is the base address of the TEC module.
391 //! \param mask is the bit mask of the interrupt sources to be disabled.
392 //! Mask value is the logical OR of any of the following:
393 //! - \b TEC_EXTERNAL_FAULT_INTERRUPT - External fault interrupt flag
394 //! - \b TEC_EXTERNAL_CLEAR_INTERRUPT - External clear interrupt flag
395 //! - \b TEC_AUXILIARY_CLEAR_INTERRUPT - Auxiliary clear interrupt flag
396 //!
397 //! Modified bits of \b TECxINT register.
398 //!
399 //! \return None
400 //
401 //*****************************************************************************
402 extern void TEC_disableInterrupt(uint16_t baseAddress,
403  uint8_t mask);
404 
405 //*****************************************************************************
406 //
407 //! \brief Gets the current Timer Event Control External Fault Status
408 //!
409 //! This returns the Timer Event Control fault status for the module.
410 //!
411 //! \param baseAddress is the base address of the TEC module.
412 //! \param mask is the masked interrupt flag status to be returned.
413 //! Mask value is the logical OR of any of the following:
414 //! - \b TEC_CE0
415 //! - \b TEC_CE1
416 //! - \b TEC_CE2
417 //! - \b TEC_CE3 - (available on TEC5 TEC7)
418 //! - \b TEC_CE4 - (available on TEC5 TEC7)
419 //! - \b TEC_CE5 - (only available on TEC7)
420 //! - \b TEC_CE6 - (only available on TEC7)
421 //!
422 //! \return Logical OR of any of the following:
423 //! - \b TEC_CE0
424 //! - \b TEC_CE1
425 //! - \b TEC_CE2
426 //! - \b TEC_CE3 (available on TEC5 TEC7)
427 //! - \b TEC_CE4 (available on TEC5 TEC7)
428 //! - \b TEC_CE5 (only available on TEC7)
429 //! - \b TEC_CE6 (only available on TEC7)
430 //! \n indicating the external fault status of the masked channel event
431 //! blocks
432 //
433 //*****************************************************************************
434 extern uint8_t TEC_getExternalFaultStatus(uint16_t baseAddress,
435  uint8_t mask);
436 
437 //*****************************************************************************
438 //
439 //! \brief Clears the Timer Event Control External Fault Status
440 //!
441 //! \param baseAddress is the base address of the TEC module.
442 //! \param mask is the masked status flag be cleared
443 //! Mask value is the logical OR of any of the following:
444 //! - \b TEC_CE0
445 //! - \b TEC_CE1
446 //! - \b TEC_CE2
447 //! - \b TEC_CE3 - (available on TEC5 TEC7)
448 //! - \b TEC_CE4 - (available on TEC5 TEC7)
449 //! - \b TEC_CE5 - (only available on TEC7)
450 //! - \b TEC_CE6 - (only available on TEC7)
451 //!
452 //! Modified bits of \b TECxINT register.
453 //!
454 //! \return None
455 //
456 //*****************************************************************************
457 extern void TEC_clearExternalFaultStatus(uint16_t baseAddress,
458  uint8_t mask);
459 
460 //*****************************************************************************
461 //
462 //! \brief Gets the current Timer Event Control External Clear Status
463 //!
464 //! \param baseAddress is the base address of the TEC module.
465 //!
466 //! \return One of the following:
467 //! - \b TEC_EXTERNAL_CLEAR_DETECTED
468 //! - \b TEC_EXTERNAL_CLEAR_NOT_DETECTED
469 //! \n indicating the status of the external clear
470 //
471 //*****************************************************************************
472 extern uint8_t TEC_getExternalClearStatus(uint16_t baseAddress);
473 
474 //*****************************************************************************
475 //
476 //! \brief Clears the Timer Event Control External Clear Status
477 //!
478 //! \param baseAddress is the base address of the TEC module.
479 //!
480 //! Modified bits of \b TECxINT register.
481 //!
482 //! \return None
483 //
484 //*****************************************************************************
485 extern void TEC_clearExternalClearStatus(uint16_t baseAddress);
486 
487 //*****************************************************************************
488 //
489 // Mark the end of the C bindings section for C++ compilers.
490 //
491 //*****************************************************************************
492 #ifdef __cplusplus
493 }
494 #endif
495 
496 #endif
497 #endif // __MSP430WARE_TEC_H__
uint8_t TEC_getInterruptStatus(uint16_t baseAddress, uint8_t mask)
Gets the current Timer Event Control interrupt status.
Definition: tec.c:93
uint8_t selectedExternalFault
Definition: tec.h:42
uint8_t signalHold
Definition: tec.h:52
void TEC_enableInterrupt(uint16_t baseAddress, uint8_t mask)
Enables individual Timer Event Control interrupt sources.
Definition: tec.c:101
uint8_t TEC_getExternalClearStatus(uint16_t baseAddress)
Gets the current Timer Event Control External Clear Status.
Definition: tec.c:132
void TEC_enableExternalClearInput(uint16_t baseAddress)
Enable the Timer Event Control External Clear Input.
Definition: tec.c:66
void TEC_disableExternalClearInput(uint16_t baseAddress)
Disable the Timer Event Control External Clear Input.
Definition: tec.c:71
void TEC_disableAuxiliaryClearSignal(uint16_t baseAddress)
Disable the Timer Event Control Auxiliary Clear Signal.
Definition: tec.c:81
void TEC_disableInterrupt(uint16_t baseAddress, uint8_t mask)
Disables individual Timer Event Control interrupt sources.
Definition: tec.c:109
void TEC_clearExternalFaultStatus(uint16_t baseAddress, uint8_t mask)
Clears the Timer Event Control External Fault Status.
Definition: tec.c:125
uint8_t TEC_getExternalFaultStatus(uint16_t baseAddress, uint8_t mask)
Gets the current Timer Event Control External Fault Status.
Definition: tec.c:117
void TEC_enableExternalFaultInput(uint16_t baseAddress, uint8_t channelEventBlock)
Enable the Timer Event Control External fault input.
Definition: tec.c:52
void TEC_enableAuxiliaryClearSignal(uint16_t baseAddress)
Enable the Timer Event Control Auxiliary Clear Signal.
Definition: tec.c:76
uint16_t signalType
Definition: tec.h:47
void TEC_clearExternalClearStatus(uint16_t baseAddress)
Clears the Timer Event Control External Clear Status.
Definition: tec.c:139
Used in the TEC_initExternalFaultInput() function as the param parameter.
Definition: tec.h:32
void TEC_initExternalClearInput(uint16_t baseAddress, uint8_t signalType, uint8_t signalHold, uint8_t polarityBit)
Configures the Timer Event Control External Clear Input.
Definition: tec.c:21
void TEC_clearInterrupt(uint16_t baseAddress, uint8_t mask)
Clears the Timer Event Control Interrupt flag.
Definition: tec.c:86
void TEC_initExternalFaultInput(uint16_t baseAddress, TEC_initExternalFaultInputParam *param)
Configures the Timer Event Control External Fault Input.
Definition: tec.c:38
void TEC_disableExternalFaultInput(uint16_t baseAddress, uint8_t channelEventBlock)
Disable the Timer Event Control External fault input.
Definition: tec.c:59
uint8_t polarityBit
Definition: tec.h:57

Copyright 2020, Texas Instruments Incorporated