RAFW Flexible Software Package Documentation  Release v2.0.1

 
I2S

Functions

fsp_err_t R_I2S_W_Open (i2s_ctrl_t *const p_ctrl, i2s_cfg_t const *const p_cfg)
 
fsp_err_t R_I2S_W_Write (i2s_ctrl_t *const p_ctrl, void const *const p_src, uint32_t const bytes)
 
fsp_err_t R_I2S_W_Read (i2s_ctrl_t *const p_ctrl, void *const p_dest, uint32_t const bytes)
 
fsp_err_t R_I2S_W_WriteRead (i2s_ctrl_t *const p_ctrl, void const *const p_src, void *const p_dest, uint32_t const bytes)
 
fsp_err_t R_I2S_W_Stop (i2s_ctrl_t *const p_ctrl)
 
fsp_err_t R_I2S_W_Mute (i2s_ctrl_t *const p_ctrl, i2s_mute_t const mute_enable)
 
fsp_err_t R_I2S_W_StatusGet (i2s_ctrl_t *const p_ctrl, i2s_status_t *const p_status)
 
fsp_err_t R_I2S_W_Close (i2s_ctrl_t *const p_ctrl)
 
fsp_err_t R_I2S_W_CallbackSet (i2s_ctrl_t *const p_api_ctrl, void(*p_callback)(i2s_callback_args_t *), void *const p_context, i2s_callback_args_t *const p_callback_memory)
 

Detailed Description

Function Documentation

◆ R_I2S_W_Open()

fsp_err_t R_I2S_W_Open ( i2s_ctrl_t *const  p_ctrl,
i2s_cfg_t const *const  p_cfg 
)

Opens the I2S. Implements i2s_api_t::open.

This function sets this clock divisor and the configurations specified in i2s_cfg_t. It also opens the timer and transfer instances if they are provided.

Return values
FSP_SUCCESSReady for I2S communication.
FSP_ERR_ASSERTIONThe pointer to p_ctrl or p_cfg is null.
FSP_ERR_ALREADY_OPENThe control block has already been opened.
FSP_ERR_IP_CHANNEL_NOT_PRESENTChannel number is not available on this MCU.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

◆ R_I2S_W_Write()

fsp_err_t R_I2S_W_Write ( i2s_ctrl_t *const  p_ctrl,
void const *const  p_src,
uint32_t const  bytes 
)

Writes data buffer to I2S. Implements i2s_api_t::write.

This function resets the transfer if the transfer interface is used, or writes the length of data that fits in the FIFO then stores the remaining write buffer in the control block to be written in the ISR.

Write() cannot be called if another write(), read() or writeRead() operation is in progress. Write can be called when the I2S is idle, or after the I2S_EVENT_TX_EMPTY event.

Return values
FSP_SUCCESSWrite initiated successfully.
FSP_ERR_ASSERTIONThe pointer to p_ctrl or p_src was null, or bytes requested was 0.
FSP_ERR_IN_USEAnother transfer is in progress, data was not written.
FSP_ERR_NOT_OPENThe channel is not opened.
FSP_ERR_UNDERFLOWA transmit underflow error is pending. Wait for the I2S to go idle before resuming communication.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

◆ R_I2S_W_Read()

fsp_err_t R_I2S_W_Read ( i2s_ctrl_t *const  p_ctrl,
void *const  p_dest,
uint32_t const  bytes 
)

Reads data into provided buffer. Implements i2s_api_t::read.

This function resets the transfer if the transfer interface is used, or reads the length of data available in the FIFO then stores the remaining read buffer in the control block to be filled in the ISR.

Read() cannot be called if another write(), read() or writeRead() operation is in progress. Read can be called when the I2S is idle, or after the I2S_EVENT_RX_FULL event.

Return values
FSP_SUCCESSRead initiated successfully.
FSP_ERR_IN_USEPeripheral is in the wrong mode or not idle.
FSP_ERR_ASSERTIONThe pointer to p_ctrl or p_dest was null, or bytes requested was 0.
FSP_ERR_NOT_OPENThe channel is not opened.
FSP_ERR_OVERFLOWA receive overflow error is pending. Wait for the I2S to go idle before resuming communication.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

◆ R_I2S_W_WriteRead()

fsp_err_t R_I2S_W_WriteRead ( i2s_ctrl_t *const  p_ctrl,
void const *const  p_src,
void *const  p_dest,
uint32_t const  bytes 
)

Writes from source buffer and reads data into destination buffer. Implements i2s_api_t::writeRead.

writeRead() cannot be called if another write(), read() or writeRead() operation is in progress. writeRead() can be called when the I2S is idle, or after the I2S_EVENT_RX_FULL event.

Return values
FSP_SUCCESSWrite and read initiated successfully.
FSP_ERR_IN_USEPeripheral is in the wrong mode or not idle.
FSP_ERR_ASSERTIONAn input parameter was invalid.
FSP_ERR_NOT_OPENThe channel is not opened.
FSP_ERR_UNDERFLOWA transmit underflow error is pending. Wait for the I2S to go idle before resuming communication.
FSP_ERR_OVERFLOWA receive overflow error is pending. Wait for the I2S to go idle before resuming communication.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

◆ R_I2S_W_Stop()

fsp_err_t R_I2S_W_Stop ( i2s_ctrl_t *const  p_ctrl)

Stops I2S. Implements i2s_api_t::stop.

This function disables both transmission and reception, and disables any transfer instances used.

The I2S will stop on the next frame boundary. Do not restart I2S until it is idle.

Return values
FSP_SUCCESSI2S communication stop request issued.
FSP_ERR_ASSERTIONThe pointer to p_ctrl was null.
FSP_ERR_NOT_OPENThe channel is not opened.
Returns
See Common Error Codes or lower level drivers for other possible return codes.

◆ R_I2S_W_Mute()

fsp_err_t R_I2S_W_Mute ( i2s_ctrl_t *const  p_ctrl,
i2s_mute_t const  mute_enable 
)

Mutes I2S on the next frame boundary. Implements i2s_api_t::mute.

Data is still written while mute is enabled, but the transmit line outputs zeros.

Return values
FSP_SUCCESSTransmission is muted.
FSP_ERR_ASSERTIONThe pointer to p_ctrl was null.
FSP_ERR_NOT_OPENThe channel is not opened.

◆ R_I2S_W_StatusGet()

fsp_err_t R_I2S_W_StatusGet ( i2s_ctrl_t *const  p_ctrl,
i2s_status_t *const  p_status 
)

Gets I2S status and stores it in provided pointer p_status. Implements i2s_api_t::statusGet.

Return values
FSP_SUCCESSInformation stored successfully.
FSP_ERR_ASSERTIONThe p_instance_ctrl or p_status parameter was null.
FSP_ERR_NOT_OPENThe channel is not opened.

◆ R_I2S_W_Close()

fsp_err_t R_I2S_W_Close ( i2s_ctrl_t *const  p_ctrl)

Closes I2S. Implements i2s_api_t::close.

This function powers down the I2S and closes the lower level timer and transfer drivers if they are used.

Return values
FSP_SUCCESSDevice closed successfully.
FSP_ERR_ASSERTIONThe pointer to p_ctrl was null.
FSP_ERR_NOT_OPENThe channel is not opened.

◆ R_I2S_W_CallbackSet()

fsp_err_t R_I2S_W_CallbackSet ( i2s_ctrl_t *const  p_api_ctrl,
void(*)(i2s_callback_args_t *)  p_callback,
void *const  p_context,
i2s_callback_args_t *const  p_callback_memory 
)

Updates the user callback and has option of providing memory for callback structure. Implements i2s_api_t::callbackSet

Return values
FSP_SUCCESSCallback updated successfully.
FSP_ERR_ASSERTIONA required pointer is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_NO_CALLBACK_MEMORYp_callback is non-secure and p_callback_memory is either secure or NULL.