]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/ti/devices/cc32xx/driverlib/i2s.h
Add SimpleLink CC3220SF demo.
[freertos] / FreeRTOS / Demo / CORTEX_M4_SimpleLink_CC3220SF_CCS / ti / devices / cc32xx / driverlib / i2s.h
1 /*
2  * -------------------------------------------
3  *    CC3220 SDK - v0.10.00.00 
4  * -------------------------------------------
5  *
6  *  Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ 
7  *  
8  *  Redistribution and use in source and binary forms, with or without 
9  *  modification, are permitted provided that the following conditions 
10  *  are met:
11  *
12  *    Redistributions of source code must retain the above copyright 
13  *    notice, this list of conditions and the following disclaimer.
14  *
15  *    Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the 
17  *    documentation and/or other materials provided with the   
18  *    distribution.
19  *
20  *    Neither the name of Texas Instruments Incorporated nor the names of
21  *    its contributors may be used to endorse or promote products derived
22  *    from this software without specific prior written permission.
23  *
24  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
25  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
26  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
28  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
29  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
30  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
33  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
34  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *  
36  */
37 //*****************************************************************************
38 //
39 //  i2s.h
40 //
41 //  Defines and Macros for the I2S.
42 //
43 //*****************************************************************************
44
45 #ifndef __I2S_H__
46 #define __I2S_H__
47
48 //*****************************************************************************
49 //
50 // If building with a C++ compiler, make all of the definitions in this header
51 // have a C binding.
52 //
53 //*****************************************************************************
54 #ifdef __cplusplus
55 extern "C"
56 {
57 #endif
58
59 //*****************************************************************************
60 //
61 // I2S DMA ports.
62 //
63 //*****************************************************************************
64 #define I2S_TX_DMA_PORT      0x4401E200
65 #define I2S_RX_DMA_PORT      0x4401E280
66
67 //*****************************************************************************
68 //
69 // Values that can be passed to I2SConfigSetExpClk() as the ulConfig parameter.
70 //
71 //*****************************************************************************
72 #define I2S_SLOT_SIZE_8       0x00300032
73 #define I2S_SLOT_SIZE_16      0x00700074
74 #define I2S_SLOT_SIZE_24      0x00B000B6
75
76
77 #define I2S_PORT_CPU          0x00080008
78 #define I2S_PORT_DMA          0x00000000
79
80 #define I2S_MODE_MASTER       0x00000000
81 #define I2S_MODE_SLAVE        0x00008000
82
83 //*****************************************************************************
84 //
85 // Values that can be passed as ulDataLine parameter.
86 //
87 //*****************************************************************************
88 #define I2S_DATA_LINE_0       0x00000001
89 #define I2S_DATA_LINE_1       0x00000002
90
91 //*****************************************************************************
92 //
93 // Values that can be passed to I2SSerializerConfig() as the ulSerMode
94 // parameter.
95 //
96 //*****************************************************************************
97 #define I2S_SER_MODE_TX       0x00000001
98 #define I2S_SER_MODE_RX       0x00000002
99 #define I2S_SER_MODE_DISABLE  0x00000000
100
101 //*****************************************************************************
102 //
103 // Values that can be passed to I2SSerializerConfig() as the ulInActState
104 // parameter.
105 //
106 //*****************************************************************************
107 #define I2S_INACT_TRI_STATE   0x00000000
108 #define I2S_INACT_LOW_LEVEL   0x00000008
109 #define I2S_INACT_HIGH_LEVEL  0x0000000C
110
111 //*****************************************************************************
112 //
113 // Values that can be passed to I2SIntEnable() and I2SIntDisable() as the
114 // ulIntFlags parameter.
115 //
116 //*****************************************************************************
117 #define I2S_INT_XUNDRN        0x00000001
118 #define I2S_INT_XSYNCERR      0x00000002
119 #define I2S_INT_XLAST         0x00000010
120 #define I2S_INT_XDATA         0x00000020
121 #define I2S_INT_XSTAFRM       0x00000080
122 #define I2S_INT_XDMA          0x80000000
123 #define I2S_INT_ROVRN         0x00010000
124 #define I2S_INT_RSYNCERR      0x00020000
125 #define I2S_INT_RLAST         0x00100000
126 #define I2S_INT_RDATA         0x00200000
127 #define I2S_INT_RSTAFRM       0x00800000
128 #define I2S_INT_RDMA          0x40000000
129
130
131 //*****************************************************************************
132 //
133 // Values that can be passed to I2SRxActiveSlotSet() and I2STxActiveSlotSet
134 //
135 //*****************************************************************************
136 #define I2S_ACT_SLOT_EVEN     0x00000001
137 #define I2S_ACT_SLOT_ODD      0x00000002
138
139 //*****************************************************************************
140 //
141 // Values that can be passed to I2SIntClear() as the
142 // ulIntFlags parameter and returned from I2SIntStatus().
143 //
144 //*****************************************************************************
145 #define I2S_STS_XERR          0x00000100
146 #define I2S_STS_XDMAERR       0x00000080
147 #define I2S_STS_XSTAFRM       0x00000040
148 #define I2S_STS_XDATA         0x00000020
149 #define I2S_STS_XLAST         0x00000010
150 #define I2S_STS_XSYNCERR      0x00000002
151 #define I2S_STS_XUNDRN        0x00000001
152 #define I2S_STS_XDMA          0x80000000
153 #define I2S_STS_RERR          0x01000000
154 #define I2S_STS_RDMAERR       0x00800000
155 #define I2S_STS_RSTAFRM       0x00400000
156 #define I2S_STS_RDATA         0x00200000
157 #define I2S_STS_RLAST         0x00100000
158 #define I2S_STS_RSYNCERR      0x00020000
159 #define I2S_STS_ROVERN        0x00010000
160 #define I2S_STS_RDMA          0x40000000
161
162 //*****************************************************************************
163 //
164 // Values that can be passed to I2SEnable() as the ulMode parameter.
165 //
166 //*****************************************************************************
167 #define I2S_MODE_TX_ONLY      0x00000001
168 #define I2S_MODE_TX_RX_SYNC   0x00000003
169
170
171 //*****************************************************************************
172 //
173 // API Function prototypes
174 //
175 //*****************************************************************************
176 extern void I2SEnable(unsigned long ulBase, unsigned long ulMode);
177 extern void I2SDisable(unsigned long ulBase);
178
179 extern void I2SDataPut(unsigned long ulBase, unsigned long ulDataLine,
180                 unsigned long ulData);
181 extern long I2SDataPutNonBlocking(unsigned long ulBase,
182                                unsigned long ulDataLine, unsigned long ulData);
183
184 extern void I2SDataGet(unsigned long ulBase, unsigned long ulDataLine,
185                 unsigned long *pulData);
186 extern long I2SDataGetNonBlocking(unsigned long ulBase,
187                 unsigned long ulDataLine, unsigned long *pulData);
188
189 extern void I2SConfigSetExpClk(unsigned long ulBase, unsigned long ulI2SClk,
190                                unsigned long ulBitClk, unsigned long ulConfig);
191
192 extern void I2STxFIFOEnable(unsigned long ulBase, unsigned long ulTxLevel,
193                      unsigned long ulWordsPerTransfer);
194 extern void I2STxFIFODisable(unsigned long ulBase);
195 extern void I2SRxFIFOEnable(unsigned long ulBase, unsigned long ulRxLevel,
196                      unsigned long ulWordsPerTransfer);
197 extern void I2SRxFIFODisable(unsigned long ulBase);
198 extern unsigned long I2STxFIFOStatusGet(unsigned long ulBase);
199 extern unsigned long I2SRxFIFOStatusGet(unsigned long ulBase);
200
201 extern void I2SSerializerConfig(unsigned long ulBase, unsigned long ulDataLine,
202                          unsigned long ulSerMode, unsigned long ulInActState);
203
204 extern void I2SIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
205 extern void I2SIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
206 extern unsigned long I2SIntStatus(unsigned long ulBase);
207 extern void I2SIntClear(unsigned long ulBase, unsigned long ulIntFlags);
208 extern void I2SIntRegister(unsigned long ulBase, void (*pfnHandler)(void));
209 extern void I2SIntUnregister(unsigned long ulBase);
210 extern void I2STxActiveSlotSet(unsigned long ulBase, unsigned long ulActSlot);
211 extern void I2SRxActiveSlotSet(unsigned long ulBase, unsigned long ulActSlot);
212
213 //*****************************************************************************
214 //
215 // Mark the end of the C bindings section for C++ compilers.
216 //
217 //*****************************************************************************
218 #ifdef __cplusplus
219 }
220 #endif
221
222 #endif //__I2S_H__
223