fsl_sai.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Freescale Semiconductor, Inc.
3  * Copyright 2016-2020 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef _FSL_SAI_H_
10 #define _FSL_SAI_H_
11 
12 #include "fsl_common.h"
13 
19 /*******************************************************************************
20  * Definitions
21  ******************************************************************************/
22 
25 #define FSL_SAI_DRIVER_VERSION (MAKE_VERSION(2, 3, 1))
27 
28 
29 enum
30 {
38 };
39 
41 enum
42 {
43  kSAI_Channel0Mask = 1 << 0U,
44  kSAI_Channel1Mask = 1 << 1U,
45  kSAI_Channel2Mask = 1 << 2U,
46  kSAI_Channel3Mask = 1 << 3U,
47  kSAI_Channel4Mask = 1 << 4U,
48  kSAI_Channel5Mask = 1 << 5U,
49  kSAI_Channel6Mask = 1 << 6U,
50  kSAI_Channel7Mask = 1 << 7U,
51 };
52 
54 typedef enum _sai_protocol
55 {
62 
64 typedef enum _sai_master_slave
65 {
66  kSAI_Master = 0x0U,
67  kSAI_Slave = 0x1U,
71 
73 typedef enum _sai_mono_stereo
74 {
75  kSAI_Stereo = 0x0U,
79 
81 typedef enum _sai_data_order
82 {
83  kSAI_DataLSB = 0x0U,
86 
88 typedef enum _sai_clock_polarity
89 {
95 
97 typedef enum _sai_sync_mode
98 {
99  kSAI_ModeAsync = 0x0U,
101 #if defined(FSL_FEATURE_SAI_HAS_SYNC_WITH_ANOTHER_SAI) && (FSL_FEATURE_SAI_HAS_SYNC_WITH_ANOTHER_SAI)
102  kSAI_ModeSyncWithOtherTx,
103  kSAI_ModeSyncWithOtherRx
104 #endif /* FSL_FEATURE_SAI_HAS_SYNC_WITH_ANOTHER_SAI */
106 
107 #if !(defined(FSL_FEATURE_SAI_HAS_NO_MCR_MICS) && (FSL_FEATURE_SAI_HAS_NO_MCR_MICS))
108 
109 typedef enum _sai_mclk_source
110 {
116 #endif
117 
119 typedef enum _sai_bclk_source
120 {
122  /* General device bit source definition */
126  /* Kinetis device bit clock source definition */
131 
133 enum
134 {
140 #if defined(FSL_FEATURE_SAI_FIFO_COUNT) && (FSL_FEATURE_SAI_FIFO_COUNT > 1)
141  kSAI_FIFORequestInterruptEnable = I2S_TCSR_FRIE_MASK,
142 #endif /* FSL_FEATURE_SAI_FIFO_COUNT */
143 };
144 
146 enum
147 {
149 #if defined(FSL_FEATURE_SAI_FIFO_COUNT) && (FSL_FEATURE_SAI_FIFO_COUNT > 1)
150  kSAI_FIFORequestDMAEnable = I2S_TCSR_FRDE_MASK,
151 #endif /* FSL_FEATURE_SAI_FIFO_COUNT */
152 };
153 
155 enum
156 {
160 #if defined(FSL_FEATURE_SAI_FIFO_COUNT) && (FSL_FEATURE_SAI_FIFO_COUNT > 1)
161  kSAI_FIFORequestFlag = I2S_TCSR_FRF_MASK,
162 #endif /* FSL_FEATURE_SAI_FIFO_COUNT */
164 };
165 
167 typedef enum _sai_reset_type
168 {
173 
174 #if defined(FSL_FEATURE_SAI_HAS_FIFO_PACKING) && FSL_FEATURE_SAI_HAS_FIFO_PACKING
175 
179 typedef enum _sai_fifo_packing
180 {
181  kSAI_FifoPackingDisabled = 0x0U,
182  kSAI_FifoPacking8bit = 0x2U,
183  kSAI_FifoPacking16bit = 0x3U
184 } sai_fifo_packing_t;
185 #endif /* FSL_FEATURE_SAI_HAS_FIFO_PACKING */
186 
188 typedef struct _sai_config
189 {
192 #if defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)
193  bool mclkOutputEnable;
194 #if !(defined(FSL_FEATURE_SAI_HAS_NO_MCR_MICS) && (FSL_FEATURE_SAI_HAS_NO_MCR_MICS))
195  sai_mclk_source_t mclkSource;
196 #endif /* FSL_FEATURE_SAI_HAS_MCR */
197 #endif
200 } sai_config_t;
201 
202 #ifndef SAI_XFER_QUEUE_SIZE
203 
204 #define SAI_XFER_QUEUE_SIZE (4U)
205 #endif
206 
208 typedef enum _sai_sample_rate
209 {
223 
225 typedef enum _sai_word_width
226 {
232 
233 #if defined(FSL_FEATURE_SAI_HAS_CHANNEL_MODE) && FSL_FEATURE_SAI_HAS_CHANNEL_MODE
234 
235 typedef enum _sai_data_pin_state
236 {
237  kSAI_DataPinStateTriState =
238  0U,
239  kSAI_DataPinStateOutputZero = 1U,
241 } sai_data_pin_state_t;
242 #endif
243 
244 #if defined(FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_COMBINE) && FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_COMBINE
245 
246 typedef enum _sai_fifo_combine
247 {
248  kSAI_FifoCombineDisabled = 0U,
249  kSAI_FifoCombineModeEnabledOnRead,
250  kSAI_FifoCombineModeEnabledOnWrite,
251  kSAI_FifoCombineModeEnabledOnReadWrite,
252 } sai_fifo_combine_t;
253 #endif
254 
257 {
261 
264 {
268 
270 typedef struct _sai_transfer_format
271 {
272  uint32_t sampleRate_Hz;
273  uint32_t bitWidth;
275 #if defined(FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) && (FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER)
276  uint32_t masterClockHz;
277 #endif /* FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER */
278 #if defined(FSL_FEATURE_SAI_FIFO_COUNT) && (FSL_FEATURE_SAI_FIFO_COUNT > 1)
279  uint8_t watermark;
280 #endif /* FSL_FEATURE_SAI_FIFO_COUNT */
281 
282  /* for the multi channel usage, user can provide channelMask Oonly, then sai driver will handle
283  * other parameter carefully, such as
284  * channelMask = kSAI_Channel0Mask | kSAI_Channel1Mask | kSAI_Channel4Mask
285  * then in SAI_RxSetFormat/SAI_TxSetFormat function, channel/endChannel/channelNums will be calculated.
286  * for the single channel usage, user can provide channel or channel mask only, such as,
287  * channel = 0 or channelMask = kSAI_Channel0Mask.
288  */
289  uint8_t channel;
290  uint8_t channelMask;
291  uint8_t endChannel;
292  uint8_t channelNums;
298 
299 #if (defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)) || \
300  (defined(FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) && (FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER))
301 
302 typedef struct _sai_master_clock
303 {
304 #if defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)
305  bool mclkOutputEnable;
306 #if !(defined(FSL_FEATURE_SAI_HAS_NO_MCR_MICS) && (FSL_FEATURE_SAI_HAS_NO_MCR_MICS))
307  sai_mclk_source_t mclkSource;
308 #endif
309 #endif
310 
311 #if (defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)) || \
312  (defined(FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) && (FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER))
313  uint32_t mclkHz;
314  uint32_t mclkSourceClkHz;
315 #endif
316 } sai_master_clock_t;
317 #endif
318 
320 #if (defined(FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_AFTER_ERROR) && FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_AFTER_ERROR) || \
321  (defined(FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_COMBINE) && FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_COMBINE) || \
322  (defined(FSL_FEATURE_SAI_HAS_FIFO_PACKING) && FSL_FEATURE_SAI_HAS_FIFO_PACKING) || \
323  (defined(FSL_FEATURE_SAI_FIFO_COUNT) && (FSL_FEATURE_SAI_FIFO_COUNT > 1))
324 #define FSL_SAI_HAS_FIFO_EXTEND_FEATURE 1
325 #else
326 #define FSL_SAI_HAS_FIFO_EXTEND_FEATURE 0
327 #endif
328 
329 #if FSL_SAI_HAS_FIFO_EXTEND_FEATURE
330 
331 typedef struct _sai_fifo
332 {
333 #if defined(FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_AFTER_ERROR) && FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_AFTER_ERROR
334  bool fifoContinueOneError;
335 #endif
336 
337 #if defined(FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_COMBINE) && FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_COMBINE
338  sai_fifo_combine_t fifoCombine;
339 #endif
340 
341 #if defined(FSL_FEATURE_SAI_HAS_FIFO_PACKING) && FSL_FEATURE_SAI_HAS_FIFO_PACKING
342  sai_fifo_packing_t fifoPacking;
343 #endif
344 #if defined(FSL_FEATURE_SAI_FIFO_COUNT) && (FSL_FEATURE_SAI_FIFO_COUNT > 1)
345  uint8_t fifoWatermark;
346 #endif
347 } sai_fifo_t;
348 #endif
349 
351 typedef struct _sai_bit_clock
352 {
353  bool bclkSrcSwap;
360 
362 typedef struct _sai_frame_sync
363 {
364  uint8_t frameSyncWidth;
368 #if defined(FSL_FEATURE_SAI_HAS_FRAME_SYNC_ON_DEMAND) && FSL_FEATURE_SAI_HAS_FRAME_SYNC_ON_DEMAND
369  bool frameSyncGenerateOnDemand;
370 #endif
371 
375 
377 typedef struct _sai_serial_data
378 {
379 #if defined(FSL_FEATURE_SAI_HAS_CHANNEL_MODE) && FSL_FEATURE_SAI_HAS_CHANNEL_MODE
380  sai_data_pin_state_t dataMode;
381 #endif
382 
384  uint8_t dataWord0Length;
385  uint8_t dataWordNLength;
386  uint8_t dataWordLength;
387  uint8_t
389  uint8_t dataWordNum;
390  uint32_t dataMaskedWord;
392 
394 typedef struct _sai_transceiver
395 {
399 #if FSL_SAI_HAS_FIFO_EXTEND_FEATURE
400  sai_fifo_t fifo;
401 #endif
406  uint8_t startChannel;
407  uint8_t channelMask;
408  uint8_t endChannel;
409  uint8_t channelNums;
412 
414 typedef struct _sai_transfer
415 {
416  uint8_t *data;
417  size_t dataSize;
419 
420 typedef struct _sai_handle sai_handle_t;
421 
423 typedef void (*sai_transfer_callback_t)(I2S_Type *base, sai_handle_t *handle, status_t status, void *userData);
424 
427 {
430  uint32_t state;
432  void *userData;
433  uint8_t bitWidth;
435  /* for the multi channel usage, user can provide channelMask Oonly, then sai driver will handle
436  * other parameter carefully, such as
437  * channelMask = kSAI_Channel0Mask | kSAI_Channel1Mask | kSAI_Channel4Mask
438  * then in SAI_RxSetFormat/SAI_TxSetFormat function, channel/endChannel/channelNums will be calculated.
439  * for the single channel usage, user can provide channel or channel mask only, such as,
440  * channel = 0 or channelMask = kSAI_Channel0Mask.
441  */
442  uint8_t channel;
443  uint8_t channelMask;
444  uint8_t endChannel;
445  uint8_t channelNums;
449  volatile uint8_t queueUser;
450  volatile uint8_t queueDriver;
451 #if defined(FSL_FEATURE_SAI_FIFO_COUNT) && (FSL_FEATURE_SAI_FIFO_COUNT > 1)
452  uint8_t watermark;
453 #endif
454 };
455 
456 /*******************************************************************************
457  * API
458  ******************************************************************************/
459 
460 #if defined(__cplusplus)
461 extern "C" {
462 #endif /*_cplusplus*/
463 
484 void SAI_TxInit(I2S_Type *base, const sai_config_t *config);
485 
501 void SAI_RxInit(I2S_Type *base, const sai_config_t *config);
502 
521 
540 
548 void SAI_Init(I2S_Type *base);
549 
558 void SAI_Deinit(I2S_Type *base);
559 
567 void SAI_TxReset(I2S_Type *base);
568 
576 void SAI_RxReset(I2S_Type *base);
577 
584 void SAI_TxEnable(I2S_Type *base, bool enable);
585 
592 void SAI_RxEnable(I2S_Type *base, bool enable);
593 
602 static inline void SAI_TxSetBitClockDirection(I2S_Type *base, sai_master_slave_t masterSlave)
603 {
604  if (masterSlave == kSAI_Master)
605  {
606  base->TCR2 |= I2S_TCR2_BCD_MASK;
607  }
608  else
609  {
610  base->TCR2 &= ~I2S_TCR2_BCD_MASK;
611  }
612 }
613 
622 static inline void SAI_RxSetBitClockDirection(I2S_Type *base, sai_master_slave_t masterSlave)
623 {
624  if (masterSlave == kSAI_Master)
625  {
626  base->RCR2 |= I2S_RCR2_BCD_MASK;
627  }
628  else
629  {
630  base->RCR2 &= ~I2S_RCR2_BCD_MASK;
631  }
632 }
633 
642 static inline void SAI_RxSetFrameSyncDirection(I2S_Type *base, sai_master_slave_t masterSlave)
643 {
644  if (masterSlave == kSAI_Master)
645  {
646  base->RCR4 |= I2S_RCR4_FSD_MASK;
647  }
648  else
649  {
650  base->RCR4 &= ~I2S_RCR4_FSD_MASK;
651  }
652 }
653 
662 static inline void SAI_TxSetFrameSyncDirection(I2S_Type *base, sai_master_slave_t masterSlave)
663 {
664  if (masterSlave == kSAI_Master)
665  {
666  base->TCR4 |= I2S_TCR4_FSD_MASK;
667  }
668  else
669  {
670  base->TCR4 &= ~I2S_TCR4_FSD_MASK;
671  }
672 }
673 
684  I2S_Type *base, uint32_t sourceClockHz, uint32_t sampleRate, uint32_t bitWidth, uint32_t channelNumbers);
685 
696  I2S_Type *base, uint32_t sourceClockHz, uint32_t sampleRate, uint32_t bitWidth, uint32_t channelNumbers);
697 
706 
715 
716 #if (defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)) || \
717  (defined(FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) && (FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER))
718 
724 void SAI_SetMasterClockConfig(I2S_Type *base, sai_master_clock_t *config);
725 #endif
726 
727 #if FSL_SAI_HAS_FIFO_EXTEND_FEATURE
728 
734 void SAI_TxSetFifoConfig(I2S_Type *base, sai_fifo_t *config);
735 
742 void SAI_RxSetFifoConfig(I2S_Type *base, sai_fifo_t *config);
743 #endif
744 
753 
762 
770 
778 
786 
794 
804  sai_word_width_t bitWidth,
805  sai_mono_stereo_t mode,
806  uint32_t saiChannelMask);
807 
817  sai_word_width_t bitWidth,
818  sai_mono_stereo_t mode,
819  uint32_t saiChannelMask);
820 
830  sai_word_width_t bitWidth,
831  sai_mono_stereo_t mode,
832  uint32_t saiChannelMask);
833 
844  sai_frame_sync_len_t frameSyncWidth,
845  sai_word_width_t bitWidth,
846  uint32_t dataWordNum,
847  uint32_t saiChannelMask);
848 
859  sai_frame_sync_len_t frameSyncWidth,
860  sai_word_width_t bitWidth,
861  sai_mono_stereo_t mode,
862  uint32_t saiChannelMask);
876 static inline uint32_t SAI_TxGetStatusFlag(I2S_Type *base)
877 {
878  return base->TCSR;
879 }
880 
890 static inline void SAI_TxClearStatusFlags(I2S_Type *base, uint32_t mask)
891 {
892  base->TCSR = ((base->TCSR & 0xFFE3FFFFU) | mask);
893 }
894 
901 static inline uint32_t SAI_RxGetStatusFlag(I2S_Type *base)
902 {
903  return base->RCSR;
904 }
905 
915 static inline void SAI_RxClearStatusFlags(I2S_Type *base, uint32_t mask)
916 {
917  base->RCSR = ((base->RCSR & 0xFFE3FFFFU) | mask);
918 }
919 
932 
945 
953 void SAI_TxSetChannelFIFOMask(I2S_Type *base, uint8_t mask);
954 
962 void SAI_RxSetChannelFIFOMask(I2S_Type *base, uint8_t mask);
963 
970 void SAI_TxSetDataOrder(I2S_Type *base, sai_data_order_t order);
971 
978 void SAI_RxSetDataOrder(I2S_Type *base, sai_data_order_t order);
979 
987 
995 
1003 
1011 
1012 #if defined(FSL_FEATURE_SAI_HAS_FIFO_PACKING) && FSL_FEATURE_SAI_HAS_FIFO_PACKING
1013 
1019 void SAI_TxSetFIFOPacking(I2S_Type *base, sai_fifo_packing_t pack);
1020 
1027 void SAI_RxSetFIFOPacking(I2S_Type *base, sai_fifo_packing_t pack);
1028 #endif /* FSL_FEATURE_SAI_HAS_FIFO_PACKING */
1029 
1030 #if defined(FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_AFTER_ERROR) && FSL_FEATURE_SAI_HAS_FIFO_FUNCTION_AFTER_ERROR
1031 
1040 static inline void SAI_TxSetFIFOErrorContinue(I2S_Type *base, bool isEnabled)
1041 {
1042  if (isEnabled)
1043  {
1044  base->TCR4 |= I2S_TCR4_FCONT_MASK;
1045  }
1046  else
1047  {
1048  base->TCR4 &= ~I2S_TCR4_FCONT_MASK;
1049  }
1050 }
1051 
1061 static inline void SAI_RxSetFIFOErrorContinue(I2S_Type *base, bool isEnabled)
1062 {
1063  if (isEnabled)
1064  {
1065  base->RCR4 |= I2S_RCR4_FCONT_MASK;
1066  }
1067  else
1068  {
1069  base->RCR4 &= ~I2S_RCR4_FCONT_MASK;
1070  }
1071 }
1072 #endif
1073 
1093 static inline void SAI_TxEnableInterrupts(I2S_Type *base, uint32_t mask)
1094 {
1095  base->TCSR = ((base->TCSR & 0xFFE3FFFFU) | mask);
1096 }
1097 
1110 static inline void SAI_RxEnableInterrupts(I2S_Type *base, uint32_t mask)
1111 {
1112  base->RCSR = ((base->RCSR & 0xFFE3FFFFU) | mask);
1113 }
1114 
1127 static inline void SAI_TxDisableInterrupts(I2S_Type *base, uint32_t mask)
1128 {
1129  base->TCSR = ((base->TCSR & 0xFFE3FFFFU) & (~mask));
1130 }
1131 
1144 static inline void SAI_RxDisableInterrupts(I2S_Type *base, uint32_t mask)
1145 {
1146  base->RCSR = ((base->RCSR & 0xFFE3FFFFU) & (~mask));
1147 }
1148 
1165 static inline void SAI_TxEnableDMA(I2S_Type *base, uint32_t mask, bool enable)
1166 {
1167  if (enable)
1168  {
1169  base->TCSR = ((base->TCSR & 0xFFE3FFFFU) | mask);
1170  }
1171  else
1172  {
1173  base->TCSR = ((base->TCSR & 0xFFE3FFFFU) & (~mask));
1174  }
1175 }
1176 
1186 static inline void SAI_RxEnableDMA(I2S_Type *base, uint32_t mask, bool enable)
1187 {
1188  if (enable)
1189  {
1190  base->RCSR = ((base->RCSR & 0xFFE3FFFFU) | mask);
1191  }
1192  else
1193  {
1194  base->RCSR = ((base->RCSR & 0xFFE3FFFFU) & (~mask));
1195  }
1196 }
1197 
1207 static inline uint32_t SAI_TxGetDataRegisterAddress(I2S_Type *base, uint32_t channel)
1208 {
1209  return (uint32_t)(&(base->TDR)[channel]);
1210 }
1211 
1221 static inline uint32_t SAI_RxGetDataRegisterAddress(I2S_Type *base, uint32_t channel)
1222 {
1223  return (uint32_t)(&(base->RDR)[channel]);
1224 }
1225 
1246 void SAI_TxSetFormat(I2S_Type *base,
1247  sai_transfer_format_t *format,
1248  uint32_t mclkSourceClockHz,
1249  uint32_t bclkSourceClockHz);
1250 
1264 void SAI_RxSetFormat(I2S_Type *base,
1265  sai_transfer_format_t *format,
1266  uint32_t mclkSourceClockHz,
1267  uint32_t bclkSourceClockHz);
1268 
1280 void SAI_WriteBlocking(I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size);
1281 
1295  I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t bitWidth, uint8_t *buffer, uint32_t size);
1296 
1304 static inline void SAI_WriteData(I2S_Type *base, uint32_t channel, uint32_t data)
1305 {
1306  base->TDR[channel] = data;
1307 }
1308 
1320 void SAI_ReadBlocking(I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size);
1321 
1335  I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t bitWidth, uint8_t *buffer, uint32_t size);
1336 
1344 static inline uint32_t SAI_ReadData(I2S_Type *base, uint32_t channel)
1345 {
1346  return base->RDR[channel];
1347 }
1348 
1367 void SAI_TransferTxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData);
1368 
1380 void SAI_TransferRxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData);
1381 
1393 
1405 
1422  sai_handle_t *handle,
1423  sai_transfer_format_t *format,
1424  uint32_t mclkSourceClockHz,
1425  uint32_t bclkSourceClockHz);
1426 
1443  sai_handle_t *handle,
1444  sai_transfer_format_t *format,
1445  uint32_t mclkSourceClockHz,
1446  uint32_t bclkSourceClockHz);
1447 
1464 
1481 
1492 
1503 
1513 void SAI_TransferAbortSend(I2S_Type *base, sai_handle_t *handle);
1514 
1524 void SAI_TransferAbortReceive(I2S_Type *base, sai_handle_t *handle);
1525 
1535 void SAI_TransferTerminateSend(I2S_Type *base, sai_handle_t *handle);
1536 
1547 
1554 void SAI_TransferTxHandleIRQ(I2S_Type *base, sai_handle_t *handle);
1555 
1562 void SAI_TransferRxHandleIRQ(I2S_Type *base, sai_handle_t *handle);
1563 
1566 #if defined(__cplusplus)
1567 }
1568 #endif /*_cplusplus*/
1569 
1572 #endif /* _FSL_SAI_H_ */
_sai_transfer::data
uint8_t * data
Definition: fsl_sai.h:416
SAI_TxSetBitClockDirection
static void SAI_TxSetBitClockDirection(I2S_Type *base, sai_master_slave_t masterSlave)
Set Rx bit clock direction.
Definition: fsl_sai.h:602
SAI_RxGetDefaultConfig
void SAI_RxGetDefaultConfig(sai_config_t *config)
Sets the SAI Rx configuration structure to default values.
Definition: fsl_sai.c:736
_sai_transfer_format::channel
uint8_t channel
Definition: fsl_sai.h:289
sai_master_slave_t
enum _sai_master_slave sai_master_slave_t
Master or slave mode.
SAI_TxSetBitclockConfig
void SAI_TxSetBitclockConfig(I2S_Type *base, sai_master_slave_t masterSlave, sai_bit_clock_t *config)
Transmitter Bit clock configurations.
Definition: fsl_sai.c:1140
kSAI_Slave
@ kSAI_Slave
Definition: fsl_sai.h:67
kSAI_FIFOWarningDMAEnable
@ kSAI_FIFOWarningDMAEnable
Definition: fsl_sai.h:148
fsl_common.h
I2S_RCR4_FCONT_MASK
#define I2S_RCR4_FCONT_MASK
Definition: MIMXRT1052.h:20581
_sai_bit_clock::bclkInputDelay
bool bclkInputDelay
Definition: fsl_sai.h:354
SAI_TransferTerminateReceive
void SAI_TransferTerminateReceive(I2S_Type *base, sai_handle_t *handle)
Terminate all SAI receive.
Definition: fsl_sai.c:2681
kSAI_SampleRate96KHz
@ kSAI_SampleRate96KHz
Definition: fsl_sai.h:219
kSAI_BusRightJustified
@ kSAI_BusRightJustified
Definition: fsl_sai.h:57
kSAI_MclkSourceSelect2
@ kSAI_MclkSourceSelect2
Definition: fsl_sai.h:113
_sai_handle::transferSize
size_t transferSize[SAI_XFER_QUEUE_SIZE]
Definition: fsl_sai.h:448
_sai_transfer_format::protocol
sai_protocol_t protocol
Definition: fsl_sai.h:294
SAI_ReadData
static uint32_t SAI_ReadData(I2S_Type *base, uint32_t channel)
Reads data from the SAI FIFO.
Definition: fsl_sai.h:1344
I2S_Type::TCR4
__IO uint32_t TCR4
Definition: MIMXRT1052.h:19874
sai_protocol_t
enum _sai_protocol sai_protocol_t
Define the SAI bus type.
SAI_TransferTxCreateHandle
void SAI_TransferTxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData)
Initializes the SAI Tx handle.
Definition: fsl_sai.c:2283
I2S_TCSR_FEIE_MASK
#define I2S_TCSR_FEIE_MASK
Definition: MIMXRT1052.h:19973
I2S_RCR2_BCD_MASK
#define I2S_RCR2_BCD_MASK
Definition: MIMXRT1052.h:20449
sai_mclk_source_t
enum _sai_mclk_source sai_mclk_source_t
Mater clock source.
_sai_serial_data::dataFirstBitShifted
uint8_t dataFirstBitShifted
Definition: fsl_sai.h:388
_sai_transfer_format::channelNums
uint8_t channelNums
Definition: fsl_sai.h:292
SAI_TransferRxSetFormat
status_t SAI_TransferRxSetFormat(I2S_Type *base, sai_handle_t *handle, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz)
Configures the SAI Rx audio format.
Definition: fsl_sai.c:2400
_sai_transfer_format::stereo
sai_mono_stereo_t stereo
Definition: fsl_sai.h:274
sai_mono_stereo_t
enum _sai_mono_stereo sai_mono_stereo_t
Mono or stereo audio format.
_sai_frame_sync
sai frame sync configurations
Definition: fsl_sai.h:362
kSAI_ResetTypeFIFO
@ kSAI_ResetTypeFIFO
Definition: fsl_sai.h:170
SAI_TxSoftwareReset
void SAI_TxSoftwareReset(I2S_Type *base, sai_reset_type_t type)
Do software reset or FIFO reset .
Definition: fsl_sai.c:870
I2S_Type::RCSR
__IO uint32_t RCSR
Definition: MIMXRT1052.h:19882
_sai_handle::channelMask
uint8_t channelMask
Definition: fsl_sai.h:443
kSAI_BclkSourceBusclk
@ kSAI_BclkSourceBusclk
Definition: fsl_sai.h:121
I2S_Type
Definition: MIMXRT1052.h:19867
I2S_TCSR_FWIE_MASK
#define I2S_TCSR_FWIE_MASK
Definition: MIMXRT1052.h:19966
kSAI_DataMSB
@ kSAI_DataMSB
Definition: fsl_sai.h:84
I2S_TCSR_FRF_MASK
#define I2S_TCSR_FRF_MASK
Definition: MIMXRT1052.h:19994
SAI_TransferTxSetFormat
status_t SAI_TransferTxSetFormat(I2S_Type *base, sai_handle_t *handle, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz)
Configures the SAI Tx audio format.
Definition: fsl_sai.c:2350
I2S_TCSR_FWF_MASK
#define I2S_TCSR_FWF_MASK
Definition: MIMXRT1052.h:20001
SAI_TxSetChannelFIFOMask
void SAI_TxSetChannelFIFOMask(I2S_Type *base, uint8_t mask)
Set the Tx channel FIFO enable mask.
Definition: fsl_sai.c:904
_sai_handle::channel
uint8_t channel
Definition: fsl_sai.h:442
kSAI_ResetTypeSoftware
@ kSAI_ResetTypeSoftware
Definition: fsl_sai.h:169
kSAI_BclkSourceOtherSai1
@ kSAI_BclkSourceOtherSai1
Definition: fsl_sai.h:129
_sai_transfer::dataSize
size_t dataSize
Definition: fsl_sai.h:417
_sai_serial_data::dataWord0Length
uint8_t dataWord0Length
Definition: fsl_sai.h:384
_sai_handle::queueDriver
volatile uint8_t queueDriver
Definition: fsl_sai.h:450
sai_serial_data_t
struct _sai_serial_data sai_serial_data_t
sai serial data configurations
sai_data_order_t
enum _sai_data_order sai_data_order_t
SAI data order, MSB or LSB.
sai_sync_mode_t
enum _sai_sync_mode sai_sync_mode_t
Synchronous or asynchronous mode.
_sai_serial_data::dataWordNLength
uint8_t dataWordNLength
Definition: fsl_sai.h:385
sai_word_width_t
enum _sai_word_width sai_word_width_t
Audio word width.
SAI_TransferGetReceiveCount
status_t SAI_TransferGetReceiveCount(I2S_Type *base, sai_handle_t *handle, size_t *count)
Gets a received byte count.
Definition: fsl_sai.c:2569
_sai_transceiver::endChannel
uint8_t endChannel
Definition: fsl_sai.h:408
SAI_RxSetBitclockConfig
void SAI_RxSetBitclockConfig(I2S_Type *base, sai_master_slave_t masterSlave, sai_bit_clock_t *config)
Receiver Bit clock configurations.
Definition: fsl_sai.c:1167
kSAI_Channel5Mask
@ kSAI_Channel5Mask
Definition: fsl_sai.h:48
kSAI_Channel1Mask
@ kSAI_Channel1Mask
Definition: fsl_sai.h:44
_sai_transfer_format::channelMask
uint8_t channelMask
Definition: fsl_sai.h:290
_sai_serial_data::dataMaskedWord
uint32_t dataMaskedWord
Definition: fsl_sai.h:390
_sai_bit_clock::bclkSrcSwap
bool bclkSrcSwap
Definition: fsl_sai.h:353
SAI_RxSetSerialDataConfig
void SAI_RxSetSerialDataConfig(I2S_Type *base, sai_serial_data_t *config)
SAI receiver Serial data configurations.
Definition: fsl_sai.c:1411
SAI_RxSetFrameSyncPolarity
void SAI_RxSetFrameSyncPolarity(I2S_Type *base, sai_clock_polarity_t polarity)
Set the Rx data order.
Definition: fsl_sai.c:999
_sai_frame_sync_len
_sai_frame_sync_len
sai frame sync len
Definition: fsl_sai.h:263
kSAI_SampleRate8KHz
@ kSAI_SampleRate8KHz
Definition: fsl_sai.h:210
SAI_GetTDMConfig
void SAI_GetTDMConfig(sai_transceiver_t *config, sai_frame_sync_len_t frameSyncWidth, sai_word_width_t bitWidth, uint32_t dataWordNum, uint32_t saiChannelMask)
Get TDM mode configurations.
Definition: fsl_sai.c:1786
SAI_RxEnable
void SAI_RxEnable(I2S_Type *base, bool enable)
Enables/disables the SAI Rx.
Definition: fsl_sai.c:835
SAI_RxEnableDMA
static void SAI_RxEnableDMA(I2S_Type *base, uint32_t mask, bool enable)
Enables/disables the SAI Rx DMA requests.
Definition: fsl_sai.h:1186
SAI_WriteMultiChannelBlocking
void SAI_WriteMultiChannelBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t bitWidth, uint8_t *buffer, uint32_t size)
Sends data to multi channel using a blocking method.
Definition: fsl_sai.c:2151
SAI_TransferGetSendCount
status_t SAI_TransferGetSendCount(I2S_Type *base, sai_handle_t *handle, size_t *count)
Gets a set byte count.
Definition: fsl_sai.c:2541
kSAI_SampleRate48KHz
@ kSAI_SampleRate48KHz
Definition: fsl_sai.h:218
_sai_transfer_format::isFrameSyncCompact
bool isFrameSyncCompact
Definition: fsl_sai.h:295
_sai_frame_sync::frameSyncEarly
bool frameSyncEarly
Definition: fsl_sai.h:365
I2S_TCR2_BCD_MASK
#define I2S_TCR2_BCD_MASK
Definition: MIMXRT1052.h:20089
kStatus_SAI_QueueFull
@ kStatus_SAI_QueueFull
Definition: fsl_sai.h:35
kSAI_BusPCMB
@ kSAI_BusPCMB
Definition: fsl_sai.h:60
_sai_frame_sync::frameSyncPolarity
sai_clock_polarity_t frameSyncPolarity
Definition: fsl_sai.h:372
kSAI_SampleRate44100Hz
@ kSAI_SampleRate44100Hz
Definition: fsl_sai.h:217
kSAI_Channel3Mask
@ kSAI_Channel3Mask
Definition: fsl_sai.h:46
sai_clock_polarity_t
enum _sai_clock_polarity sai_clock_polarity_t
SAI clock polarity, active high or low.
_sai_handle::callback
sai_transfer_callback_t callback
Definition: fsl_sai.h:431
kSAI_SampleRate24KHz
@ kSAI_SampleRate24KHz
Definition: fsl_sai.h:215
sai_frame_sync_t
struct _sai_frame_sync sai_frame_sync_t
sai frame sync configurations
kSAI_SampleRate12KHz
@ kSAI_SampleRate12KHz
Definition: fsl_sai.h:212
_sai_transceiver::masterSlave
sai_master_slave_t masterSlave
Definition: fsl_sai.h:402
SAI_TxSetBitClockRate
void SAI_TxSetBitClockRate(I2S_Type *base, uint32_t sourceClockHz, uint32_t sampleRate, uint32_t bitWidth, uint32_t channelNumbers)
Transmitter bit clock rate configurations.
Definition: fsl_sai.c:1048
_sai_transceiver::channelMask
uint8_t channelMask
Definition: fsl_sai.h:407
kSAI_PolarityActiveLow
@ kSAI_PolarityActiveLow
Definition: fsl_sai.h:91
SAI_RxGetStatusFlag
static uint32_t SAI_RxGetStatusFlag(I2S_Type *base)
Gets the SAI Tx status flag state.
Definition: fsl_sai.h:901
SAI_TxSetFrameSyncPolarity
void SAI_TxSetFrameSyncPolarity(I2S_Type *base, sai_clock_polarity_t polarity)
Set the Tx data order.
Definition: fsl_sai.c:985
_sai_handle::userData
void * userData
Definition: fsl_sai.h:432
kSAI_BclkSourceOtherSai0
@ kSAI_BclkSourceOtherSai0
Definition: fsl_sai.h:128
SAI_TxGetDataRegisterAddress
static uint32_t SAI_TxGetDataRegisterAddress(I2S_Type *base, uint32_t channel)
Gets the SAI Tx data register address.
Definition: fsl_sai.h:1207
_sai_protocol
_sai_protocol
Define the SAI bus type.
Definition: fsl_sai.h:54
kSAI_WordWidth32bits
@ kSAI_WordWidth32bits
Definition: fsl_sai.h:230
kStatus_SAI_RxError
@ kStatus_SAI_RxError
Definition: fsl_sai.h:34
SAI_RxSetFormat
void SAI_RxSetFormat(I2S_Type *base, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz)
Configures the SAI Rx audio format.
Definition: fsl_sai.c:1972
_sai_transceiver_type
_sai_transceiver_type
sai transceiver type
Definition: fsl_sai.h:256
_sai_serial_data
sai serial data configurations
Definition: fsl_sai.h:377
kSAI_PolarityActiveHigh
@ kSAI_PolarityActiveHigh
Definition: fsl_sai.h:90
_sai_transfer_format::endChannel
uint8_t endChannel
Definition: fsl_sai.h:291
sai_sample_rate_t
enum _sai_sample_rate sai_sample_rate_t
Audio sample rate.
_sai_transceiver::frameSync
sai_frame_sync_t frameSync
Definition: fsl_sai.h:397
kSAI_SampleRate16KHz
@ kSAI_SampleRate16KHz
Definition: fsl_sai.h:213
SAI_TransferReceiveNonBlocking
status_t SAI_TransferReceiveNonBlocking(I2S_Type *base, sai_handle_t *handle, sai_transfer_t *xfer)
Performs an interrupt non-blocking receive transfer on SAI.
Definition: fsl_sai.c:2498
kSAI_SampleRate22050Hz
@ kSAI_SampleRate22050Hz
Definition: fsl_sai.h:214
kSAI_Channel0Mask
@ kSAI_Channel0Mask
Definition: fsl_sai.h:43
kSAI_Transmitter
@ kSAI_Transmitter
Definition: fsl_sai.h:258
sai_config_t
struct _sai_config sai_config_t
SAI user configuration structure.
MAKE_STATUS
#define MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
Definition: fsl_common.h:43
_sai_transceiver::bitClock
sai_bit_clock_t bitClock
Definition: fsl_sai.h:398
sai_transceiver_t
struct _sai_transceiver sai_transceiver_t
sai transceiver configurations
_sai_config::protocol
sai_protocol_t protocol
Definition: fsl_sai.h:190
I2S_TCSR_SEIE_MASK
#define I2S_TCSR_SEIE_MASK
Definition: MIMXRT1052.h:19980
SAI_TransferAbortSend
void SAI_TransferAbortSend(I2S_Type *base, sai_handle_t *handle)
Aborts the current send.
Definition: fsl_sai.c:2597
_sai_bclk_source
_sai_bclk_source
Bit clock source.
Definition: fsl_sai.h:119
SAI_XFER_QUEUE_SIZE
#define SAI_XFER_QUEUE_SIZE
SAI transfer queue size, user can refine it according to use case.
Definition: fsl_sai.h:204
SAI_TransferRxHandleIRQ
void SAI_TransferRxHandleIRQ(I2S_Type *base, sai_handle_t *handle)
Tx interrupt handler.
Definition: fsl_sai.c:2779
SAI_TxInit
void SAI_TxInit(I2S_Type *base, const sai_config_t *config)
Initializes the SAI Tx peripheral.
Definition: fsl_sai.c:409
_sai_config::masterSlave
sai_master_slave_t masterSlave
Definition: fsl_sai.h:199
_sai_mono_stereo
_sai_mono_stereo
Mono or stereo audio format.
Definition: fsl_sai.h:73
SAI_TransferRxSetConfig
void SAI_TransferRxSetConfig(I2S_Type *base, sai_handle_t *handle, sai_transceiver_t *config)
SAI receiver transfer configurations.
Definition: fsl_sai.c:1665
_sai_handle::saiQueue
sai_transfer_t saiQueue[SAI_XFER_QUEUE_SIZE]
Definition: fsl_sai.h:447
I2S_TCSR_FRDE_MASK
#define I2S_TCSR_FRDE_MASK
Definition: MIMXRT1052.h:19945
sai_reset_type_t
enum _sai_reset_type sai_reset_type_t
The reset type.
I2S_Type::RCR4
__IO uint32_t RCR4
Definition: MIMXRT1052.h:19886
SAI_RxSetFrameSyncConfig
void SAI_RxSetFrameSyncConfig(I2S_Type *base, sai_master_slave_t masterSlave, sai_frame_sync_t *config)
SAI receiver Frame sync configurations.
Definition: fsl_sai.c:1344
kSAI_FrameSyncLenOneBitClk
@ kSAI_FrameSyncLenOneBitClk
Definition: fsl_sai.h:265
SAI_RxDisableInterrupts
static void SAI_RxDisableInterrupts(I2S_Type *base, uint32_t mask)
Disables the SAI Rx interrupt requests.
Definition: fsl_sai.h:1144
kSAI_Channel7Mask
@ kSAI_Channel7Mask
Definition: fsl_sai.h:50
SAI_TransferTerminateSend
void SAI_TransferTerminateSend(I2S_Type *base, sai_handle_t *handle)
Terminate all SAI send.
Definition: fsl_sai.c:2657
_sai_config::bclkSource
sai_bclk_source_t bclkSource
Definition: fsl_sai.h:198
kSAI_Stereo
@ kSAI_Stereo
Definition: fsl_sai.h:75
kSAI_ModeSync
@ kSAI_ModeSync
Definition: fsl_sai.h:100
kSAI_MonoLeft
@ kSAI_MonoLeft
Definition: fsl_sai.h:77
_sai_sync_mode
_sai_sync_mode
Synchronous or asynchronous mode.
Definition: fsl_sai.h:97
kSAI_ResetAll
@ kSAI_ResetAll
Definition: fsl_sai.h:171
kSAI_BclkSourceMclkOption3
@ kSAI_BclkSourceMclkOption3
Definition: fsl_sai.h:125
kSAI_Bclk_Master_FrameSync_Slave
@ kSAI_Bclk_Master_FrameSync_Slave
Definition: fsl_sai.h:68
SAI_WriteData
static void SAI_WriteData(I2S_Type *base, uint32_t channel, uint32_t data)
Writes data into SAI FIFO.
Definition: fsl_sai.h:1304
sai_frame_sync_len_t
enum _sai_frame_sync_len sai_frame_sync_len_t
sai frame sync len
I2S_Type::TDR
__O uint32_t TDR[4]
Definition: MIMXRT1052.h:19876
I2S_TCSR_FEF_MASK
#define I2S_TCSR_FEF_MASK
Definition: MIMXRT1052.h:20008
_sai_handle::state
uint32_t state
Definition: fsl_sai.h:430
count
size_t count
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/tests/test_common/ma_test_common.c:31
kSAI_Bclk_Slave_FrameSync_Master
@ kSAI_Bclk_Slave_FrameSync_Master
Definition: fsl_sai.h:69
SAI_TxEnableInterrupts
static void SAI_TxEnableInterrupts(I2S_Type *base, uint32_t mask)
Enables the SAI Tx interrupt requests.
Definition: fsl_sai.h:1093
SAI_GetRightJustifiedConfig
void SAI_GetRightJustifiedConfig(sai_transceiver_t *config, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
Get right justified mode configurations.
Definition: fsl_sai.c:1731
I2S_TCSR_WSIE_MASK
#define I2S_TCSR_WSIE_MASK
Definition: MIMXRT1052.h:19987
SAI_RxClearStatusFlags
static void SAI_RxClearStatusFlags(I2S_Type *base, uint32_t mask)
Clears the SAI Rx status flag state.
Definition: fsl_sai.h:915
_sai_config::syncMode
sai_sync_mode_t syncMode
Definition: fsl_sai.h:191
SAI_Deinit
void SAI_Deinit(I2S_Type *base)
De-initializes the SAI peripheral.
Definition: fsl_sai.c:676
I2S_TCSR_WSF_MASK
#define I2S_TCSR_WSF_MASK
Definition: MIMXRT1052.h:20022
SAI_GetLeftJustifiedConfig
void SAI_GetLeftJustifiedConfig(sai_transceiver_t *config, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
Get left justified mode configurations.
Definition: fsl_sai.c:1709
I2S_TCSR_SEF_MASK
#define I2S_TCSR_SEF_MASK
Definition: MIMXRT1052.h:20015
kSAI_SampleRate192KHz
@ kSAI_SampleRate192KHz
Definition: fsl_sai.h:220
_sai_transceiver
sai transceiver configurations
Definition: fsl_sai.h:394
SAI_TransferTxHandleIRQ
void SAI_TransferTxHandleIRQ(I2S_Type *base, sai_handle_t *handle)
Tx interrupt handler.
Definition: fsl_sai.c:2702
_sai_bit_clock::bclkSource
sai_bclk_source_t bclkSource
Definition: fsl_sai.h:358
SAI_RxSetBitClockDirection
static void SAI_RxSetBitClockDirection(I2S_Type *base, sai_master_slave_t masterSlave)
Set Rx bit clock direction.
Definition: fsl_sai.h:622
kSAI_BusLeftJustified
@ kSAI_BusLeftJustified
Definition: fsl_sai.h:56
_sai_data_order
_sai_data_order
SAI data order, MSB or LSB.
Definition: fsl_sai.h:81
kSAI_Channel4Mask
@ kSAI_Channel4Mask
Definition: fsl_sai.h:47
kSAI_MonoRight
@ kSAI_MonoRight
Definition: fsl_sai.h:76
kSAI_DataLSB
@ kSAI_DataLSB
Definition: fsl_sai.h:83
kSAI_BusI2S
@ kSAI_BusI2S
Definition: fsl_sai.h:58
kSAI_ModeAsync
@ kSAI_ModeAsync
Definition: fsl_sai.h:99
SAI_WriteBlocking
void SAI_WriteBlocking(I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size)
Sends data using a blocking method.
Definition: fsl_sai.c:2113
kSAI_Channel6Mask
@ kSAI_Channel6Mask
Definition: fsl_sai.h:49
_sai_transceiver::syncMode
sai_sync_mode_t syncMode
Definition: fsl_sai.h:404
_sai_transfer_format::sampleRate_Hz
uint32_t sampleRate_Hz
Definition: fsl_sai.h:272
SAI_RxSetFrameSyncDirection
static void SAI_RxSetFrameSyncDirection(I2S_Type *base, sai_master_slave_t masterSlave)
Set Rx frame sync direction.
Definition: fsl_sai.h:642
SAI_TransferRxCreateHandle
void SAI_TransferRxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData)
Initializes the SAI Rx handle.
Definition: fsl_sai.c:2314
kSAI_WordStartFlag
@ kSAI_WordStartFlag
Definition: fsl_sai.h:157
SAI_TransferAbortReceive
void SAI_TransferAbortReceive(I2S_Type *base, sai_handle_t *handle)
Aborts the current IRQ receive.
Definition: fsl_sai.c:2627
sai_transfer_format_t
struct _sai_transfer_format sai_transfer_format_t
sai transfer format
kSAI_FIFOWarningFlag
@ kSAI_FIFOWarningFlag
Definition: fsl_sai.h:163
SAI_ReadBlocking
void SAI_ReadBlocking(I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size)
Receives data using a blocking method.
Definition: fsl_sai.c:2251
SAI_RxReset
void SAI_RxReset(I2S_Type *base)
Resets the SAI Rx.
Definition: fsl_sai.c:783
sai_bclk_source_t
enum _sai_bclk_source sai_bclk_source_t
Bit clock source.
I2S_Type::TCSR
__IO uint32_t TCSR
Definition: MIMXRT1052.h:19870
kSAI_BclkSourceMclkDiv
@ kSAI_BclkSourceMclkDiv
Definition: fsl_sai.h:127
_sai_mclk_source
_sai_mclk_source
Mater clock source.
Definition: fsl_sai.h:109
_sai_config
SAI user configuration structure.
Definition: fsl_sai.h:188
SAI_RxSetConfig
void SAI_RxSetConfig(I2S_Type *base, sai_transceiver_t *config)
SAI receiver configurations.
Definition: fsl_sai.c:1562
_sai_transceiver::channelNums
uint8_t channelNums
Definition: fsl_sai.h:409
sai_bit_clock_t
struct _sai_bit_clock sai_bit_clock_t
sai bit clock configurations
_sai_handle::channelNums
uint8_t channelNums
Definition: fsl_sai.h:445
SAI_TxSetSerialDataConfig
void SAI_TxSetSerialDataConfig(I2S_Type *base, sai_serial_data_t *config)
SAI transmitter Serial data configurations.
Definition: fsl_sai.c:1377
kSAI_Master
@ kSAI_Master
Definition: fsl_sai.h:66
kSAI_BusPCMA
@ kSAI_BusPCMA
Definition: fsl_sai.h:59
SAI_TransferTxSetConfig
void SAI_TransferTxSetConfig(I2S_Type *base, sai_handle_t *handle, sai_transceiver_t *config)
SAI transmitter transfer configurations.
Definition: fsl_sai.c:1535
kSAI_MclkSourceSelect1
@ kSAI_MclkSourceSelect1
Definition: fsl_sai.h:112
_sai_transfer_format::bitWidth
uint32_t bitWidth
Definition: fsl_sai.h:273
_sai_serial_data::dataWordNum
uint8_t dataWordNum
Definition: fsl_sai.h:389
SAI_TxDisableInterrupts
static void SAI_TxDisableInterrupts(I2S_Type *base, uint32_t mask)
Disables the SAI Tx interrupt requests.
Definition: fsl_sai.h:1127
I2S_RCR4_FSD_MASK
#define I2S_RCR4_FSD_MASK
Definition: MIMXRT1052.h:20518
I2S_TCSR_FRIE_MASK
#define I2S_TCSR_FRIE_MASK
Definition: MIMXRT1052.h:19959
_sai_serial_data::dataWordLength
uint8_t dataWordLength
Definition: fsl_sai.h:386
_sai_word_width
_sai_word_width
Audio word width.
Definition: fsl_sai.h:225
kSAI_SampleRate384KHz
@ kSAI_SampleRate384KHz
Definition: fsl_sai.h:221
SAI_TxSetBitClockPolarity
void SAI_TxSetBitClockPolarity(I2S_Type *base, sai_clock_polarity_t polarity)
Set the Tx data order.
Definition: fsl_sai.c:957
kSAI_SyncErrorInterruptEnable
@ kSAI_SyncErrorInterruptEnable
Definition: fsl_sai.h:137
SAI_TxSetFrameSyncConfig
void SAI_TxSetFrameSyncConfig(I2S_Type *base, sai_master_slave_t masterSlave, sai_frame_sync_t *config)
SAI transmitter Frame sync configurations.
Definition: fsl_sai.c:1310
_sai_transceiver::serialData
sai_serial_data_t serialData
Definition: fsl_sai.h:396
_sai_master_slave
_sai_master_slave
Master or slave mode.
Definition: fsl_sai.h:64
SAI_RxEnableInterrupts
static void SAI_RxEnableInterrupts(I2S_Type *base, uint32_t mask)
Enables the SAI Rx interrupt requests.
Definition: fsl_sai.h:1110
I2S_TCSR_FWDE_MASK
#define I2S_TCSR_FWDE_MASK
Definition: MIMXRT1052.h:19952
kSAI_SampleRate11025Hz
@ kSAI_SampleRate11025Hz
Definition: fsl_sai.h:211
_sai_serial_data::dataOrder
sai_data_order_t dataOrder
Definition: fsl_sai.h:383
SAI_TxEnableDMA
static void SAI_TxEnableDMA(I2S_Type *base, uint32_t mask, bool enable)
Enables/disables the SAI Tx DMA requests.
Definition: fsl_sai.h:1165
SAI_RxInit
void SAI_RxInit(I2S_Type *base, const sai_config_t *config)
Initializes the SAI Rx peripheral.
Definition: fsl_sai.c:533
kSAI_MclkSourceSysclk
@ kSAI_MclkSourceSysclk
Definition: fsl_sai.h:111
kSAI_FIFOWarningInterruptEnable
@ kSAI_FIFOWarningInterruptEnable
Definition: fsl_sai.h:138
_sai_transfer_format
sai transfer format
Definition: fsl_sai.h:270
SAI_RxGetDataRegisterAddress
static uint32_t SAI_RxGetDataRegisterAddress(I2S_Type *base, uint32_t channel)
Gets the SAI Rx data register address.
Definition: fsl_sai.h:1221
I2S_TCR4_FCONT_MASK
#define I2S_TCR4_FCONT_MASK
Definition: MIMXRT1052.h:20228
_sai_handle
SAI handle structure.
Definition: fsl_sai.h:426
_sai_sample_rate
_sai_sample_rate
Audio sample rate.
Definition: fsl_sai.h:208
kSAI_MclkSourceSelect3
@ kSAI_MclkSourceSelect3
Definition: fsl_sai.h:114
SAI_GetDSPConfig
void SAI_GetDSPConfig(sai_transceiver_t *config, sai_frame_sync_len_t frameSyncWidth, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
Get DSP mode configurations.
Definition: fsl_sai.c:1753
_sai_transfer
SAI transfer structure.
Definition: fsl_sai.h:414
kSAI_WordWidth24bits
@ kSAI_WordWidth24bits
Definition: fsl_sai.h:229
kSAI_BclkSourceMclkOption2
@ kSAI_BclkSourceMclkOption2
Definition: fsl_sai.h:124
kSAI_SyncErrorFlag
@ kSAI_SyncErrorFlag
Definition: fsl_sai.h:158
SAI_RxSetDataOrder
void SAI_RxSetDataOrder(I2S_Type *base, sai_data_order_t order)
Set the Rx data order.
Definition: fsl_sai.c:943
kSAI_Channel2Mask
@ kSAI_Channel2Mask
Definition: fsl_sai.h:45
SAI_TxGetStatusFlag
static uint32_t SAI_TxGetStatusFlag(I2S_Type *base)
Gets the SAI Tx status flag state.
Definition: fsl_sai.h:876
sai_transfer_t
struct _sai_transfer sai_transfer_t
SAI transfer structure.
_sai_handle::base
I2S_Type * base
Definition: fsl_sai.h:428
kStatus_SAI_RxIdle
@ kStatus_SAI_RxIdle
Definition: fsl_sai.h:37
kStatus_SAI_TxError
@ kStatus_SAI_TxError
Definition: fsl_sai.h:33
_sai_bit_clock
sai bit clock configurations
Definition: fsl_sai.h:351
SAI_TxSetConfig
void SAI_TxSetConfig(I2S_Type *base, sai_transceiver_t *config)
SAI transmitter configurations.
Definition: fsl_sai.c:1433
SAI_RxSoftwareReset
void SAI_RxSoftwareReset(I2S_Type *base, sai_reset_type_t type)
Do software reset or FIFO reset .
Definition: fsl_sai.c:889
I2S_Type::TCR2
__IO uint32_t TCR2
Definition: MIMXRT1052.h:19872
I2S_TCSR_SR_MASK
#define I2S_TCSR_SR_MASK
Definition: MIMXRT1052.h:20029
SAI_RxSetBitClockRate
void SAI_RxSetBitClockRate(I2S_Type *base, uint32_t sourceClockHz, uint32_t sampleRate, uint32_t bitWidth, uint32_t channelNumbers)
Receiver bit clock rate configurations.
Definition: fsl_sai.c:1095
kSAI_SampleRate32KHz
@ kSAI_SampleRate32KHz
Definition: fsl_sai.h:216
SAI_TxClearStatusFlags
static void SAI_TxClearStatusFlags(I2S_Type *base, uint32_t mask)
Clears the SAI Tx status flag state.
Definition: fsl_sai.h:890
kStatus_SAI_RxBusy
@ kStatus_SAI_RxBusy
Definition: fsl_sai.h:32
_sai_handle::queueUser
volatile uint8_t queueUser
Definition: fsl_sai.h:449
sai_transceiver_type_t
enum _sai_transceiver_type sai_transceiver_type_t
sai transceiver type
I2S_TCSR_FR_MASK
#define I2S_TCSR_FR_MASK
Definition: MIMXRT1052.h:20036
config
static sai_transceiver_t config
Definition: imxrt1050/imxrt1050-evkb/source/pv_audio_rec.c:75
SAI_TxReset
void SAI_TxReset(I2S_Type *base)
Resets the SAI Tx.
Definition: fsl_sai.c:760
_sai_handle::endChannel
uint8_t endChannel
Definition: fsl_sai.h:444
_sai_transceiver::startChannel
uint8_t startChannel
Definition: fsl_sai.h:406
kSAI_SampleOnFallingEdge
@ kSAI_SampleOnFallingEdge
Definition: fsl_sai.h:92
kSAI_WordWidth16bits
@ kSAI_WordWidth16bits
Definition: fsl_sai.h:228
kSAI_FIFOErrorFlag
@ kSAI_FIFOErrorFlag
Definition: fsl_sai.h:159
kStatus_SAI_TxBusy
@ kStatus_SAI_TxBusy
Definition: fsl_sai.h:31
kStatusGroup_SAI
@ kStatusGroup_SAI
Definition: fsl_common.h:86
I2S_Type::RCR2
__IO uint32_t RCR2
Definition: MIMXRT1052.h:19884
SAI_RxSetChannelFIFOMask
void SAI_RxSetChannelFIFOMask(I2S_Type *base, uint8_t mask)
Set the Rx channel FIFO enable mask.
Definition: fsl_sai.c:917
I2S_Type::RDR
__I uint32_t RDR[4]
Definition: MIMXRT1052.h:19888
SAI_TxSetDataOrder
void SAI_TxSetDataOrder(I2S_Type *base, sai_data_order_t order)
Set the Tx data order.
Definition: fsl_sai.c:929
sai_transfer_callback_t
void(* sai_transfer_callback_t)(I2S_Type *base, sai_handle_t *handle, status_t status, void *userData)
SAI transfer callback prototype.
Definition: fsl_sai.h:423
kStatus_SAI_TxIdle
@ kStatus_SAI_TxIdle
Definition: fsl_sai.h:36
status_t
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:189
kSAI_FrameSyncLenPerWordWidth
@ kSAI_FrameSyncLenPerWordWidth
Definition: fsl_sai.h:266
SAI_TxSetFormat
void SAI_TxSetFormat(I2S_Type *base, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz)
Configures the SAI Tx audio format.
Definition: fsl_sai.c:1829
_sai_frame_sync::frameSyncWidth
uint8_t frameSyncWidth
Definition: fsl_sai.h:364
_sai_bit_clock::bclkPolarity
sai_clock_polarity_t bclkPolarity
Definition: fsl_sai.h:357
kSAI_BclkSourceMclkOption1
@ kSAI_BclkSourceMclkOption1
Definition: fsl_sai.h:123
_sai_clock_polarity
_sai_clock_polarity
SAI clock polarity, active high or low.
Definition: fsl_sai.h:88
kSAI_Receiver
@ kSAI_Receiver
Definition: fsl_sai.h:259
SAI_RxSetBitClockPolarity
void SAI_RxSetBitClockPolarity(I2S_Type *base, sai_clock_polarity_t polarity)
Set the Rx data order.
Definition: fsl_sai.c:971
kSAI_WordStartInterruptEnable
@ kSAI_WordStartInterruptEnable
Definition: fsl_sai.h:135
I2S_TCR4_FSD_MASK
#define I2S_TCR4_FSD_MASK
Definition: MIMXRT1052.h:20158
SAI_GetClassicI2SConfig
void SAI_GetClassicI2SConfig(sai_transceiver_t *config, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
Get classic I2S mode configurations.
Definition: fsl_sai.c:1693
SAI_Init
void SAI_Init(I2S_Type *base)
Initializes the SAI peripheral.
Definition: fsl_sai.c:648
SAI_TxEnable
void SAI_TxEnable(I2S_Type *base, bool enable)
Enables/disables the SAI Tx.
Definition: fsl_sai.c:805
SAI_TxSetFrameSyncDirection
static void SAI_TxSetFrameSyncDirection(I2S_Type *base, sai_master_slave_t masterSlave)
Set Tx frame sync direction.
Definition: fsl_sai.h:662
kSAI_SampleOnRisingEdge
@ kSAI_SampleOnRisingEdge
Definition: fsl_sai.h:93
SAI_TransferSendNonBlocking
status_t SAI_TransferSendNonBlocking(I2S_Type *base, sai_handle_t *handle, sai_transfer_t *xfer)
Performs an interrupt non-blocking send transfer on SAI.
Definition: fsl_sai.c:2449
SAI_ReadMultiChannelBlocking
void SAI_ReadMultiChannelBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t bitWidth, uint8_t *buffer, uint32_t size)
Receives multi channel data using a blocking method.
Definition: fsl_sai.c:2205
SAI_TxGetDefaultConfig
void SAI_TxGetDefaultConfig(sai_config_t *config)
Sets the SAI Tx configuration structure to default values.
Definition: fsl_sai.c:702
_sai_handle::bitWidth
uint8_t bitWidth
Definition: fsl_sai.h:433
kSAI_WordWidth8bits
@ kSAI_WordWidth8bits
Definition: fsl_sai.h:227
kSAI_FIFOErrorInterruptEnable
@ kSAI_FIFOErrorInterruptEnable
Definition: fsl_sai.h:139
_sai_reset_type
_sai_reset_type
The reset type.
Definition: fsl_sai.h:167


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:13:56