MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.91.13.01
mtif.h
1 //*****************************************************************************
2 //
3 // mtif.h - Driver for the MTIF Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_MTIF_H__
8 #define __MSP430WARE_MTIF_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_MTIF__
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 freq parameter for
28 // functions: MTIF_setPulseGenPulseGridFreq
29 //
30 //*****************************************************************************
31 #define MTIF_PULSE_GRID_FREQUENCY_8HZ PGFS_0
32 #define MTIF_PULSE_GRID_FREQUENCY_16HZ PGFS_1
33 #define MTIF_PULSE_GRID_FREQUENCY_32HZ PGFS_2
34 #define MTIF_PULSE_GRID_FREQUENCY_64HZ PGFS_3
35 #define MTIF_PULSE_GRID_FREQUENCY_128HZ PGFS_4
36 #define MTIF_PULSE_GRID_FREQUENCY_256HZ PGFS_5
37 #define MTIF_PULSE_GRID_FREQUENCY_512HZ PGFS_6
38 #define MTIF_PULSE_GRID_FREQUENCY_1024HZ PGFS_7
39 
40 //*****************************************************************************
41 //
42 // The following are values that can be passed to the num parameter for
43 // functions: MTIF_setPulseGenCountNum
44 //
45 //*****************************************************************************
46 #define MTIF_KVAL_BIT0 KVAL0
47 #define MTIF_KVAL_BIT1 KVAL1
48 #define MTIF_KVAL_BIT2 KVAL2
49 #define MTIF_KVAL_BIT3 KVAL3
50 #define MTIF_KVAL_BIT4 KVAL4
51 #define MTIF_KVAL_BIT5 KVAL5
52 #define MTIF_KVAL_BIT6 KVAL6
53 
54 //*****************************************************************************
55 //
56 // The following are values that can be returned by the
57 // MTIF_isPulseKCountUpdated() function.
58 //
59 //*****************************************************************************
60 #define MTIF_K_COUNT_IS_UPDATED PKUA
61 #define MTIF_K_COUNT_IS_NOT_UPDATED 0x0
62 
63 //*****************************************************************************
64 //
65 // The following are values that can be returned by the
66 // MTIF_isPulseGridFreqUpdated() function.
67 //
68 //*****************************************************************************
69 #define MTIF_PULSE_GRID_FREQUENCY_IS_UPDATED PGUA
70 #define MTIF_PULSE_GRID_FREQUENCY_IS_NOT_UPDATED 0x0
71 
72 //*****************************************************************************
73 //
74 // The following are values that can be returned by the
75 // MTIF_getPulseCounterOverflow() function.
76 //
77 //*****************************************************************************
78 #define MTIF_PULSE_COUNTER_OVERFLOW PCOFL
79 #define MTIF_PULSE_COUNTER_NOT_OVERFLOW 0x0
80 
81 //*****************************************************************************
82 //
83 // The following are values that can be returned by the
84 // MTIF_isPulseCounterReadReady() function.
85 //
86 //*****************************************************************************
87 #define MTIF_PULSE_COUNTER_READY_TO_READ PCRA
88 #define MTIF_PULSE_COUNTER_NOT_READY_TO_READ 0x0
89 
90 //*****************************************************************************
91 //
92 // Prototypes for the APIs.
93 //
94 //*****************************************************************************
95 
96 //*****************************************************************************
97 //
98 //! \brief Enables Pulse Generator.
99 //!
100 //! Enable the PG sub module
101 //!
102 //! \param baseAddress is the base address of the MTIF module.
103 //!
104 //! \return None
105 //
106 //*****************************************************************************
107 extern void MTIF_enablePulseGen(uint16_t baseAddress);
108 
109 //*****************************************************************************
110 //
111 //! \brief Disables Pulse Generator.
112 //!
113 //! Disable the PG sub module
114 //!
115 //! \param baseAddress is the base address of the MTIF module.
116 //!
117 //! \return None
118 //
119 //*****************************************************************************
120 extern void MTIF_disablePulseGen(uint16_t baseAddress);
121 
122 //*****************************************************************************
123 //
124 //! \brief Pulse Generator pulse counter clear.
125 //!
126 //! Clears the pulse generator. (PGEN has to be set to one to perform a clear).
127 //! Note!: A clear request is being latched and released after the clear
128 //! is executed. MTIF_disablePulseGen (PCEN=0) and LFXTOFF=1 will prevent that.
129 //! The clear occurs then after the clock is reenabled. Clear reset by PUC.
130 //!
131 //! \param baseAddress is the base address of the MTIF module.
132 //!
133 //! \return None
134 //
135 //*****************************************************************************
136 extern void MTIF_clearPulseGenCounter(uint16_t baseAddress);
137 
138 //*****************************************************************************
139 //
140 //! \brief Pulse Generator pulse grid frequency select.
141 //!
142 //! This value determines at which time grid pulses are generated.
143 //! The pulse generator frame frequency is an 1/256th of this
144 //! (PGEN has to be one to perform a change). Reset by PUC.
145 //!
146 //! \param baseAddress is the base address of the MTIF module.
147 //! \param freq is the specified pulse grid frequency select.
148 //! Valid values are:
149 //! - \b MTIF_PULSE_GRID_FREQUENCY_8HZ
150 //! - \b MTIF_PULSE_GRID_FREQUENCY_16HZ
151 //! - \b MTIF_PULSE_GRID_FREQUENCY_32HZ
152 //! - \b MTIF_PULSE_GRID_FREQUENCY_64HZ
153 //! - \b MTIF_PULSE_GRID_FREQUENCY_128HZ
154 //! - \b MTIF_PULSE_GRID_FREQUENCY_256HZ
155 //! - \b MTIF_PULSE_GRID_FREQUENCY_512HZ
156 //! - \b MTIF_PULSE_GRID_FREQUENCY_1024HZ [Default]
157 //!
158 //! \return None
159 //
160 //*****************************************************************************
161 extern void MTIF_setPulseGenPulseGridFreq(uint16_t baseAddress, uint8_t freq);
162 
163 //*****************************************************************************
164 //
165 //! \brief Set Pulse Count Number.
166 //!
167 //! This register value determines how many pulses are generated withing
168 //! 256 periods of the pulse grid frequency(with password protection as in PGCNF).
169 //! PGEN has to be one to perform a change. Reset by PUC.
170 //!
171 //! \param baseAddress is the base address of the MTIF module.
172 //! \param num is the logical OR of any of the following:
173 //! - \b MTIF_KVAL_BIT0
174 //! - \b MTIF_KVAL_BIT1
175 //! - \b MTIF_KVAL_BIT2
176 //! - \b MTIF_KVAL_BIT3
177 //! - \b MTIF_KVAL_BIT4
178 //! - \b MTIF_KVAL_BIT5
179 //! - \b MTIF_KVAL_BIT6
180 //!
181 //! \return None
182 //
183 //*****************************************************************************
184 extern void MTIF_setPulseGenCountNum(uint16_t baseAddress, uint8_t num);
185 
186 //*****************************************************************************
187 //
188 //! \brief Pulse K-Count Update Request.
189 //!
190 //! The update of KVAL occurs during the frequency grid slot
191 //! 0xff (e.g. in the last 4ms of a second with a pulse grid frequency of
192 //! 256Hz). Reset type: PUC
193 //!
194 //! \param baseAddress is the base address of the MTIF module.
195 //!
196 //! \return None
197 //
198 //*****************************************************************************
199 extern void MTIF_clearPulseKCountUpdateRequest(uint16_t baseAddress);
200 
201 //*****************************************************************************
202 //
203 //! \brief Pulse Grid Frequency Update Request.
204 //!
205 //! The update of PGFS occurs during the frequency grid
206 //! slot 0xff (e.g. in the last 4ms of an second with an pulse grid
207 //! frequency of 256Hz). Reset type: PUC
208 //!
209 //! \param baseAddress is the base address of the MTIF module.
210 //!
211 //! \return None
212 //
213 //*****************************************************************************
214 extern void MTIF_clearPulseGridFreqUpdateRequest(uint16_t baseAddress);
215 
216 //*****************************************************************************
217 //
218 //! \brief Pulse K-Count Update Acknowledge.
219 //!
220 //! This acknowledges a PCUR directly after the K-values has been updated.
221 //! Reset type: PUC
222 //!
223 //! \param baseAddress is the base address of the MTIF module.
224 //!
225 //! \return None
226 //
227 //*****************************************************************************
228 extern void MTIF_setPulseKCountUpdateAck(uint16_t baseAddress);
229 
230 //*****************************************************************************
231 //
232 //! \brief Is Pulse K-Count Updated?
233 //!
234 //! This checks whether Pulse K-Count has been updated.
235 //! Reset type: PUC
236 //!
237 //! \param baseAddress is the base address of the MTIF module.
238 //!
239 //! \return Valid values are:
240 //! - \b MTIF_K_COUNT_IS_UPDATED
241 //! - \b MTIF_K_COUNT_IS_NOT_UPDATED
242 //
243 //*****************************************************************************
244 extern uint16_t MTIF_isPulseKCountUpdated(uint16_t baseAddress);
245 
246 //*****************************************************************************
247 //
248 //! \brief Pulse Grid Frequency Update Acknowledge.
249 //!
250 //! This acknowledges a PGUR directly after the PGFS has been updated.
251 //! Reset type: PUC
252 //!
253 //! \param baseAddress is the base address of the MTIF module.
254 //!
255 //! \return None
256 //
257 //*****************************************************************************
258 extern void MTIF_setPulseGridFreqUpdateAck(uint16_t baseAddress);
259 
260 //*****************************************************************************
261 //
262 //! \brief Is Pulse Pulse Grid Frequency Updated?
263 //!
264 //! This checks whether Pulse Grid Frequency has been updated.
265 //! Reset type: PUC
266 //!
267 //! \param baseAddress is the base address of the MTIF module.
268 //!
269 //! \return Valid values are:
270 //! - \b MTIF_PULSE_GRID_FREQUENCY_IS_UPDATED
271 //! - \b MTIF_PULSE_GRID_FREQUENCY_IS_NOT_UPDATED
272 //
273 //*****************************************************************************
274 extern uint16_t MTIF_isPulseGridFreqUpdated(uint16_t baseAddress);
275 
276 //*****************************************************************************
277 //
278 //! \brief PC sub module enable.
279 //!
280 //! This bit enables the PC sub module when set to one. Reset type: POR
281 //!
282 //! \param baseAddress is the base address of the MTIF module.
283 //!
284 //! \return None
285 //
286 //*****************************************************************************
287 extern void MTIF_enablePulseCounter(uint16_t baseAddress);
288 
289 //*****************************************************************************
290 //
291 //! \brief PC sub module disable.
292 //!
293 //! This bit disables the PC sub module when set to zero. Reset type: POR
294 //!
295 //! \param baseAddress is the base address of the MTIF module.
296 //!
297 //! \return None
298 //
299 //*****************************************************************************
300 extern void MTIF_disablePulseCounter(uint16_t baseAddress);
301 
302 //*****************************************************************************
303 //
304 //! \brief Pulse counter clear.
305 //!
306 //! Clears the pulse counter (PC has to be disabled to perform a clear).
307 //! Note!: A clear request is being latched and released after the clear is executed.
308 //! LFXTOFF=1 and PCEN=0 will prevent that. The clear occurs then after the clock
309 //! is reenabled. This bit is for triggering only; it's state cannot be read back
310 //! Reset type: PUC
311 //!
312 //! \param baseAddress is the base address of the MTIF module.
313 //!
314 //! \return None
315 //
316 //*****************************************************************************
317 extern void MTIF_clearPulseCounter(uint16_t baseAddress);
318 
319 //*****************************************************************************
320 //
321 //! \brief Pulse Counter value register.
322 //!
323 //! Get count value from the pulse counter.
324 //!
325 //! \param baseAddress is the base address of the MTIF module.
326 //!
327 //! \return 16-bit count value from pulse counter
328 //
329 //*****************************************************************************
330 extern uint16_t MTIF_getPulseCount(uint16_t baseAddress);
331 
332 //*****************************************************************************
333 //
334 //! \brief Pulse Counter Read Request.
335 //!
336 //! Requests an update of PCR read register from the actual counter.
337 //! Reset type: PUC
338 //!
339 //! \param baseAddress is the base address of the MTIF module.
340 //!
341 //! \return None
342 //
343 //*****************************************************************************
344 extern void MTIF_setPulseCounterReadRequest(uint16_t baseAddress);
345 
346 //*****************************************************************************
347 //
348 //! \brief Pulse counter read acknowledge.
349 //!
350 //! This acknowledges the update of the PCR register as response to
351 //! the PCRR read request. Note!: A read request is being latched.
352 //! LFXTOFF=1 and PCEN=0 will prevent that.The read will then be performed and
353 //! acknowledged after the clock is reenabled. Reset type: PUC
354 //!
355 //! \param baseAddress is the base address of the MTIF module.
356 //!
357 //! \return None
358 //
359 //*****************************************************************************
360 extern void MTIF_setPulseCounterReadAck(uint16_t baseAddress);
361 
362 //*****************************************************************************
363 //
364 //! \brief Is Pulse Counter value ready to read?.
365 //!
366 //! This function will let you know if Pulse Counter value is updated and ready
367 //! to read as a response to the Pulse Counter Read Request. Reset type: PUC
368 //!
369 //! \param baseAddress is the base address of the MTIF module.
370 //!
371 //! \return Valid values are:
372 //! - \b MTIF_PULSE_COUNTER_READY_TO_READ
373 //! - \b MTIF_PULSE_COUNTER_NOT_READY_TO_READ
374 //
375 //*****************************************************************************
376 extern uint16_t MTIF_isPulseCounterReadReady(uint16_t baseAddress);
377 
378 //*****************************************************************************
379 //
380 //! \brief Pulse counter overflow.
381 //!
382 //! This bit indicates an overflow of the pulse counter when its value changes since
383 //! the last read request procedure. It is basically the 17th bit of the counter
384 //! Reset type: PUC
385 //!
386 //! \param baseAddress is the base address of the MTIF module.
387 //!
388 //! \return Valid values are:
389 //! - \b MTIF_PULSE_COUNTER_OVERFLOW
390 //! - \b MTIF_PULSE_COUNTER_NOT_OVERFLOW
391 //
392 //*****************************************************************************
393 extern uint16_t MTIF_getPulseCounterOverflow(uint16_t baseAddress);
394 
395 //*****************************************************************************
396 //
397 //! \brief Acknowledge pulse counter overflow.
398 //!
399 //! This function acknowledges an overflow of the pulse counter since
400 //! the last read request procedure.
401 //! Reset type: PUC
402 //!
403 //! \param baseAddress is the base address of the MTIF module.
404 //!
405 //! \return None
406 //
407 //*****************************************************************************
408 extern void MTIF_ackPulseCounterOverflow(uint16_t baseAddress);
409 
410 //*****************************************************************************
411 //
412 //! \brief Enables test port output.
413 //!
414 //! Enable the test pulse output. Reset type: POR
415 //!
416 //! \param baseAddress is the base address of the MTIF module.
417 //!
418 //! \return None
419 //
420 //*****************************************************************************
421 extern void MTIF_enableTestPortOutput(uint16_t baseAddress);
422 
423 //*****************************************************************************
424 //
425 //! \brief Disables test port output.
426 //!
427 //! Disable the test pulse output. Reset type: POR
428 //!
429 //! \param baseAddress is the base address of the MTIF module.
430 //!
431 //! \return None
432 //
433 //*****************************************************************************
434 extern void MTIF_disableTestPortOutput(uint16_t baseAddress);
435 
436 //*****************************************************************************
437 //
438 //! \brief Enables test port input.
439 //!
440 //! Enable the test input port. Reset type: POR
441 //!
442 //! \param baseAddress is the base address of the MTIF module.
443 //!
444 //! \return None
445 //
446 //*****************************************************************************
447 extern void MTIF_enableTestPortInput(uint16_t baseAddress);
448 
449 //*****************************************************************************
450 //
451 //! \brief Disables test port input.
452 //!
453 //! Disable the test input port. Reset type: POR
454 //!
455 //! \param baseAddress is the base address of the MTIF module.
456 //!
457 //! \return None
458 //
459 //*****************************************************************************
460 extern void MTIF_disableTestPortInput(uint16_t baseAddress);
461 
462 //*****************************************************************************
463 //
464 //! \brief Test port input select for pulse counter, sourced from pulse generator.
465 //!
466 //! Pulse generator is used as input for test port of pulse counter
467 //! Reset Type: POR
468 //!
469 //! \param baseAddress is the base address of the MTIF module.
470 //!
471 //! \return None
472 //
473 //*****************************************************************************
474 extern void MTIF_setPulseGeneratorAsPulseCounterInput(uint16_t baseAddress);
475 
476 //*****************************************************************************
477 //
478 //! \brief Test port input select for pulse counter, sourced from test port
479 //! input terminal.
480 //!
481 //! Test port input terminal is used as input for test port of pulse counter
482 //! Reset Type: POR
483 //!
484 //! \param baseAddress is the base address of the MTIF module.
485 //!
486 //! \return None
487 //
488 //*****************************************************************************
489 extern void MTIF_setTestPortInputTerminalAsPulseCounterInput(uint16_t baseAddress);
490 
491 //*****************************************************************************
492 //
493 //! \brief Test port terminal enable activation by software.
494 //!
495 //! The test port output is enabled solely by TPOE (enabled if TPOE=1) test port
496 //! output enabled.
497 //! Reset Type: POR
498 //!
499 //! \param baseAddress is the base address of the MTIF module.
500 //!
501 //! \return None
502 //
503 //*****************************************************************************
504 extern void MTIF_enableTestPortTerminalActivationBySW(uint16_t baseAddress);
505 
506 //*****************************************************************************
507 //
508 //! \brief Test port terminal enable activation by software and hardware.
509 //!
510 //! The test port output requires both TPOE (enabled if TPOE=1) test port
511 //! output enabled, and MTPE pin to be high, to be enabled.
512 //! Reset Type: POR
513 //!
514 //! \param baseAddress is the base address of the MTIF module.
515 //!
516 //! \return None
517 //
518 //*****************************************************************************
519 extern void MTIF_enableTestPortTerminalActivationBySWAndHW(uint16_t baseAddress);
520 
521 //*****************************************************************************
522 //
523 // Mark the end of the C bindings section for C++ compilers.
524 //
525 //*****************************************************************************
526 #ifdef __cplusplus
527 }
528 #endif
529 
530 #endif
531 #endif // __MSP430WARE_MTIF_H__
532 
void MTIF_clearPulseKCountUpdateRequest(uint16_t baseAddress)
Pulse K-Count Update Request.
Definition: mtif.c:49
void MTIF_setPulseGenCountNum(uint16_t baseAddress, uint8_t num)
Set Pulse Count Number.
Definition: mtif.c:44
void MTIF_disableTestPortInput(uint16_t baseAddress)
Disables test port input.
Definition: mtif.c:142
void MTIF_disableTestPortOutput(uint16_t baseAddress)
Disables test port output.
Definition: mtif.c:130
void MTIF_setPulseGridFreqUpdateAck(uint16_t baseAddress)
Pulse Grid Frequency Update Acknowledge.
Definition: mtif.c:69
uint16_t MTIF_getPulseCount(uint16_t baseAddress)
Pulse Counter value register.
Definition: mtif.c:94
uint16_t MTIF_getPulseCounterOverflow(uint16_t baseAddress)
Pulse counter overflow.
Definition: mtif.c:114
void MTIF_enableTestPortTerminalActivationBySW(uint16_t baseAddress)
Test port terminal enable activation by software.
Definition: mtif.c:160
void MTIF_disablePulseCounter(uint16_t baseAddress)
PC sub module disable.
Definition: mtif.c:84
void MTIF_setTestPortInputTerminalAsPulseCounterInput(uint16_t baseAddress)
Test port input select for pulse counter, sourced from test port input terminal.
Definition: mtif.c:154
void MTIF_enableTestPortInput(uint16_t baseAddress)
Enables test port input.
Definition: mtif.c:136
void MTIF_enableTestPortOutput(uint16_t baseAddress)
Enables test port output.
Definition: mtif.c:124
uint16_t MTIF_isPulseKCountUpdated(uint16_t baseAddress)
Is Pulse K-Count Updated?
Definition: mtif.c:64
void MTIF_setPulseCounterReadAck(uint16_t baseAddress)
Pulse counter read acknowledge.
Definition: mtif.c:104
void MTIF_ackPulseCounterOverflow(uint16_t baseAddress)
Acknowledge pulse counter overflow.
Definition: mtif.c:119
void MTIF_disablePulseGen(uint16_t baseAddress)
Disables Pulse Generator.
Definition: mtif.c:26
uint16_t MTIF_isPulseCounterReadReady(uint16_t baseAddress)
Is Pulse Counter value ready to read?.
Definition: mtif.c:109
void MTIF_enablePulseGen(uint16_t baseAddress)
Enables Pulse Generator.
Definition: mtif.c:21
void MTIF_setPulseKCountUpdateAck(uint16_t baseAddress)
Pulse K-Count Update Acknowledge.
Definition: mtif.c:59
void MTIF_setPulseGeneratorAsPulseCounterInput(uint16_t baseAddress)
Test port input select for pulse counter, sourced from pulse generator.
Definition: mtif.c:148
void MTIF_clearPulseGenCounter(uint16_t baseAddress)
Pulse Generator pulse counter clear.
Definition: mtif.c:31
void MTIF_clearPulseGridFreqUpdateRequest(uint16_t baseAddress)
Pulse Grid Frequency Update Request.
Definition: mtif.c:54
void MTIF_enablePulseCounter(uint16_t baseAddress)
PC sub module enable.
Definition: mtif.c:79
void MTIF_clearPulseCounter(uint16_t baseAddress)
Pulse counter clear.
Definition: mtif.c:89
uint16_t MTIF_isPulseGridFreqUpdated(uint16_t baseAddress)
Is Pulse Pulse Grid Frequency Updated?
Definition: mtif.c:74
void MTIF_enableTestPortTerminalActivationBySWAndHW(uint16_t baseAddress)
Test port terminal enable activation by software and hardware.
Definition: mtif.c:166
void MTIF_setPulseCounterReadRequest(uint16_t baseAddress)
Pulse Counter Read Request.
Definition: mtif.c:99
void MTIF_setPulseGenPulseGridFreq(uint16_t baseAddress, uint8_t freq)
Pulse Generator pulse grid frequency select.
Definition: mtif.c:36

Copyright 2020, Texas Instruments Incorporated