TI-RTOS for SimpleLink Wireless MCUs  2.14.02.22
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 
184 typedef struct SPITivaDMA_HWAttrs {
186  SPIBaseAddrType baseAddr;
188  unsigned int intNum;
189 
191  uint32_t intPriority;
192 
194  uint32_t *scratchBufPtr;
198  uint32_t rxChannelIndex;
200  uint32_t txChannelIndex;
201 
209 
215 typedef struct SPITivaDMA_Object {
216  Semaphore_Struct transferComplete; /* Notify finished SPITivaDMA transfer */
217  ti_sysbios_family_arm_m3_Hwi_Struct hwi; /* Hwi object handle */
218 
219  SPI_TransferMode transferMode; /* SPITivaDMA transfer mode */
220  SPI_CallbackFxn transferCallbackFxn; /* Callback fxn in CALLBACK mode */
221  uint32_t transferTimeout; /* Transfer timeout in system ticks */
222 
223  SPI_Transaction *transaction; /* void * to the current transaction*/
224 
225  SPITivaDMA_FrameSize frameSize; /* Data frame size variable */
226 
227  bool isOpen; /* flag to indicate module is open */
229 
230 /* Do not interfere with the app if they include the family Hwi module */
231 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
232 
233 #ifdef __cplusplus
234 }
235 #endif
236 
237 #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:217
SPI_TransferMode
SPI transfer mode determines the whether the SPI controller operates synchronously or asynchronously...
Definition: SPI.h:298
bool isOpen
Definition: SPITivaDMA.h:227
SPITivaDMA_FrameSize frameSize
Definition: SPITivaDMA.h:225
uint32_t defaultTxBufValue
Definition: SPITivaDMA.h:196
uint32_t rxChannelIndex
Definition: SPITivaDMA.h:198
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:215
SPI_TransferMode transferMode
Definition: SPITivaDMA.h:219
SPI_Transaction * transaction
Definition: SPITivaDMA.h:223
Definition: SPITivaDMA.h:152
uint32_t txChannelMappingFxnArg
Definition: SPITivaDMA.h:207
Semaphore_Struct transferComplete
Definition: SPITivaDMA.h:216
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:188
SPI_CallbackFxn transferCallbackFxn
Definition: SPITivaDMA.h:220
SPITivaDMA Hardware attributes.
Definition: SPITivaDMA.h:184
void(* channelMappingFxn)(SPIDataType)
Definition: SPITivaDMA.h:203
Definition: SPITivaDMA.h:153
uint32_t transferTimeout
Definition: SPITivaDMA.h:221
uint32_t rxChannelMappingFxnArg
Definition: SPITivaDMA.h:205
uint32_t txChannelIndex
Definition: SPITivaDMA.h:200
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:191
const SPI_FxnTable SPITivaDMA_fxnTable
SPIBaseAddrType baseAddr
Definition: SPITivaDMA.h:186
uint32_t * scratchBufPtr
Definition: SPITivaDMA.h:194
Copyright 2015, Texas Instruments Incorporated