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