2 * -------------------------------------------
3 * MSP432 DriverLib - v01_04_00_18
4 * -------------------------------------------
6 * --COPYRIGHT--,BSD,BSD
7 * Copyright (c) 2015, Texas Instruments Incorporated
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * * Neither the name of Texas Instruments Incorporated nor the names of
22 * its contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 //*****************************************************************************
42 //! \addtogroup uart_api
45 //*****************************************************************************
47 //*****************************************************************************
49 // If building with a C++ compiler, make all of the definitions in this header
52 //*****************************************************************************
64 #define DEFAULT_SYNC 0x00
65 #define EUSCI_A_UART_AUTOMATICBAUDRATE_SYNC 0x55
67 #define EUSCI_A_UART_NO_PARITY 0x00
68 #define EUSCI_A_UART_ODD_PARITY 0x01
69 #define EUSCI_A_UART_EVEN_PARITY 0x02
71 #define EUSCI_A_UART_MSB_FIRST UCMSB
72 #define EUSCI_A_UART_LSB_FIRST 0x00
74 #define EUSCI_A_UART_MODE UCMODE_0
75 #define EUSCI_A_UART_IDLE_LINE_MULTI_PROCESSOR_MODE UCMODE_1
76 #define EUSCI_A_UART_ADDRESS_BIT_MULTI_PROCESSOR_MODE UCMODE_2
77 #define EUSCI_A_UART_AUTOMATIC_BAUDRATE_DETECTION_MODE UCMODE_3
79 #define EUSCI_A_UART_CLOCKSOURCE_SMCLK UCSSEL__SMCLK
80 #define EUSCI_A_UART_CLOCKSOURCE_ACLK UCSSEL__ACLK
82 #define EUSCI_A_UART_ONE_STOP_BIT 0x00
83 #define EUSCI_A_UART_TWO_STOP_BITS UCSPB
85 #define EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION 0x01
86 #define EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION 0x00
88 #define EUSCI_A_UART_RECEIVE_INTERRUPT UCRXIE
89 #define EUSCI_A_UART_TRANSMIT_INTERRUPT UCTXIE
90 #define EUSCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT UCRXEIE
91 #define EUSCI_A_UART_BREAKCHAR_INTERRUPT UCBRKIE
92 #define EUSCI_A_UART_STARTBIT_INTERRUPT UCSTTIE
93 #define EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT UCTXCPTIE
95 #define EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG UCRXIFG
96 #define EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG UCTXIFG
97 #define EUSCI_A_UART_STARTBIT_INTERRUPT_FLAG UCSTTIFG
98 #define EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT_FLAG UCTXCPTIFG
100 #define EUSCI_A_UART_LISTEN_ENABLE UCLISTEN
101 #define EUSCI_A_UART_FRAMING_ERROR UCFE
102 #define EUSCI_A_UART_OVERRUN_ERROR UCOE
103 #define EUSCI_A_UART_PARITY_ERROR UCPE
104 #define EUSCI_A_UART_BREAK_DETECT UCBRK
105 #define EUSCI_A_UART_RECEIVE_ERROR UCRXERR
106 #define EUSCI_A_UART_ADDRESS_RECEIVED UCADDR
107 #define EUSCI_A_UART_IDLELINE UCIDLE
108 #define EUSCI_A_UART_BUSY UCBUSY
110 #define EUSCI_A_UART_DEGLITCH_TIME_2ns 0x00
111 #define EUSCI_A_UART_DEGLITCH_TIME_50ns 0x0001
112 #define EUSCI_A_UART_DEGLITCH_TIME_100ns 0x0002
113 #define EUSCI_A_UART_DEGLITCH_TIME_200ns (0x0001 + 0x0002)
115 //*****************************************************************************
117 //! \typedef eUSCI_eUSCI_UART_Config
118 //! \brief Type definition for \link _eUSCI_UART_Config \endlink
121 //! \struct _eUSCI_eUSCI_UART_Config
122 //! \brief Configuration structure for compare mode in the \b UART module. See
123 //! \link UART_initModule \endlink for parameter
126 //*****************************************************************************
127 typedef struct _eUSCI_eUSCI_UART_Config
129 uint_fast8_t selectClockSource;
130 uint_fast16_t clockPrescalar;
131 uint_fast8_t firstModReg;
132 uint_fast8_t secondModReg;
134 uint_fast16_t msborLsbFirst;
135 uint_fast16_t numberofStopBits;
136 uint_fast16_t uartMode;
137 uint_fast8_t overSampling;
140 //*****************************************************************************
142 //! Initialization routine for the UART block. The values to be written
143 //! into the UCAxBRW and UCAxMCTLW registers should be pre-computed and passed
144 //! into the initialization function
146 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
147 //! Valid parameters vary from part to part, but can include:
148 //! - \b EUSCI_A0_MODULE
149 //! - \b EUSCI_A1_MODULE
150 //! - \b EUSCI_A2_MODULE
151 //! - \b EUSCI_A3_MODULE
152 //! \param config Configuration structure for the UART module
155 //! <b>Configuration options for \link eUSCI_UART_Config \endlink
158 //! <br> It is important to note that for eUSCI modules, only "A" modules such
159 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
161 //! \param selectClockSource selects Clock source. Valid values are
162 //! - \b EUSCI_A_UART_CLOCKSOURCE_SMCLK
163 //! - \b EUSCI_A_UART_CLOCKSOURCE_ACLK
164 //! \param clockPrescalar is the value to be written into UCBRx bits
165 //! \param firstModReg is First modulation stage register setting. This
166 //! value is a pre-calculated value which can be obtained from the Device
167 //! User Guide.This value is written into UCBRFx bits of UCAxMCTLW.
168 //! \param secondModReg is Second modulation stage register setting.
169 //! This value is a pre-calculated value which can be obtained from the
170 //! Device User Guide. This value is written into UCBRSx bits of
172 //! \param parity is the desired parity. Valid values are
173 //! - \b EUSCI_A_UART_NO_PARITY [Default Value],
174 //! - \b EUSCI_A_UART_ODD_PARITY,
175 //! - \b EUSCI_A_UART_EVEN_PARITY
176 //! \param msborLsbFirst controls direction of receive and transmit shift
177 //! register. Valid values are
178 //! - \b EUSCI_A_UART_MSB_FIRST
179 //! - \b EUSCI_A_UART_LSB_FIRST [Default Value]
180 //! \param numberofStopBits indicates one/two STOP bits
182 //! - \b EUSCI_A_UART_ONE_STOP_BIT [Default Value]
183 //! - \b EUSCI_A_UART_TWO_STOP_BITS
184 //! \param uartMode selects the mode of operation
186 //! - \b EUSCI_A_UART_MODE [Default Value],
187 //! - \b EUSCI_A_UART_IDLE_LINE_MULTI_PROCESSOR_MODE,
188 //! - \b EUSCI_A_UART_ADDRESS_BIT_MULTI_PROCESSOR_MODE,
189 //! - \b EUSCI_A_UART_AUTOMATIC_BAUDRATE_DETECTION_MODE
190 //! \param overSampling indicates low frequency or oversampling baud
193 //! - \b EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION
194 //! - \b EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION
196 //! Upon successful initialization of the UART block, this function
197 //! will have initialized the module, but the UART block still remains
198 //! disabled and must be enabled with UART_enableModule()
201 //! <a href="http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430BaudRateConverter/index.html">
202 //! this calculator </a> for help on calculating values for the parameters.
204 //! Modified bits are \b UCPEN, \b UCPAR, \b UCMSB, \b UC7BIT, \b UCSPB,
205 //! \b UCMODEx, \b UCSYNC bits of \b UCAxCTL0 and \b UCSSELx,
206 //! \b UCSWRST bits of \b UCAxCTL1
209 //! STATUS_FAIL of the initialization process
211 //*****************************************************************************
212 extern bool UART_initModule(uint32_t moduleInstance,
213 const eUSCI_UART_Config *config);
215 //*****************************************************************************
217 //! Transmits a byte from the UART Module.
219 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
220 //! Valid parameters vary from part to part, but can include:
221 //! - \b EUSCI_A0_MODULE
222 //! - \b EUSCI_A1_MODULE
223 //! - \b EUSCI_A2_MODULE
224 //! - \b EUSCI_A3_MODULE
225 //! <br> It is important to note that for eUSCI modules, only "A" modules such
226 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
228 //! \param transmitData data to be transmitted from the UART module
230 //! This function will place the supplied data into UART transmit data register
231 //! to start transmission
233 //! Modified register is \b UCAxTXBUF
236 //*****************************************************************************
237 extern void UART_transmitData(uint32_t moduleInstance,
238 uint_fast8_t transmitData);
240 //*****************************************************************************
242 //! Receives a byte that has been sent to the UART Module.
244 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
245 //! Valid parameters vary from part to part, but can include:
246 //! - \b EUSCI_A0_MODULE
247 //! - \b EUSCI_A1_MODULE
248 //! - \b EUSCI_A2_MODULE
249 //! - \b EUSCI_A3_MODULE
250 //! <br> It is important to note that for eUSCI modules, only "A" modules such
251 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
254 //! This function reads a byte of data from the UART receive data Register.
256 //! Modified register is \b UCAxRXBUF
258 //! \return Returns the byte received from by the UART module, cast as an
261 //*****************************************************************************
262 extern uint8_t UART_receiveData(uint32_t moduleInstance);
264 //*****************************************************************************
266 //! Enables the UART block.
268 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
269 //! Valid parameters vary from part to part, but can include:
270 //! - \b EUSCI_A0_MODULE
271 //! - \b EUSCI_A1_MODULE
272 //! - \b EUSCI_A2_MODULE
273 //! - \b EUSCI_A3_MODULE
274 //! <br> It is important to note that for eUSCI modules, only "A" modules such
275 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
278 //! This will enable operation of the UART block.
280 //! Modified register is \b UCAxCTL1
284 //*****************************************************************************
285 extern void UART_enableModule(uint32_t moduleInstance);
287 //*****************************************************************************
289 //! Disables the UART block.
291 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
292 //! Valid parameters vary from part to part, but can include:
293 //! - \b EUSCI_A0_MODULE
294 //! - \b EUSCI_A1_MODULE
295 //! - \b EUSCI_A2_MODULE
296 //! - \b EUSCI_A3_MODULE
297 //! <br> It is important to note that for eUSCI modules, only "A" modules such
298 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
301 //! This will disable operation of the UART block.
303 //! Modified register is \b UCAxCTL1
307 //*****************************************************************************
308 extern void UART_disableModule(uint32_t moduleInstance);
310 //*****************************************************************************
312 //! Gets the current UART status flags.
314 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
315 //! Valid parameters vary from part to part, but can include:
316 //! - \b EUSCI_A0_MODULE
317 //! - \b EUSCI_A1_MODULE
318 //! - \b EUSCI_A2_MODULE
319 //! - \b EUSCI_A3_MODULE
320 //! <br> It is important to note that for eUSCI modules, only "A" modules such
321 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
323 //! \param mask is the masked interrupt flag status to be returned.
325 //! This returns the status for the UART module based on which
326 //! flag is passed. mask parameter can be either any of the following
328 //! - \b EUSCI_A_UART_LISTEN_ENABLE
329 //! - \b EUSCI_A_UART_FRAMING_ERROR
330 //! - \b EUSCI_A_UART_OVERRUN_ERROR
331 //! - \b EUSCI_A_UART_PARITY_ERROR
332 //! - \b eUARTBREAK_DETECT
333 //! - \b EUSCI_A_UART_RECEIVE_ERROR
334 //! - \b EUSCI_A_UART_ADDRESS_RECEIVED
335 //! - \b EUSCI_A_UART_IDLELINE
336 //! - \b EUSCI_A_UART_BUSY
338 //! Modified register is \b UCAxSTAT
340 //! \return the masked status flag
342 //*****************************************************************************
343 extern uint_fast8_t UART_queryStatusFlags(uint32_t moduleInstance,
346 //*****************************************************************************
348 //! Sets the UART module in dormant mode
350 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
351 //! Valid parameters vary from part to part, but can include:
352 //! - \b EUSCI_A0_MODULE
353 //! - \b EUSCI_A1_MODULE
354 //! - \b EUSCI_A2_MODULE
355 //! - \b EUSCI_A3_MODULE
356 //! <br> It is important to note that for eUSCI modules, only "A" modules such
357 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
360 //! Puts USCI in sleep mode
361 //! Only characters that are preceded by an idle-line or with address bit set
362 //! UCRXIFG. In UART mode with automatic baud-rate detection, only the
363 //! combination of a break and synch field sets UCRXIFG.
365 //! Modified register is \b UCAxCTL1
369 //*****************************************************************************
370 extern void UART_setDormant(uint32_t moduleInstance);
372 //*****************************************************************************
374 //! Re-enables UART module from dormant mode
376 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
377 //! Valid parameters vary from part to part, but can include:
378 //! - \b EUSCI_A0_MODULE
379 //! - \b EUSCI_A1_MODULE
380 //! - \b EUSCI_A2_MODULE
381 //! - \b EUSCI_A3_MODULE
382 //! <br> It is important to note that for eUSCI modules, only "A" modules such
383 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
386 //! Not dormant. All received characters set UCRXIFG.
388 //! Modified bits are \b UCDORM of \b UCAxCTL1 register.
392 //*****************************************************************************
393 extern void UART_resetDormant(uint32_t moduleInstance);
395 //*****************************************************************************
397 //! Transmits the next byte to be transmitted marked as address depending on
398 //! selected multiprocessor mode
400 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
401 //! Valid parameters vary from part to part, but can include:
402 //! - \b EUSCI_A0_MODULE
403 //! - \b EUSCI_A1_MODULE
404 //! - \b EUSCI_A2_MODULE
405 //! - \b EUSCI_A3_MODULE
406 //! <br> It is important to note that for eUSCI modules, only "A" modules such
407 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
409 //! \param transmitAddress is the next byte to be transmitted
411 //! Modified register is \b UCAxCTL1, \b UCAxTXBUF
415 //*****************************************************************************
416 extern void UART_transmitAddress(uint32_t moduleInstance,
417 uint_fast8_t transmitAddress);
419 //*****************************************************************************
421 //! Transmit break. Transmits a break with the next write to the transmit
422 //! buffer. In UART mode with automatic baud-rate detection,
423 //! EUSCI_A_UART_AUTOMATICBAUDRATE_SYNC(0x55) must be written into UCAxTXBUF to
424 //! generate the required break/synch fields.
425 //! Otherwise, DEFAULT_SYNC(0x00) must be written into the transmit buffer.
426 //! Also ensures module is ready for transmitting the next data
428 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
429 //! Valid parameters vary from part to part, but can include:
430 //! - \b EUSCI_A0_MODULE
431 //! - \b EUSCI_A1_MODULE
432 //! - \b EUSCI_A2_MODULE
433 //! - \b EUSCI_A3_MODULE
434 //! <br> It is important to note that for eUSCI modules, only "A" modules such
435 //! asEUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
438 //! Modified register is \b UCAxCTL1, \b UCAxTXBUF
442 //*****************************************************************************
443 extern void UART_transmitBreak(uint32_t moduleInstance);
445 //*****************************************************************************
447 //! Returns the address of the RX Buffer of the UART for the DMA module.
449 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
450 //! Valid parameters vary from part to part, but can include:
451 //! - \b EUSCI_A0_MODULE
452 //! - \b EUSCI_A1_MODULE
453 //! - \b EUSCI_A2_MODULE
454 //! - \b EUSCI_A3_MODULE
455 //! <br> It is important to note that for eUSCI modules, only "A" modules such
456 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
459 //! Returns the address of the UART RX Buffer. This can be used in conjunction
460 //! with the DMA to store the received data directly to memory.
464 //*****************************************************************************
465 extern uint32_t UART_getReceiveBufferAddressForDMA(uint32_t moduleInstance);
467 //*****************************************************************************
469 //! Returns the address of the TX Buffer of the UART for the DMA module.
471 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
472 //! Valid parameters vary from part to part, but can include:
473 //! - \b EUSCI_A0_MODULE
474 //! - \b EUSCI_A1_MODULE
475 //! - \b EUSCI_A2_MODULE
476 //! - \b EUSCI_A3_MODULE
477 //! <br> It is important to note that for eUSCI modules, only "A" modules such
478 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
481 //! Returns the address of the UART TX Buffer. This can be used in conjunction
482 //! with the DMA to obtain transmitted data directly from memory.
486 //*****************************************************************************
487 extern uint32_t UART_getTransmitBufferAddressForDMA(uint32_t moduleInstance);
489 //*****************************************************************************
491 //! Sets the deglitch time
493 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
494 //! Valid parameters vary from part to part, but can include:
495 //! - \b EUSCI_A0_MODULE
496 //! - \b EUSCI_A1_MODULE
497 //! - \b EUSCI_A2_MODULE
498 //! - \b EUSCI_A3_MODULE
499 //! <br> It is important to note that for eUSCI modules, only "A" modules such
500 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
502 //! \param deglitchTime is the selected deglitch time
504 //! - \b EUSCI_A_UART_DEGLITCH_TIME_2ns
505 //! - \b EUSCI_A_UART_DEGLITCH_TIME_50ns
506 //! - \b EUSCI_A_UART_DEGLITCH_TIME_100ns
507 //! - \b EUSCI_A_UART_DEGLITCH_TIME_200ns
510 //! Returns the address of the UART TX Buffer. This can be used in conjunction
511 //! with the DMA to obtain transmitted data directly from memory.
515 //*****************************************************************************
516 extern void UART_selectDeglitchTime(uint32_t moduleInstance,
517 uint32_t deglitchTime);
519 //*****************************************************************************
521 //! Enables individual UART interrupt sources.
523 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
524 //! Valid parameters vary from part to part, but can include:
525 //! - \b EUSCI_A0_MODULE
526 //! - \b EUSCI_A1_MODULE
527 //! - \b EUSCI_A2_MODULE
528 //! - \b EUSCI_A3_MODULE
529 //! <br> It is important to note that for eUSCI modules, only "A" modules such
530 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
532 //! \param mask is the bit mask of the interrupt sources to be enabled.
534 //! Enables the indicated UART interrupt sources. The interrupt flag is first
535 //! and then the corresponding interrupt is enabled. Only the sources that
536 //! are enabled can be reflected to the processor interrupt; disabled sources
537 //! have no effect on the processor.
539 //! The mask parameter is the logical OR of any of the following:
540 //! - \b EUSCI_A_UART_RECEIVE_INTERRUPT -Receive interrupt
541 //! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT - Transmit interrupt
542 //! - \b EUSCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT - Receive
543 //! erroneous-character interrupt enable
544 //! - \b EUSCI_A_UART_BREAKCHAR_INTERRUPT - Receive break character interrupt
547 //! Modified register is \b UCAxIFG, \b UCAxIE and \b UCAxCTL1
551 //*****************************************************************************
552 extern void UART_enableInterrupt(uint32_t moduleInstance, uint_fast8_t mask);
554 //*****************************************************************************
556 //! Disables individual UART interrupt sources.
558 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
559 //! Valid parameters vary from part to part, but can include:
560 //! - \b EUSCI_A0_MODULE
561 //! - \b EUSCI_A1_MODULE
562 //! - \b EUSCI_A2_MODULE
563 //! - \b EUSCI_A3_MODULE
564 //! <br> It is important to note that for eUSCI modules, only "A" modules such
565 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
567 //! \param mask is the bit mask of the interrupt sources to be
570 //! Disables the indicated UART interrupt sources. Only the sources that
571 //! are enabled can be reflected to the processor interrupt; disabled sources
572 //! have no effect on the processor.
574 //! The mask parameter is the logical OR of any of the following:
575 //! - \b EUSCI_A_UART_RECEIVE_INTERRUPT -Receive interrupt
576 //! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT - Transmit interrupt
577 //! - \b EUSCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT - Receive
578 //! erroneous-character interrupt enable
579 //! - \b EUSCI_A_UART_BREAKCHAR_INTERRUPT - Receive break character interrupt
582 //! Modified register is \b UCAxIFG, \b UCAxIE and \b UCAxCTL1
585 //*****************************************************************************
586 extern void UART_disableInterrupt(uint32_t moduleInstance, uint_fast8_t mask);
588 //*****************************************************************************
590 //! Gets the current UART interrupt status.
592 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
593 //! Valid parameters vary from part to part, but can include:
594 //! - \b EUSCI_A0_MODULE
595 //! - \b EUSCI_A1_MODULE
596 //! - \b EUSCI_A2_MODULE
597 //! - \b EUSCI_A3_MODULE
598 //! <br> It is important to note that for eUSCI modules, only "A" modules such
599 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
601 //! \param mask is the masked interrupt flag status to be returned.
602 //! Mask value is the logical OR of any of the following:
603 //! - \b EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG
604 //! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG
605 //! - \b EUSCI_A_UART_STARTBIT_INTERRUPT_FLAG
606 //! - \b EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT_FLAG
609 //! \return The current interrupt status as an ORed bit mask:
610 //! - \b EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG -Receive interrupt flag
611 //! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG - Transmit interrupt flag
613 //*****************************************************************************
614 extern uint_fast8_t UART_getInterruptStatus(uint32_t moduleInstance,
617 //*****************************************************************************
619 //! Gets the current UART interrupt status masked with the enabled interrupts.
620 //! This function is useful to call in ISRs to get a list of pending
621 //! interrupts that are actually enabled and could have caused
625 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
626 //! Valid parameters vary from part to part, but can include:
627 //! - \b EUSCI_A0_MODULE
628 //! - \b EUSCI_A1_MODULE
629 //! - \b EUSCI_A2_MODULE
630 //! - \b EUSCI_A3_MODULE
631 //! <br> It is important to note that for eUSCI modules, only "A" modules such
632 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
635 //! \return The current interrupt status as an ORed bit mask:
636 //! - \b EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG -Receive interrupt flag
637 //! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG - Transmit interrupt flag
639 //*****************************************************************************
640 extern uint_fast8_t UART_getEnabledInterruptStatus(uint32_t moduleInstance);
642 //*****************************************************************************
644 //! Clears UART interrupt sources.
646 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
647 //! Valid parameters vary from part to part, but can include:
648 //! - \b EUSCI_A0_MODULE
649 //! - \b EUSCI_A1_MODULE
650 //! - \b EUSCI_A2_MODULE
651 //! - \b EUSCI_A3_MODULE
652 //! <br> It is important to note that for eUSCI modules, only "A" modules such
653 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
655 //! \param mask is a bit mask of the interrupt sources to be cleared.
657 //! The UART interrupt source is cleared, so that it no longer asserts.
658 //! The highest interrupt flag is automatically cleared when an interrupt vector
659 //! generator is used.
661 //! The mask parameter has the same definition as the mask parameter to
662 //! EUSCI_A_UART_enableInterrupt().
664 //! Modified register is \b UCAxIFG
668 //*****************************************************************************
669 extern void UART_clearInterruptFlag(uint32_t moduleInstance, uint_fast8_t mask);
671 //*****************************************************************************
673 //! Registers an interrupt handler for UART interrupts.
675 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
676 //! Valid parameters vary from part to part, but can include:
677 //! - \b EUSCI_A0_MODULE
678 //! - \b EUSCI_A1_MODULE
679 //! - \b EUSCI_A2_MODULE
680 //! - \b EUSCI_A3_MODULE
681 //! <br> It is important to note that for eUSCI modules, only "A" modules such
682 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
685 //! \param intHandler is a pointer to the function to be called when the
686 //! timer capture compare interrupt occurs.
688 //! This function registers the handler to be called when an UART
689 //! interrupt occurs. This function enables the global interrupt in the
690 //! interrupt controller; specific UART interrupts must be enabled
691 //! via UART_enableInterrupt(). It is the interrupt handler's responsibility to
692 //! clear the interrupt source via UART_clearInterruptFlag().
696 //*****************************************************************************
697 extern void UART_registerInterrupt(uint32_t moduleInstance,
698 void (*intHandler)(void));
700 //*****************************************************************************
702 //! Unregisters the interrupt handler for the UART module
704 //! \param moduleInstance is the instance of the eUSCI A (UART) module.
705 //! Valid parameters vary from part to part, but can include:
706 //! - \b EUSCI_A0_MODULE
707 //! - \b EUSCI_A1_MODULE
708 //! - \b EUSCI_A2_MODULE
709 //! - \b EUSCI_A3_MODULE
710 //! <br> It is important to note that for eUSCI modules, only "A" modules such
711 //! as EUSCI_A0 can be used. "B" modules such as EUSCI_B0 do not support the
714 //! This function unregisters the handler to be called when timer
715 //! interrupt occurs. This function also masks off the interrupt in the
716 //! interrupt controller so that the interrupt handler no longer is called.
718 //! \sa Interrupt_registerInterrupt() for important information about
719 //! registering interrupt handlers.
723 //*****************************************************************************
724 extern void UART_unregisterInterrupt(uint32_t moduleInstance);
726 /* Backwards Compatibility Layer */
727 #define EUSCI_A_UART_transmitData UART_transmitData
728 #define EUSCI_A_UART_receiveData UART_receiveData
729 #define EUSCI_A_UART_enableInterrupt UART_enableInterrupt
730 #define EUSCI_A_UART_disableInterrupt UART_disableInterrupt
731 #define EUSCI_A_UART_getInterruptStatus UART_getInterruptStatus
732 #define EUSCI_A_UART_clearInterruptFlag UART_clearInterruptFlag
733 #define EUSCI_A_UART_enable UART_enableModule
734 #define EUSCI_A_UART_disable UART_disableModule
735 #define EUSCI_A_UART_queryStatusFlags UART_queryStatusFlags
736 #define EUSCI_A_UART_setDormant UART_setDormant
737 #define EUSCI_A_UART_resetDormant UART_resetDormant
738 #define EUSCI_A_UART_transmitAddress UART_transmitAddress
739 #define EUSCI_A_UART_transmitBreak UART_transmitBreak
740 #define EUSCI_A_UART_getReceiveBufferAddressForDMA UART_getReceiveBufferAddressForDMA
741 #define EUSCI_A_UART_getTransmitBufferAddressForDMA UART_getTransmitBufferAddressForDMA
742 #define EUSCI_A_UART_selectDeglitchTime UART_selectDeglitchTime
744 //*****************************************************************************
746 // Mark the end of the C bindings section for C++ compilers.
748 //*****************************************************************************
753 //*****************************************************************************
755 // Close the Doxygen group.
758 //*****************************************************************************