I2SCC32XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, 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  */
39 #ifndef ti_drivers_i2s_I2SCC32XX__include
40 #define ti_drivers_i2s_I2SCC32XX__include
41 
42 #include <ti/drivers/I2S.h>
44 #include <ti/drivers/dpl/SemaphoreP.h>
45 #include <ti/drivers/dpl/HwiP.h>
46 #include <ti/drivers/utils/List.h>
47 #include <ti/drivers/Power.h>
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 
54 /*
55  * Macros defining possible I2S signal pin mux options
56  *
57  * The bits in the pin mode macros are as follows:
58  * The lower 8 bits of the macro refer to the pin, offset by 1, to match
59  * driverlib pin defines. For example, I2SCC32XX_PIN_02_WS & 0xff = 1,
60  * which equals PIN_02 in driverlib pin.h. By matching the PIN_xx defines in
61  * driverlib pin.h, we can pass the pin directly to the driverlib functions.
62  * The upper 8 bits of the macro correspond to the pin mux confg mode
63  * value for the pin to operate in the I2S mode. For example, pin 2 is
64  * configured with mode 13 to operate as WS.
65  *
66  * The macro I2SCC32XX_PIN_UNUSED allows the user to not activate one
67  * of the signal.
68  */
70 #define I2SCC32XX_PIN_02_McAFSX 0x0d01
71 #define I2SCC32XX_PIN_03_McACLK 0x0302
72 #define I2SCC32XX_PIN_15_McAFSX 0x070e
73 #define I2SCC32XX_PIN_17_McAFSX 0x0610
74 #define I2SCC32XX_PIN_21_McAFSX 0x0214
75 #define I2SCC32XX_PIN_45_McAXR0 0x062c
76 #define I2SCC32XX_PIN_45_McAFSX 0x0c2c
77 #define I2SCC32XX_PIN_50_McAXR0 0x0431
78 #define I2SCC32XX_PIN_50_McAXR1 0x0631
79 #define I2SCC32XX_PIN_52_McACLK 0x0233
80 #define I2SCC32XX_PIN_52_McAXR0 0x0433
81 #define I2SCC32XX_PIN_53_McACLK 0x0234
82 #define I2SCC32XX_PIN_53_McAFSX 0x0334
83 #define I2SCC32XX_PIN_60_McAXR1 0x063b
84 #define I2SCC32XX_PIN_62_McACLKX 0x0d3d
85 #define I2SCC32XX_PIN_63_McAFSX 0x073e
86 #define I2SCC32XX_PIN_64_McAXR0 0x073f
87 #define I2SCC32XX_PIN_UNUSED 0xffff
89 #define I2SCC32XX_PIN_50_SD1 I2SCC32XX_PIN_50_McAXR1
90 #define I2SCC32XX_PIN_60_SD1 I2SCC32XX_PIN_60_McAXR1
91 #define I2SCC32XX_PIN_52_SD0 I2SCC32XX_PIN_52_McAXR0
92 #define I2SCC32XX_PIN_64_SD0 I2SCC32XX_PIN_64_McAXR0
93 #define I2SCC32XX_PIN_45_SD0 I2SCC32XX_PIN_45_McAXR0
94 #define I2SCC32XX_PIN_50_SD0 I2SCC32XX_PIN_50_McAXR0
95 #define I2SCC32XX_PIN_03_SCK I2SCC32XX_PIN_03_McACLK
96 #define I2SCC32XX_PIN_52_SCK I2SCC32XX_PIN_52_McACLK
97 #define I2SCC32XX_PIN_53_SCK I2SCC32XX_PIN_53_McACLK
98 #define I2SCC32XX_PIN_62_SCKX I2SCC32XX_PIN_62_McACLKX
99 #define I2SCC32XX_PIN_02_WS I2SCC32XX_PIN_02_McAFSX
100 #define I2SCC32XX_PIN_15_WS I2SCC32XX_PIN_15_McAFSX
101 #define I2SCC32XX_PIN_17_WS I2SCC32XX_PIN_17_McAFSX
102 #define I2SCC32XX_PIN_21_WS I2SCC32XX_PIN_21_McAFSX
103 #define I2SCC32XX_PIN_45_WS I2SCC32XX_PIN_45_McAFSX
104 #define I2SCC32XX_PIN_63_WS I2SCC32XX_PIN_63_McAFSX
105 #define I2SCC32XX_PIN_53_WS I2SCC32XX_PIN_53_McAFSX
138 typedef struct {
139  uint32_t pinSD1;
142  uint32_t pinSD0;
145  uint32_t pinSCK;
148  uint32_t pinSCKX;
150  uint32_t pinWS;
153  uint32_t rxChannelIndex;
155  uint32_t txChannelIndex;
157  uint32_t intPriority;
159 
167 typedef struct {
168  I2S_DataInterfaceUse interfaceConfig;
169  I2S_ChannelConfig channelsUsed;
170  uint8_t numberOfChannelsUsed;
171  uint8_t dataLine;
172 }I2SCC32XX_DataInterface;
182 typedef struct {
183  uint16_t delay;
184  I2S_Transaction *activeTransfer;
185  I2S_Callback callback;
186  uint32_t udmaConfig;
187  I2S_StopInterface stopInterface;
188 }I2SCC32XX_Interface;
198 typedef void (*I2SCC32XX_FifoUpdate)(uintptr_t arg);
199 
205 typedef struct {
206 
207  bool isOpen;
208  bool invertWS;
211  bool isMSBFirst;
214  bool isDMAUnused;
217  volatile bool isLastReadTransfer;
220  volatile bool isLastWriteTransfer;
223  uint8_t dataShift;
227  uint8_t memorySlotLength;
232  uint8_t sampleRotation;
233  uint8_t noOfInputs;
234  uint8_t noOfOutputs;
235  uint8_t udmaArbLength;
236  uint8_t dataLength;
237  I2S_Role moduleRole;
240  I2S_SamplingEdge samplingEdge;
243  uint32_t samplingFrequency;
244  uint32_t sampleMask;
245  uint32_t activatedFlag;
246  I2SCC32XX_DataInterface dataInterfaceSD0;
247  I2SCC32XX_DataInterface dataInterfaceSD1;
248  I2SCC32XX_Interface read;
249  I2SCC32XX_Interface write;
250  I2S_Callback errorCallback;
251  I2SCC32XX_FifoUpdate updateDataReadFxn;
252  I2SCC32XX_FifoUpdate updateDataWriteFxn;
253  HwiP_Handle hwi;
254  UDMACC32XX_Handle dmaHandle;
255  Power_NotifyObj notifyObj;
256 } I2SCC32XX_Object;
259 #ifdef __cplusplus
260 }
261 #endif
262 
263 #endif /* ti_drivers_i2s_I2SCC32XX__include */
uint32_t pinSCKX
Definition: I2SCC32XX.h:148
void(* I2S_Callback)(I2S_Handle handle, int_fast16_t status, I2S_Transaction *transactionPtr)
The definition of a user-callback function used by the I2S driver.
Definition: I2S.h:695
Power Manager.
uint32_t rxChannelIndex
Definition: I2SCC32XX.h:153
I2S_DataInterfaceUse
I2S data interface configuration.
Definition: I2S.h:772
uDMA driver implementation for CC32XX.
uint32_t pinSD0
Definition: I2SCC32XX.h:142
uint32_t pinWS
Definition: I2SCC32XX.h:150
I2S_Role
I2S master / slave selection.
Definition: I2S.h:736
UDMACC32XX Global configuration.
Definition: UDMACC32XX.h:125
I2S Hardware attributes.
Definition: I2SCC32XX.h:138
uint32_t pinSD1
Definition: I2SCC32XX.h:139
void(* I2SCC32XX_FifoUpdate)(uintptr_t arg)
The definition of a function used by the I2S driver to refresh the FIFO.
Definition: I2SCC32XX.h:198
Inter-Integrated Circuit Sound (I2S) Bus Driver.
I2S_ChannelConfig
Channels used selection.
Definition: I2S.h:788
Power notify object structure.
Definition: Power.h:443
I2S_SamplingEdge
I2S sampling setting.
Definition: I2S.h:748
uint32_t txChannelIndex
Definition: I2SCC32XX.h:155
void(* I2S_StopInterface)(I2S_Handle handle)
The definition of a function used to stop an I2S interface.
Definition: I2S.h:713
uint32_t intPriority
Definition: I2SCC32XX.h:157
I2S transaction descriptor.
Definition: I2S.h:665
uint32_t pinSCK
Definition: I2SCC32XX.h:145
Linked List interface for use in drivers.
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale