nrfx 4.5.0
Loading...
Searching...
No Matches
TDM HAL

Hardware access layer for managing the Time Division Multiplexed Audio Interface (TDM) peripheral. More...

Data Structures

struct  nrf_tdm_config_t
 TDM configuration. More...
 
struct  nrf_tdm_pins_t
 TDM pins. More...
 

Macros

#define NRF_TDM_INST_GET(idx)
 Macro for getting a pointer to the structure of registers of the TDM peripheral.
 
#define NRF_TDM_PIN_NOT_CONNECTED   UINT32_MAX
 This value can be provided as a parameter for the nrf_tdm_pins_set function call to specify that the given TDM signal (SDOUT, SDIN, or MCK) shall not be connected to a physical pin.
 
#define NRF_TDM_PSEL_SCK_PIN_MASK   TDM_PSEL_SCK_PIN_Msk
 TDM SCK pin selection mask.
 
#define NRF_TDM_PSEL_SCK_PORT_MASK   TDM_PSEL_SCK_PORT_Msk
 TDM SCK port selection mask.
 
#define NRF_TDM_CK_DIV_MIN   TDM_CONFIG_MCK_DIV_DIV_Min
 Minimum value of TDM clock divisor.
 
#define NRF_TDM_CK_DIV_MAX   TDM_CONFIG_MCK_DIV_DIV_Max
 Maximum value of TDM clock divisor.
 

Enumerations

enum  nrf_tdm_task_t {
  NRF_TDM_TASK_START = offsetof(NRF_TDM_Type, TASKS_START) ,
  NRF_TDM_TASK_STOP = offsetof(NRF_TDM_Type, TASKS_STOP) ,
  NRF_TDM_TASK_ABORT = offsetof(NRF_TDM_Type, TASKS_ABORT)
}
 TDM tasks. More...
 
enum  nrf_tdm_event_t {
  NRF_TDM_EVENT_RXPTRUPD = offsetof(NRF_TDM_Type, EVENTS_RXPTRUPD) ,
  NRF_TDM_EVENT_STOPPED = offsetof(NRF_TDM_Type, EVENTS_STOPPED) ,
  NRF_TDM_EVENT_ABORTED = offsetof(NRF_TDM_Type, EVENTS_ABORTED) ,
  NRF_TDM_EVENT_TXPTRUPD = offsetof(NRF_TDM_Type, EVENTS_TXPTRUPD) ,
  NRF_TDM_EVENT_MAXCNT = offsetof(NRF_TDM_Type, EVENTS_MAXCNT)
}
 TDM events. More...
 
enum  nrf_tdm_int_mask_t {
  NRF_TDM_INT_RXPTRUPD_MASK_MASK = TDM_INTENSET_RXPTRUPD_Msk ,
  NRF_TDM_INT_STOPPED_MASK_MASK = TDM_INTENSET_STOPPED_Msk ,
  NRF_TDM_INT_ABORTED_MASK = TDM_INTENSET_ABORTED_Msk ,
  NRF_TDM_INT_TXPTRUPD_MASK_MASK = TDM_INTENSET_TXPTRUPD_Msk ,
  NRF_TDM_INT_MAXCNT_MASK = TDM_INTENSET_MAXCNT_Msk
}
 TDM interrupts. More...
 
enum  nrf_tdm_mode_t {
  NRF_TDM_MODE_MASTER = TDM_CONFIG_MODE_MODE_Master ,
  NRF_TDM_MODE_SLAVE = TDM_CONFIG_MODE_MODE_Slave
}
 TDM modes of operation. More...
 
enum  nrf_tdm_rxtxen_t {
  NRF_TDM_RXTXEN_DUPLEX = TDM_CONFIG_RXTXEN_RXTXEN_Duplex ,
  NRF_TDM_RXTXEN_RX = TDM_CONFIG_RXTXEN_RXTXEN_Rx ,
  NRF_TDM_RXTXEN_TX = TDM_CONFIG_RXTXEN_RXTXEN_Tx
}
 TDM Reception and transmission settings. More...
 
enum  nrf_tdm_mck_div_t {
  NRF_TDM_MCK_DIV_2 = TDM_CONFIG_MCK_DIV_DIV_CKDIV2 ,
  NRF_TDM_MCK_DIV_3 = TDM_CONFIG_MCK_DIV_DIV_CKDIV3 ,
  NRF_TDM_MCK_DIV_4 = TDM_CONFIG_MCK_DIV_DIV_CKDIV4 ,
  NRF_TDM_MCK_DIV_5 = TDM_CONFIG_MCK_DIV_DIV_CKDIV5 ,
  NRF_TDM_MCK_DIV_6 = TDM_CONFIG_MCK_DIV_DIV_CKDIV6 ,
  NRF_TDM_MCK_DIV_8 = TDM_CONFIG_MCK_DIV_DIV_CKDIV8 ,
  NRF_TDM_MCK_DIV_10 = TDM_CONFIG_MCK_DIV_DIV_CKDIV10 ,
  NRF_TDM_MCK_DIV_11 = TDM_CONFIG_MCK_DIV_DIV_CKDIV11 ,
  NRF_TDM_MCK_DIV_15 = TDM_CONFIG_MCK_DIV_DIV_CKDIV15 ,
  NRF_TDM_MCK_DIV_16 = TDM_CONFIG_MCK_DIV_DIV_CKDIV16 ,
  NRF_TDM_MCK_DIV_21 = TDM_CONFIG_MCK_DIV_DIV_CKDIV21 ,
  NRF_TDM_MCK_DIV_23 = TDM_CONFIG_MCK_DIV_DIV_CKDIV23 ,
  NRF_TDM_MCK_DIV_30 = TDM_CONFIG_MCK_DIV_DIV_CKDIV30 ,
  NRF_TDM_MCK_DIV_31 = TDM_CONFIG_MCK_DIV_DIV_CKDIV31 ,
  NRF_TDM_MCK_DIV_32 = TDM_CONFIG_MCK_DIV_DIV_CKDIV32 ,
  NRF_TDM_MCK_DIV_42 = TDM_CONFIG_MCK_DIV_DIV_CKDIV42 ,
  NRF_TDM_MCK_DIV_63 = TDM_CONFIG_MCK_DIV_DIV_CKDIV63 ,
  NRF_TDM_MCK_DIV_125 = TDM_CONFIG_MCK_DIV_DIV_CKDIV125
}
 TDM master clock divider settings. More...
 
enum  nrf_tdm_sck_div_t {
  NRF_TDM_SCK_DIV_2 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV2 ,
  NRF_TDM_SCK_DIV_3 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV3 ,
  NRF_TDM_SCK_DIV_4 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV4 ,
  NRF_TDM_SCK_DIV_5 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV5 ,
  NRF_TDM_SCK_DIV_6 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV6 ,
  NRF_TDM_SCK_DIV_8 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV8 ,
  NRF_TDM_SCK_DIV_10 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV10 ,
  NRF_TDM_SCK_DIV_11 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV11 ,
  NRF_TDM_SCK_DIV_15 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV15 ,
  NRF_TDM_SCK_DIV_16 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV16 ,
  NRF_TDM_SCK_DIV_21 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV21 ,
  NRF_TDM_SCK_DIV_23 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV23 ,
  NRF_TDM_SCK_DIV_30 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV30 ,
  NRF_TDM_SCK_DIV_31 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV31 ,
  NRF_TDM_SCK_DIV_32 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV32 ,
  NRF_TDM_SCK_DIV_42 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV42 ,
  NRF_TDM_SCK_DIV_63 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV63 ,
  NRF_TDM_SCK_DIV_125 = TDM_CONFIG_SCK_DIV_SCKDIV_CKDIV125
}
 TDM serial clock divider settings. More...
 
enum  nrf_tdm_src_t {
  NRF_TDM_SRC_PCLK32M = TDM_CONFIG_SCK_SRC_CLKSRC_PCLK ,
  NRF_TDM_SRC_ACLK = TDM_CONFIG_SCK_SRC_CLKSRC_ACLK
}
 TDM clock source selection. More...
 
enum  nrf_tdm_swidth_t {
  NRF_TDM_SWIDTH_8BIT = TDM_CONFIG_SWIDTH_SWIDTH_8Bit ,
  NRF_TDM_SWIDTH_16BIT = TDM_CONFIG_SWIDTH_SWIDTH_16Bit ,
  NRF_TDM_SWIDTH_24BIT = TDM_CONFIG_SWIDTH_SWIDTH_24Bit ,
  NRF_TDM_SWIDTH_32BIT = TDM_CONFIG_SWIDTH_SWIDTH_32Bit ,
  NRF_TDM_SWIDTH_8BIT_IN16BIT = TDM_CONFIG_SWIDTH_SWIDTH_8BitIn16 ,
  NRF_TDM_SWIDTH_8BIT_IN32BIT = TDM_CONFIG_SWIDTH_SWIDTH_8BitIn32 ,
  NRF_TDM_SWIDTH_16BIT_IN32BIT = TDM_CONFIG_SWIDTH_SWIDTH_16BitIn32 ,
  NRF_TDM_SWIDTH_24BIT_IN32BIT = TDM_CONFIG_SWIDTH_SWIDTH_24BitIn32
}
 TDM sample widths. More...
 
enum  nrf_tdm_align_t {
  NRF_TDM_ALIGN_LEFT = TDM_CONFIG_ALIGN_ALIGN_Left ,
  NRF_TDM_ALIGN_RIGHT = TDM_CONFIG_ALIGN_ALIGN_Right
}
 TDM alignments of sample within a frame. More...
 
enum  nrf_tdm_channel_mask_t {
  NRF_TDM_CHANNEL_RX0_MASK = TDM_CONFIG_CHANNEL_MASK_Rx0Enable_Msk ,
  NRF_TDM_CHANNEL_RX1_MASK = TDM_CONFIG_CHANNEL_MASK_Rx1Enable_Msk ,
  NRF_TDM_CHANNEL_RX2_MASK = TDM_CONFIG_CHANNEL_MASK_Rx2Enable_Msk ,
  NRF_TDM_CHANNEL_RX3_MASK = TDM_CONFIG_CHANNEL_MASK_Rx3Enable_Msk ,
  NRF_TDM_CHANNEL_RX4_MASK = TDM_CONFIG_CHANNEL_MASK_Rx4Enable_Msk ,
  NRF_TDM_CHANNEL_RX5_MASK = TDM_CONFIG_CHANNEL_MASK_Rx5Enable_Msk ,
  NRF_TDM_CHANNEL_RX6_MASK = TDM_CONFIG_CHANNEL_MASK_Rx6Enable_Msk ,
  NRF_TDM_CHANNEL_RX7_MASK = TDM_CONFIG_CHANNEL_MASK_Rx7Enable_Msk ,
  NRF_TDM_CHANNEL_TX0_MASK = TDM_CONFIG_CHANNEL_MASK_Tx0Enable_Msk ,
  NRF_TDM_CHANNEL_TX1_MASK = TDM_CONFIG_CHANNEL_MASK_Tx1Enable_Msk ,
  NRF_TDM_CHANNEL_TX2_MASK = TDM_CONFIG_CHANNEL_MASK_Tx2Enable_Msk ,
  NRF_TDM_CHANNEL_TX3_MASK = TDM_CONFIG_CHANNEL_MASK_Tx3Enable_Msk ,
  NRF_TDM_CHANNEL_TX4_MASK = TDM_CONFIG_CHANNEL_MASK_Tx4Enable_Msk ,
  NRF_TDM_CHANNEL_TX5_MASK = TDM_CONFIG_CHANNEL_MASK_Tx5Enable_Msk ,
  NRF_TDM_CHANNEL_TX6_MASK = TDM_CONFIG_CHANNEL_MASK_Tx6Enable_Msk ,
  NRF_TDM_CHANNEL_TX7_MASK = TDM_CONFIG_CHANNEL_MASK_Tx7Enable_Msk
}
 TDM channel mask. More...
 
enum  nrf_tdm_channels_count_t {
  NRF_TDM_CHANNELS_COUNT_1 = TDM_CONFIG_CHANNEL_NUM_NUM_Tdm1Ch ,
  NRF_TDM_CHANNELS_COUNT_2 = TDM_CONFIG_CHANNEL_NUM_NUM_Tdm2Ch ,
  NRF_TDM_CHANNELS_COUNT_3 = TDM_CONFIG_CHANNEL_NUM_NUM_Tdm3Ch ,
  NRF_TDM_CHANNELS_COUNT_4 = TDM_CONFIG_CHANNEL_NUM_NUM_Tdm4Ch ,
  NRF_TDM_CHANNELS_COUNT_5 = TDM_CONFIG_CHANNEL_NUM_NUM_Tdm5Ch ,
  NRF_TDM_CHANNELS_COUNT_6 = TDM_CONFIG_CHANNEL_NUM_NUM_Tdm6Ch ,
  NRF_TDM_CHANNELS_COUNT_7 = TDM_CONFIG_CHANNEL_NUM_NUM_Tdm7Ch ,
  NRF_TDM_CHANNELS_COUNT_8 = TDM_CONFIG_CHANNEL_NUM_NUM_Tdm8Ch
}
 TDM number of channels. More...
 
enum  nrf_tdm_channel_delay_t {
  NRF_TDM_CHANNEL_DELAY_NONE = TDM_CONFIG_CHANNEL_DELAY_DELAY_Delay0Ck ,
  NRF_TDM_CHANNEL_DELAY_1CK = TDM_CONFIG_CHANNEL_DELAY_DELAY_Delay1Ck ,
  NRF_TDM_CHANNEL_DELAY_2CK = TDM_CONFIG_CHANNEL_DELAY_DELAY_Delay2Ck
}
 TDM channel delay. More...
 
enum  nrf_tdm_polarity_t {
  NRF_TDM_POLARITY_POSEDGE ,
  NRF_TDM_POLARITY_NEGEDGE
}
 TDM signal polarity. More...
 
enum  nrf_tdm_fsync_duration_t {
  NRF_TDM_FSYNC_DURATION_SCK = TDM_CONFIG_FSYNC_DURATION_DURATION_Sck ,
  NRF_TDM_FSYNC_DURATION_CHANNEL = TDM_CONFIG_FSYNC_DURATION_DURATION_Channel
}
 TDM frame synchronization pulse duration. More...
 

Functions

NRF_STATIC_INLINE void nrf_tdm_task_trigger (NRF_TDM_Type *p_reg, nrf_tdm_task_t task)
 Function for activating the specified TDM task.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_task_address_get (NRF_TDM_Type const *p_reg, nrf_tdm_task_t task)
 Function for getting the address of the specified TDM task register.
 
NRF_STATIC_INLINE void nrf_tdm_event_clear (NRF_TDM_Type *p_reg, nrf_tdm_event_t event)
 Function for clearing the specified TDM event.
 
NRF_STATIC_INLINE bool nrf_tdm_event_check (NRF_TDM_Type const *p_reg, nrf_tdm_event_t event)
 Function for retrieving the state of the TDM event.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_event_address_get (NRF_TDM_Type const *p_reg, nrf_tdm_event_t event)
 Function for getting the address of the specified TDM event register.
 
NRF_STATIC_INLINE void nrf_tdm_int_enable (NRF_TDM_Type *p_reg, uint32_t mask)
 Function for enabling specified interrupts.
 
NRF_STATIC_INLINE void nrf_tdm_int_disable (NRF_TDM_Type *p_reg, uint32_t mask)
 Function for disabling specified interrupts.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_int_enable_check (NRF_TDM_Type const *p_reg, uint32_t mask)
 Function for checking if the specified interrupts are enabled.
 
NRF_STATIC_INLINE void nrf_tdm_enable (NRF_TDM_Type *p_reg)
 Function for enabling the TDM peripheral.
 
NRF_STATIC_INLINE void nrf_tdm_disable (NRF_TDM_Type *p_reg)
 Function for disabling the TDM peripheral.
 
NRF_STATIC_INLINE bool nrf_tdm_enable_check (NRF_TDM_Type *p_reg)
 Function for checking if the TDM peripheral is enabled.
 
NRF_STATIC_INLINE void nrf_tdm_subscribe_set (NRF_TDM_Type *p_reg, nrf_tdm_task_t task, uint8_t channel)
 Function for setting the subscribe configuration for a given TDM task.
 
NRF_STATIC_INLINE void nrf_tdm_subscribe_clear (NRF_TDM_Type *p_reg, nrf_tdm_task_t task)
 Function for clearing the subscribe configuration for a given TDM task.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_subscribe_get (NRF_TDM_Type const *p_reg, nrf_tdm_task_t task)
 Function for getting the subscribe configuration for a given TDM task.
 
NRF_STATIC_INLINE void nrf_tdm_publish_set (NRF_TDM_Type *p_reg, nrf_tdm_event_t event, uint8_t channel)
 Function for setting the publish configuration for a given TDM event.
 
NRF_STATIC_INLINE void nrf_tdm_publish_clear (NRF_TDM_Type *p_reg, nrf_tdm_event_t event)
 Function for clearing the publish configuration for a given TDM event.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_publish_get (NRF_TDM_Type const *p_reg, nrf_tdm_event_t event)
 Function for getting the publish configuration for a given TDM event.
 
NRF_STATIC_INLINE void nrf_tdm_pins_set (NRF_TDM_Type *p_reg, nrf_tdm_pins_t const *p_pins)
 Function for configuring TDM pins.
 
NRF_STATIC_INLINE void nrf_tdm_pins_get (NRF_TDM_Type *p_reg, nrf_tdm_pins_t *p_pins)
 Function for getting TDM pins configuration.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_sck_pin_get (NRF_TDM_Type const *p_reg)
 Function for getting the SCK pin selection.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_fsync_pin_get (NRF_TDM_Type const *p_reg)
 Function for getting the FSYNC pin selection.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_mck_pin_get (NRF_TDM_Type const *p_reg)
 Function for getting the MCK pin selection.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_sdout_pin_get (NRF_TDM_Type const *p_reg)
 Function for getting the SDOUT pin selection.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_sdin_pin_get (NRF_TDM_Type const *p_reg)
 Function for getting the SDIN pin selection.
 
NRF_STATIC_INLINE void nrf_tdm_configure (NRF_TDM_Type *p_reg, nrf_tdm_config_t const *p_config)
 Function for setting the TDM peripheral configuration.
 
NRF_STATIC_INLINE void nrf_tdm_mck_set (NRF_TDM_Type *p_reg, bool enable)
 Function for setting the master clock generator.
 
NRF_STATIC_INLINE void nrf_tdm_rx_count_set (NRF_TDM_Type *p_reg, uint16_t size)
 Function for setting up the TDM RX transfer length.
 
NRF_STATIC_INLINE void nrf_tdm_tx_count_set (NRF_TDM_Type *p_reg, uint16_t size)
 Function for setting up the TDM TX transfer length.
 
NRF_STATIC_INLINE void nrf_tdm_transfer_direction_set (NRF_TDM_Type *p_reg, nrf_tdm_rxtxen_t dir)
 Function for setting up the direction of the TDM transfer.
 
NRF_STATIC_INLINE void nrf_tdm_rx_buffer_set (NRF_TDM_Type *p_reg, uint32_t *p_buffer)
 Function for setting the pointer to the receive buffer.
 
NRF_STATIC_INLINE uint32_t * nrf_tdm_rx_buffer_get (NRF_TDM_Type const *p_reg)
 Function for getting the pointer to the receive buffer.
 
NRF_STATIC_INLINE void nrf_tdm_tx_buffer_set (NRF_TDM_Type *p_reg, uint32_t const *p_buffer)
 Function for setting the pointer to the transmit buffer.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_current_tx_transfer_amount_get (NRF_TDM_Type const *p_reg)
 Function for getting the number of bytes transferred in the current transaction.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_last_tx_transfer_amount_get (NRF_TDM_Type const *p_reg)
 Function for getting the number of bytes transferred in the last transaction. The value has been updated after the END event.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_current_rx_transfer_amount_get (NRF_TDM_Type const *p_reg)
 Function for getting the number of bytes received in the current transaction.
 
NRF_STATIC_INLINE uint32_t nrf_tdm_last_rx_transfer_amount_get (NRF_TDM_Type const *p_reg)
 Function for getting the number of bytes received in the last transaction. The value has been updated after the END event.
 
NRF_STATIC_INLINE uint32_t * nrf_tdm_tx_buffer_get (NRF_TDM_Type const *p_reg)
 Function for getting the pointer to the transmit buffer.
 
NRF_STATIC_INLINE void nrf_tdm_mck_configure (NRF_TDM_Type *p_reg, nrf_tdm_src_t clksrc, bool enable_bypass)
 Function for configuring TDM master Clock.
 
NRF_STATIC_INLINE void nrf_tdm_sck_configure (NRF_TDM_Type *p_reg, nrf_tdm_src_t clksrc, bool enable_bypass)
 Function for configuring TDM serial Clock.
 
NRF_STATIC_INLINE void nrf_tdm_ors_set (NRF_TDM_Type *p_reg, uint32_t ors)
 Function for setting over-read sample.
 

Detailed Description

Hardware access layer for managing the Time Division Multiplexed Audio Interface (TDM) peripheral.

Macro Definition Documentation

◆ NRF_TDM_INST_GET

#define NRF_TDM_INST_GET ( idx)
Value:
NRFX_CONCAT(NRF_, TDM, idx)
#define NRFX_CONCAT(...)
Macro for concatenating multiple arguments.
Definition nrfx_utils.h:777

Macro for getting a pointer to the structure of registers of the TDM peripheral.

Parameters
[in]idxTDM instance index.
Returns
Pointer to the structure of registers of the TDM peripheral.

Enumeration Type Documentation

◆ nrf_tdm_align_t

TDM alignments of sample within a frame.

Enumerator
NRF_TDM_ALIGN_LEFT 

Left-aligned.

NRF_TDM_ALIGN_RIGHT 

Right-aligned.

◆ nrf_tdm_channel_delay_t

TDM channel delay.

Enumerator
NRF_TDM_CHANNEL_DELAY_NONE 

No delay. Use with DSP/Aligned format.

NRF_TDM_CHANNEL_DELAY_1CK 

1 clock pulse delay. Used with original TDM format.

NRF_TDM_CHANNEL_DELAY_2CK 

2 clock pulses delay.

◆ nrf_tdm_channel_mask_t

TDM channel mask.

Enumerator
NRF_TDM_CHANNEL_RX0_MASK 

Enable RX channel 0 data.

NRF_TDM_CHANNEL_RX1_MASK 

Enable RX channel 1 data.

NRF_TDM_CHANNEL_RX2_MASK 

Enable RX channel 2 data.

NRF_TDM_CHANNEL_RX3_MASK 

Enable RX channel 3 data.

NRF_TDM_CHANNEL_RX4_MASK 

Enable RX channel 4 data.

NRF_TDM_CHANNEL_RX5_MASK 

Enable RX channel 5 data.

NRF_TDM_CHANNEL_RX6_MASK 

Enable RX channel 6 data.

NRF_TDM_CHANNEL_RX7_MASK 

Enable RX channel 7 data.

NRF_TDM_CHANNEL_TX0_MASK 

Enable TX channel 0 data.

NRF_TDM_CHANNEL_TX1_MASK 

Enable TX channel 1 data.

NRF_TDM_CHANNEL_TX2_MASK 

Enable TX channel 2 data.

NRF_TDM_CHANNEL_TX3_MASK 

Enable TX channel 3 data.

NRF_TDM_CHANNEL_TX4_MASK 

Enable TX channel 4 data.

NRF_TDM_CHANNEL_TX5_MASK 

Enable TX channel 5 data.

NRF_TDM_CHANNEL_TX6_MASK 

Enable TX channel 6 data.

NRF_TDM_CHANNEL_TX7_MASK 

Enable TX channel 7 data.

◆ nrf_tdm_channels_count_t

TDM number of channels.

Enumerator
NRF_TDM_CHANNELS_COUNT_1 

1 channel audio (mono).

NRF_TDM_CHANNELS_COUNT_2 

2 channels audio (stereo).

NRF_TDM_CHANNELS_COUNT_3 

3 channels audio.

NRF_TDM_CHANNELS_COUNT_4 

4 channels audio.

NRF_TDM_CHANNELS_COUNT_5 

5 channels audio.

NRF_TDM_CHANNELS_COUNT_6 

6 channels audio.

NRF_TDM_CHANNELS_COUNT_7 

7 channels audio.

NRF_TDM_CHANNELS_COUNT_8 

8 channels audio.

◆ nrf_tdm_event_t

TDM events.

Enumerator
NRF_TDM_EVENT_RXPTRUPD 

The RXD.PTR register has been copied to internal double buffers.

NRF_TDM_EVENT_STOPPED 

TDM transfer stopped.

NRF_TDM_EVENT_ABORTED 

TDM transfer aborted.

NRF_TDM_EVENT_TXPTRUPD 

The TXD.PTR register has been copied to internal double buffers.

NRF_TDM_EVENT_MAXCNT 

MAXCNT block event, generated on the active edge of FSYNC of every MAXCNT block.

◆ nrf_tdm_fsync_duration_t

TDM frame synchronization pulse duration.

Enumerator
NRF_TDM_FSYNC_DURATION_SCK 

FSYNC is active for the duration of one SCK pulse.

NRF_TDM_FSYNC_DURATION_CHANNEL 

FSYNC is active for the duration of channel transmission.

◆ nrf_tdm_int_mask_t

TDM interrupts.

Enumerator
NRF_TDM_INT_RXPTRUPD_MASK_MASK 

Interrupt on RXPTRUPD event.

NRF_TDM_INT_STOPPED_MASK_MASK 

Interrupt on STOPPED event.

NRF_TDM_INT_ABORTED_MASK 

Interrupt on EVENTS_ABORTED event.

NRF_TDM_INT_TXPTRUPD_MASK_MASK 

Interrupt on TXPTRUPD event.

NRF_TDM_INT_MAXCNT_MASK 

Interrupt on EVENTS_MAXCNT event.

◆ nrf_tdm_mck_div_t

TDM master clock divider settings.

Enumerator
NRF_TDM_MCK_DIV_2 

MCK divided by 2.

NRF_TDM_MCK_DIV_3 

MCK divided by 3.

NRF_TDM_MCK_DIV_4 

MCK divided by 4.

NRF_TDM_MCK_DIV_5 

MCK divided by 5.

NRF_TDM_MCK_DIV_6 

MCK divided by 6.

NRF_TDM_MCK_DIV_8 

MCK divided by 8.

NRF_TDM_MCK_DIV_10 

MCK divided by 10.

NRF_TDM_MCK_DIV_11 

MCK divided by 11.

NRF_TDM_MCK_DIV_15 

MCK divided by 15.

NRF_TDM_MCK_DIV_16 

MCK divided by 16.

NRF_TDM_MCK_DIV_21 

MCK divided by 21.

NRF_TDM_MCK_DIV_23 

MCK divided by 23.

NRF_TDM_MCK_DIV_30 

MCK divided by 30.

NRF_TDM_MCK_DIV_31 

MCK divided by 31.

NRF_TDM_MCK_DIV_32 

MCK divided by 32.

NRF_TDM_MCK_DIV_42 

MCK divided by 42.

NRF_TDM_MCK_DIV_63 

MCK divided by 63.

NRF_TDM_MCK_DIV_125 

MCK divided by 125.

◆ nrf_tdm_mode_t

TDM modes of operation.

Enumerator
NRF_TDM_MODE_MASTER 

Master mode.

NRF_TDM_MODE_SLAVE 

Slave mode.

◆ nrf_tdm_polarity_t

TDM signal polarity.

Enumerator
NRF_TDM_POLARITY_POSEDGE 

Synchronization at rising edge of the reference signal.

NRF_TDM_POLARITY_NEGEDGE 

Synchronization at falling edge of the reference signal.

◆ nrf_tdm_rxtxen_t

TDM Reception and transmission settings.

Enumerator
NRF_TDM_RXTXEN_DUPLEX 

Enable reception and transmission.

NRF_TDM_RXTXEN_RX 

Enable reception, disable transmission.

NRF_TDM_RXTXEN_TX 

Enable transmission, disable reception.

◆ nrf_tdm_sck_div_t

TDM serial clock divider settings.

Enumerator
NRF_TDM_SCK_DIV_2 

SCK divided by 2.

NRF_TDM_SCK_DIV_3 

SCK divided by 3.

NRF_TDM_SCK_DIV_4 

SCK divided by 4.

NRF_TDM_SCK_DIV_5 

SCK divided by 5.

NRF_TDM_SCK_DIV_6 

SCK divided by 6.

NRF_TDM_SCK_DIV_8 

SCK divided by 8.

NRF_TDM_SCK_DIV_10 

SCK divided by 10.

NRF_TDM_SCK_DIV_11 

SCK divided by 11.

NRF_TDM_SCK_DIV_15 

SCK divided by 15.

NRF_TDM_SCK_DIV_16 

SCK divided by 16.

NRF_TDM_SCK_DIV_21 

SCK divided by 21.

NRF_TDM_SCK_DIV_23 

SCK divided by 23.

NRF_TDM_SCK_DIV_30 

SCK divided by 30.

NRF_TDM_SCK_DIV_31 

SCK divided by 31.

NRF_TDM_SCK_DIV_32 

SCK divided by 32.

NRF_TDM_SCK_DIV_42 

SCK divided by 42.

NRF_TDM_SCK_DIV_63 

SCK divided by 63.

NRF_TDM_SCK_DIV_125 

SCK divided by 125.

◆ nrf_tdm_src_t

TDM clock source selection.

Enumerator
NRF_TDM_SRC_PCLK32M 

32MHz peripheral clock.

NRF_TDM_SRC_ACLK 

Audio PLL clock.

◆ nrf_tdm_swidth_t

TDM sample widths.

Enumerator
NRF_TDM_SWIDTH_8BIT 

8 bit.

NRF_TDM_SWIDTH_16BIT 

16 bit.

NRF_TDM_SWIDTH_24BIT 

24 bit.

NRF_TDM_SWIDTH_32BIT 

32 bit.

NRF_TDM_SWIDTH_8BIT_IN16BIT 

8 bit sample in a 16-bit half-frame.

NRF_TDM_SWIDTH_8BIT_IN32BIT 

8 bit sample in a 32-bit half-frame.

NRF_TDM_SWIDTH_16BIT_IN32BIT 

16 bit sample in a 32-bit half-frame.

NRF_TDM_SWIDTH_24BIT_IN32BIT 

24 bit sample in a 32-bit half-frame.

◆ nrf_tdm_task_t

TDM tasks.

Enumerator
NRF_TDM_TASK_START 

Starts continuous TDM transfer. Also starts the MCK generator if this is enabled.

NRF_TDM_TASK_STOP 

Stops TDM transfer after completion of MAXCNT words.

NRF_TDM_TASK_ABORT 

Aborts TDM transfer without completing MAXCNT words.

Function Documentation

◆ nrf_tdm_configure()

NRF_STATIC_INLINE void nrf_tdm_configure ( NRF_TDM_Type * p_reg,
nrf_tdm_config_t const * p_config )

Function for setting the TDM peripheral configuration.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_configPointer to the structure with configuration.

◆ nrf_tdm_current_rx_transfer_amount_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_current_rx_transfer_amount_get ( NRF_TDM_Type const * p_reg)

Function for getting the number of bytes received in the current transaction.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Number of bytes received.

◆ nrf_tdm_current_tx_transfer_amount_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_current_tx_transfer_amount_get ( NRF_TDM_Type const * p_reg)

Function for getting the number of bytes transferred in the current transaction.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Number of bytes transferred.

◆ nrf_tdm_disable()

NRF_STATIC_INLINE void nrf_tdm_disable ( NRF_TDM_Type * p_reg)

Function for disabling the TDM peripheral.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_tdm_enable()

NRF_STATIC_INLINE void nrf_tdm_enable ( NRF_TDM_Type * p_reg)

Function for enabling the TDM peripheral.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_tdm_enable_check()

NRF_STATIC_INLINE bool nrf_tdm_enable_check ( NRF_TDM_Type * p_reg)

Function for checking if the TDM peripheral is enabled.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueThe TDM is enabled.
falseThe TDM is not enabled.

◆ nrf_tdm_event_address_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_event_address_get ( NRF_TDM_Type const * p_reg,
nrf_tdm_event_t event )

Function for getting the address of the specified TDM event register.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventSpecified event.
Returns
Address of the specified event register.

◆ nrf_tdm_event_check()

NRF_STATIC_INLINE bool nrf_tdm_event_check ( NRF_TDM_Type const * p_reg,
nrf_tdm_event_t event )

Function for retrieving the state of the TDM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to be checked.
Return values
trueThe event has been generated.
falseThe event has not been generated.

◆ nrf_tdm_event_clear()

NRF_STATIC_INLINE void nrf_tdm_event_clear ( NRF_TDM_Type * p_reg,
nrf_tdm_event_t event )

Function for clearing the specified TDM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to clear.

◆ nrf_tdm_fsync_pin_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_fsync_pin_get ( NRF_TDM_Type const * p_reg)

Function for getting the FSYNC pin selection.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
FSYNC pin selection.

◆ nrf_tdm_int_disable()

NRF_STATIC_INLINE void nrf_tdm_int_disable ( NRF_TDM_Type * p_reg,
uint32_t mask )

Function for disabling specified interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be disabled. Use nrf_tdm_int_mask_t values for bit masking.

◆ nrf_tdm_int_enable()

NRF_STATIC_INLINE void nrf_tdm_int_enable ( NRF_TDM_Type * p_reg,
uint32_t mask )

Function for enabling specified interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be enabled. Use nrf_tdm_int_mask_t values for bit masking.

◆ nrf_tdm_int_enable_check()

NRF_STATIC_INLINE uint32_t nrf_tdm_int_enable_check ( NRF_TDM_Type const * p_reg,
uint32_t mask )

Function for checking if the specified interrupts are enabled.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be checked. Use nrf_tdm_int_mask_t values for bit masking.
Returns
Mask of enabled interrupts.

◆ nrf_tdm_last_rx_transfer_amount_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_last_rx_transfer_amount_get ( NRF_TDM_Type const * p_reg)

Function for getting the number of bytes received in the last transaction. The value has been updated after the END event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Number of bytes received.

◆ nrf_tdm_last_tx_transfer_amount_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_last_tx_transfer_amount_get ( NRF_TDM_Type const * p_reg)

Function for getting the number of bytes transferred in the last transaction. The value has been updated after the END event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Number of bytes transferred.

◆ nrf_tdm_mck_configure()

NRF_STATIC_INLINE void nrf_tdm_mck_configure ( NRF_TDM_Type * p_reg,
nrf_tdm_src_t clksrc,
bool enable_bypass )

Function for configuring TDM master Clock.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]clksrcTDM master clock source selection.
[in]enable_bypassBypass clock generator. MCK will be equal to source input. If bypass is enabled the MCK.DIV setting has no effect.

◆ nrf_tdm_mck_pin_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_mck_pin_get ( NRF_TDM_Type const * p_reg)

Function for getting the MCK pin selection.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
MCK pin selection.

◆ nrf_tdm_mck_set()

NRF_STATIC_INLINE void nrf_tdm_mck_set ( NRF_TDM_Type * p_reg,
bool enable )

Function for setting the master clock generator.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]enableTrue if the master clock generator is to be enabled, false otherwise.

◆ nrf_tdm_ors_set()

NRF_STATIC_INLINE void nrf_tdm_ors_set ( NRF_TDM_Type * p_reg,
uint32_t ors )

Function for setting over-read sample.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]orsValue that will be transmitted in case of over-read of TXD buffer.

◆ nrf_tdm_pins_get()

NRF_STATIC_INLINE void nrf_tdm_pins_get ( NRF_TDM_Type * p_reg,
nrf_tdm_pins_t * p_pins )

Function for getting TDM pins configuration.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_pinsPointer to the structure to be filled with TDM pins configuration.

◆ nrf_tdm_pins_set()

NRF_STATIC_INLINE void nrf_tdm_pins_set ( NRF_TDM_Type * p_reg,
nrf_tdm_pins_t const * p_pins )

Function for configuring TDM pins.

Usage of the SDOUT, SDIN, and MCK signals is optional. If a given signal is not needed, pass the NRF_TDM_PIN_NOT_CONNECTED value instead of its pin number.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_pinsPointer to the structure with pins selection.

◆ nrf_tdm_publish_clear()

NRF_STATIC_INLINE void nrf_tdm_publish_clear ( NRF_TDM_Type * p_reg,
nrf_tdm_event_t event )

Function for clearing the publish configuration for a given TDM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to clear the configuration.

◆ nrf_tdm_publish_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_publish_get ( NRF_TDM_Type const * p_reg,
nrf_tdm_event_t event )

Function for getting the publish configuration for a given TDM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to read the configuration.
Returns
TDM publish configuration.

◆ nrf_tdm_publish_set()

NRF_STATIC_INLINE void nrf_tdm_publish_set ( NRF_TDM_Type * p_reg,
nrf_tdm_event_t event,
uint8_t channel )

Function for setting the publish configuration for a given TDM event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to set the configuration.
[in]channelChannel through which to publish the event.

◆ nrf_tdm_rx_buffer_get()

NRF_STATIC_INLINE uint32_t * nrf_tdm_rx_buffer_get ( NRF_TDM_Type const * p_reg)

Function for getting the pointer to the receive buffer.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Pointer to the receive buffer.

◆ nrf_tdm_rx_buffer_set()

NRF_STATIC_INLINE void nrf_tdm_rx_buffer_set ( NRF_TDM_Type * p_reg,
uint32_t * p_buffer )

Function for setting the pointer to the receive buffer.

Note
The size of the buffer can be set only by calling nrf_tdm_rx_count_set.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_bufferPointer to the receive buffer.

◆ nrf_tdm_rx_count_set()

NRF_STATIC_INLINE void nrf_tdm_rx_count_set ( NRF_TDM_Type * p_reg,
uint16_t size )

Function for setting up the TDM RX transfer length.

Note
This function sets up the RX buffer size. At least one of nrf_tdm_rx_count_set or nrf_tdm_tx_count_set functions must be called before starting the transmission. Also nrf_tdm_transfer_direction_set and nrf_tdm_rx_buffer_set should be called before starting the transmission.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]sizeSize of the buffer (in 32-bit words).

◆ nrf_tdm_sck_configure()

NRF_STATIC_INLINE void nrf_tdm_sck_configure ( NRF_TDM_Type * p_reg,
nrf_tdm_src_t clksrc,
bool enable_bypass )

Function for configuring TDM serial Clock.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]clksrcTDM serial clock source selection.
[in]enable_bypassBypass clock generator. SCK will be equal to source input. If bypass is enabled the SCK.DIV setting has no effect.

◆ nrf_tdm_sck_pin_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_sck_pin_get ( NRF_TDM_Type const * p_reg)

Function for getting the SCK pin selection.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
SCK pin selection.

◆ nrf_tdm_sdin_pin_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_sdin_pin_get ( NRF_TDM_Type const * p_reg)

Function for getting the SDIN pin selection.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
SDIN pin selection.

◆ nrf_tdm_sdout_pin_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_sdout_pin_get ( NRF_TDM_Type const * p_reg)

Function for getting the SDOUT pin selection.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
SDOUT pin selection.

◆ nrf_tdm_subscribe_clear()

NRF_STATIC_INLINE void nrf_tdm_subscribe_clear ( NRF_TDM_Type * p_reg,
nrf_tdm_task_t task )

Function for clearing the subscribe configuration for a given TDM task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to clear the configuration.

◆ nrf_tdm_subscribe_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_subscribe_get ( NRF_TDM_Type const * p_reg,
nrf_tdm_task_t task )

Function for getting the subscribe configuration for a given TDM task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to read the configuration.
Returns
TDM subscribe configuration.

◆ nrf_tdm_subscribe_set()

NRF_STATIC_INLINE void nrf_tdm_subscribe_set ( NRF_TDM_Type * p_reg,
nrf_tdm_task_t task,
uint8_t channel )

Function for setting the subscribe configuration for a given TDM task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to set the configuration.
[in]channelChannel through which to subscribe events.

◆ nrf_tdm_task_address_get()

NRF_STATIC_INLINE uint32_t nrf_tdm_task_address_get ( NRF_TDM_Type const * p_reg,
nrf_tdm_task_t task )

Function for getting the address of the specified TDM task register.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskSpecified task.
Returns
Address of the specified task register.

◆ nrf_tdm_task_trigger()

NRF_STATIC_INLINE void nrf_tdm_task_trigger ( NRF_TDM_Type * p_reg,
nrf_tdm_task_t task )

Function for activating the specified TDM task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask to be activated.

◆ nrf_tdm_transfer_direction_set()

NRF_STATIC_INLINE void nrf_tdm_transfer_direction_set ( NRF_TDM_Type * p_reg,
nrf_tdm_rxtxen_t dir )

Function for setting up the direction of the TDM transfer.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]dirTransmission direction.

◆ nrf_tdm_tx_buffer_get()

NRF_STATIC_INLINE uint32_t * nrf_tdm_tx_buffer_get ( NRF_TDM_Type const * p_reg)

Function for getting the pointer to the transmit buffer.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Pointer to the transmit buffer.

◆ nrf_tdm_tx_buffer_set()

NRF_STATIC_INLINE void nrf_tdm_tx_buffer_set ( NRF_TDM_Type * p_reg,
uint32_t const * p_buffer )

Function for setting the pointer to the transmit buffer.

Note
The size of the buffer can be set only by calling nrf_tdm_tx_count_set.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_bufferPointer to the transmit buffer.

◆ nrf_tdm_tx_count_set()

NRF_STATIC_INLINE void nrf_tdm_tx_count_set ( NRF_TDM_Type * p_reg,
uint16_t size )

Function for setting up the TDM TX transfer length.

Note
This function sets up the RX buffer size. At least one of nrf_tdm_rx_count_set or nrf_tdm_tx_count_set functions must be called before starting the transmission. Also nrf_tdm_transfer_direction_set and nrf_tdm_tx_buffer_set should be called before starting the transmission.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]sizeSize of the buffer (in 32-bit words).