TI-RTOS Drivers  tidrivers_full_2_20_00_08
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  */
118 #ifndef ti_drivers_spi_SPITivaDMA__include
119 #define ti_drivers_spi_SPITivaDMA__include
120 
121 #ifdef __cplusplus
122 extern "C" {
123 #endif
124 
125 #include <stdint.h>
126 #include <ti/drivers/SPI.h>
127 
128 #include <ti/sysbios/knl/Semaphore.h>
129 #define ti_sysbios_family_arm_m3_Hwi__nolocalnames
130 #include <ti/sysbios/family/arm/m3/Hwi.h>
131 
142 /* Add SPITivaDMA_STATUS_* macros here */
143 
156 /* Add SPITivaDMA_CMD_* macros here */
157 
160 #if defined(TIVAWARE)
161 /* c99 types required by TivaWare */
162 #include <stdint.h>
163 typedef uint32_t SPIBaseAddrType;
164 typedef uint32_t SPIDataType;
165 #else /* MWARE */
166 typedef unsigned long SPIBaseAddrType;
167 typedef unsigned long SPIDataType;
168 #endif
169 
170 /* SPI function table pointer */
171 extern const SPI_FxnTable SPITivaDMA_fxnTable;
172 
181 typedef enum SPITivaDMA_FrameSize {
185 
225 typedef struct SPITivaDMA_HWAttrs {
227  SPIBaseAddrType baseAddr;
229  unsigned int intNum;
230 
232  uint32_t intPriority;
233 
235  uint32_t *scratchBufPtr;
239  uint32_t rxChannelIndex;
241  uint32_t txChannelIndex;
242 
250 
256 typedef struct SPITivaDMA_Object {
257  Semaphore_Struct transferComplete; /* Notify finished SPITivaDMA transfer */
258  ti_sysbios_family_arm_m3_Hwi_Struct hwi; /* Hwi object handle */
259 
260  SPI_TransferMode transferMode; /* SPITivaDMA transfer mode */
261  SPI_CallbackFxn transferCallbackFxn; /* Callback fxn in CALLBACK mode */
262  uint32_t transferTimeout; /* Transfer timeout in system ticks */
263 
264  SPI_Transaction *transaction; /* void * to the current transaction*/
265 
266  SPITivaDMA_FrameSize frameSize; /* Data frame size variable */
267 
268  bool isOpen; /* flag to indicate module is open */
270 
271 /* Do not interfere with the app if they include the family Hwi module */
272 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
273 
274 #ifdef __cplusplus
275 }
276 #endif
277 
278 #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:282
ti_sysbios_family_arm_m3_Hwi_Struct hwi
Definition: SPITivaDMA.h:258
SPI_TransferMode
SPI transfer mode determines the whether the SPI controller operates synchronously or asynchronously...
Definition: SPI.h:316
bool isOpen
Definition: SPITivaDMA.h:268
SPITivaDMA_FrameSize frameSize
Definition: SPITivaDMA.h:266
uint32_t defaultTxBufValue
Definition: SPITivaDMA.h:237
uint32_t rxChannelIndex
Definition: SPITivaDMA.h:239
The definition of a SPI function table that contains the required set of functions to control a speci...
Definition: SPI.h:402
SPITivaDMA Object.
Definition: SPITivaDMA.h:256
SPI_TransferMode transferMode
Definition: SPITivaDMA.h:260
SPI_Transaction * transaction
Definition: SPITivaDMA.h:264
Definition: SPITivaDMA.h:182
uint32_t txChannelMappingFxnArg
Definition: SPITivaDMA.h:248
Semaphore_Struct transferComplete
Definition: SPITivaDMA.h:257
A SPI_Transaction data structure is used with SPI_transfer(). It indicates how many SPI_FrameFormat f...
Definition: SPI.h:262
unsigned long SPIDataType
Definition: SPITivaDMA.h:167
struct SPITivaDMA_Object * SPITivaDMA_Handle
unsigned int intNum
Definition: SPITivaDMA.h:229
SPI_CallbackFxn transferCallbackFxn
Definition: SPITivaDMA.h:261
SPITivaDMA Hardware attributes.
Definition: SPITivaDMA.h:225
void(* channelMappingFxn)(SPIDataType)
Definition: SPITivaDMA.h:244
Definition: SPITivaDMA.h:183
uint32_t transferTimeout
Definition: SPITivaDMA.h:262
uint32_t rxChannelMappingFxnArg
Definition: SPITivaDMA.h:246
uint32_t txChannelIndex
Definition: SPITivaDMA.h:241
struct SPITivaDMA_HWAttrs SPITivaDMA_HWAttrs
SPITivaDMA Hardware attributes.
struct SPITivaDMA_Object SPITivaDMA_Object
SPITivaDMA Object.
unsigned long SPIBaseAddrType
Definition: SPITivaDMA.h:166
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:181
uint32_t intPriority
Definition: SPITivaDMA.h:232
const SPI_FxnTable SPITivaDMA_fxnTable
SPIBaseAddrType baseAddr
Definition: SPITivaDMA.h:227
uint32_t * scratchBufPtr
Definition: SPITivaDMA.h:235
Copyright 2016, Texas Instruments Incorporated