TI-RTOS Drivers  tidrivers_full_2_20_00_08
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  */
51 #ifndef ti_drivers_uart_UARTUSCIA__include
52 #define ti_drivers_uart_UARTUSCIA__include
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 #include <stdint.h>
59 #include <stdbool.h>
60 #include <ti/drivers/UART.h>
61 
62 #include <ti/sysbios/knl/Semaphore.h>
63 
74 /* Add UARTUSCIA_STATUS_* macros here */
75 
88 /* Add UARTUSCIA_CMD_* macros here */
89 
92 /* UARTUSCIA function table pointer */
94 
122 typedef struct UARTUSCIA_BaudrateConfig {
123  uint32_t outputBaudrate;
124  uint32_t inputClockFreq;
126  uint8_t prescalar;
127  uint8_t hwRegUCBRFx;
128  uint8_t hwRegUCBRSx;
129  uint8_t oversampling;
131 
174 typedef struct UARTUSCIA_HWAttrs {
176  unsigned int baseAddr;
178  uint8_t clockSource;
180  uint32_t bitOrder;
182  unsigned int numBaudrateEntries;
186 
192 typedef struct UARTUSCIA_Object {
193  /* UARTUSCIA control variables */
194  bool isOpen; /* Status for open */
195  UART_Mode readMode; /* Mode for all read calls */
196  UART_Mode writeMode; /* Mode for all write calls */
197  unsigned int readTimeout; /* Timeout for read semaphore */
198  unsigned int writeTimeout; /* Timeout for write semaphore */
199  UART_Callback readCallback; /* Pointer to read callback */
200  UART_Callback writeCallback; /* Pointer to write callback */
201  UART_ReturnMode readReturnMode; /* Receive return mode */
202  UART_DataMode readDataMode; /* Type of data being read */
203  UART_DataMode writeDataMode; /* Type of data being written */
204  UART_Echo readEcho; /* Echo received data back */
205 
206  /* UARTUSCIA write variables */
207  const void *writeBuf; /* Buffer data pointer */
208  size_t writeCount; /* Number of Chars sent */
209  size_t writeSize; /* Chars remaining in buffer */
210  bool writeCR; /* Write a return character */
211 
212  /* UARTUSCIA receive variables */
213  void *readBuf; /* Buffer data pointer */
214  size_t readCount; /* Number of Chars read */
215  size_t readSize; /* Chars remaining in buffer */
216 
217  /* UARTUSCIA SYS/BIOS objects */
218  Semaphore_Struct writeSem; /* UARTUSCIA write semaphore*/
219  Semaphore_Struct readSem; /* UARTUSCIA read semaphore */
221 
222 #ifdef __cplusplus
223 }
224 #endif
225 
226 #endif /* ti_drivers_uart_UARTUSCIA__include */
UART_Callback writeCallback
Definition: UARTUSCIA.h:200
uint8_t oversampling
Definition: UARTUSCIA.h:129
unsigned int readTimeout
Definition: UARTUSCIA.h:197
UART_Mode readMode
Definition: UARTUSCIA.h:195
UART_Callback readCallback
Definition: UARTUSCIA.h:199
bool isOpen
Definition: UARTUSCIA.h:194
size_t readCount
Definition: UARTUSCIA.h:214
The definition of a UART function table that contains the required set of functions to control a spec...
Definition: UART.h:528
UART_Mode
UART mode settings.
Definition: UART.h:322
size_t readSize
Definition: UARTUSCIA.h:215
UART_DataMode
UART data mode settings.
Definition: UART.h:370
uint8_t hwRegUCBRSx
Definition: UARTUSCIA.h:128
const void * writeBuf
Definition: UARTUSCIA.h:207
UART_ReturnMode
UART return mode settings.
Definition: UART.h:355
UARTUSCIA Hardware attributes.
Definition: UARTUSCIA.h:174
Semaphore_Struct writeSem
Definition: UARTUSCIA.h:218
UART_Echo
UART echo settings.
Definition: UART.h:388
uint8_t hwRegUCBRFx
Definition: UARTUSCIA.h:127
uint8_t clockSource
Definition: UARTUSCIA.h:178
Semaphore_Struct readSem
Definition: UARTUSCIA.h:219
UARTUSCIA_BaudrateConfig const * baudrateLUT
Definition: UARTUSCIA.h:184
unsigned int baseAddr
Definition: UARTUSCIA.h:176
UART_ReturnMode readReturnMode
Definition: UARTUSCIA.h:201
void * readBuf
Definition: UARTUSCIA.h:213
UART_Echo readEcho
Definition: UARTUSCIA.h:204
UARTUSCIA Baudrate configuration.
Definition: UARTUSCIA.h:122
UART_DataMode writeDataMode
Definition: UARTUSCIA.h:203
bool writeCR
Definition: UARTUSCIA.h:210
UART driver interface.
UARTUSCIA Object.
Definition: UARTUSCIA.h:192
uint32_t outputBaudrate
Definition: UARTUSCIA.h:123
unsigned int numBaudrateEntries
Definition: UARTUSCIA.h:182
struct UARTUSCIA_Object * UARTUSCIA_Handle
size_t writeCount
Definition: UARTUSCIA.h:208
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:315
uint32_t inputClockFreq
Definition: UARTUSCIA.h:124
const UART_FxnTable UARTUSCIA_fxnTable
uint8_t prescalar
Definition: UARTUSCIA.h:126
struct UARTUSCIA_Object UARTUSCIA_Object
UARTUSCIA Object.
UART_Mode writeMode
Definition: UARTUSCIA.h:196
UART_DataMode readDataMode
Definition: UARTUSCIA.h:202
uint32_t bitOrder
Definition: UARTUSCIA.h:180
struct UARTUSCIA_HWAttrs UARTUSCIA_HWAttrs
UARTUSCIA Hardware attributes.
size_t writeSize
Definition: UARTUSCIA.h:209
struct UARTUSCIA_BaudrateConfig UARTUSCIA_BaudrateConfig
UARTUSCIA Baudrate configuration.
unsigned int writeTimeout
Definition: UARTUSCIA.h:198
Copyright 2016, Texas Instruments Incorporated