Hardware access layer for managing the Inter-IC Sound (I2S) peripheral. More...
Data Structures | |
struct | nrf_i2s_config_t |
I2S configuration. More... | |
struct | nrf_i2s_pins_t |
I2S pins. More... | |
Macros | |
#define | NRF_I2S_HAS_CLKCONFIG 1 |
Symbol indicating whether clock source configuration is available. | |
#define | NRF_I2S_HAS_FRAMESTART 1 |
Symbol indicating whether frame start event is available. | |
#define | NRF_I2S_HAS_GPIO_PORT_SELECTION 1 |
Symbol indicating whether GPIO port selection for pins is available. | |
#define | NRF_I2S_HAS_SWIDTH_32BIT 1 |
Symbol indicating whether 32-bit sample width is available. | |
#define | NRF_I2S_PIN_NOT_CONNECTED 0xFFFFFFFF |
This value can be provided as a parameter for the nrf_i2s_pins_set function call to specify that the given I2S signal (SDOUT, SDIN, or MCK) shall not be connected to a physical pin. | |
#define | NRF_I2S_PSEL_SCK_PIN_MASK I2S_PSEL_SCK_PIN_Msk |
I2S SCK pin selection mask. | |
#define | NRF_I2S_PSEL_SCK_PORT_MASK I2S_PSEL_SCK_PORT_Msk |
I2S SCK port selection mask. | |
Enumerations | |
enum | nrf_i2s_task_t { NRF_I2S_TASK_START = offsetof(NRF_I2S_Type, TASKS_START) , NRF_I2S_TASK_STOP = offsetof(NRF_I2S_Type, TASKS_STOP) } |
I2S tasks. More... | |
enum | nrf_i2s_event_t { NRF_I2S_EVENT_RXPTRUPD = offsetof(NRF_I2S_Type, EVENTS_RXPTRUPD) , NRF_I2S_EVENT_TXPTRUPD = offsetof(NRF_I2S_Type, EVENTS_TXPTRUPD) , NRF_I2S_EVENT_STOPPED = offsetof(NRF_I2S_Type, EVENTS_STOPPED) , NRF_I2S_EVENT_FRAMESTART = offsetof(NRF_I2S_Type, EVENTS_FRAMESTART) } |
I2S events. More... | |
enum | nrf_i2s_int_mask_t { NRF_I2S_INT_RXPTRUPD_MASK = I2S_INTENSET_RXPTRUPD_Msk , NRF_I2S_INT_TXPTRUPD_MASK = I2S_INTENSET_TXPTRUPD_Msk , NRF_I2S_INT_STOPPED_MASK = I2S_INTENSET_STOPPED_Msk , NRF_I2S_INT_FRAMESTART_MASK = I2S_INTENCLR_FRAMESTART_Msk } |
I2S interrupts. More... | |
enum | nrf_i2s_mode_t { NRF_I2S_MODE_MASTER = I2S_CONFIG_MODE_MODE_Master , NRF_I2S_MODE_SLAVE = I2S_CONFIG_MODE_MODE_Slave } |
I2S modes of operation. More... | |
enum | nrf_i2s_mck_t { NRF_I2S_MCK_DISABLED = 0 , NRF_I2S_MCK_32MDIV2 = (int)I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV2 , NRF_I2S_MCK_32MDIV3 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV3 , NRF_I2S_MCK_32MDIV4 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV4 , NRF_I2S_MCK_32MDIV5 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV5 , NRF_I2S_MCK_32MDIV6 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV6 , NRF_I2S_MCK_32MDIV8 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV8 , NRF_I2S_MCK_32MDIV10 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV10 , NRF_I2S_MCK_32MDIV11 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV11 , NRF_I2S_MCK_32MDIV15 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV15 , NRF_I2S_MCK_32MDIV16 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV16 , NRF_I2S_MCK_32MDIV21 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV21 , NRF_I2S_MCK_32MDIV23 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV23 , NRF_I2S_MCK_32MDIV30 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV30 , NRF_I2S_MCK_32MDIV31 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV31 , NRF_I2S_MCK_32MDIV32 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV32 , NRF_I2S_MCK_32MDIV42 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV42 , NRF_I2S_MCK_32MDIV63 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV63 , NRF_I2S_MCK_32MDIV125 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV125 } |
I2S master clock generator settings. More... | |
enum | nrf_i2s_ratio_t { NRF_I2S_RATIO_32X = I2S_CONFIG_RATIO_RATIO_32X , NRF_I2S_RATIO_48X = I2S_CONFIG_RATIO_RATIO_48X , NRF_I2S_RATIO_64X = I2S_CONFIG_RATIO_RATIO_64X , NRF_I2S_RATIO_96X = I2S_CONFIG_RATIO_RATIO_96X , NRF_I2S_RATIO_128X = I2S_CONFIG_RATIO_RATIO_128X , NRF_I2S_RATIO_192X = I2S_CONFIG_RATIO_RATIO_192X , NRF_I2S_RATIO_256X = I2S_CONFIG_RATIO_RATIO_256X , NRF_I2S_RATIO_384X = I2S_CONFIG_RATIO_RATIO_384X , NRF_I2S_RATIO_512X = I2S_CONFIG_RATIO_RATIO_512X } |
I2S MCK/LRCK ratios. More... | |
enum | nrf_i2s_swidth_t { NRF_I2S_SWIDTH_8BIT = I2S_CONFIG_SWIDTH_SWIDTH_8Bit , NRF_I2S_SWIDTH_16BIT = I2S_CONFIG_SWIDTH_SWIDTH_16Bit , NRF_I2S_SWIDTH_24BIT = I2S_CONFIG_SWIDTH_SWIDTH_24Bit , NRF_I2S_SWIDTH_32BIT = I2S_CONFIG_SWIDTH_SWIDTH_32Bit , NRF_I2S_SWIDTH_8BIT_IN16BIT = I2S_CONFIG_SWIDTH_SWIDTH_8BitIn16 , NRF_I2S_SWIDTH_8BIT_IN32BIT = I2S_CONFIG_SWIDTH_SWIDTH_8BitIn32 , NRF_I2S_SWIDTH_16BIT_IN32BIT = I2S_CONFIG_SWIDTH_SWIDTH_16BitIn32 , NRF_I2S_SWIDTH_24BIT_IN32BIT = I2S_CONFIG_SWIDTH_SWIDTH_24BitIn32 } |
I2S sample widths. More... | |
enum | nrf_i2s_align_t { NRF_I2S_ALIGN_LEFT = I2S_CONFIG_ALIGN_ALIGN_Left , NRF_I2S_ALIGN_RIGHT = I2S_CONFIG_ALIGN_ALIGN_Right } |
I2S alignments of sample within a frame. More... | |
enum | nrf_i2s_format_t { NRF_I2S_FORMAT_I2S = I2S_CONFIG_FORMAT_FORMAT_I2S , NRF_I2S_FORMAT_ALIGNED = I2S_CONFIG_FORMAT_FORMAT_Aligned } |
I2S frame formats. More... | |
enum | nrf_i2s_channels_t { NRF_I2S_CHANNELS_STEREO = I2S_CONFIG_CHANNELS_CHANNELS_Stereo , NRF_I2S_CHANNELS_LEFT = I2S_CONFIG_CHANNELS_CHANNELS_Left , NRF_I2S_CHANNELS_RIGHT = I2S_CONFIG_CHANNELS_CHANNELS_Right } |
I2S enabled channels. More... | |
enum | nrf_i2s_clksrc_t { NRF_I2S_CLKSRC_PCLK32M = I2S_CONFIG_CLKCONFIG_CLKSRC_PCLK32M , NRF_I2S_CLKSRC_ACLK = I2S_CONFIG_CLKCONFIG_CLKSRC_ACLK } |
I2S Clock source selection. More... | |
Functions | |
NRF_STATIC_INLINE void | nrf_i2s_task_trigger (NRF_I2S_Type *p_reg, nrf_i2s_task_t task) |
Function for activating the specified I2S task. | |
NRF_STATIC_INLINE uint32_t | nrf_i2s_task_address_get (NRF_I2S_Type const *p_reg, nrf_i2s_task_t task) |
Function for getting the address of the specified I2S task register. | |
NRF_STATIC_INLINE void | nrf_i2s_event_clear (NRF_I2S_Type *p_reg, nrf_i2s_event_t event) |
Function for clearing the specified I2S event. | |
NRF_STATIC_INLINE bool | nrf_i2s_event_check (NRF_I2S_Type const *p_reg, nrf_i2s_event_t event) |
Function for retrieving the state of the I2S event. | |
NRF_STATIC_INLINE uint32_t | nrf_i2s_event_address_get (NRF_I2S_Type const *p_reg, nrf_i2s_event_t event) |
Function for getting the address of the specified I2S event register. | |
NRF_STATIC_INLINE void | nrf_i2s_int_enable (NRF_I2S_Type *p_reg, uint32_t mask) |
Function for enabling specified interrupts. | |
NRF_STATIC_INLINE void | nrf_i2s_int_disable (NRF_I2S_Type *p_reg, uint32_t mask) |
Function for disabling specified interrupts. | |
NRF_STATIC_INLINE uint32_t | nrf_i2s_int_enable_check (NRF_I2S_Type const *p_reg, uint32_t mask) |
Function for checking if the specified interrupts are enabled. | |
NRF_STATIC_INLINE void | nrf_i2s_enable (NRF_I2S_Type *p_reg) |
Function for enabling the I2S peripheral. | |
NRF_STATIC_INLINE void | nrf_i2s_disable (NRF_I2S_Type *p_reg) |
Function for disabling the I2S peripheral. | |
NRF_STATIC_INLINE void | nrf_i2s_subscribe_set (NRF_I2S_Type *p_reg, nrf_i2s_task_t task, uint8_t channel) |
Function for setting the subscribe configuration for a given I2S task. | |
NRF_STATIC_INLINE void | nrf_i2s_subscribe_clear (NRF_I2S_Type *p_reg, nrf_i2s_task_t task) |
Function for clearing the subscribe configuration for a given I2S task. | |
NRF_STATIC_INLINE void | nrf_i2s_publish_set (NRF_I2S_Type *p_reg, nrf_i2s_event_t event, uint8_t channel) |
Function for setting the publish configuration for a given I2S event. | |
NRF_STATIC_INLINE void | nrf_i2s_publish_clear (NRF_I2S_Type *p_reg, nrf_i2s_event_t event) |
Function for clearing the publish configuration for a given I2S event. | |
NRF_STATIC_INLINE void | nrf_i2s_pins_set (NRF_I2S_Type *p_reg, nrf_i2s_pins_t const *p_pins) |
Function for configuring I2S pins. | |
NRF_STATIC_INLINE uint32_t | nrf_i2s_sck_pin_get (NRF_I2S_Type const *p_reg) |
Function for getting the SCK pin selection. | |
NRF_STATIC_INLINE uint32_t | nrf_i2s_lrck_pin_get (NRF_I2S_Type const *p_reg) |
Function for getting the LRCK pin selection. | |
NRF_STATIC_INLINE uint32_t | nrf_i2s_mck_pin_get (NRF_I2S_Type const *p_reg) |
Function for getting the MCK pin selection. | |
NRF_STATIC_INLINE uint32_t | nrf_i2s_sdout_pin_get (NRF_I2S_Type const *p_reg) |
Function for getting the SDOUT pin selection. | |
NRF_STATIC_INLINE uint32_t | nrf_i2s_sdin_pin_get (NRF_I2S_Type const *p_reg) |
Function for getting the SDIN pin selection. | |
NRF_STATIC_INLINE void | nrf_i2s_configure (NRF_I2S_Type *p_reg, nrf_i2s_config_t const *p_config) |
Function for setting the I2S peripheral configuration. | |
NRF_STATIC_INLINE void | nrf_i2s_transfer_set (NRF_I2S_Type *p_reg, uint16_t size, uint32_t *p_rx_buffer, uint32_t const *p_tx_buffer) |
Function for setting up the I2S transfer. | |
NRF_STATIC_INLINE void | nrf_i2s_rx_buffer_set (NRF_I2S_Type *p_reg, uint32_t *p_buffer) |
Function for setting the pointer to the receive buffer. | |
NRF_STATIC_INLINE uint32_t * | nrf_i2s_rx_buffer_get (NRF_I2S_Type const *p_reg) |
Function for getting the pointer to the receive buffer. | |
NRF_STATIC_INLINE void | nrf_i2s_tx_buffer_set (NRF_I2S_Type *p_reg, uint32_t const *p_buffer) |
Function for setting the pointer to the transmit buffer. | |
NRF_STATIC_INLINE uint32_t * | nrf_i2s_tx_buffer_get (NRF_I2S_Type const *p_reg) |
Function for getting the pointer to the transmit buffer. | |
NRF_STATIC_INLINE void | nrf_i2s_clk_configure (NRF_I2S_Type *p_reg, nrf_i2s_clksrc_t clksrc, bool enable_bypass) |
Function for configuring I2S Clock. | |
Hardware access layer for managing the Inter-IC Sound (I2S) peripheral.
enum nrf_i2s_align_t |
enum nrf_i2s_channels_t |
enum nrf_i2s_clksrc_t |
enum nrf_i2s_event_t |
I2S events.
enum nrf_i2s_format_t |
enum nrf_i2s_int_mask_t |
enum nrf_i2s_mck_t |
I2S master clock generator settings.
enum nrf_i2s_mode_t |
enum nrf_i2s_ratio_t |
I2S MCK/LRCK ratios.
enum nrf_i2s_swidth_t |
I2S sample widths.
enum nrf_i2s_task_t |
NRF_STATIC_INLINE void nrf_i2s_clk_configure | ( | NRF_I2S_Type * | p_reg, |
nrf_i2s_clksrc_t | clksrc, | ||
bool | enable_bypass | ||
) |
Function for configuring I2S Clock.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | clksrc | I2S Clock source selection. |
[in] | enable_bypass | Bypass clock generator. MCK will be equal to source input. If bypass is enabled the MCKFREQ setting has no effect. |
NRF_STATIC_INLINE void nrf_i2s_configure | ( | NRF_I2S_Type * | p_reg, |
nrf_i2s_config_t const * | p_config | ||
) |
Function for setting the I2S peripheral configuration.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | p_config | Pointer to the structure with configuration. |
NRF_STATIC_INLINE void nrf_i2s_disable | ( | NRF_I2S_Type * | p_reg | ) |
Function for disabling the I2S peripheral.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_i2s_enable | ( | NRF_I2S_Type * | p_reg | ) |
Function for enabling the I2S peripheral.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_i2s_event_address_get | ( | NRF_I2S_Type const * | p_reg, |
nrf_i2s_event_t | event | ||
) |
Function for getting the address of the specified I2S event register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Specified event. |
NRF_STATIC_INLINE bool nrf_i2s_event_check | ( | NRF_I2S_Type const * | p_reg, |
nrf_i2s_event_t | event | ||
) |
Function for retrieving the state of the I2S event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event to be checked. |
true | The event has been generated. |
false | The event has not been generated. |
NRF_STATIC_INLINE void nrf_i2s_event_clear | ( | NRF_I2S_Type * | p_reg, |
nrf_i2s_event_t | event | ||
) |
Function for clearing the specified I2S event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event to clear. |
NRF_STATIC_INLINE void nrf_i2s_int_disable | ( | NRF_I2S_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for disabling specified interrupts.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be disabled. Use nrf_i2s_int_mask_t values for bit masking. |
NRF_STATIC_INLINE void nrf_i2s_int_enable | ( | NRF_I2S_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for enabling specified interrupts.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be enabled. Use nrf_i2s_int_mask_t values for bit masking. |
NRF_STATIC_INLINE uint32_t nrf_i2s_int_enable_check | ( | NRF_I2S_Type const * | p_reg, |
uint32_t | mask | ||
) |
Function for checking if the specified interrupts are enabled.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be checked. Use nrf_i2s_int_mask_t values for bit masking. |
NRF_STATIC_INLINE uint32_t nrf_i2s_lrck_pin_get | ( | NRF_I2S_Type const * | p_reg | ) |
Function for getting the LRCK pin selection.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_i2s_mck_pin_get | ( | NRF_I2S_Type const * | p_reg | ) |
Function for getting the MCK pin selection.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_i2s_pins_set | ( | NRF_I2S_Type * | p_reg, |
nrf_i2s_pins_t const * | p_pins | ||
) |
Function for configuring I2S pins.
Usage of the SDOUT, SDIN, and MCK signals is optional. If a given signal is not needed, pass the NRF_I2S_PIN_NOT_CONNECTED value instead of its pin number.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | p_pins | Pointer to the structure with pins selection. |
NRF_STATIC_INLINE void nrf_i2s_publish_clear | ( | NRF_I2S_Type * | p_reg, |
nrf_i2s_event_t | event | ||
) |
Function for clearing the publish configuration for a given I2S event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event for which to clear the configuration. |
NRF_STATIC_INLINE void nrf_i2s_publish_set | ( | NRF_I2S_Type * | p_reg, |
nrf_i2s_event_t | event, | ||
uint8_t | channel | ||
) |
Function for setting the publish configuration for a given I2S event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event for which to set the configuration. |
[in] | channel | Channel through which to publish the event. |
NRF_STATIC_INLINE uint32_t * nrf_i2s_rx_buffer_get | ( | NRF_I2S_Type const * | p_reg | ) |
Function for getting the pointer to the receive buffer.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_i2s_rx_buffer_set | ( | NRF_I2S_Type * | p_reg, |
uint32_t * | p_buffer | ||
) |
Function for setting the pointer to the receive buffer.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | p_buffer | Pointer to the receive buffer. |
NRF_STATIC_INLINE uint32_t nrf_i2s_sck_pin_get | ( | NRF_I2S_Type const * | p_reg | ) |
Function for getting the SCK pin selection.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_i2s_sdin_pin_get | ( | NRF_I2S_Type const * | p_reg | ) |
Function for getting the SDIN pin selection.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_i2s_sdout_pin_get | ( | NRF_I2S_Type const * | p_reg | ) |
Function for getting the SDOUT pin selection.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_i2s_subscribe_clear | ( | NRF_I2S_Type * | p_reg, |
nrf_i2s_task_t | task | ||
) |
Function for clearing the subscribe configuration for a given I2S task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task for which to clear the configuration. |
NRF_STATIC_INLINE void nrf_i2s_subscribe_set | ( | NRF_I2S_Type * | p_reg, |
nrf_i2s_task_t | task, | ||
uint8_t | channel | ||
) |
Function for setting the subscribe configuration for a given I2S task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task for which to set the configuration. |
[in] | channel | Channel through which to subscribe events. |
NRF_STATIC_INLINE uint32_t nrf_i2s_task_address_get | ( | NRF_I2S_Type const * | p_reg, |
nrf_i2s_task_t | task | ||
) |
Function for getting the address of the specified I2S task register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Specified task. |
NRF_STATIC_INLINE void nrf_i2s_task_trigger | ( | NRF_I2S_Type * | p_reg, |
nrf_i2s_task_t | task | ||
) |
Function for activating the specified I2S task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task to be activated. |
NRF_STATIC_INLINE void nrf_i2s_transfer_set | ( | NRF_I2S_Type * | p_reg, |
uint16_t | size, | ||
uint32_t * | p_rx_buffer, | ||
uint32_t const * | p_tx_buffer | ||
) |
Function for setting up the I2S transfer.
This function sets up the RX and TX buffers and enables reception or transmission (or both) accordingly. If the transfer in a given direction is not required, pass NULL instead of the pointer to the corresponding buffer.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | size | Size of the buffers (in 32-bit words). |
[in] | p_rx_buffer | Pointer to the receive buffer. Pass NULL to disable reception. |
[in] | p_tx_buffer | Pointer to the transmit buffer. Pass NULL to disable transmission. |
NRF_STATIC_INLINE uint32_t * nrf_i2s_tx_buffer_get | ( | NRF_I2S_Type const * | p_reg | ) |
Function for getting the pointer to the transmit buffer.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_i2s_tx_buffer_set | ( | NRF_I2S_Type * | p_reg, |
uint32_t const * | p_buffer | ||
) |
Function for setting the pointer to the transmit buffer.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | p_buffer | Pointer to the transmit buffer. |