Kinetis SDK v.1.3 API Reference Manual
Rev. 0
Freescale Semiconductor, Inc.
|
This section describes the programming interface of the FlexIO I2S Peripheral driver. The FlexIO I2S Peripheral driver provides functions for a I2S device to send and receive data.
The driver uses an instantiation of the flexio_i2s_handler_t structure to maintain the current state of a particular FlexIO-simulated I2S driver. This structures holds data that is used by the FlexIO-simulated I2S Peripheral driver to communicate between the transmit and receive transfer functions and the interrupt handler. The interrupt handler also uses this information to keep track of its progress. Because the driver itself does not statically allocate memory, the caller provides memory for the driver state structure during initialization by providing a structure.
The FlexIO-simulated I2S driver uses instances of the user configuration structure flexio_i2s_config_t for the FlexIO-simulated I2S driver. The user settings include: I2S mode(master or slave), sample rate, audio data bit count, FlexIO base pin DMA source and the associated FlexIO timers, shifters, and pin.
The flexio_i2s_user configuration contents can be easily modified to configure the FlexIO I2S peripheral driver either to a different audio data format or using different FlexIO hardware resource. This is an example code to set up a user FlexIO I2S configuration instantiation:
The driver implements transmit and receive functions to transfer buffers of data in an interrupt and DAM methods. Both interrupt and DMA transfer functions are non-blocking. This code examples shows how to use the functions, assuming that the FLEXIO I2S module has been initialized as described previously in the Initialization Section.
Ensure that data is consistent when there is cache in memory and when using DMA to transfer data. In other words, when reading the data from memory, ensure that data from or to the memory device is not cached.
For blocking transfer functions transmit and receive: