|
SmartSnippets DA1459x SDK
|
Go to the documentation of this file.
45 #if dg_configUSE_HW_PCM
58 #define HW_PCM_CRG_REG_GETF(reg, field) REG_GETF(CRG_AUD, PCM_##reg##_REG, field)
68 #define HW_PCM_CRG_REG_SETF(reg, field, val) REG_SETF(CRG_AUD, PCM_##reg##_REG, field, val)
76 #define HW_PCM_CRG_REG_SET_BIT(reg, field) REG_SET_BIT(CRG_AUD, PCM_##reg##_REG, field)
84 #define HW_PCM_CRG_REG_CLR_BIT(reg, field) REG_CLR_BIT(CRG_AUD, PCM_##reg##_REG, field)
95 #define HW_PCM_SRC_REG_GETF(reg, field) REG_GETF(PCM1, PCM1_##reg##_REG, field)
105 #define HW_PCM_SRC_REG_SETF(reg, field, val) REG_SETF(PCM1, PCM1_##reg##_REG, field, val)
113 #define HW_PCM_SRC_REG_SET_BIT(reg, field) REG_SET_BIT(PCM1, PCM1_##reg##_REG, field)
121 #define HW_PCM_SRC_REG_CLR_BIT(reg, field) REG_CLR_BIT(PCM1, PCM1_##reg##_REG, field)
233 HW_PCM_INPUT_MUX_SIZE
313 HW_PCM_CONFIG_GENERIC_PCM_MODE,
315 HW_PCM_CONFIG_I2S_MODE,
317 HW_PCM_CONFIG_TDM_MODE,
319 HW_PCM_CONFIG_IOM_MODE
519 return(
REG_GETF(SRC1, SRC1_MUX_REG, PCM1_MUX_IN));
595 ASSERT_WARNING(delay <= 3);
620 ASSERT_WARNING(length <= 8);
634 uint32_t pcm1_ctrl_reg = PCM1->PCM1_CTRL_REG;
636 ASSERT_WARNING(div >= 8 && div <= 0x1000);
638 if (pcm1_ctrl_reg &
REG_MSK(PCM1, PCM1_CTRL_REG, PCM_CLK_BIT)) {
643 REG_SET_FIELD(PCM1, PCM1_CTRL_REG, PCM_FSC_DIV, pcm1_ctrl_reg, div - 1);
645 PCM1->PCM1_CTRL_REG = pcm1_ctrl_reg;
684 REG_SETF(SRC1, SRC1_MUX_REG, PCM1_MUX_IN, input);
740 return PCM1->PCM1_IN1_REG;
742 return PCM1->PCM1_IN2_REG;
762 PCM1->PCM1_OUT1_REG = data;
765 PCM1->PCM1_OUT2_REG = data;
PCM configuration in I2S mode.
Definition: hw_pcm.h:273
#define REG_SETF(base, reg, field, new_val)
Set the value of a register field.
Definition: sdk_defs.h:738
__STATIC_INLINE uint8_t hw_pcm_get_channel_delay()
Get PCM channel delay.
Definition: hw_pcm.h:420
__STATIC_INLINE bool hw_pcm_get_clk_per_bit(void)
Get PCM clock cycles per data bit.
Definition: hw_pcm.h:506
HW_PCM_FSC_POLARITY fsc_polarity
Definition: hw_pcm.h:262
__STATIC_INLINE void hw_pcm_set_fsc_div(uint16_t div)
Set PCM FSC divider.
Definition: hw_pcm.h:632
uint8_t chs
Definition: hw_pcm.h:346
uint8_t fsc_length
Definition: hw_pcm.h:266
uint16_t bit_depth
Definition: hw_pcm.h:345
HW_PCM_CLK_POLARITY clock_polarity
Definition: hw_pcm.h:287
__STATIC_INLINE bool hw_pcm_get_fsc_edge(void)
Get PCM FSC edge.
Definition: hw_pcm.h:432
__STATIC_INLINE bool hw_pcm_is_enabled(void)
Get the status of the PCM interface.
Definition: hw_pcm.h:409
uint16_t fsc_div
Definition: hw_pcm.h:305
__STATIC_INLINE void hw_pcm_set_output_mode(HW_PCM_DO_OUTPUT_MODE mode)
Set PCM DO output mode.
Definition: hw_pcm.h:722
HW_PCM_INPUT_MUX
PCM input multiplexer.
Definition: hw_pcm.h:227
#define ASSERT_ERROR(a)
Assert as error macro.
Definition: sdk_defs.h:422
uint16_t fsc_div
Definition: hw_pcm.h:277
__STATIC_INLINE void hw_pcm_set_fsc_length(uint8_t length)
Set PCM FSC length.
Definition: hw_pcm.h:618
__STATIC_INLINE bool hw_pcm_clk_is_enabled(void)
Get the status of the PCM interface clock source.
Definition: hw_pcm.h:379
__STATIC_INLINE uint32_t hw_pcm_input_read(HW_PCM_INPUT input)
Read PCM input (RX) register.
Definition: hw_pcm.h:736
uint8_t fsc_length
Definition: hw_pcm.h:276
uint8_t fsc_length
Definition: hw_pcm.h:293
HW_PCM_CLK_POLARITY clock_polarity
Definition: hw_pcm.h:302
uint8_t sample_rate
Definition: hw_pcm.h:344
Central include header file with platform definitions.
__STATIC_INLINE void hw_pcm_clk_disable(void)
Disable the PCM interface clock source.
Definition: hw_pcm.h:366
PCM interface clock configuration.
Definition: hw_pcm.h:342
__STATIC_INLINE void hw_pcm_set_fsc_edge(HW_PCM_FSC_EDGE edge)
Set PCM FSC edge.
Definition: hw_pcm.h:605
HW_PCM_DO_OUTPUT_MODE
PCM DO output mode.
Definition: hw_pcm.h:181
HW_PCM_FSC_POLARITY fsc_polarity
Definition: hw_pcm.h:292
__STATIC_INLINE bool hw_pcm_get_fsc_delay(void)
Get PCM FSC delay.
Definition: hw_pcm.h:466
#define HW_PCM_SRC_REG_SET_BIT(reg, field)
Set a bit of a PCM register of SRC.
Definition: hw_pcm.h:113
#define HW_PCM_SRC_REG_GETF(reg, field)
Get the value of a field of a PCM register of SRC.
Definition: hw_pcm.h:95
HW_PCM_OUTPUT
PCM output register.
Definition: hw_pcm.h:218
void hw_pcm_init(hw_pcm_config_t *config)
Set initialization of PCM interface.
__STATIC_INLINE uint16_t hw_pcm_get_fsc_div(void)
Get PCM FSC divider.
Definition: hw_pcm.h:453
PCM configuration in PCM mode.
Definition: hw_pcm.h:258
__STATIC_INLINE void hw_pcm_set_mode(HW_PCM_MODE mode)
Set PCM master/slave mode.
Definition: hw_pcm.h:557
HW_PCM_ERROR_CODE
PCM error code.
Definition: hw_pcm.h:127
uint8_t channel_delay
Definition: hw_pcm.h:289
HW_PCM_CLK_GENERATION
PCM clock generation.
Definition: hw_pcm.h:160
void hw_pcm_unregister_interrupt(void)
Unregister interrupt PCM handler.
HW_PCM_CYCLE_PER_BIT cycle_per_bit
Definition: hw_pcm.h:259
__STATIC_INLINE void hw_pcm_set_clk_per_bit(HW_PCM_CYCLE_PER_BIT cycles)
Set PCM clock cycles per data bit.
Definition: hw_pcm.h:708
HW_PCM_CONFIG_MODE config_mode
Definition: hw_pcm.h:327
HW_PCM_FSC_POLARITY fsc_polarity
Definition: hw_pcm.h:278
HW_PCM_FSC_EDGE
PCM FSC edge.
Definition: hw_pcm.h:190
__STATIC_INLINE HW_PCM_DO_OUTPUT_MODE hw_pcm_get_output_mode(void)
Get PCM DO output mode.
Definition: hw_pcm.h:530
__STATIC_INLINE void hw_pcm_set_pcm_input_mux(HW_PCM_INPUT_MUX input)
Set input for the PCM1_MUX_IN multiplexer.
Definition: hw_pcm.h:681
__STATIC_INLINE void hw_pcm_set_channel_delay(uint8_t delay)
Set PCM channel delay.
Definition: hw_pcm.h:592
HW_PCM_CYCLE_PER_BIT cycle_per_bit
Definition: hw_pcm.h:286
uint16_t fsc_div
Definition: hw_pcm.h:350
PCM configuration in TDM mode.
Definition: hw_pcm.h:285
__STATIC_INLINE void hw_pcm_set_fsc_delay(HW_PCM_FSC_DELAY delay)
Set PCM FSC delay.
Definition: hw_pcm.h:656
HW_PCM_MODE
PCM master/slave mode.
Definition: hw_pcm.h:142
HW_PCM_CLK_POLARITY clock_polarity
Definition: hw_pcm.h:261
HW_PCM_FSC_DELAY
PCM FSC delay.
Definition: hw_pcm.h:200
HW_PCM_FSC_POLARITY fsc_polarity
Definition: hw_pcm.h:304
uint16_t fsc_div
Definition: hw_pcm.h:291
__STATIC_INLINE void hw_pcm_set_fsc_polarity(HW_PCM_FSC_POLARITY pol)
Set PCM FSC polarity.
Definition: hw_pcm.h:695
__STATIC_INLINE void hw_pcm_set_clk_polarity(HW_PCM_CLK_POLARITY pol)
Set PCM clock polarity.
Definition: hw_pcm.h:670
void(* hw_pcm_interrupt_cb_t)(void)
Application-defined callback type for the PCM interrupt.
Definition: hw_pcm.h:777
__STATIC_INLINE void hw_pcm_output_write(HW_PCM_OUTPUT output, const uint32_t data)
Write PCM output (TX) register.
Definition: hw_pcm.h:758
HW_PCM_CLOCK clock
Definition: hw_pcm.h:343
HW_PCM_FSC_POLARITY
PCM FSC polarity.
Definition: hw_pcm.h:249
#define REG_MSK(base, reg, field)
Access register field mask.
Definition: sdk_defs.h:583
HW_GPIO_MODE mode
Definition: hw_gpio.h:211
uint8_t channel_delay
Definition: hw_pcm.h:260
#define HW_PCM_CRG_REG_SET_BIT(reg, field)
Set a bit of a PCM register of CRG.
Definition: hw_pcm.h:76
__STATIC_INLINE bool hw_pcm_get_clk_polarity(void)
Get PCM clock polarity.
Definition: hw_pcm.h:479
#define HW_PCM_CRG_REG_GETF(reg, field)
Get the value of a field of a PCM register of CRG.
Definition: hw_pcm.h:58
HW_PCM_MODE pcm_mode
Definition: hw_pcm.h:328
void hw_pcm_register_interrupt(hw_pcm_interrupt_cb_t cb)
Register PCM interrupt handler.
HW_PCM_CYCLE_PER_BIT
PCM clock cycles per bit.
Definition: hw_pcm.h:172
HW_PCM_CLK_POLARITY
PCM clock polarity.
Definition: hw_pcm.h:240
__STATIC_INLINE bool hw_pcm_get_fsc_polarity(void)
Get PCM FSC polarity.
Definition: hw_pcm.h:493
__STATIC_INLINE uint8_t hw_pcm_get_fsc_length(void)
Get PCM FSC length.
Definition: hw_pcm.h:442
__STATIC_INLINE HW_PCM_INPUT_MUX hw_pcm_get_pcm_input_mux(void)
Get input for the PCM1_MUX_IN multiplexer.
Definition: hw_pcm.h:516
__STATIC_INLINE void hw_pcm_clk_enable(void)
Enable the PCM interface clock source.
Definition: hw_pcm.h:357
HW_PCM_CYCLE_PER_BIT cycle_per_bit
Definition: hw_pcm.h:348
HW_PCM_CYCLE_PER_BIT cycle_per_bit
Definition: hw_pcm.h:274
__STATIC_INLINE void hw_pcm_disable(void)
Disable the PCM interface.
Definition: hw_pcm.h:396
uint16_t ch_delay
Definition: hw_pcm.h:347
#define REG_GETF(base, reg, field)
Return the value of a register field.
Definition: sdk_defs.h:711
uint16_t fsc_div
Definition: hw_pcm.h:263
HW_PCM_DO_OUTPUT_MODE gpio_output_mode
Definition: hw_pcm.h:329
PCM configuration in IOM2 mode.
Definition: hw_pcm.h:301
HW_PCM_CLOCK
PCM system clock source.
Definition: hw_pcm.h:151
PCM interface mode configuration.
Definition: hw_pcm.h:325
#define HW_PCM_SRC_REG_CLR_BIT(reg, field)
Clear a bit of a PCM register of SRC.
Definition: hw_pcm.h:121
HW_PCM_FSC_DELAY fsc_delay
Definition: hw_pcm.h:264
__STATIC_INLINE void hw_pcm_enable(void)
Enable the PCM interface.
Definition: hw_pcm.h:387
#define REG_SET_FIELD(base, reg, field, var, val)
Set register field value.
Definition: sdk_defs.h:626
#define HW_PCM_SRC_REG_SETF(reg, field, val)
Set the value of a field of a PCM register of SRC.
Definition: hw_pcm.h:105
HW_PCM_CONFIG_MODE
PCM interface modes.
Definition: hw_pcm.h:311
HW_PCM_CLK_GENERATION div
Definition: hw_pcm.h:351
HW_PCM_INPUT
PCM input register.
Definition: hw_pcm.h:209
uint8_t slot
Definition: hw_pcm.h:349
#define HW_PCM_CRG_REG_CLR_BIT(reg, field)
Clear a bit of a PCM register of CRG.
Definition: hw_pcm.h:84
HW_PCM_ERROR_CODE hw_pcm_init_clk(hw_pcm_clk_cfg_t *pcm_clk)
Initialize PCM clock registers.
__STATIC_INLINE HW_PCM_MODE hw_pcm_get_mode(void)
Get PCM master/slave mode.
Definition: hw_pcm.h:544