MSPM0L11XX_L13XX TI-Driver Library  1.20.01.06
UARTMSPM0L11XX_L13XX.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 UARTMSPM0L11XX_L13XX.h
34  *
35  * @brief UART driver interface for the MSPM0L11XX_L13XX devices.
36  *
37  * @defgroup UARTMSPM0L11XX_L13XX UART MSPM0L11XX_L13XX 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_UARTMSPM0L11XX_L13XX__include
51 #define ti_drivers_uart_UARTMSPM0L11XX_L13XX__include
52 
53 #include <ti/devices/msp/msp.h>
55 
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
67 #define UART_RX_ERRS \
68  (DL_UART_INTERRUPT_OVERRUN_ERROR | DL_UART_INTERRUPT_BREAK_ERROR | \
69  DL_UART_INTERRUPT_PARITY_ERROR | \
70  DL_UART_INTERRUPT_FRAMING_ERROR)
71 
76 typedef struct
77 {
78  UART_Regs *regs;
79  IRQn_Type irq;
80  uint32_t rxPin;
81  uint32_t rxPinFunction;
82  uint32_t txPin;
83  uint32_t txPinFunction;
84  DL_UART_MODE mode;
85  DL_UART_DIRECTION direction;
86  DL_UART_FLOW_CONTROL flowControl;
87  DL_UART_CLOCK clockSource;
88  DL_UART_CLOCK_DIVIDE_RATIO clockDivider;
89  DL_UART_RX_FIFO_LEVEL rxIntFifoThr;
90  DL_UART_TX_FIFO_LEVEL txIntFifoThr;
92 
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 
201 void UARTMSP_enableInts(UART_Handle handle);
202 
203 #ifdef __cplusplus
204 } /* extern "C" */
205 #endif
206 
207 #endif /* ti_drivers_uart_UARTMSPM0L11XX_L13XX__include */
208 /* clang-format on */
Private Metadata structure for a UART instance supporting callbacks.
Definition: UARTSupportMSPM0L11XX_L13XX.h:189
UART driver support APIs for the MSPM0L11XX_L13XX devices.
__STATIC_INLINE UART_Callback_Object * UART_callbackObject(UART_Object *object)
This function returns a pointer to UART callback object.
Definition: UARTMSPM0L11XX_L13XX.h:172
IRQn_Type irq
Definition: UARTMSPM0L11XX_L13XX.h:79
DL_UART_DIRECTION direction
Definition: UARTMSPM0L11XX_L13XX.h:85
void * object
Definition: UARTSupportMSPM0L11XX_L13XX.h:231
__STATIC_INLINE UART_EventCallback_Object * UART_eventCallbackObject(UART_Object *object)
This function returns a pointer to UART event callback object.
Definition: UARTMSPM0L11XX_L13XX.h:156
DL_UART_FLOW_CONTROL flowControl
Definition: UARTMSPM0L11XX_L13XX.h:86
__STATIC_INLINE UART_Buffers_Object * UART_buffersObject(UART_Object *object)
This function returns a pointer to UART buffers object.
Definition: UARTMSPM0L11XX_L13XX.h:140
DL_UART_TX_FIFO_LEVEL txIntFifoThr
Definition: UARTMSPM0L11XX_L13XX.h:90
uint32_t rxPin
Definition: UARTMSPM0L11XX_L13XX.h:80
UART Global configuration.
Definition: UARTSupportMSPM0L11XX_L13XX.h:228
void const * hwAttrs
Definition: UARTSupportMSPM0L11XX_L13XX.h:234
DL_UART_MODE mode
Definition: UARTMSPM0L11XX_L13XX.h:84
Private Metadata structure for a UART instance supporting hardware parameters.
Definition: UARTMSPM0L11XX_L13XX.h:76
__STATIC_INLINE UART_Object * UART_Obj_Ptr(UART_Handle handle)
This function returns a pointer to UART object.
Definition: UARTMSPM0L11XX_L13XX.h:104
UART_Regs * regs
Definition: UARTMSPM0L11XX_L13XX.h:78
__STATIC_INLINE UARTMSP_HWAttrs * UART_HWAttrs_Ptr(UART_Handle handle)
This function returns a pointer to UART hardware Attribute.
Definition: UARTMSPM0L11XX_L13XX.h:120
void UARTMSP_enableInts(UART_Handle handle)
This function enables receive, receive timeout, and error interrupts.
void UARTMSP_interruptHandler(UART_Handle handle)
This function handles the UART interrupts.
Private Metadata structure for a UART instance supporting events.
Definition: UARTSupportMSPM0L11XX_L13XX.h:180
DL_UART_RX_FIFO_LEVEL rxIntFifoThr
Definition: UARTMSPM0L11XX_L13XX.h:89
uint32_t txPin
Definition: UARTMSPM0L11XX_L13XX.h:82
DL_UART_CLOCK_DIVIDE_RATIO clockDivider
Definition: UARTMSPM0L11XX_L13XX.h:88
const UARTSupport_Fxns UARTMSPSupportFxns
UART support function pointers.
Private Metadata structure for a UART instance supporting buffers.
Definition: UARTSupportMSPM0L11XX_L13XX.h:165
Private Metadata structure for a UART instance.
Definition: UARTSupportMSPM0L11XX_L13XX.h:137
uint32_t txPinFunction
Definition: UARTMSPM0L11XX_L13XX.h:83
DL_UART_CLOCK clockSource
Definition: UARTMSPM0L11XX_L13XX.h:87
Function pointers to implementation/hardware specific logic.
Definition: UARTSupportMSPM0L11XX_L13XX.h:63
uint32_t rxPinFunction
Definition: UARTMSPM0L11XX_L13XX.h:81
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale