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