TI-RTOS for SimpleLink Wireless MCUs  2.14.02.22
UARTTivaDMA.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  */
47 #ifndef ti_drivers_uart_UARTTivaDMA__include
48 #define ti_drivers_uart_UARTTivaDMA__include
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 #include <stdint.h>
55 #include <stdbool.h>
56 #include <ti/drivers/UART.h>
57 
58 #include <ti/sysbios/knl/Semaphore.h>
59 #define ti_sysbios_family_arm_m3_Hwi__nolocalnames
60 #include <ti/sysbios/family/arm/m3/Hwi.h>
61 
62 /* UART function table pointer */
64 
93 typedef struct UARTTivaDMA_HWAttrs {
95  unsigned int baseAddr;
97  unsigned int intNum;
99  unsigned int intPriority;
101  uint32_t rxChannelIndex;
103  uint32_t txChannelIndex;
105 
111 typedef struct UARTTivaDMA_Object {
112  /* UART control variables */
113  bool opened; /* Has the obj been opened */
114  UART_Mode readMode; /* Mode for all read calls */
115  UART_Mode writeMode; /* Mode for all write calls */
116  unsigned int readTimeout; /* Timeout for read semaphore */
117  unsigned int writeTimeout; /* Timeout for write semaphore */
118  UART_Callback readCallback; /* Pointer to read callback */
119  UART_Callback writeCallback; /* Pointer to write callback */
120  UART_ReturnMode readReturnMode; /* Receive return mode */
121  UART_DataMode readDataMode; /* Type of data being read */
122  UART_DataMode writeDataMode; /* Type of data being written */
123  UART_Echo readEcho; /* Echo received data back */
124 
125  /* UART write variables */
126  const void *writeBuf; /* Buffer data pointer */
127  size_t writeCount; /* Number of Chars sent */
128  size_t writeSize; /* Chars remaining in buffer */
129 
130  /* UART receive variables */
131  void *readBuf; /* Buffer data pointer */
132  size_t readCount; /* Number of Chars read */
133  size_t readSize; /* Chars remaining in buffer */
134 
135  /* UART SYS/BIOS objects */
136  ti_sysbios_family_arm_m3_Hwi_Struct hwi; /* Hwi object */
137  Semaphore_Struct writeSem; /* UART write semaphore*/
138  Semaphore_Struct readSem; /* UART read semaphore */
140 
141 /* Do not interfere with the app if they include the family Hwi module */
142 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif /* ti_drivers_uart_UARTTivaDMA__include */
uint32_t txChannelIndex
Definition: UARTTivaDMA.h:103
size_t writeCount
Definition: UARTTivaDMA.h:127
Semaphore_Struct writeSem
Definition: UARTTivaDMA.h:137
struct UARTTivaDMA_Object UARTTivaDMA_Object
UARTTivaDMA Object.
UARTTivaDMA Object.
Definition: UARTTivaDMA.h:111
struct UARTTivaDMA_HWAttrs UARTTivaDMA_HWAttrs
UARTTivaDMA Hardware attributes.
UART_Callback readCallback
Definition: UARTTivaDMA.h:118
Semaphore_Struct readSem
Definition: UARTTivaDMA.h:138
The definition of a UART function table that contains the required set of functions to control a spec...
Definition: UART.h:497
unsigned int baseAddr
Definition: UARTTivaDMA.h:95
bool opened
Definition: UARTTivaDMA.h:113
unsigned int intPriority
Definition: UARTTivaDMA.h:99
UART_Mode
UART mode settings.
Definition: UART.h:291
unsigned int readTimeout
Definition: UARTTivaDMA.h:116
UART_DataMode
UART data mode settings.
Definition: UART.h:339
UART_ReturnMode
UART return mode settings.
Definition: UART.h:324
UART_Mode writeMode
Definition: UARTTivaDMA.h:115
size_t writeSize
Definition: UARTTivaDMA.h:128
UART_Echo
UART echo settings.
Definition: UART.h:357
void * readBuf
Definition: UARTTivaDMA.h:131
UART_DataMode writeDataMode
Definition: UARTTivaDMA.h:122
UARTTivaDMA Hardware attributes.
Definition: UARTTivaDMA.h:93
ti_sysbios_family_arm_m3_Hwi_Struct hwi
Definition: UARTTivaDMA.h:136
unsigned int intNum
Definition: UARTTivaDMA.h:97
UART_Echo readEcho
Definition: UARTTivaDMA.h:123
struct UARTTivaDMA_Object * UARTTivaDMA_Handle
UART_Callback writeCallback
Definition: UARTTivaDMA.h:119
const void * writeBuf
Definition: UARTTivaDMA.h:126
UART driver interface.
UART_ReturnMode readReturnMode
Definition: UARTTivaDMA.h:120
UART_DataMode readDataMode
Definition: UARTTivaDMA.h:121
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
unsigned int writeTimeout
Definition: UARTTivaDMA.h:117
size_t readCount
Definition: UARTTivaDMA.h:132
uint32_t rxChannelIndex
Definition: UARTTivaDMA.h:101
size_t readSize
Definition: UARTTivaDMA.h:133
const UART_FxnTable UARTTivaDMA_fxnTable
UART_Mode readMode
Definition: UARTTivaDMA.h:114
Copyright 2015, Texas Instruments Incorporated