TI-RTOS Drivers  tidrivers_cc32xx_2_16_00_08
I2SCC3200DMA.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  */
48 #ifndef ti_drivers_i2s_I2SCC3200DMA__include
49 #define ti_drivers_i2s_I2SCC3200DMA__include
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 #include <stdint.h>
56 #include <stdbool.h>
57 #include <ti/drivers/I2S.h>
58 #include <ti/drivers/ports/HwiP.h>
60 #include <ti/drivers/utils/List.h>
61 
72 /* Add I2SCC3200DMA_STATUS_* macros here */
73 
86 #define I2SCC3200DMA_CMD_SET_ZEROBUF_LEN I2S_CMD_RESERVED + 0
87 #define I2SCC3200DMA_CMD_SET_EMPTYBUF_LEN I2S_CMD_RESERVED + 1
88 
91 /* BACKWARDS COMPATIBILITY */
92 #define I2SCC3200DMA_SET_ZEROBUF_LEN I2SCC3200DMA_CMD_SET_ZEROBUF_LEN
93 #define I2SCC3200DMA_SET_EMPTYBUF_LEN I2SCC3200DMA_CMD_SET_EMPTYBUF_LEN
94 /* END BACKWARDS COMPATIBILITY */
95 
96 /* Value for Invalid Index */
97 #define I2SCC3200DMA_INDEX_INVALID 0xFF
98 
99 /*Number of Serial data pins supported*/
100 #define I2SCC3200DMA_NUM_SERIAL_PINS 2
101 
110 typedef enum I2SCC3200DMA_DataSize {
114 
115 
116 /* I2S function table pointer */
118 
119 /*Zero buffer to write when there is no data from the application*/
120 extern unsigned short I2SCC3200DMA_zeroBuffer[32];
122 
123 /*Empty buffer to read into when there is no data requested
124  from the application*/
125 extern unsigned char I2SCC3200DMA_emptyBuffer[32];
127 
160 typedef struct I2SCC3200DMA_HWAttrs {
162  uint32_t baseAddr;
164  uint32_t intNum;
166  uint32_t intPriority;
168  unsigned long rxChannelIndex;
170  unsigned long txChannelIndex;
172 
178  unsigned char pinNumber;
179 
182 
185 
187 
192 
195 
197 
205  /* Pointer to read/write callback */
207  /* Timeout for read/write semaphore */
209 
211 
217 typedef struct I2SCC3200DMA_Object {
218  /* I2S control variables */
219  bool opened; /* Has the obj been opened */
220  uint32_t operationMode; /* Mode of operation of I2S */
221 
222  /* I2S serial pin variables */
224 
225  uint16_t readIndex; /* read channel Index */
226  uint16_t writeIndex; /* write channel Index */
227 
228  I2SCC3200DMA_DataSize dmaSize; /* Config DMA word size */
229 
230  /* I2S OSAL objects */
231  SemaphoreP_Handle writeSem; /* I2S write semaphore*/
232  SemaphoreP_Handle readSem; /* I2S read semaphore */
234 
235  /* DMA write Ping pong mode */
237  /* DMA read Ping pong mode */
239 
241  unsigned char zeroWriteBufLength;
242 
245  unsigned char emptyReadBufLength;
246 
247  /* Lists for issue-reclaim mode */
253 
268 
269 #ifdef __cplusplus
270 }
271 #endif
272 
273 #endif /* ti_drivers_i2s_I2SCC3200DMA__include */
void I2SCC3200DMA_Params_init(I2SCC3200DMA_SerialPinParams *params)
Function to initialize the I2S_Params struct to its defaults.
Definition: I2SCC3200DMA.h:112
const I2S_FxnTable I2SCC3200DMA_fxnTable
struct I2SCC3200DMA_SerialPinParams I2SCC3200DMA_SerialPinParams
CC3200 specific I2S Parameters.
SemaphoreP_Handle readSem
Definition: I2SCC3200DMA.h:232
The definition of a I2S function table that contains the required set of functions to control a speci...
Definition: I2S.h:431
uint32_t baseAddr
Definition: I2SCC3200DMA.h:162
bool i2sReadPingPongMode
Definition: I2SCC3200DMA.h:238
I2SCC3200DMA_DataSize dmaSize
Definition: I2SCC3200DMA.h:228
Definition: List.h:131
#define I2SCC3200DMA_NUM_SERIAL_PINS
Definition: I2SCC3200DMA.h:100
unsigned char zeroWriteBufLength
Definition: I2SCC3200DMA.h:241
unsigned long rxChannelIndex
Definition: I2SCC3200DMA.h:168
struct I2SCC3200DMA_Object * I2SCC3200DMA_Handle
List_List readActiveQueue
Definition: I2SCC3200DMA.h:248
struct I2SCC3200DMA_SerialPinConfig I2SCC3200DMA_SerialPinConfig
CC3200 Serial Pin Configuration.
SemaphoreP_Handle writeSem
Definition: I2SCC3200DMA.h:231
unsigned char I2SCC3200DMA_emptyBuffer[32]
unsigned long txChannelIndex
Definition: I2SCC3200DMA.h:170
unsigned char pinNumber
Definition: I2SCC3200DMA.h:178
CC3200 specific I2S Parameters.
Definition: I2SCC3200DMA.h:191
I2S_Callback readWriteCallback
Definition: I2SCC3200DMA.h:206
struct I2SCC3200DMA_Object I2SCC3200DMA_Object
I2SCC3200DMA Object.
I2SCC3200DMA Hardware attributes.
Definition: I2SCC3200DMA.h:160
List_List writeDoneQueue
Definition: I2SCC3200DMA.h:251
HwiP_Handle hwiHandle
Definition: I2SCC3200DMA.h:233
void * SemaphoreP_Handle
Opaque client reference to an instance of a SemaphoreP.
Definition: SemaphoreP.h:96
Semaphore module for the RTOS Porting Interface.
I2S buffer descriptor for issue/reclaim mode.
Definition: I2S.h:258
uint32_t intPriority
Definition: I2SCC3200DMA.h:166
uint32_t intNum
Definition: I2SCC3200DMA.h:164
struct I2SCC3200DMA_HWAttrs I2SCC3200DMA_HWAttrs
I2SCC3200DMA Hardware attributes.
uint16_t writeIndex
Definition: I2SCC3200DMA.h:226
uint32_t readWriteTimeout
Definition: I2SCC3200DMA.h:208
I2S_BufDesc I2SCC3200DMA_zeroBufDesc
uint32_t operationMode
Definition: I2SCC3200DMA.h:220
I2S_DataMode
I2S mode settings.
Definition: I2S.h:291
bool opened
Definition: I2SCC3200DMA.h:219
I2S driver interface.
I2SCC3200DMA_SerialPinVars serialPinVars[I2SCC3200DMA_NUM_SERIAL_PINS]
Definition: I2SCC3200DMA.h:223
List_List readDoneQueue
Definition: I2SCC3200DMA.h:249
I2SCC3200DMA_DataSize
I2SCC3200DMA data size is used to determine how to configure the DMA data transfers. This field is to be only used internally.
Definition: I2SCC3200DMA.h:110
Definition: I2SCC3200DMA.h:111
struct I2SCC3200DMA_SerialPinVars I2SCC3200DMA_SerialPinVars
I2SCC3200DMA Serial pin variables.
I2S_DataMode readWriteMode
Definition: I2SCC3200DMA.h:204
bool i2sWritePingPongMode
Definition: I2SCC3200DMA.h:236
I2S_SerInActiveConfig
I2S Serializer InActive state settings.
Definition: I2S.h:324
I2S_BufDesc I2SCC3200DMA_emptyBufDesc
void(* I2S_Callback)(I2S_Handle, I2S_BufDesc *desc)
The definition of a callback function used by the I2S driver when used in I2S_MODE_CALLBACK.
Definition: I2S.h:283
unsigned short I2SCC3200DMA_zeroBuffer[32]
I2S_PinMode pinMode
Definition: I2SCC3200DMA.h:181
I2SCC3200DMA_SerialPinConfig serialPinConfig[I2SCC3200DMA_NUM_SERIAL_PINS]
Definition: I2SCC3200DMA.h:194
uint16_t readIndex
Definition: I2SCC3200DMA.h:225
unsigned char emptyReadBufLength
Definition: I2SCC3200DMA.h:245
List_List writeActiveQueue
Definition: I2SCC3200DMA.h:250
I2S_SerInActiveConfig inActiveConfig
Definition: I2SCC3200DMA.h:184
void * HwiP_Handle
Opaque client reference to an instance of a HwiP.
Definition: HwiP.h:66
I2S_PinMode
I2S serial pin mode.
Definition: I2S.h:335
I2SCC3200DMA Object.
Definition: I2SCC3200DMA.h:217
Hardware Interrupt module for the RTOS Porting Interface.
CC3200 Serial Pin Configuration.
Definition: I2SCC3200DMA.h:176
Linked List interface for use in drivers.
I2SCC3200DMA Serial pin variables.
Definition: I2SCC3200DMA.h:203
Copyright 2016, Texas Instruments Incorporated