I2SCC32XXDMA.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018, 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 /*
64  * Macros defining possible I2S signal pin mux options
65  *
66  * The bits in the pin mode macros are as follows:
67  * The lower 8 bits of the macro refer to the pin, offset by 1, to match
68  * driverlib pin defines. For example, I2SCC32XXDMA_PIN_02_McAFSX & 0xff = 1,
69  * which equals PIN_02 in driverlib pin.h. By matching the PIN_xx defines in
70  * driverlib pin.h, we can pass the pin directly to the driverlib functions.
71  * The upper 8 bits of the macro correspond to the pin mux confg mode
72  * value for the pin to operate in the I2S mode. For example, pin 2 is
73  * configured with mode 13 to operate as McAFSX.
74  */
75 #define I2SCC32XXDMA_PIN_02_McAFSX 0x0d01
76 #define I2SCC32XXDMA_PIN_03_McACLK 0x0302
77 #define I2SCC32XXDMA_PIN_15_McAFSX 0x070e
78 #define I2SCC32XXDMA_PIN_17_McAFSX 0x0610
79 #define I2SCC32XXDMA_PIN_21_McAFSX 0x0214
80 #define I2SCC32XXDMA_PIN_45_McAXR0 0x062c
81 #define I2SCC32XXDMA_PIN_45_McAFSX 0x0c2c
82 #define I2SCC32XXDMA_PIN_50_McAXR0 0x0431
83 #define I2SCC32XXDMA_PIN_50_McAXR1 0x0631
84 #define I2SCC32XXDMA_PIN_52_McACLK 0x0233
85 #define I2SCC32XXDMA_PIN_52_McAXR0 0x0433
86 #define I2SCC32XXDMA_PIN_53_McACLK 0x0234
87 #define I2SCC32XXDMA_PIN_53_McAFSX 0x0334
88 #define I2SCC32XXDMA_PIN_60_McAXR1 0x063b
89 #define I2SCC32XXDMA_PIN_62_McACLKX 0x0d3d
90 #define I2SCC32XXDMA_PIN_63_McAFSX 0x073e
91 #define I2SCC32XXDMA_PIN_64_McAXR0 0x073f
103 /* Add I2SCC32XXDMA_STATUS_* macros here */
104 
117 #define I2SCC32XXDMA_CMD_SET_ZEROBUF_LEN (I2S_CMD_RESERVED + 0)
118 #define I2SCC32XXDMA_CMD_SET_EMPTYBUF_LEN (I2S_CMD_RESERVED + 1)
119 
122 /* BACKWARDS COMPATIBILITY */
123 #define I2SCC32XXDMA_SET_ZEROBUF_LEN I2SCC32XXDMA_CMD_SET_ZEROBUF_LEN
124 #define I2SCC32XXDMA_SET_EMPTYBUF_LEN I2SCC32XXDMA_CMD_SET_EMPTYBUF_LEN
125 /* END BACKWARDS COMPATIBILITY */
126 
127 /* Value for Invalid Index */
128 #define I2SCC32XXDMA_INDEX_INVALID 0xFF
129 
130 /*Number of Serial data pins supported*/
131 #define I2SCC32XXDMA_NUM_SERIAL_PINS 2
132 
141 typedef enum I2SCC32XXDMA_DataSize {
145 
146 
147 /* I2S function table pointer */
149 
150 
188 typedef struct I2SCC32XXDMA_HWAttrsV1 {
190  uint32_t baseAddr;
192  uint32_t intNum;
194  uint32_t intPriority;
196  unsigned long rxChannelIndex;
198  unsigned long txChannelIndex;
200  uint16_t xr0Pin;
202  uint16_t xr1Pin;
204  uint16_t clkxPin;
206  uint16_t clkPin;
208  uint16_t fsxPin;
210 
216  unsigned char pinNumber;
217 
220 
223 
225 
230 
233 
235 
243  /* Pointer to read/write callback */
245  /* Timeout for read/write semaphore */
247 
249 
255 typedef struct I2SCC32XXDMA_Object {
256  /* I2S control variables */
257  bool opened; /* Has the obj been opened */
258  uint32_t operationMode; /* Mode of operation of I2S */
259 
260  /* I2S serial pin variables */
262 
263  uint16_t readIndex; /* read channel Index */
264  uint16_t writeIndex; /* write channel Index */
265 
266  I2SCC32XXDMA_DataSize dmaSize; /* Config DMA word size */
267 
268  /* I2S OSAL objects */
269  SemaphoreP_Handle writeSem; /* I2S write semaphore*/
270  SemaphoreP_Handle readSem; /* I2S read semaphore */
271  HwiP_Handle hwiHandle;
272 
273  /* Length of zero buffer to write in case of no data */
274  unsigned long zeroWriteBufLength;
275 
276  /* Length of empty buffer to read in case of no data
277  requested */
278  unsigned long emptyReadBufLength;
279 
280  /* Current Write buffer descriptor pointer */
282 
283  /* Previous Write Buffer descriptor pointer */
285 
286  /* Current Read buffer descriptor pointer */
288 
289  /* Previous Read Buffer descriptor pointer */
291 
292  /* UDMA */
294 
295  /* Lists for issue-reclaim mode */
301 
316 
317 #ifdef __cplusplus
318 }
319 #endif
320 
321 #endif /* ti_drivers_i2s_I2SCC32XXDMA__include */
uint16_t xr1Pin
Definition: I2SCC32XXDMA.h:202
bool opened
Definition: I2SCC32XXDMA.h:257
CC32XX Serial Pin Configuration.
Definition: I2SCC32XXDMA.h:214
struct I2SCC32XXDMA_Object * I2SCC32XXDMA_Handle
List_List writeDoneQueue
Definition: I2SCC32XXDMA.h:299
CC32XX specific I2S Parameters.
Definition: I2SCC32XXDMA.h:229
Definition: List.h:131
SemaphoreP_Handle readSem
Definition: I2SCC32XXDMA.h:270
uint32_t baseAddr
Definition: I2SCC32XXDMA.h:190
uint32_t intNum
Definition: I2SCC32XXDMA.h:192
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:141
uint16_t clkPin
Definition: I2SCC32XXDMA.h:206
uint16_t xr0Pin
Definition: I2SCC32XXDMA.h:200
Definition: I2SCC32XXDMA.h:142
I2S_DataMode readWriteMode
Definition: I2SCC32XXDMA.h:242
uDMA driver implementation for CC32XX.
enum I2S_PinMode_ I2S_PinMode
I2S serial pin mode.
UDMACC32XX_Handle dmaHandle
Definition: I2SCC32XXDMA.h:293
I2S_Callback readWriteCallback
Definition: I2SCC32XXDMA.h:244
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:125
I2S_BufDesc * prevReadBufDesc
Definition: I2SCC32XXDMA.h:290
struct I2SCC32XXDMA_SerialPinVars I2SCC32XXDMA_SerialPinVars
I2SCC32XXDMA Serial pin variables.
const I2S_FxnTable I2SCC32XXDMA_fxnTable
uint16_t readIndex
Definition: I2SCC32XXDMA.h:263
void I2SCC32XXDMA_Params_init(I2SCC32XXDMA_SerialPinParams *params)
Function to initialize the I2S_Params struct to its defaults.
Definition: I2SCC32XXDMA.h:143
uint16_t writeIndex
Definition: I2SCC32XXDMA.h:264
I2SCC32XXDMA Serial pin variables.
Definition: I2SCC32XXDMA.h:241
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:255
List_List readActiveQueue
Definition: I2SCC32XXDMA.h:296
unsigned long emptyReadBufLength
Definition: I2SCC32XXDMA.h:278
uint32_t intPriority
Definition: I2SCC32XXDMA.h:194
List_List readDoneQueue
Definition: I2SCC32XXDMA.h:297
enum I2S_DataMode_ I2S_DataMode
I2S mode settings.
I2S_BufDesc * currentReadBufDesc
Definition: I2SCC32XXDMA.h:287
unsigned long txChannelIndex
Definition: I2SCC32XXDMA.h:198
I2S_BufDesc * currentWriteBufDesc
Definition: I2SCC32XXDMA.h:281
enum I2S_SerInActiveConfig_ I2S_SerInActiveConfig
I2S Serializer InActive state settings.
HwiP_Handle hwiHandle
Definition: I2SCC32XXDMA.h:271
uint16_t clkxPin
Definition: I2SCC32XXDMA.h:204
uint16_t fsxPin
Definition: I2SCC32XXDMA.h:208
#define I2SCC32XXDMA_NUM_SERIAL_PINS
Definition: I2SCC32XXDMA.h:131
struct I2SCC32XXDMA_SerialPinConfig I2SCC32XXDMA_SerialPinConfig
CC32XX Serial Pin Configuration.
I2S_SerInActiveConfig inActiveConfig
Definition: I2SCC32XXDMA.h:222
I2S buffer descriptor for issue/reclaim mode.
Definition: I2S.h:347
I2SCC32XXDMA Hardware attributes.
Definition: I2SCC32XXDMA.h:188
List_List writeActiveQueue
Definition: I2SCC32XXDMA.h:298
I2SCC32XXDMA_DataSize dmaSize
Definition: I2SCC32XXDMA.h:266
unsigned char pinNumber
Definition: I2SCC32XXDMA.h:216
SemaphoreP_Handle writeSem
Definition: I2SCC32XXDMA.h:269
uint32_t readWriteTimeout
Definition: I2SCC32XXDMA.h:246
uint32_t operationMode
Definition: I2SCC32XXDMA.h:258
unsigned long zeroWriteBufLength
Definition: I2SCC32XXDMA.h:274
Linked List interface for use in drivers.
I2S_PinMode pinMode
Definition: I2SCC32XXDMA.h:219
I2S_BufDesc * prevWriteBufDesc
Definition: I2SCC32XXDMA.h:284
unsigned long rxChannelIndex
Definition: I2SCC32XXDMA.h:196
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale