Go to the documentation of this file.
15 #ifndef UX500_MSP_I2S_H
16 #define UX500_MSP_I2S_H
22 #define MSP_INPUT_FREQ_APB 48000000
39 #define MSP_BIG_ENDIAN 0x00000000
40 #define MSP_LITTLE_ENDIAN 0x00001000
41 #define MSP_UNEXPECTED_FS_ABORT 0x00000000
42 #define MSP_UNEXPECTED_FS_IGNORE 0x00008000
43 #define MSP_NON_MODE_BIT_MASK 0x00009000
46 #define RX_ENABLE 0x00000001
47 #define RX_FIFO_ENABLE 0x00000002
48 #define RX_SYNC_SRG 0x00000010
49 #define RX_CLK_POL_RISING 0x00000020
50 #define RX_CLK_SEL_SRG 0x00000040
51 #define TX_ENABLE 0x00000100
52 #define TX_FIFO_ENABLE 0x00000200
53 #define TX_SYNC_SRG_PROG 0x00001800
54 #define TX_SYNC_SRG_AUTO 0x00001000
55 #define TX_CLK_POL_RISING 0x00002000
56 #define TX_CLK_SEL_SRG 0x00004000
57 #define TX_EXTRA_DELAY_ENABLE 0x00008000
58 #define SRG_ENABLE 0x00010000
59 #define FRAME_GEN_ENABLE 0x00100000
60 #define SRG_CLK_SEL_APB 0x00000000
61 #define RX_FIFO_SYNC_HI 0x00000000
62 #define TX_FIFO_SYNC_HI 0x00000000
63 #define SPI_CLK_MODE_NORMAL 0x00000000
65 #define MSP_FRAME_SIZE_AUTO -1
73 #define MSP_DMACR 0x18
92 #define MSP_IODLY 0x70
97 #define MSP_TSTDR 0x8c
99 #define MSP_PID0 0xfe0
100 #define MSP_PID1 0xfe4
101 #define MSP_PID2 0xfe8
102 #define MSP_PID3 0xfec
104 #define MSP_CID0 0xff0
105 #define MSP_CID1 0xff4
106 #define MSP_CID2 0xff8
107 #define MSP_CID3 0xffc
110 #define RX_ENABLE_MASK BIT(0)
111 #define RX_FIFO_ENABLE_MASK BIT(1)
112 #define RX_FSYNC_MASK BIT(2)
113 #define DIRECT_COMPANDING_MASK BIT(3)
114 #define RX_SYNC_SEL_MASK BIT(4)
115 #define RX_CLK_POL_MASK BIT(5)
116 #define RX_CLK_SEL_MASK BIT(6)
117 #define LOOPBACK_MASK BIT(7)
118 #define TX_ENABLE_MASK BIT(8)
119 #define TX_FIFO_ENABLE_MASK BIT(9)
120 #define TX_FSYNC_MASK BIT(10)
121 #define TX_MSP_TDR_TSR BIT(11)
122 #define TX_SYNC_SEL_MASK (BIT(12) | BIT(11))
123 #define TX_CLK_POL_MASK BIT(13)
124 #define TX_CLK_SEL_MASK BIT(14)
125 #define TX_EXTRA_DELAY_MASK BIT(15)
126 #define SRG_ENABLE_MASK BIT(16)
127 #define SRG_CLK_POL_MASK BIT(17)
128 #define SRG_CLK_SEL_MASK (BIT(19) | BIT(18))
129 #define FRAME_GEN_EN_MASK BIT(20)
130 #define SPI_CLK_MODE_MASK (BIT(22) | BIT(21))
131 #define SPI_BURST_MODE_MASK BIT(23)
134 #define RFFEN_SHIFT 1
135 #define RFSPOL_SHIFT 2
137 #define RFSSEL_SHIFT 4
138 #define RCKPOL_SHIFT 5
139 #define RCKSEL_SHIFT 6
142 #define TFFEN_SHIFT 9
143 #define TFSPOL_SHIFT 10
144 #define TFSSEL_SHIFT 11
145 #define TCKPOL_SHIFT 13
146 #define TCKSEL_SHIFT 14
147 #define TXDDL_SHIFT 15
148 #define SGEN_SHIFT 16
149 #define SCKPOL_SHIFT 17
150 #define SCKSEL_SHIFT 18
151 #define FGEN_SHIFT 20
152 #define SPICKM_SHIFT 21
153 #define TBSWAP_SHIFT 28
155 #define RCKPOL_MASK BIT(0)
156 #define TCKPOL_MASK BIT(0)
157 #define SPICKM_MASK (BIT(1) | BIT(0))
158 #define MSP_RX_CLKPOL_BIT(n) ((n & RCKPOL_MASK) << RCKPOL_SHIFT)
159 #define MSP_TX_CLKPOL_BIT(n) ((n & TCKPOL_MASK) << TCKPOL_SHIFT)
161 #define P1ELEN_SHIFT 0
162 #define P1FLEN_SHIFT 3
163 #define DTYP_SHIFT 10
164 #define ENDN_SHIFT 12
165 #define DDLY_SHIFT 13
166 #define FSIG_SHIFT 15
167 #define P2ELEN_SHIFT 16
168 #define P2FLEN_SHIFT 19
169 #define P2SM_SHIFT 26
170 #define P2EN_SHIFT 27
171 #define FSYNC_SHIFT 15
173 #define P1ELEN_MASK 0x00000007
174 #define P2ELEN_MASK 0x00070000
175 #define P1FLEN_MASK 0x00000378
176 #define P2FLEN_MASK 0x03780000
177 #define DDLY_MASK 0x00003000
178 #define DTYP_MASK 0x00000600
179 #define P2SM_MASK 0x04000000
180 #define P2EN_MASK 0x08000000
181 #define ENDN_MASK 0x00001000
182 #define TFSPOL_MASK 0x00000400
183 #define TBSWAP_MASK 0x30000000
184 #define COMPANDING_MODE_MASK 0x00000c00
185 #define FSYNC_MASK 0x00008000
187 #define MSP_P1_ELEM_LEN_BITS(n) (n & P1ELEN_MASK)
188 #define MSP_P2_ELEM_LEN_BITS(n) (((n) << P2ELEN_SHIFT) & P2ELEN_MASK)
189 #define MSP_P1_FRAME_LEN_BITS(n) (((n) << P1FLEN_SHIFT) & P1FLEN_MASK)
190 #define MSP_P2_FRAME_LEN_BITS(n) (((n) << P2FLEN_SHIFT) & P2FLEN_MASK)
191 #define MSP_DATA_DELAY_BITS(n) (((n) << DDLY_SHIFT) & DDLY_MASK)
192 #define MSP_DATA_TYPE_BITS(n) (((n) << DTYP_SHIFT) & DTYP_MASK)
193 #define MSP_P2_START_MODE_BIT(n) ((n << P2SM_SHIFT) & P2SM_MASK)
194 #define MSP_P2_ENABLE_BIT(n) ((n << P2EN_SHIFT) & P2EN_MASK)
195 #define MSP_SET_ENDIANNES_BIT(n) ((n << ENDN_SHIFT) & ENDN_MASK)
196 #define MSP_FSYNC_POL(n) ((n << TFSPOL_SHIFT) & TFSPOL_MASK)
197 #define MSP_DATA_WORD_SWAP(n) ((n << TBSWAP_SHIFT) & TBSWAP_MASK)
198 #define MSP_SET_COMPANDING_MODE(n) ((n << DTYP_SHIFT) & \
199 COMPANDING_MODE_MASK)
200 #define MSP_SET_FSYNC_IGNORE(n) ((n << FSYNC_SHIFT) & FSYNC_MASK)
203 #define RX_BUSY BIT(0)
204 #define RX_FIFO_EMPTY BIT(1)
205 #define RX_FIFO_FULL BIT(2)
206 #define TX_BUSY BIT(3)
207 #define TX_FIFO_EMPTY BIT(4)
208 #define TX_FIFO_FULL BIT(5)
210 #define RBUSY_SHIFT 0
213 #define TBUSY_SHIFT 3
218 #define RMCEN_SHIFT 0
219 #define RMCSF_SHIFT 1
220 #define RCMPM_SHIFT 3
221 #define TMCEN_SHIFT 5
222 #define TNCSF_SHIFT 6
225 #define SCKDIV_SHIFT 0
226 #define FRWID_SHIFT 10
227 #define FRPER_SHIFT 16
229 #define SCK_DIV_MASK 0x0000003FF
230 #define FRAME_WIDTH_BITS(n) (((n) << FRWID_SHIFT) & 0x0000FC00)
231 #define FRAME_PERIOD_BITS(n) (((n) << FRPER_SHIFT) & 0x1FFF0000)
234 #define RX_DMA_ENABLE BIT(0)
235 #define TX_DMA_ENABLE BIT(1)
237 #define RDMAE_SHIFT 0
238 #define TDMAE_SHIFT 1
241 #define RX_SERVICE_INT BIT(0)
242 #define RX_OVERRUN_ERROR_INT BIT(1)
243 #define RX_FSYNC_ERR_INT BIT(2)
244 #define RX_FSYNC_INT BIT(3)
245 #define TX_SERVICE_INT BIT(4)
246 #define TX_UNDERRUN_ERR_INT BIT(5)
247 #define TX_FSYNC_ERR_INT BIT(6)
248 #define TX_FSYNC_INT BIT(7)
249 #define ALL_INT 0x000000ff
252 #define MSP_ITCR_ITEN BIT(0)
253 #define MSP_ITCR_TESTFIFO BIT(1)
358 #define MSP_FRAME_PERIOD_IN_MONO_MODE 256
359 #define MSP_FRAME_PERIOD_IN_STEREO_MODE 32
360 #define MSP_FRAME_WIDTH_IN_STEREO_MODE 16
373 #define MAX_MSP_BACKUP_REGS 36
478 const struct i2s_algorithm *
algo;