I2SCC32XXDMA.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, 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_I2SCC32XXDMA__include
49 #define ti_drivers_i2s_I2SCC32XXDMA__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/dpl/HwiP.h>
59 #include <ti/drivers/dpl/SemaphoreP.h>
60 #include <ti/drivers/utils/List.h>
62 
63 #define I2SCC32XXDMA_PIN_02_McAFSX 0x0d01
64 #define I2SCC32XXDMA_PIN_03_McACLK 0x0302
65 #define I2SCC32XXDMA_PIN_15_McAFSX 0x070e
66 #define I2SCC32XXDMA_PIN_17_McAFSX 0x0610
67 #define I2SCC32XXDMA_PIN_21_McAFSX 0x0214
68 #define I2SCC32XXDMA_PIN_45_McAXR0 0x062c
69 #define I2SCC32XXDMA_PIN_45_McAFSX 0x0c2c
70 #define I2SCC32XXDMA_PIN_50_McAXR0 0x0431
71 #define I2SCC32XXDMA_PIN_50_McAXR1 0x0631
72 #define I2SCC32XXDMA_PIN_52_McACLK 0x0233
73 #define I2SCC32XXDMA_PIN_52_McAXR0 0x0433
74 #define I2SCC32XXDMA_PIN_53_McACLK 0x0234
75 #define I2SCC32XXDMA_PIN_53_McAFSX 0x0334
76 #define I2SCC32XXDMA_PIN_60_McAXR1 0x063b
77 #define I2SCC32XXDMA_PIN_62_McACLKX 0x0d3d
78 #define I2SCC32XXDMA_PIN_63_McAFSX 0x073e
79 #define I2SCC32XXDMA_PIN_64_McAXR0 0x073f
80 
91 /* Add I2SCC32XXDMA_STATUS_* macros here */
92 
105 #define I2SCC32XXDMA_CMD_SET_ZEROBUF_LEN (I2S_CMD_RESERVED + 0)
106 #define I2SCC32XXDMA_CMD_SET_EMPTYBUF_LEN (I2S_CMD_RESERVED + 1)
107 
110 /* BACKWARDS COMPATIBILITY */
111 #define I2SCC32XXDMA_SET_ZEROBUF_LEN I2SCC32XXDMA_CMD_SET_ZEROBUF_LEN
112 #define I2SCC32XXDMA_SET_EMPTYBUF_LEN I2SCC32XXDMA_CMD_SET_EMPTYBUF_LEN
113 /* END BACKWARDS COMPATIBILITY */
114 
115 /* Value for Invalid Index */
116 #define I2SCC32XXDMA_INDEX_INVALID 0xFF
117 
118 /*Number of Serial data pins supported*/
119 #define I2SCC32XXDMA_NUM_SERIAL_PINS 2
120 
129 typedef enum I2SCC32XXDMA_DataSize {
133 
134 
135 /* I2S function table pointer */
137 
138 
176 typedef struct I2SCC32XXDMA_HWAttrsV1 {
178  uint32_t baseAddr;
180  uint32_t intNum;
182  uint32_t intPriority;
184  unsigned long rxChannelIndex;
186  unsigned long txChannelIndex;
188  uint16_t xr0Pin;
190  uint16_t xr1Pin;
192  uint16_t clkxPin;
194  uint16_t clkPin;
196  uint16_t fsxPin;
198 
204  unsigned char pinNumber;
205 
208 
211 
213 
218 
221 
223 
231  /* Pointer to read/write callback */
233  /* Timeout for read/write semaphore */
235 
237 
243 typedef struct I2SCC32XXDMA_Object {
244  /* I2S control variables */
245  bool opened; /* Has the obj been opened */
246  uint32_t operationMode; /* Mode of operation of I2S */
247 
248  /* I2S serial pin variables */
250 
251  uint16_t readIndex; /* read channel Index */
252  uint16_t writeIndex; /* write channel Index */
253 
254  I2SCC32XXDMA_DataSize dmaSize; /* Config DMA word size */
255 
256  /* I2S OSAL objects */
257  SemaphoreP_Handle writeSem; /* I2S write semaphore*/
258  SemaphoreP_Handle readSem; /* I2S read semaphore */
259  HwiP_Handle hwiHandle;
260 
262  unsigned long zeroWriteBufLength;
263 
266  unsigned long emptyReadBufLength;
267 
268  /* Current Write buffer descriptor pointer */
270 
271  /* Previous Write Buffer descriptor pointer */
273 
274  /* Current Read buffer descriptor pointer */
276 
277  /* Previous Read Buffer descriptor pointer */
279 
280  /* UDMA */
282 
283  /* Lists for issue-reclaim mode */
289 
304 
305 #ifdef __cplusplus
306 }
307 #endif
308 
309 #endif /* ti_drivers_i2s_I2SCC32XXDMA__include */
uint16_t xr1Pin
Definition: I2SCC32XXDMA.h:190
bool opened
Definition: I2SCC32XXDMA.h:245
CC32XX Serial Pin Configuration.
Definition: I2SCC32XXDMA.h:202
struct I2SCC32XXDMA_Object * I2SCC32XXDMA_Handle
List_List writeDoneQueue
Definition: I2SCC32XXDMA.h:287
CC32XX specific I2S Parameters.
Definition: I2SCC32XXDMA.h:217
Definition: List.h:131
SemaphoreP_Handle readSem
Definition: I2SCC32XXDMA.h:258
uint32_t baseAddr
Definition: I2SCC32XXDMA.h:178
uint32_t intNum
Definition: I2SCC32XXDMA.h:180
void(* I2S_Callback)(I2S_Handle handle, I2S_BufDesc *desc)
The definition of a callback function used by the I2S driver when used in I2S_MODE_CALLBACK.
Definition: I2S.h:372
I2SCC32XXDMA_DataSize
I2SCC32XXDMA data size is used to determine how to configure the DMA data transfers. This field is to be only used internally.
Definition: I2SCC32XXDMA.h:129
uint16_t clkPin
Definition: I2SCC32XXDMA.h:194
uint16_t xr0Pin
Definition: I2SCC32XXDMA.h:188
Definition: I2SCC32XXDMA.h:130
I2S_DataMode readWriteMode
Definition: I2SCC32XXDMA.h:230
uDMA driver implementation for CC32XX.
enum I2S_PinMode_ I2S_PinMode
I2S serial pin mode.
UDMACC32XX_Handle dmaHandle
Definition: I2SCC32XXDMA.h:281
I2S_Callback readWriteCallback
Definition: I2SCC32XXDMA.h:232
struct I2SCC32XXDMA_SerialPinParams I2SCC32XXDMA_SerialPinParams
CC32XX specific I2S Parameters.
struct I2SCC32XXDMA_HWAttrsV1 I2SCC32XXDMA_HWAttrsV1
I2SCC32XXDMA Hardware attributes.
struct I2SCC32XXDMA_Object I2SCC32XXDMA_Object
I2SCC32XXDMA Object.
UDMACC32XX Global configuration.
Definition: UDMACC32XX.h:135
I2S_BufDesc * prevReadBufDesc
Definition: I2SCC32XXDMA.h:278
struct I2SCC32XXDMA_SerialPinVars I2SCC32XXDMA_SerialPinVars
I2SCC32XXDMA Serial pin variables.
const I2S_FxnTable I2SCC32XXDMA_fxnTable
uint16_t readIndex
Definition: I2SCC32XXDMA.h:251
void I2SCC32XXDMA_Params_init(I2SCC32XXDMA_SerialPinParams *params)
Function to initialize the I2S_Params struct to its defaults.
Definition: I2SCC32XXDMA.h:131
uint16_t writeIndex
Definition: I2SCC32XXDMA.h:252
I2SCC32XXDMA Serial pin variables.
Definition: I2SCC32XXDMA.h:229
I2S driver interface.
The definition of a I2S function table that contains the required set of functions to control a speci...
Definition: I2S.h:519
I2SCC32XXDMA Object.
Definition: I2SCC32XXDMA.h:243
List_List readActiveQueue
Definition: I2SCC32XXDMA.h:284
unsigned long emptyReadBufLength
Definition: I2SCC32XXDMA.h:266
uint32_t intPriority
Definition: I2SCC32XXDMA.h:182
List_List readDoneQueue
Definition: I2SCC32XXDMA.h:285
enum I2S_DataMode_ I2S_DataMode
I2S mode settings.
I2S_BufDesc * currentReadBufDesc
Definition: I2SCC32XXDMA.h:275
unsigned long txChannelIndex
Definition: I2SCC32XXDMA.h:186
I2S_BufDesc * currentWriteBufDesc
Definition: I2SCC32XXDMA.h:269
enum I2S_SerInActiveConfig_ I2S_SerInActiveConfig
I2S Serializer InActive state settings.
HwiP_Handle hwiHandle
Definition: I2SCC32XXDMA.h:259
uint16_t clkxPin
Definition: I2SCC32XXDMA.h:192
uint16_t fsxPin
Definition: I2SCC32XXDMA.h:196
#define I2SCC32XXDMA_NUM_SERIAL_PINS
Definition: I2SCC32XXDMA.h:119
struct I2SCC32XXDMA_SerialPinConfig I2SCC32XXDMA_SerialPinConfig
CC32XX Serial Pin Configuration.
I2S_SerInActiveConfig inActiveConfig
Definition: I2SCC32XXDMA.h:210
I2S buffer descriptor for issue/reclaim mode.
Definition: I2S.h:347
I2SCC32XXDMA Hardware attributes.
Definition: I2SCC32XXDMA.h:176
List_List writeActiveQueue
Definition: I2SCC32XXDMA.h:286
I2SCC32XXDMA_DataSize dmaSize
Definition: I2SCC32XXDMA.h:254
unsigned char pinNumber
Definition: I2SCC32XXDMA.h:204
SemaphoreP_Handle writeSem
Definition: I2SCC32XXDMA.h:257
uint32_t readWriteTimeout
Definition: I2SCC32XXDMA.h:234
uint32_t operationMode
Definition: I2SCC32XXDMA.h:246
unsigned long zeroWriteBufLength
Definition: I2SCC32XXDMA.h:262
Linked List interface for use in drivers.
I2S_PinMode pinMode
Definition: I2SCC32XXDMA.h:207
I2S_BufDesc * prevWriteBufDesc
Definition: I2SCC32XXDMA.h:272
unsigned long rxChannelIndex
Definition: I2SCC32XXDMA.h:184
Copyright 2017, Texas Instruments Incorporated