<p>The MCUXpresso SDK provides a peripheral driver for the Serial Audio Interface (SAI) module of MCUXpresso SDK devices.</p>
<p>SAI driver includes functional APIs and transactional APIs.</p>
<p>Functional APIs target low-level APIs. Functional APIs can be used for SAI initialization, configuration and operation, and for optimization and customization purposes. Using the functional API requires the knowledge of the SAI peripheral and how to organize functional APIs to meet the application requirements. All functional API use the peripheral base address as the first parameter. SAI functional operation groups provide the functional API set.</p>
<p>Transactional APIs target high-level APIs. Transactional APIs can be used to enable the peripheral and in the application if the code size and performance of transactional APIs satisfy the requirements. If the code size and performance are a critical requirement, see the transactional API implementation and write a custom code. All transactional APIs use the sai_handle_t as the first parameter. Initialize the handle by calling the <aclass="el"href="a00061.html#ga69eaf09522d88c69b47ec104c11875de"title="Initializes the SAI Tx handle. ">SAI_TransferTxCreateHandle()</a> or <aclass="el"href="a00061.html#ga4c29a38ae0802fa81e304eee337ecf6b"title="Initializes the SAI Rx handle. ">SAI_TransferRxCreateHandle()</a> API.</p>
<p>Transactional APIs support asynchronous transfer. This means that the functions <aclass="el"href="a00061.html#gaefe0557861a223913d7b1d8959a56995"title="Performs an interrupt non-blocking send transfer on SAI. ">SAI_TransferSendNonBlocking()</a> and <aclass="el"href="a00061.html#gad23a55af8054fbd0cb8cbb175f2e497c"title="Performs an interrupt non-blocking receive transfer on SAI. ">SAI_TransferReceiveNonBlocking()</a> set up the interrupt for data transfer. When the transfer completes, the upper layer is notified through a callback function with the kStatus_SAI_TxIdle and kStatus_SAI_RxIdle status.</p>
<h1><aclass="anchor"id="SAIConfigurations"></a>
Typical configurations</h1>
<h2>Bit width configuration</h2>
<p>SAI driver support 8/16/24/32bits stereo/mono raw audio data transfer. SAI EDMA driver support 8/16/32bits stereo/mono raw audio data transfer, since the EDMA doesn't support 24bit data width, so application should pre-convert the 24bit data to 32bit. SAI DMA driver support 8/16/32bits stereo/mono raw audio data transfer, since the EDMA doesn't support 24bit data width, so application should pre-convert the 24bit data to 32bit. SAI SDMA driver support 8/16/24/32bits stereo/mono raw audio data transfer. </p>
<h2>Frame configuration</h2>
<p>SAI driver support I2S, DSP, Left justified, Right justified, TDM mode. Application can call the api directly: SAI_GetClassicI2SConfig SAI_GetLeftJustifiedConfig SAI_GetRightJustifiedConfig SAI_GetTDMConfig SAI_GetDSPConfig</p>
<h1><aclass="anchor"id="SAICase"></a>
Typical use case</h1>
<h2><aclass="anchor"id="SAICaseInterrupt"></a>
SAI Send/receive using an interrupt method</h2>
<p>Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/sai </p>
<h2><aclass="anchor"id="SAICaseDma"></a>
SAI Send/receive using a DMA method</h2>
<p>Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/sai </p>