TI-RTOS for SimpleLink Wireless MCUs  2.14.03.28
UARTUSCIA.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, 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  */
49 #ifndef ti_drivers_uart_UARTUSCIA__include
50 #define ti_drivers_uart_UARTUSCIA__include
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 #include <stdint.h>
57 #include <stdbool.h>
58 #include <ti/drivers/UART.h>
59 
60 #include <ti/sysbios/knl/Semaphore.h>
61 
62 /* UARTUSCIA function table pointer */
64 
92 typedef struct UARTUSCIA_BaudrateConfig {
93  uint32_t outputBaudrate;
94  uint32_t inputClockFreq;
96  uint8_t prescalar;
97  uint8_t hwRegUCBRFx;
98  uint8_t hwRegUCBRSx;
99  uint8_t oversampling;
101 
144 typedef struct UARTUSCIA_HWAttrs {
146  unsigned int baseAddr;
148  uint8_t clockSource;
150  uint32_t bitOrder;
152  unsigned int numBaudrateEntries;
156 
162 typedef struct UARTUSCIA_Object {
163  /* UARTUSCIA control variables */
164  bool isOpen; /* Status for open */
165  UART_Mode readMode; /* Mode for all read calls */
166  UART_Mode writeMode; /* Mode for all write calls */
167  unsigned int readTimeout; /* Timeout for read semaphore */
168  unsigned int writeTimeout; /* Timeout for write semaphore */
169  UART_Callback readCallback; /* Pointer to read callback */
170  UART_Callback writeCallback; /* Pointer to write callback */
171  UART_ReturnMode readReturnMode; /* Receive return mode */
172  UART_DataMode readDataMode; /* Type of data being read */
173  UART_DataMode writeDataMode; /* Type of data being written */
174  UART_Echo readEcho; /* Echo received data back */
175 
176  /* UARTUSCIA write variables */
177  const void *writeBuf; /* Buffer data pointer */
178  size_t writeCount; /* Number of Chars sent */
179  size_t writeSize; /* Chars remaining in buffer */
180  bool writeCR; /* Write a return character */
181 
182  /* UARTUSCIA receive variables */
183  void *readBuf; /* Buffer data pointer */
184  size_t readCount; /* Number of Chars read */
185  size_t readSize; /* Chars remaining in buffer */
186 
187  /* UARTUSCIA SYS/BIOS objects */
188  Semaphore_Struct writeSem; /* UARTUSCIA write semaphore*/
189  Semaphore_Struct readSem; /* UARTUSCIA read semaphore */
191 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 #endif /* ti_drivers_uart_UARTUSCIA__include */
UART_Callback writeCallback
Definition: UARTUSCIA.h:170
uint8_t oversampling
Definition: UARTUSCIA.h:99
unsigned int readTimeout
Definition: UARTUSCIA.h:167
UART_Mode readMode
Definition: UARTUSCIA.h:165
UART_Callback readCallback
Definition: UARTUSCIA.h:169
bool isOpen
Definition: UARTUSCIA.h:164
size_t readCount
Definition: UARTUSCIA.h:184
The definition of a UART function table that contains the required set of functions to control a spec...
Definition: UART.h:497
UART_Mode
UART mode settings.
Definition: UART.h:291
size_t readSize
Definition: UARTUSCIA.h:185
UART_DataMode
UART data mode settings.
Definition: UART.h:339
uint8_t hwRegUCBRSx
Definition: UARTUSCIA.h:98
const void * writeBuf
Definition: UARTUSCIA.h:177
UART_ReturnMode
UART return mode settings.
Definition: UART.h:324
UARTUSCIA Hardware attributes.
Definition: UARTUSCIA.h:144
Semaphore_Struct writeSem
Definition: UARTUSCIA.h:188
UART_Echo
UART echo settings.
Definition: UART.h:357
uint8_t hwRegUCBRFx
Definition: UARTUSCIA.h:97
uint8_t clockSource
Definition: UARTUSCIA.h:148
Semaphore_Struct readSem
Definition: UARTUSCIA.h:189
UARTUSCIA_BaudrateConfig const * baudrateLUT
Definition: UARTUSCIA.h:154
unsigned int baseAddr
Definition: UARTUSCIA.h:146
UART_ReturnMode readReturnMode
Definition: UARTUSCIA.h:171
void * readBuf
Definition: UARTUSCIA.h:183
UART_Echo readEcho
Definition: UARTUSCIA.h:174
UARTUSCIA Baudrate configuration.
Definition: UARTUSCIA.h:92
UART_DataMode writeDataMode
Definition: UARTUSCIA.h:173
bool writeCR
Definition: UARTUSCIA.h:180
UART driver interface.
UARTUSCIA Object.
Definition: UARTUSCIA.h:162
uint32_t outputBaudrate
Definition: UARTUSCIA.h:93
unsigned int numBaudrateEntries
Definition: UARTUSCIA.h:152
struct UARTUSCIA_Object * UARTUSCIA_Handle
size_t writeCount
Definition: UARTUSCIA.h:178
void(* UART_Callback)(UART_Handle, void *buf, size_t count)
The definition of a callback function used by the UART driver when used in UART_MODE_CALLBACK The cal...
Definition: UART.h:284
uint32_t inputClockFreq
Definition: UARTUSCIA.h:94
const UART_FxnTable UARTUSCIA_fxnTable
uint8_t prescalar
Definition: UARTUSCIA.h:96
struct UARTUSCIA_Object UARTUSCIA_Object
UARTUSCIA Object.
UART_Mode writeMode
Definition: UARTUSCIA.h:166
UART_DataMode readDataMode
Definition: UARTUSCIA.h:172
uint32_t bitOrder
Definition: UARTUSCIA.h:150
struct UARTUSCIA_HWAttrs UARTUSCIA_HWAttrs
UARTUSCIA Hardware attributes.
size_t writeSize
Definition: UARTUSCIA.h:179
struct UARTUSCIA_BaudrateConfig UARTUSCIA_BaudrateConfig
UARTUSCIA Baudrate configuration.
unsigned int writeTimeout
Definition: UARTUSCIA.h:168
Copyright 2015, Texas Instruments Incorporated