TI-RTOS for SimpleLink Wireless MCUs  2.14.03.28
UARTEUSCIA.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_UARTEUSCIA__include
50 #define ti_drivers_uart_UARTEUSCIA__include
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 #include <stdint.h>
57 #include <ti/drivers/UART.h>
58 
59 #include <ti/sysbios/knl/Semaphore.h>
60 
61 /* UARTEUSCIA function table pointer */
63 
91 typedef struct UARTEUSCIA_BaudrateConfig {
92  uint32_t outputBaudrate;
93  uint32_t inputClockFreq;
95  uint8_t prescalar;
96  uint8_t hwRegUCBRFx;
97  uint8_t hwRegUCBRSx;
98  uint8_t oversampling;
100 
143 typedef struct UARTEUSCIA_HWAttrs {
145  unsigned int baseAddr;
147  uint8_t clockSource;
149  uint32_t bitOrder;
151  unsigned int numBaudrateEntries;
155 
161 typedef struct UARTEUSCIA_Object {
162  /* UARTEUSCIA control variables */
163  bool isOpen; /* Status for open */
164  UART_Mode readMode; /* Mode for all read calls */
165  UART_Mode writeMode; /* Mode for all write calls */
166  unsigned int readTimeout; /* Timeout for read semaphore */
167  unsigned int writeTimeout; /* Timeout for write semaphore */
168  UART_Callback readCallback; /* Pointer to read callback */
169  UART_Callback writeCallback; /* Pointer to write callback */
170  UART_ReturnMode readReturnMode; /* Receive return mode */
171  UART_DataMode readDataMode; /* Type of data being read */
172  UART_DataMode writeDataMode; /* Type of data being written */
173  UART_Echo readEcho; /* Echo received data back */
174 
175  /* UARTEUSCIA write variables */
176  const void *writeBuf; /* Buffer data pointer */
177  size_t writeCount; /* Number of Chars sent */
178  size_t writeSize; /* Chars remaining in buffer */
179  bool writeCR; /* Write a return character */
180 
181  /* UARTEUSCIA receive variables */
182  void *readBuf; /* Buffer data pointer */
183  size_t readCount; /* Number of Chars read */
184  size_t readSize; /* Chars remaining in buffer */
185 
186  /* UARTEUSCIA SYS/BIOS objects */
187  Semaphore_Struct writeSem; /* UARTEUSCIA write semaphore */
188  Semaphore_Struct readSem; /* UARTEUSCIA read semaphore */
190 
191 #ifdef __cplusplus
192 }
193 #endif
194 
195 #endif /* ti_drivers_uart_UARTEUSCIA__include */
size_t writeSize
Definition: UARTEUSCIA.h:178
UARTEUSCIA Hardware attributes.
Definition: UARTEUSCIA.h:143
unsigned int writeTimeout
Definition: UARTEUSCIA.h:167
unsigned int baseAddr
Definition: UARTEUSCIA.h:145
size_t writeCount
Definition: UARTEUSCIA.h:177
The definition of a UART function table that contains the required set of functions to control a spec...
Definition: UART.h:497
void * readBuf
Definition: UARTEUSCIA.h:182
UART_Mode
UART mode settings.
Definition: UART.h:291
size_t readCount
Definition: UARTEUSCIA.h:183
Semaphore_Struct writeSem
Definition: UARTEUSCIA.h:187
UART_DataMode
UART data mode settings.
Definition: UART.h:339
UART_ReturnMode
UART return mode settings.
Definition: UART.h:324
UART_Echo
UART echo settings.
Definition: UART.h:357
struct UARTEUSCIA_Object UARTEUSCIA_Object
UARTEUSCIA Object.
uint8_t oversampling
Definition: UARTEUSCIA.h:98
uint8_t hwRegUCBRFx
Definition: UARTEUSCIA.h:96
const UART_FxnTable UARTEUSCIA_fxnTable
const void * writeBuf
Definition: UARTEUSCIA.h:176
uint8_t clockSource
Definition: UARTEUSCIA.h:147
uint32_t outputBaudrate
Definition: UARTEUSCIA.h:92
UART driver interface.
UART_Callback writeCallback
Definition: UARTEUSCIA.h:169
UARTEUSCIA_BaudrateConfig const * baudrateLUT
Definition: UARTEUSCIA.h:153
struct UARTEUSCIA_BaudrateConfig UARTEUSCIA_BaudrateConfig
UARTEUSCIA Baudrate configuration.
struct UARTEUSCIA_HWAttrs UARTEUSCIA_HWAttrs
UARTEUSCIA Hardware attributes.
uint8_t prescalar
Definition: UARTEUSCIA.h:95
Semaphore_Struct readSem
Definition: UARTEUSCIA.h:188
UARTEUSCIA Object.
Definition: UARTEUSCIA.h:161
bool isOpen
Definition: UARTEUSCIA.h:163
UART_Mode readMode
Definition: UARTEUSCIA.h:164
UART_ReturnMode readReturnMode
Definition: UARTEUSCIA.h:170
unsigned int numBaudrateEntries
Definition: UARTEUSCIA.h:151
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
UARTEUSCIA Baudrate configuration.
Definition: UARTEUSCIA.h:91
UART_DataMode readDataMode
Definition: UARTEUSCIA.h:171
unsigned int readTimeout
Definition: UARTEUSCIA.h:166
uint32_t bitOrder
Definition: UARTEUSCIA.h:149
bool writeCR
Definition: UARTEUSCIA.h:179
UART_DataMode writeDataMode
Definition: UARTEUSCIA.h:172
UART_Mode writeMode
Definition: UARTEUSCIA.h:165
UART_Callback readCallback
Definition: UARTEUSCIA.h:168
uint8_t hwRegUCBRSx
Definition: UARTEUSCIA.h:97
uint32_t inputClockFreq
Definition: UARTEUSCIA.h:93
UART_Echo readEcho
Definition: UARTEUSCIA.h:173
size_t readSize
Definition: UARTEUSCIA.h:184
struct UARTEUSCIA_Object * UARTEUSCIA_Handle
Copyright 2015, Texas Instruments Incorporated