TI-RTOS for SimpleLink Wireless MCUs  2.14.03.28
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  */
46 #ifndef ti_drivers_i2s_I2SCC3200DMA__include
47 #define ti_drivers_i2s_I2SCC3200DMA__include
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 #include <stdint.h>
54 #include <stdbool.h>
55 #include <ti/drivers/I2S.h>
56 #include <ti/drivers/ports/HwiP.h>
58 #include <ti/drivers/utils/List.h>
59 
60 /* Return codes for I2S_control() */
61 #define I2SCC3200DMA_SET_ZEROBUF_LEN I2S_CMD_RESERVED + 0
62 #define I2SCC3200DMA_SET_EMPTYBUF_LEN I2S_CMD_RESERVED + 1
63 
64 /* Value for Invalid Index */
65 #define I2SCC3200DMA_INDEX_INVALID 0xFF
66 
67 /*Number of Serial data pins supported*/
68 #define I2SCC3200DMA_NUM_SERIAL_PINS 2
69 
78 typedef enum I2SCC3200DMA_DataSize {
82 
83 
84 /* I2S function table pointer */
86 
87 /*Zero buffer to write when there is no data from the application*/
88 extern unsigned short I2SCC3200DMA_zeroBuffer[32];
90 
91 /*Empty buffer to read into when there is no data requested
92  from the application*/
93 extern unsigned char I2SCC3200DMA_emptyBuffer[32];
95 
128 typedef struct I2SCC3200DMA_HWAttrs {
130  uint32_t baseAddr;
132  uint32_t intNum;
134  uint32_t intPriority;
136  unsigned long rxChannelIndex;
138  unsigned long txChannelIndex;
140 
146  unsigned char pinNumber;
147 
150 
153 
155 
160 
163 
165 
173  /* Pointer to read/write callback */
175  /* Timeout for read/write semaphore */
177 
179 
185 typedef struct I2SCC3200DMA_Object {
186  /* I2S control variables */
187  bool opened; /* Has the obj been opened */
188  uint32_t operationMode; /* Mode of operation of I2S */
189 
190  /* I2S serial pin variables */
192 
193  uint16_t readIndex; /* read channel Index */
194  uint16_t writeIndex; /* write channel Index */
195 
196  I2SCC3200DMA_DataSize dmaSize; /* Config DMA word size */
197 
198  /* I2S OSAL objects */
199  SemaphoreP_Handle writeSem; /* I2S write semaphore*/
200  SemaphoreP_Handle readSem; /* I2S read semaphore */
202 
203  /* DMA write Ping pong mode */
205  /* DMA read Ping pong mode */
207 
209  unsigned char zeroWriteBufLength;
210 
213  unsigned char emptyReadBufLength;
214 
215  /* Lists for issue-reclaim mode */
216  List_List readActiveQueue;
217  List_List readDoneQueue;
218  List_List writeActiveQueue;
219  List_List writeDoneQueue;
221 
236 
237 #ifdef __cplusplus
238 }
239 #endif
240 
241 #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:80
const I2S_FxnTable I2SCC3200DMA_fxnTable
struct I2SCC3200DMA_SerialPinParams I2SCC3200DMA_SerialPinParams
CC3200 specific I2S Parameters.
SemaphoreP_Handle readSem
Definition: I2SCC3200DMA.h:200
The definition of a I2S function table that contains the required set of functions to control a speci...
Definition: I2S.h:406
uint32_t baseAddr
Definition: I2SCC3200DMA.h:130
bool i2sReadPingPongMode
Definition: I2SCC3200DMA.h:206
I2SCC3200DMA_DataSize dmaSize
Definition: I2SCC3200DMA.h:196
#define I2SCC3200DMA_NUM_SERIAL_PINS
Definition: I2SCC3200DMA.h:68
unsigned char zeroWriteBufLength
Definition: I2SCC3200DMA.h:209
unsigned long rxChannelIndex
Definition: I2SCC3200DMA.h:136
struct I2SCC3200DMA_Object * I2SCC3200DMA_Handle
List_List readActiveQueue
Definition: I2SCC3200DMA.h:216
struct I2SCC3200DMA_SerialPinConfig I2SCC3200DMA_SerialPinConfig
CC3200 Serial Pin Configuration.
SemaphoreP_Handle writeSem
Definition: I2SCC3200DMA.h:199
unsigned char I2SCC3200DMA_emptyBuffer[32]
unsigned long txChannelIndex
Definition: I2SCC3200DMA.h:138
unsigned char pinNumber
Definition: I2SCC3200DMA.h:146
CC3200 specific I2S Parameters.
Definition: I2SCC3200DMA.h:159
I2S_Callback readWriteCallback
Definition: I2SCC3200DMA.h:174
struct I2SCC3200DMA_Object I2SCC3200DMA_Object
I2SCC3200DMA Object.
I2SCC3200DMA Hardware attributes.
Definition: I2SCC3200DMA.h:128
List_List writeDoneQueue
Definition: I2SCC3200DMA.h:219
HwiP_Handle hwiHandle
Definition: I2SCC3200DMA.h:201
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:233
uint32_t intPriority
Definition: I2SCC3200DMA.h:134
uint32_t intNum
Definition: I2SCC3200DMA.h:132
struct I2SCC3200DMA_HWAttrs I2SCC3200DMA_HWAttrs
I2SCC3200DMA Hardware attributes.
uint16_t writeIndex
Definition: I2SCC3200DMA.h:194
uint32_t readWriteTimeout
Definition: I2SCC3200DMA.h:176
I2S_BufDesc I2SCC3200DMA_zeroBufDesc
uint32_t operationMode
Definition: I2SCC3200DMA.h:188
I2S_DataMode
I2S mode settings.
Definition: I2S.h:266
bool opened
Definition: I2SCC3200DMA.h:187
I2S driver interface.
I2SCC3200DMA_SerialPinVars serialPinVars[I2SCC3200DMA_NUM_SERIAL_PINS]
Definition: I2SCC3200DMA.h:191
List_List readDoneQueue
Definition: I2SCC3200DMA.h:217
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:78
Definition: I2SCC3200DMA.h:79
struct I2SCC3200DMA_SerialPinVars I2SCC3200DMA_SerialPinVars
I2SCC3200DMA Serial pin variables.
I2S_DataMode readWriteMode
Definition: I2SCC3200DMA.h:172
bool i2sWritePingPongMode
Definition: I2SCC3200DMA.h:204
I2S_SerInActiveConfig
I2S Serializer InActive state settings.
Definition: I2S.h:299
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:258
unsigned short I2SCC3200DMA_zeroBuffer[32]
I2S_PinMode pinMode
Definition: I2SCC3200DMA.h:149
I2SCC3200DMA_SerialPinConfig serialPinConfig[I2SCC3200DMA_NUM_SERIAL_PINS]
Definition: I2SCC3200DMA.h:162
uint16_t readIndex
Definition: I2SCC3200DMA.h:193
unsigned char emptyReadBufLength
Definition: I2SCC3200DMA.h:213
List_List writeActiveQueue
Definition: I2SCC3200DMA.h:218
I2S_SerInActiveConfig inActiveConfig
Definition: I2SCC3200DMA.h:152
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:310
I2SCC3200DMA Object.
Definition: I2SCC3200DMA.h:185
Hardware Interrupt module for the RTOS Porting Interface.
CC3200 Serial Pin Configuration.
Definition: I2SCC3200DMA.h:144
I2SCC3200DMA Serial pin variables.
Definition: I2SCC3200DMA.h:171
Copyright 2015, Texas Instruments Incorporated