MSPM0G1X0X_G3X0X TI-Driver Library  2.01.00.03
UARTMSPM0.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*!****************************************************************************
33  * @file UARTMSPM0.h
34  *
35  * @brief UART driver interface for the MSPM0 devices.
36  *
37  * @defgroup UARTMSPM0 UART driver APIs
38  *
39  * # Overview
40  * Refer to @ref ti_drivers_UART_Overview for a complete description of APIs and examples
41  * of use.
42  *
43  ******************************************************************************
44  */
49 /* clang-format off */
50 #ifndef ti_drivers_uart_UARTMSPM0__include
51 #define ti_drivers_uart_UARTMSPM0__include
52 
53 #include <ti/devices/msp/msp.h>
55 
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
68 #define UART_RX_ERRS \
69  (DL_UART_INTERRUPT_OVERRUN_ERROR | DL_UART_INTERRUPT_BREAK_ERROR | \
70  DL_UART_INTERRUPT_PARITY_ERROR | \
71  DL_UART_INTERRUPT_FRAMING_ERROR)
72 
77 typedef struct
78 {
79  UART_Regs *regs;
80  IRQn_Type irq;
81  uint32_t rxPin;
82  uint32_t rxPinFunction;
83  uint32_t txPin;
84  uint32_t txPinFunction;
85  DL_UART_MODE mode;
86  DL_UART_DIRECTION direction;
87  DL_UART_FLOW_CONTROL flowControl;
88  DL_UART_CLOCK clockSource;
89  DL_UART_CLOCK_DIVIDE_RATIO clockDivider;
90  DL_UART_RX_FIFO_LEVEL rxIntFifoThr;
91  DL_UART_TX_FIFO_LEVEL txIntFifoThr;
104 __STATIC_INLINE UART_Object* UART_Obj_Ptr(UART_Handle handle)
105 {
106  return (UART_Object *) (handle->object);
107 }
108 
121 {
122  return (UARTMSP_HWAttrs *) (handle->hwAttrs);
123 }
124 /* The functions given below are based on @ref UART_Data_Object structure.
125 * These functions return a pointer to particular element in the structure
126 * which is based on the sequence in the structure. The sequence of elements
127 * in @ref UART_Data_Object must NOT be modified else below functions will be broken.
128 */
141 {
142  return (UART_Buffers_Object *) (object + 1);
143 }
144 
157 {
158  return (UART_EventCallback_Object *) (UART_buffersObject(object) + 1);
159 }
160 
173 {
174  return (UART_Callback_Object *) (UART_eventCallbackObject(object) + 1);
175 }
176 
188 #ifndef UART_NO_DMA
189 
201 void UARTMSP_dmaTx(UART_Handle handle);
202 
216 void UARTMSP_dmaRx(UART_Handle handle, bool copyfifo);
217 
230 void UARTMSP_dmaStopRx(UART_Handle handle);
231 
244 uint32_t UARTMSP_dmaStopTx(UART_Handle handle);
245 #endif
246 
258 void UARTMSP_enableInts(UART_Handle handle);
259 
260 #ifdef __cplusplus
261 } /* extern "C" */
262 #endif
263 
264 #endif /* ti_drivers_uart_UARTMSPM0__include */
265 /* clang-format on */
Private Metadata structure for a UART instance supporting callbacks.
Definition: UARTSupportMSPM0.h:193
IRQn_Type irq
Definition: UARTMSPM0.h:80
DL_UART_DIRECTION direction
Definition: UARTMSPM0.h:86
void * object
Definition: UARTSupportMSPM0.h:235
void UARTMSP_dmaRx(UART_Handle handle, bool copyfifo)
This function configures and starts DMA receive.
const UARTSupport_Fxns UARTMSPSupportFxns
UART support function pointers.
__STATIC_INLINE UART_Buffers_Object * UART_buffersObject(UART_Object *object)
This function returns a pointer to UART buffers object.
Definition: UARTMSPM0.h:140
DL_UART_FLOW_CONTROL flowControl
Definition: UARTMSPM0.h:87
DL_UART_TX_FIFO_LEVEL txIntFifoThr
Definition: UARTMSPM0.h:91
uint32_t rxPin
Definition: UARTMSPM0.h:81
UART Global configuration.
Definition: UARTSupportMSPM0.h:232
void UARTMSP_dmaTx(UART_Handle handle)
This function configures and starts DMA transfer.
void const * hwAttrs
Definition: UARTSupportMSPM0.h:238
DL_UART_MODE mode
Definition: UARTMSPM0.h:85
__STATIC_INLINE UART_Callback_Object * UART_callbackObject(UART_Object *object)
This function returns a pointer to UART callback object.
Definition: UARTMSPM0.h:172
Private Metadata structure for a UART instance supporting hardware parameters.
Definition: UARTMSPM0.h:77
UART_Regs * regs
Definition: UARTMSPM0.h:79
Private Metadata structure for a UART instance supporting events.
Definition: UARTSupportMSPM0.h:184
DL_UART_RX_FIFO_LEVEL rxIntFifoThr
Definition: UARTMSPM0.h:90
uint32_t txPin
Definition: UARTMSPM0.h:83
__STATIC_INLINE UARTMSP_HWAttrs * UART_HWAttrs_Ptr(UART_Handle handle)
This function returns a pointer to UART hardware Attribute.
Definition: UARTMSPM0.h:120
DL_UART_CLOCK_DIVIDE_RATIO clockDivider
Definition: UARTMSPM0.h:89
void UARTMSP_interruptHandler(UART_Handle handle)
This function handles the UART interrupts.
Private Metadata structure for a UART instance supporting buffers.
Definition: UARTSupportMSPM0.h:169
__STATIC_INLINE UART_EventCallback_Object * UART_eventCallbackObject(UART_Object *object)
This function returns a pointer to UART event callback object.
Definition: UARTMSPM0.h:156
Private Metadata structure for a UART instance.
Definition: UARTSupportMSPM0.h:137
__STATIC_INLINE UART_Object * UART_Obj_Ptr(UART_Handle handle)
This function returns a pointer to UART object.
Definition: UARTMSPM0.h:104
void UARTMSP_enableInts(UART_Handle handle)
This function enables receive, receive timeout, and error interrupts.
uint32_t txPinFunction
Definition: UARTMSPM0.h:84
DL_UART_CLOCK clockSource
Definition: UARTMSPM0.h:88
uint32_t UARTMSP_dmaStopTx(UART_Handle handle)
This function stops DMA tx and disables the channel.
UART driver support APIs for the MSPM0 devices.
Function pointers to implementation/hardware specific logic.
Definition: UARTSupportMSPM0.h:63
uint32_t rxPinFunction
Definition: UARTMSPM0.h:82
void UARTMSP_dmaStopRx(UART_Handle handle)
This function stops DMA rx and disables the channel.
© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale