I2S HALY

group nrfy_i2s

Hardware access layer with cache and barrier support for managing the I2S peripheral.

Functions

NRFY_STATIC_INLINE void nrfy_i2s_periph_configure(NRF_I2S_Type *p_reg, nrfy_i2s_config_t const *p_config)

Function for configuring the I2S.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_config[in] Pointer to the peripheral configuration structure.

NRFY_STATIC_INLINE void nrfy_i2s_int_init(NRF_I2S_Type *p_reg, uint32_t mask, uint8_t irq_priority, bool enable)

Function for initializing the specified I2S interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be initialized.

  • irq_priority[in] Interrupt priority.

  • enable[in] True if interrupts are to be enabled, false otherwise.

NRFY_STATIC_INLINE void nrfy_i2s_int_uninit(NRF_I2S_Type *p_reg)

Function for uninitializing the I2S interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE uint32_t nrfy_i2s_events_process(NRF_I2S_Type *p_reg, uint32_t mask, nrfy_i2s_xfer_desc_t *p_xfer)

Function for processing the specified I2S events.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of events to be processed, created by NRFY_EVENT_TO_INT_BITMASK().

  • p_xfer[in] Pointer to the structure containing buffers associated with the last transaction. Can be NULL.

Returns:

Mask of events that were generated and processed. To be checked against the result of NRFY_EVENT_TO_INT_BITMASK().

NRFY_STATIC_INLINE void nrfy_i2s_buffers_set(NRF_I2S_Type *p_reg, nrfy_i2s_xfer_desc_t const *p_xfer)

Function for setting the I2S transaction buffers.

If the transfer in a given direction is not required, pass NULL instead of the pointer to the corresponding buffer.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_xfer[in] Pointer to the structure containing transaction buffers.

NRFY_STATIC_INLINE void nrfy_i2s_xfer_start(NRF_I2S_Type *p_reg, nrfy_i2s_xfer_desc_t const *p_xfer)

Function for starting the I2S transaction.

If the transfer in a given direction is not required, pass NULL instead of the pointer to the corresponding buffer.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_xfer[in] Pointer to the structure containing transaction buffers if the transaction is to be blocking. NULL for non-blocking transactions.

NRFY_STATIC_INLINE void nrfy_i2s_abort(NRF_I2S_Type *p_reg, nrfy_i2s_xfer_desc_t const *p_xfer)

Function for aborting the ongoing I2S transaction.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_xfer[in] Pointer to the structure containing transaction buffers if the abort is to be blocking. NULL for non-blocking operation.

NRFY_STATIC_INLINE void nrfy_i2s_pins_get(NRF_I2S_Type const *p_reg, nrf_i2s_pins_t *p_pins)

Function for getting the pins selection.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_pins[in] Pointer to the I2S pin configuration structure.

NRFY_STATIC_INLINE void nrfy_i2s_task_trigger(NRF_I2S_Type *p_reg, nrf_i2s_task_t task)

See also

nrf_i2s_task_trigger Function for activating the specified I2S task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task to be activated.

NRFY_STATIC_INLINE uint32_t nrfy_i2s_task_address_get(NRF_I2S_Type const *p_reg, nrf_i2s_task_t task)

See also

nrf_i2s_task_address_get Function for getting the address of the specified I2S task register.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Specified task.

Returns:

Address of the specified task register.

NRFY_STATIC_INLINE void nrfy_i2s_event_clear(NRF_I2S_Type *p_reg, nrf_i2s_event_t event)

See also

nrf_i2s_event_clear Function for clearing the specified I2S event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to clear.

NRFY_STATIC_INLINE bool nrfy_i2s_event_check(NRF_I2S_Type const *p_reg, nrf_i2s_event_t event)

See also

nrf_i2s_event_check Function for retrieving the state of the I2S event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to be checked.

Return values:
  • true – The event has been generated.

  • false – The event has not been generated.

NRFY_STATIC_INLINE uint32_t nrfy_i2s_event_address_get(NRF_I2S_Type const *p_reg, nrf_i2s_event_t event)

See also

nrf_i2s_event_address_get Function for getting the address of the specified I2S event register.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Specified event.

Returns:

Address of the specified event register.

NRFY_STATIC_INLINE void nrfy_i2s_int_enable(NRF_I2S_Type *p_reg, uint32_t mask)

See also

nrf_i2s_int_enable Function for enabling specified interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be enabled. Use nrf_i2s_int_mask_t values for bit masking.

NRFY_STATIC_INLINE void nrfy_i2s_int_disable(NRF_I2S_Type *p_reg, uint32_t mask)

See also

nrf_i2s_int_disable Function for disabling specified interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be disabled. Use nrf_i2s_int_mask_t values for bit masking.

NRFY_STATIC_INLINE uint32_t nrfy_i2s_int_enable_check(NRF_I2S_Type const *p_reg, uint32_t mask)

See also

nrf_i2s_int_enable_check Function for checking if the specified interrupts are enabled.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be checked. Use nrf_i2s_int_mask_t values for bit masking.

Returns:

Mask of enabled interrupts.

NRFY_STATIC_INLINE void nrfy_i2s_enable(NRF_I2S_Type *p_reg)

See also

nrf_i2s_enable Function for enabling the I2S peripheral.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE void nrfy_i2s_disable(NRF_I2S_Type *p_reg)

See also

nrf_i2s_disable Function for disabling the I2S peripheral.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE void nrfy_i2s_subscribe_set(NRF_I2S_Type *p_reg, nrf_i2s_task_t task, uint8_t channel)

See also

nrf_i2s_subscribe_set Function for setting the subscribe configuration for a given I2S task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task for which to set the configuration.

  • channel[in] Channel through which to subscribe events.

NRFY_STATIC_INLINE void nrfy_i2s_subscribe_clear(NRF_I2S_Type *p_reg, nrf_i2s_task_t task)

See also

nrf_i2s_subscribe_clear Function for clearing the subscribe configuration for a given I2S task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task for which to clear the configuration.

NRFY_STATIC_INLINE void nrfy_i2s_publish_set(NRF_I2S_Type *p_reg, nrf_i2s_event_t event, uint8_t channel)

See also

nrf_i2s_publish_set Function for setting the publish configuration for a given I2S event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event for which to set the configuration.

  • channel[in] Channel through which to publish the event.

NRFY_STATIC_INLINE void nrfy_i2s_publish_clear(NRF_I2S_Type *p_reg, nrf_i2s_event_t event)

See also

nrf_i2s_publish_clear Function for clearing the publish configuration for a given I2S event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event for which to clear the configuration.

NRFY_STATIC_INLINE void nrfy_i2s_pins_set(NRF_I2S_Type *p_reg, nrf_i2s_pins_t const *p_pins)

See also

nrf_i2s_pins_set 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.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_pins[in] Pointer to the structure with pins selection.

NRFY_STATIC_INLINE uint32_t nrfy_i2s_sck_pin_get(NRF_I2S_Type const *p_reg)

See also

nrf_i2s_sck_pin_get Function for getting the SCK pin selection.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

SCK pin selection.

NRFY_STATIC_INLINE uint32_t nrfy_i2s_lrck_pin_get(NRF_I2S_Type const *p_reg)

See also

nrf_i2s_lrck_pin_get Function for getting the LRCK pin selection.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

LRCK pin selection.

NRFY_STATIC_INLINE uint32_t nrfy_i2s_mck_pin_get(NRF_I2S_Type const *p_reg)

See also

nrf_i2s_mck_pin_get Function for getting the MCK pin selection.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

MCK pin selection.

NRFY_STATIC_INLINE uint32_t nrfy_i2s_sdout_pin_get(NRF_I2S_Type const *p_reg)

See also

nrf_i2s_sdout_pin_get Function for getting the SDOUT pin selection.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

SDOUT pin selection.

NRFY_STATIC_INLINE uint32_t nrfy_i2s_sdin_pin_get(NRF_I2S_Type const *p_reg)

See also

nrf_i2s_sdin_pin_get Function for getting the SDIN pin selection.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

SDIN pin selection.

NRFY_STATIC_INLINE void nrfy_i2s_configure(NRF_I2S_Type *p_reg, nrf_i2s_config_t const *p_config)

See also

nrf_i2s_configure Function for setting the I2S peripheral configuration.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_config[in] Pointer to the structure with configuration.

NRFY_STATIC_INLINE void nrfy_i2s_transfer_set(NRF_I2S_Type *p_reg, uint16_t size, uint32_t *p_rx_buffer, uint32_t const *p_tx_buffer)

See also

nrf_i2s_transfer_set 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.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • size[in] Size of the buffers (in 32-bit words).

  • p_rx_buffer[in] Pointer to the receive buffer. Pass NULL to disable reception.

  • p_tx_buffer[in] Pointer to the transmit buffer. Pass NULL to disable transmission.

NRFY_STATIC_INLINE void nrfy_i2s_rx_buffer_set(NRF_I2S_Type *p_reg, uint32_t *p_buffer)

See also

nrf_i2s_rx_buffer_set Function for setting the pointer to the receive buffer.

Note

The size of the buffer can be set only by calling nrf_i2s_transfer_set.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_buffer[in] Pointer to the receive buffer.

NRFY_STATIC_INLINE uint32_t *nrfy_i2s_rx_buffer_get(NRF_I2S_Type const *p_reg)

See also

nrf_i2s_rx_buffer_get Function for getting the pointer to the receive buffer.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Pointer to the receive buffer.

NRFY_STATIC_INLINE void nrfy_i2s_tx_buffer_set(NRF_I2S_Type *p_reg, uint32_t const *p_buffer)

See also

nrf_i2s_tx_buffer_set Function for setting the pointer to the transmit buffer.

Note

The size of the buffer can be set only by calling nrf_i2s_transfer_set.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_buffer[in] Pointer to the transmit buffer.

NRFY_STATIC_INLINE uint32_t *nrfy_i2s_tx_buffer_get(NRF_I2S_Type const *p_reg)

See also

nrf_i2s_tx_buffer_get Function for getting the pointer to the transmit buffer.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Pointer to the transmit buffer.

struct nrfy_i2s_config_t
#include <nrfy_i2s.h>

Structure for I2S configuration.

Public Members

nrf_i2s_config_t config

Peripheral configuration.

nrf_i2s_pins_t pins

Pins to be used.

bool skip_psel_cfg

Skip pin selection configuration.

When set to true, the driver does not modify pin select registers in the peripheral. Those registers are supposed to be set up externally before the driver is initialized.

Note

When both GPIO configuration and pin selection are to be skipped, the structure fields that specify pins can be omitted, as they are ignored anyway.

struct nrfy_i2s_buffers_t
#include <nrfy_i2s.h>

I2S driver buffers structure.

Public Members

uint32_t *p_rx_buffer

Pointer to the buffer for received data.

uint32_t const *p_tx_buffer

Pointer to the buffer with data to be sent.

struct nrfy_i2s_xfer_desc_t
#include <nrfy_i2s.h>

Structure describing single I2S transfer.

Public Members

uint32_t *p_rx_buffer

Pointer to the buffer for received data.

uint32_t const *p_tx_buffer

Pointer to the buffer with data to be sent.

uint16_t buffer_size

Size of buffers.