TI-RTOS for SimpleLink Wireless MCUs  2.14.03.28
SPITivaDMA.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  */
116 #ifndef ti_drivers_spi_SPITivaDMA__include
117 #define ti_drivers_spi_SPITivaDMA__include
118 
119 #ifdef __cplusplus
120 extern "C" {
121 #endif
122 
123 #include <stdint.h>
124 #include <ti/drivers/SPI.h>
125 
126 #include <ti/sysbios/knl/Semaphore.h>
127 #define ti_sysbios_family_arm_m3_Hwi__nolocalnames
128 #include <ti/sysbios/family/arm/m3/Hwi.h>
129 
130 #if defined(TIVAWARE)
131 /* c99 types required by TivaWare */
132 #include <stdint.h>
133 typedef uint32_t SPIBaseAddrType;
134 typedef uint32_t SPIDataType;
135 #else /* MWARE */
136 typedef unsigned long SPIBaseAddrType;
137 typedef unsigned long SPIDataType;
138 #endif
139 
140 /* SPI function table pointer */
141 extern const SPI_FxnTable SPITivaDMA_fxnTable;
142 
151 typedef enum SPITivaDMA_FrameSize {
155 
195 typedef struct SPITivaDMA_HWAttrs {
197  SPIBaseAddrType baseAddr;
199  unsigned int intNum;
200 
202  uint32_t intPriority;
203 
205  uint32_t *scratchBufPtr;
209  uint32_t rxChannelIndex;
211  uint32_t txChannelIndex;
212 
220 
226 typedef struct SPITivaDMA_Object {
227  Semaphore_Struct transferComplete; /* Notify finished SPITivaDMA transfer */
228  ti_sysbios_family_arm_m3_Hwi_Struct hwi; /* Hwi object handle */
229 
230  SPI_TransferMode transferMode; /* SPITivaDMA transfer mode */
231  SPI_CallbackFxn transferCallbackFxn; /* Callback fxn in CALLBACK mode */
232  uint32_t transferTimeout; /* Transfer timeout in system ticks */
233 
234  SPI_Transaction *transaction; /* void * to the current transaction*/
235 
236  SPITivaDMA_FrameSize frameSize; /* Data frame size variable */
237 
238  bool isOpen; /* flag to indicate module is open */
240 
241 /* Do not interfere with the app if they include the family Hwi module */
242 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
243 
244 #ifdef __cplusplus
245 }
246 #endif
247 
248 #endif /* ti_drivers_spi_SPITivaDMA__include */
SPI driver interface.
void(* SPI_CallbackFxn)(SPI_Handle handle, SPI_Transaction *transaction)
The definition of a callback function used by the SPI driver when used in SPI_MODE_CALLBACK.
Definition: SPI.h:264
ti_sysbios_family_arm_m3_Hwi_Struct hwi
Definition: SPITivaDMA.h:228
SPI_TransferMode
SPI transfer mode determines the whether the SPI controller operates synchronously or asynchronously...
Definition: SPI.h:298
bool isOpen
Definition: SPITivaDMA.h:238
SPITivaDMA_FrameSize frameSize
Definition: SPITivaDMA.h:236
uint32_t defaultTxBufValue
Definition: SPITivaDMA.h:207
uint32_t rxChannelIndex
Definition: SPITivaDMA.h:209
The definition of a SPI function table that contains the required set of functions to control a speci...
Definition: SPI.h:384
SPITivaDMA Object.
Definition: SPITivaDMA.h:226
SPI_TransferMode transferMode
Definition: SPITivaDMA.h:230
SPI_Transaction * transaction
Definition: SPITivaDMA.h:234
Definition: SPITivaDMA.h:152
uint32_t txChannelMappingFxnArg
Definition: SPITivaDMA.h:218
Semaphore_Struct transferComplete
Definition: SPITivaDMA.h:227
A SPI_Transaction data structure is used with SPI_transfer(). It indicates how many SPI_FrameFormat f...
Definition: SPI.h:244
unsigned long SPIDataType
Definition: SPITivaDMA.h:137
struct SPITivaDMA_Object * SPITivaDMA_Handle
unsigned int intNum
Definition: SPITivaDMA.h:199
SPI_CallbackFxn transferCallbackFxn
Definition: SPITivaDMA.h:231
SPITivaDMA Hardware attributes.
Definition: SPITivaDMA.h:195
void(* channelMappingFxn)(SPIDataType)
Definition: SPITivaDMA.h:214
Definition: SPITivaDMA.h:153
uint32_t transferTimeout
Definition: SPITivaDMA.h:232
uint32_t rxChannelMappingFxnArg
Definition: SPITivaDMA.h:216
uint32_t txChannelIndex
Definition: SPITivaDMA.h:211
struct SPITivaDMA_HWAttrs SPITivaDMA_HWAttrs
SPITivaDMA Hardware attributes.
struct SPITivaDMA_Object SPITivaDMA_Object
SPITivaDMA Object.
unsigned long SPIBaseAddrType
Definition: SPITivaDMA.h:136
SPITivaDMA_FrameSize
SPITivaDMA data frame size is used to determine how to configure the DMA data transfers. This field is to be only used internally.
Definition: SPITivaDMA.h:151
uint32_t intPriority
Definition: SPITivaDMA.h:202
const SPI_FxnTable SPITivaDMA_fxnTable
SPIBaseAddrType baseAddr
Definition: SPITivaDMA.h:197
uint32_t * scratchBufPtr
Definition: SPITivaDMA.h:205
Copyright 2015, Texas Instruments Incorporated