Quentin Roche / ST_I2S

Dependents:   X_NUCLEO_CCA02M1

Fork of ST_I2S by ST

Embed: (wiki syntax)

« Back to documentation index

Asynchronous I2S Hardware Abstraction Layer

Asynchronous I2S Hardware Abstraction Layer

Functions

void i2s_transfer (i2s_t *obj, void *tx, int tx_length, void *rx, int rx_length, bool circular, i2s_dma_prio_t prio, uint32_t handler_tx, uint32_t handler_rx, uint32_t event)
 Begin the I2S transfer.
uint32_t i2s_irq_handler_asynch (i2s_t *obj, uint8_t direction)
 The asynchronous IRQ handler.
uint8_t i2s_active (i2s_t *obj)
 Attempts to determine if the I2S peripheral is already in use.
void i2s_abort_asynch (i2s_t *obj)
 Abort an I2S transfer.
int8_t i2s_harmonize (i2s_t *dev_i2s_1, uint32_t *freq_i2s_1, i2s_t *dev_i2s_2, uint32_t *freq_i2s_2)
 Harmonize frequencies of two I2S devices TODO: doxygen description.

Function Documentation

void i2s_abort_asynch ( i2s_t obj )

Abort an I2S transfer.

Parameters:
objThe I2S peripheral to stop
uint8_t i2s_active ( i2s_t obj )

Attempts to determine if the I2S peripheral is already in use.

For each assigned buffer, check if the corresponding buffer position is less than the buffer length. If buffers do not indicate activity, check if there are any bytes in the FIFOs.

Parameters:
[in]objThe I2S object to check for activity
Returns:
Non-zero if the I2S port is active or zero if it is not.
int8_t i2s_harmonize ( i2s_t dev_i2s_1,
uint32_t *  freq_i2s_1,
i2s_t dev_i2s_2,
uint32_t *  freq_i2s_2 
)

Harmonize frequencies of two I2S devices TODO: doxygen description.

Returns:
Zero if the frequencies have been harmonized correctly, -1 otherwise.
uint32_t i2s_irq_handler_asynch ( i2s_t obj,
uint8_t  direction 
)

The asynchronous IRQ handler.

Reads the received values out of the RX FIFO, writes values into the TX FIFO and checks for transfer termination conditions, such as buffer overflows or transfer complete.

Parameters:
[in]objThe I2S object that holds the transfer information
[in]directionFrom whom is the irq coming (RX or TX)
Returns:
Event flags if a transfer termination condition was met; otherwise 0.
void i2s_transfer ( i2s_t obj,
void *  tx,
int  tx_length,
void *  rx,
int  rx_length,
bool  circular,
i2s_dma_prio_t  prio,
uint32_t  handler_tx,
uint32_t  handler_rx,
uint32_t  event 
)

Begin the I2S transfer.

Buffer pointers and lengths are specified in tx_buff and rx_buff

Parameters:
[in]objThe I2S object that holds the transfer information
[in]txThe transmit buffer
[in]tx_lengthThe number of bytes to transmit
[in]rxThe receive buffer
[in]rx_lengthThe number of bytes to receive
[in]circularEnable circular buffer transfer
[in]prioDMA priority of the transfer
[in]handler_txI2S tx interrupt handler
[in]handler_rxI2S rx interrupt handler
[in]eventThe logical OR of events to be registered