TI-RTOS for SimpleLink Wireless MCUs  2.14.02.22
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 
117 typedef struct I2SCC3200DMA_HWAttrs {
119  uint32_t baseAddr;
121  uint32_t intNum;
123  uint32_t intPriority;
125  unsigned long rxChannelIndex;
127  unsigned long txChannelIndex;
129 
135  unsigned char pinNumber;
136 
139 
142 
144 
149 
152 
154 
162  /* Pointer to read/write callback */
164  /* Timeout for read/write semaphore */
166 
168 
174 typedef struct I2SCC3200DMA_Object {
175  /* I2S control variables */
176  bool opened; /* Has the obj been opened */
177  uint32_t operationMode; /* Mode of operation of I2S */
178 
179  /* I2S serial pin variables */
181 
182  uint16_t readIndex; /* read channel Index */
183  uint16_t writeIndex; /* write channel Index */
184 
185  I2SCC3200DMA_DataSize dmaSize; /* Config DMA word size */
186 
187  /* I2S OSAL objects */
188  SemaphoreP_Handle writeSem; /* I2S write semaphore*/
189  SemaphoreP_Handle readSem; /* I2S read semaphore */
191 
192  /* DMA write Ping pong mode */
194  /* DMA read Ping pong mode */
196 
198  unsigned char zeroWriteBufLength;
199 
202  unsigned char emptyReadBufLength;
203 
204  /* Lists for issue-reclaim mode */
205  List_List readActiveQueue;
206  List_List readDoneQueue;
207  List_List writeActiveQueue;
208  List_List writeDoneQueue;
210 
225 
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 #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:189
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:119
bool i2sReadPingPongMode
Definition: I2SCC3200DMA.h:195
I2SCC3200DMA_DataSize dmaSize
Definition: I2SCC3200DMA.h:185
#define I2SCC3200DMA_NUM_SERIAL_PINS
Definition: I2SCC3200DMA.h:68
unsigned char zeroWriteBufLength
Definition: I2SCC3200DMA.h:198
unsigned long rxChannelIndex
Definition: I2SCC3200DMA.h:125
struct I2SCC3200DMA_Object * I2SCC3200DMA_Handle
List_List readActiveQueue
Definition: I2SCC3200DMA.h:205
struct I2SCC3200DMA_SerialPinConfig I2SCC3200DMA_SerialPinConfig
CC3200 Serial Pin Configuration.
SemaphoreP_Handle writeSem
Definition: I2SCC3200DMA.h:188
unsigned char I2SCC3200DMA_emptyBuffer[32]
unsigned long txChannelIndex
Definition: I2SCC3200DMA.h:127
unsigned char pinNumber
Definition: I2SCC3200DMA.h:135
CC3200 specific I2S Parameters.
Definition: I2SCC3200DMA.h:148
I2S_Callback readWriteCallback
Definition: I2SCC3200DMA.h:163
struct I2SCC3200DMA_Object I2SCC3200DMA_Object
I2SCC3200DMA Object.
I2SCC3200DMA Hardware attributes.
Definition: I2SCC3200DMA.h:117
List_List writeDoneQueue
Definition: I2SCC3200DMA.h:208
HwiP_Handle hwiHandle
Definition: I2SCC3200DMA.h:190
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:123
uint32_t intNum
Definition: I2SCC3200DMA.h:121
struct I2SCC3200DMA_HWAttrs I2SCC3200DMA_HWAttrs
I2SCC3200DMA Hardware attributes.
uint16_t writeIndex
Definition: I2SCC3200DMA.h:183
uint32_t readWriteTimeout
Definition: I2SCC3200DMA.h:165
I2S_BufDesc I2SCC3200DMA_zeroBufDesc
uint32_t operationMode
Definition: I2SCC3200DMA.h:177
I2S_DataMode
I2S mode settings.
Definition: I2S.h:266
bool opened
Definition: I2SCC3200DMA.h:176
I2S driver interface.
I2SCC3200DMA_SerialPinVars serialPinVars[I2SCC3200DMA_NUM_SERIAL_PINS]
Definition: I2SCC3200DMA.h:180
List_List readDoneQueue
Definition: I2SCC3200DMA.h:206
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:161
bool i2sWritePingPongMode
Definition: I2SCC3200DMA.h:193
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:138
I2SCC3200DMA_SerialPinConfig serialPinConfig[I2SCC3200DMA_NUM_SERIAL_PINS]
Definition: I2SCC3200DMA.h:151
uint16_t readIndex
Definition: I2SCC3200DMA.h:182
unsigned char emptyReadBufLength
Definition: I2SCC3200DMA.h:202
List_List writeActiveQueue
Definition: I2SCC3200DMA.h:207
I2S_SerInActiveConfig inActiveConfig
Definition: I2SCC3200DMA.h:141
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:174
Hardware Interrupt module for the RTOS Porting Interface.
CC3200 Serial Pin Configuration.
Definition: I2SCC3200DMA.h:133
I2SCC3200DMA Serial pin variables.
Definition: I2SCC3200DMA.h:160
Copyright 2015, Texas Instruments Incorporated