SmartSnippets DA1459x SDK
hw_pcm.h
Go to the documentation of this file.
1 
42 #ifndef HW_PCM_H_
43 #define HW_PCM_H_
44 
45 #if dg_configUSE_HW_PCM
46 
47 #include "sdk_defs.h"
48 
58 #define HW_PCM_CRG_REG_GETF(reg, field) REG_GETF(CRG_AUD, PCM_##reg##_REG, field)
59 
68 #define HW_PCM_CRG_REG_SETF(reg, field, val) REG_SETF(CRG_AUD, PCM_##reg##_REG, field, val)
69 
76 #define HW_PCM_CRG_REG_SET_BIT(reg, field) REG_SET_BIT(CRG_AUD, PCM_##reg##_REG, field)
77 
84 #define HW_PCM_CRG_REG_CLR_BIT(reg, field) REG_CLR_BIT(CRG_AUD, PCM_##reg##_REG, field)
85 
95 #define HW_PCM_SRC_REG_GETF(reg, field) REG_GETF(PCM1, PCM1_##reg##_REG, field)
96 
105 #define HW_PCM_SRC_REG_SETF(reg, field, val) REG_SETF(PCM1, PCM1_##reg##_REG, field, val)
106 
113 #define HW_PCM_SRC_REG_SET_BIT(reg, field) REG_SET_BIT(PCM1, PCM1_##reg##_REG, field)
114 
121 #define HW_PCM_SRC_REG_CLR_BIT(reg, field) REG_CLR_BIT(PCM1, PCM1_##reg##_REG, field)
122 
127 typedef enum {
137 
142 typedef enum {
145 } HW_PCM_MODE;
146 
151 typedef enum {
154 } HW_PCM_CLOCK;
155 
160 typedef enum {
167 
172 typedef enum {
176 
181 typedef enum {
185 
190 typedef enum {
195 
200 typedef enum {
204 
209 typedef enum {
212 } HW_PCM_INPUT;
213 
218 typedef enum {
221 } HW_PCM_OUTPUT;
222 
227 typedef enum {
233  HW_PCM_INPUT_MUX_SIZE
235 
240 typedef enum {
244 
249 typedef enum {
253 
258 typedef struct {
260  uint8_t channel_delay;
263  uint16_t fsc_div;
266  uint8_t fsc_length;
268 
273 typedef struct {
276  uint8_t fsc_length;
277  uint16_t fsc_div;
280 
285 typedef struct {
289  uint8_t channel_delay;
291  uint16_t fsc_div;
293  uint8_t fsc_length;
296 
301 typedef struct {
305  uint16_t fsc_div;
307 
311 typedef enum {
312  /* Generic PCM interface format configuration */
313  HW_PCM_CONFIG_GENERIC_PCM_MODE,
314  /* PCM-I2S configuration */
315  HW_PCM_CONFIG_I2S_MODE,
316  /* PCM-TDM configuration */
317  HW_PCM_CONFIG_TDM_MODE,
318  /* PCM-IOM configuration */
319  HW_PCM_CONFIG_IOM_MODE
321 
325 typedef struct {
326  /* PCM mode configuration is placed in mode specific structures */
331  union {
332  hw_pcm_config_generic_pcm_t pcm_param;
333  hw_pcm_config_i2s_mode_t i2s_param;
334  hw_pcm_config_tdm_mode_t tdm_param;
335  hw_pcm_config_iom_mode_t iom_param;
336  };
338 
342 typedef struct {
344  uint8_t sample_rate;
345  uint16_t bit_depth;
346  uint8_t chs;
347  uint16_t ch_delay;
349  uint8_t slot;
350  uint16_t fsc_div;
353 
357 __STATIC_INLINE void hw_pcm_clk_enable(void)
358 {
359  // Enable PCM interface clock source
360  HW_PCM_CRG_REG_SET_BIT(DIV, CLK_PCM_EN);
361 }
362 
366 __STATIC_INLINE void hw_pcm_clk_disable(void)
367 {
368  // Disable PCM interface clock source
369  HW_PCM_CRG_REG_CLR_BIT(DIV, CLK_PCM_EN);
370 }
371 
379 __STATIC_INLINE bool hw_pcm_clk_is_enabled(void)
380 {
381  return (HW_PCM_CRG_REG_GETF(DIV, CLK_PCM_EN));
382 }
383 
387 __STATIC_INLINE void hw_pcm_enable(void)
388 {
389  // Enable PCM interface
390  HW_PCM_SRC_REG_SET_BIT(CTRL, PCM_EN);
391 }
392 
396 __STATIC_INLINE void hw_pcm_disable(void)
397 {
398  // Disable PCM interface
399  HW_PCM_SRC_REG_CLR_BIT(CTRL, PCM_EN);
400 }
401 
409 __STATIC_INLINE bool hw_pcm_is_enabled(void)
410 {
411  return (HW_PCM_SRC_REG_GETF(CTRL, PCM_EN));
412 }
413 
420 __STATIC_INLINE uint8_t hw_pcm_get_channel_delay()
421 {
422  return (HW_PCM_SRC_REG_GETF(CTRL, PCM_CH_DEL));
423 }
424 
432 __STATIC_INLINE bool hw_pcm_get_fsc_edge(void)
433 {
434  return (HW_PCM_SRC_REG_GETF(CTRL, PCM_FSC_EDGE));
435 }
436 
442 __STATIC_INLINE uint8_t hw_pcm_get_fsc_length(void)
443 {
444  return (HW_PCM_SRC_REG_GETF(CTRL, PCM_FSCLEN));
445 }
446 
453 __STATIC_INLINE uint16_t hw_pcm_get_fsc_div(void)
454 {
455  return (HW_PCM_SRC_REG_GETF(CTRL, PCM_FSC_DIV));
456 }
457 
466 __STATIC_INLINE bool hw_pcm_get_fsc_delay(void)
467 {
468  return (HW_PCM_SRC_REG_GETF(CTRL, PCM_FSCDEL));
469 }
470 
479 __STATIC_INLINE bool hw_pcm_get_clk_polarity(void)
480 {
481 
482  return (HW_PCM_SRC_REG_GETF(CTRL, PCM_CLKINV));
483 }
484 
493 __STATIC_INLINE bool hw_pcm_get_fsc_polarity(void)
494 {
495 
496  return (HW_PCM_SRC_REG_GETF(CTRL, PCM_FSCINV));
497 }
498 
506 __STATIC_INLINE bool hw_pcm_get_clk_per_bit(void)
507 {
508  return (HW_PCM_SRC_REG_GETF(CTRL, PCM_CLK_BIT));
509 }
510 
517 {
518  // Set PCM1_MUX_IN field in SRC1 MUX register
519  return(REG_GETF(SRC1, SRC1_MUX_REG, PCM1_MUX_IN));
520 }
521 
531 {
532  // Set PCM_PPOD field in PCM control register
533  return(HW_PCM_SRC_REG_GETF(CTRL, PCM_PPOD));
534 }
535 
544 __STATIC_INLINE HW_PCM_MODE hw_pcm_get_mode(void)
545 {
546  return(HW_PCM_SRC_REG_GETF(CTRL, PCM_MASTER));
547 }
548 
557 __STATIC_INLINE void hw_pcm_set_mode(HW_PCM_MODE mode)
558 {
559  HW_PCM_SRC_REG_SETF(CTRL, PCM_MASTER, mode); // set/reset PCM_MASTER bit
560 }
561 
562 
576 
584 void hw_pcm_init(hw_pcm_config_t *config);
585 
592 __STATIC_INLINE void hw_pcm_set_channel_delay(uint8_t delay)
593 {
594  // Delay has a maximum value of 31
595  ASSERT_WARNING(delay <= 3);
596  // Set PCM_CH_DEL field in PCM control register
597  HW_PCM_SRC_REG_SETF(CTRL, PCM_CH_DEL, delay);
598 }
599 
605 __STATIC_INLINE void hw_pcm_set_fsc_edge(HW_PCM_FSC_EDGE edge)
606 {
607  // Set PCM_FSC_EDGE field in PCM control register
608  HW_PCM_SRC_REG_SETF(CTRL, PCM_FSC_EDGE, edge);
609 }
610 
618 __STATIC_INLINE void hw_pcm_set_fsc_length(uint8_t length)
619 {
620  ASSERT_WARNING(length <= 8);
621 
622  // Set PCM_FSCLEN field in PCM control register
623  HW_PCM_SRC_REG_SETF(CTRL, PCM_FSCLEN, length);
624 }
625 
632 __STATIC_INLINE void hw_pcm_set_fsc_div(uint16_t div)
633 {
634  uint32_t pcm1_ctrl_reg = PCM1->PCM1_CTRL_REG;
635 
636  ASSERT_WARNING(div >= 8 && div <= 0x1000);
637 
638  if (pcm1_ctrl_reg & REG_MSK(PCM1, PCM1_CTRL_REG, PCM_CLK_BIT)) {
639  ASSERT_ERROR((div % 2 == 0));
640  }
641 
642  // Set PCM_FSC_DIV field in PCM control register
643  REG_SET_FIELD(PCM1, PCM1_CTRL_REG, PCM_FSC_DIV, pcm1_ctrl_reg, div - 1);
644 
645  PCM1->PCM1_CTRL_REG = pcm1_ctrl_reg;
646 }
647 
656 __STATIC_INLINE void hw_pcm_set_fsc_delay(HW_PCM_FSC_DELAY delay)
657 {
658  // Set PCM_FSCDEL field in PCM control register
659  HW_PCM_SRC_REG_SETF(CTRL, PCM_FSCDEL, delay);
660 }
661 
671 {
672  // Set PCM_CLKINV field in PCM control register
673  HW_PCM_SRC_REG_SETF(CTRL, PCM_CLKINV, pol);
674 }
675 
681 __STATIC_INLINE void hw_pcm_set_pcm_input_mux(HW_PCM_INPUT_MUX input)
682 {
683  // Set PCM1_MUX_IN field in APU MUX register
684  REG_SETF(SRC1, SRC1_MUX_REG, PCM1_MUX_IN, input);
685 }
686 
696 {
697  // Set PCM_FSCINV field in PCM control register
698  HW_PCM_SRC_REG_SETF(CTRL, PCM_FSCINV, pol);
699 }
700 
708 __STATIC_INLINE void hw_pcm_set_clk_per_bit(HW_PCM_CYCLE_PER_BIT cycles)
709 {
710  // Set PCM_CLK_BIT field in PCM control register
711  HW_PCM_SRC_REG_SETF(CTRL, PCM_CLK_BIT, cycles);
712 }
713 
723 {
724  // Set PCM_PPOD field in PCM control register
725  HW_PCM_SRC_REG_SETF(CTRL, PCM_PPOD, mode);
726 }
727 
736 __STATIC_INLINE uint32_t hw_pcm_input_read(HW_PCM_INPUT input)
737 {
738  switch (input) {
739  case HW_PCM_INPUT_REG_1:
740  return PCM1->PCM1_IN1_REG;
741  case HW_PCM_INPUT_REG_2:
742  return PCM1->PCM1_IN2_REG;
743  default:
744  ASSERT_WARNING(0);
745  }
746  return 0;
747 }
748 
758 __STATIC_INLINE void hw_pcm_output_write(HW_PCM_OUTPUT output, const uint32_t data)
759 {
760  switch (output) {
761  case HW_PCM_OUTPUT_REG_1:
762  PCM1->PCM1_OUT1_REG = data;
763  break;
764  case HW_PCM_OUTPUT_REG_2:
765  PCM1->PCM1_OUT2_REG = data;
766  break;
767  default:
768  ASSERT_WARNING(0);
769  }
770 }
777 typedef void (*hw_pcm_interrupt_cb_t)(void);
778 
790 
797 void hw_pcm_unregister_interrupt(void);
798 
799 #endif /* dg_configUSE_HW_PCM */
800 #endif /* HW_PCM_H_ */
801 
HW_PCM_FSC_POLARITY_NORMAL
Definition: hw_pcm.h:250
hw_pcm_config_i2s_mode_t
PCM configuration in I2S mode.
Definition: hw_pcm.h:273
REG_SETF
#define REG_SETF(base, reg, field, new_val)
Set the value of a register field.
Definition: sdk_defs.h:738
hw_pcm_get_channel_delay
__STATIC_INLINE uint8_t hw_pcm_get_channel_delay()
Get PCM channel delay.
Definition: hw_pcm.h:420
HW_PCM_DO_OUTPUT_PUSH_PULL
Definition: hw_pcm.h:182
hw_pcm_get_clk_per_bit
__STATIC_INLINE bool hw_pcm_get_clk_per_bit(void)
Get PCM clock cycles per data bit.
Definition: hw_pcm.h:506
hw_pcm_config_generic_pcm_t::fsc_polarity
HW_PCM_FSC_POLARITY fsc_polarity
Definition: hw_pcm.h:262
hw_pcm_set_fsc_div
__STATIC_INLINE void hw_pcm_set_fsc_div(uint16_t div)
Set PCM FSC divider.
Definition: hw_pcm.h:632
hw_pcm_clk_cfg_t::chs
uint8_t chs
Definition: hw_pcm.h:346
hw_pcm_config_generic_pcm_t::fsc_length
uint8_t fsc_length
Definition: hw_pcm.h:266
hw_pcm_clk_cfg_t::bit_depth
uint16_t bit_depth
Definition: hw_pcm.h:345
hw_pcm_config_tdm_mode_t::clock_polarity
HW_PCM_CLK_POLARITY clock_polarity
Definition: hw_pcm.h:287
hw_pcm_get_fsc_edge
__STATIC_INLINE bool hw_pcm_get_fsc_edge(void)
Get PCM FSC edge.
Definition: hw_pcm.h:432
hw_pcm_is_enabled
__STATIC_INLINE bool hw_pcm_is_enabled(void)
Get the status of the PCM interface.
Definition: hw_pcm.h:409
hw_pcm_config_iom_mode_t::fsc_div
uint16_t fsc_div
Definition: hw_pcm.h:305
hw_pcm_set_output_mode
__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
HW_PCM_INPUT_MUX
PCM input multiplexer.
Definition: hw_pcm.h:227
HW_PCM_ONE_CYCLE_PER_BIT
Definition: hw_pcm.h:173
ASSERT_ERROR
#define ASSERT_ERROR(a)
Assert as error macro.
Definition: sdk_defs.h:422
hw_pcm_config_i2s_mode_t::fsc_div
uint16_t fsc_div
Definition: hw_pcm.h:277
hw_pcm_set_fsc_length
__STATIC_INLINE void hw_pcm_set_fsc_length(uint8_t length)
Set PCM FSC length.
Definition: hw_pcm.h:618
HW_PCM_INPUT_MUX_SRC1_OUT
Definition: hw_pcm.h:229
hw_pcm_clk_is_enabled
__STATIC_INLINE bool hw_pcm_clk_is_enabled(void)
Get the status of the PCM interface clock source.
Definition: hw_pcm.h:379
HW_PCM_ERROR_INVALID_SLOTS
Definition: hw_pcm.h:133
hw_pcm_input_read
__STATIC_INLINE uint32_t hw_pcm_input_read(HW_PCM_INPUT input)
Read PCM input (RX) register.
Definition: hw_pcm.h:736
hw_pcm_config_i2s_mode_t::fsc_length
uint8_t fsc_length
Definition: hw_pcm.h:276
HW_PCM_FSC_POLARITY_INVERTED
Definition: hw_pcm.h:251
hw_pcm_config_tdm_mode_t::fsc_length
uint8_t fsc_length
Definition: hw_pcm.h:293
HW_PCM_TWO_CYCLE_PER_BIT
Definition: hw_pcm.h:174
hw_pcm_config_iom_mode_t::clock_polarity
HW_PCM_CLK_POLARITY clock_polarity
Definition: hw_pcm.h:302
HW_PCM_INPUT_MUX_SRC_OUT
Definition: hw_pcm.h:230
hw_pcm_clk_cfg_t::sample_rate
uint8_t sample_rate
Definition: hw_pcm.h:344
HW_PCM_ERROR_INVALID_BIT_DEPTH
Definition: hw_pcm.h:130
sdk_defs.h
Central include header file with platform definitions.
HW_PCM_CLK_POLARITY_INVERTED
Definition: hw_pcm.h:242
hw_pcm_clk_disable
__STATIC_INLINE void hw_pcm_clk_disable(void)
Disable the PCM interface clock source.
Definition: hw_pcm.h:366
hw_pcm_clk_cfg_t
PCM interface clock configuration.
Definition: hw_pcm.h:342
hw_pcm_set_fsc_edge
__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
HW_PCM_DO_OUTPUT_MODE
PCM DO output mode.
Definition: hw_pcm.h:181
hw_pcm_config_tdm_mode_t::fsc_polarity
HW_PCM_FSC_POLARITY fsc_polarity
Definition: hw_pcm.h:292
hw_pcm_get_fsc_delay
__STATIC_INLINE bool hw_pcm_get_fsc_delay(void)
Get PCM FSC delay.
Definition: hw_pcm.h:466
HW_PCM_ERROR_INVALID_SAMPLE_RATE
Definition: hw_pcm.h:129
HW_PCM_DO_OUTPUT_OPEN_DRAIN
Definition: hw_pcm.h:183
HW_PCM_SRC_REG_SET_BIT
#define HW_PCM_SRC_REG_SET_BIT(reg, field)
Set a bit of a PCM register of SRC.
Definition: hw_pcm.h:113
HW_PCM_SRC_REG_GETF
#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
HW_PCM_OUTPUT
PCM output register.
Definition: hw_pcm.h:218
hw_pcm_init
void hw_pcm_init(hw_pcm_config_t *config)
Set initialization of PCM interface.
HW_PCM_OUTPUT_REG_1
Definition: hw_pcm.h:219
HW_PCM_CLK_GEN_INTEGER_ONLY
Definition: hw_pcm.h:163
hw_pcm_get_fsc_div
__STATIC_INLINE uint16_t hw_pcm_get_fsc_div(void)
Get PCM FSC divider.
Definition: hw_pcm.h:453
hw_pcm_config_generic_pcm_t
PCM configuration in PCM mode.
Definition: hw_pcm.h:258
hw_pcm_set_mode
__STATIC_INLINE void hw_pcm_set_mode(HW_PCM_MODE mode)
Set PCM master/slave mode.
Definition: hw_pcm.h:557
HW_PCM_CLK_DIVN
Definition: hw_pcm.h:152
HW_PCM_FSC_STARTS_SYNCH_TO_MSB_BIT
Definition: hw_pcm.h:202
HW_PCM_FSC_STARTS_1_CYCLE_BEFORE_MSB_BIT
Definition: hw_pcm.h:201
HW_PCM_ERROR_CODE
HW_PCM_ERROR_CODE
PCM error code.
Definition: hw_pcm.h:127
hw_pcm_config_tdm_mode_t::channel_delay
uint8_t channel_delay
Definition: hw_pcm.h:289
HW_PCM_CLK_GENERATION
HW_PCM_CLK_GENERATION
PCM clock generation.
Definition: hw_pcm.h:160
hw_pcm_unregister_interrupt
void hw_pcm_unregister_interrupt(void)
Unregister interrupt PCM handler.
hw_pcm_config_generic_pcm_t::cycle_per_bit
HW_PCM_CYCLE_PER_BIT cycle_per_bit
Definition: hw_pcm.h:259
hw_pcm_set_clk_per_bit
__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_t::config_mode
HW_PCM_CONFIG_MODE config_mode
Definition: hw_pcm.h:327
HW_PCM_FSC_EDGE_RISING_AND_FALLING
Definition: hw_pcm.h:192
hw_pcm_config_i2s_mode_t::fsc_polarity
HW_PCM_FSC_POLARITY fsc_polarity
Definition: hw_pcm.h:278
HW_PCM_MODE_SLAVE
Definition: hw_pcm.h:143
HW_PCM_FSC_EDGE
HW_PCM_FSC_EDGE
PCM FSC edge.
Definition: hw_pcm.h:190
hw_pcm_get_output_mode
__STATIC_INLINE HW_PCM_DO_OUTPUT_MODE hw_pcm_get_output_mode(void)
Get PCM DO output mode.
Definition: hw_pcm.h:530
HW_PCM_ERROR_INVALID_FSC_DIV
Definition: hw_pcm.h:134
hw_pcm_set_pcm_input_mux
__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
hw_pcm_set_channel_delay
__STATIC_INLINE void hw_pcm_set_channel_delay(uint8_t delay)
Set PCM channel delay.
Definition: hw_pcm.h:592
HW_PCM_ERROR_INVALID_CHANNEL_DELAYS
Definition: hw_pcm.h:132
hw_pcm_config_tdm_mode_t::cycle_per_bit
HW_PCM_CYCLE_PER_BIT cycle_per_bit
Definition: hw_pcm.h:286
hw_pcm_clk_cfg_t::fsc_div
uint16_t fsc_div
Definition: hw_pcm.h:350
hw_pcm_config_tdm_mode_t
PCM configuration in TDM mode.
Definition: hw_pcm.h:285
hw_pcm_set_fsc_delay
__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
HW_PCM_MODE
PCM master/slave mode.
Definition: hw_pcm.h:142
hw_pcm_config_generic_pcm_t::clock_polarity
HW_PCM_CLK_POLARITY clock_polarity
Definition: hw_pcm.h:261
HW_PCM_FSC_DELAY
HW_PCM_FSC_DELAY
PCM FSC delay.
Definition: hw_pcm.h:200
hw_pcm_config_iom_mode_t::fsc_polarity
HW_PCM_FSC_POLARITY fsc_polarity
Definition: hw_pcm.h:304
hw_pcm_config_tdm_mode_t::fsc_div
uint16_t fsc_div
Definition: hw_pcm.h:291
hw_pcm_set_fsc_polarity
__STATIC_INLINE void hw_pcm_set_fsc_polarity(HW_PCM_FSC_POLARITY pol)
Set PCM FSC polarity.
Definition: hw_pcm.h:695
hw_pcm_set_clk_polarity
__STATIC_INLINE void hw_pcm_set_clk_polarity(HW_PCM_CLK_POLARITY pol)
Set PCM clock polarity.
Definition: hw_pcm.h:670
hw_pcm_interrupt_cb_t
void(* hw_pcm_interrupt_cb_t)(void)
Application-defined callback type for the PCM interrupt.
Definition: hw_pcm.h:777
hw_pcm_output_write
__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_clk_cfg_t::clock
HW_PCM_CLOCK clock
Definition: hw_pcm.h:343
HW_PCM_FSC_POLARITY
HW_PCM_FSC_POLARITY
PCM FSC polarity.
Definition: hw_pcm.h:249
REG_MSK
#define REG_MSK(base, reg, field)
Access register field mask.
Definition: sdk_defs.h:583
mode
HW_GPIO_MODE mode
Definition: hw_gpio.h:211
hw_pcm_config_generic_pcm_t::channel_delay
uint8_t channel_delay
Definition: hw_pcm.h:260
HW_PCM_CRG_REG_SET_BIT
#define HW_PCM_CRG_REG_SET_BIT(reg, field)
Set a bit of a PCM register of CRG.
Definition: hw_pcm.h:76
hw_pcm_get_clk_polarity
__STATIC_INLINE bool hw_pcm_get_clk_polarity(void)
Get PCM clock polarity.
Definition: hw_pcm.h:479
HW_PCM_CRG_REG_GETF
#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_CLK_GEN_FRACTIONAL
Definition: hw_pcm.h:161
hw_pcm_config_t::pcm_mode
HW_PCM_MODE pcm_mode
Definition: hw_pcm.h:328
hw_pcm_register_interrupt
void hw_pcm_register_interrupt(hw_pcm_interrupt_cb_t cb)
Register PCM interrupt handler.
HW_PCM_CLK_POLARITY_NORMAL
Definition: hw_pcm.h:241
HW_PCM_CYCLE_PER_BIT
HW_PCM_CYCLE_PER_BIT
PCM clock cycles per bit.
Definition: hw_pcm.h:172
HW_PCM_CLK_POLARITY
HW_PCM_CLK_POLARITY
PCM clock polarity.
Definition: hw_pcm.h:240
hw_pcm_get_fsc_polarity
__STATIC_INLINE bool hw_pcm_get_fsc_polarity(void)
Get PCM FSC polarity.
Definition: hw_pcm.h:493
hw_pcm_get_fsc_length
__STATIC_INLINE uint8_t hw_pcm_get_fsc_length(void)
Get PCM FSC length.
Definition: hw_pcm.h:442
HW_PCM_INPUT_MUX_PCM_OUT_REG
Definition: hw_pcm.h:231
hw_pcm_get_pcm_input_mux
__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
hw_pcm_clk_enable
__STATIC_INLINE void hw_pcm_clk_enable(void)
Enable the PCM interface clock source.
Definition: hw_pcm.h:357
hw_pcm_clk_cfg_t::cycle_per_bit
HW_PCM_CYCLE_PER_BIT cycle_per_bit
Definition: hw_pcm.h:348
hw_pcm_config_i2s_mode_t::cycle_per_bit
HW_PCM_CYCLE_PER_BIT cycle_per_bit
Definition: hw_pcm.h:274
hw_pcm_disable
__STATIC_INLINE void hw_pcm_disable(void)
Disable the PCM interface.
Definition: hw_pcm.h:396
hw_pcm_clk_cfg_t::ch_delay
uint16_t ch_delay
Definition: hw_pcm.h:347
HW_PCM_ERROR_NO_ERROR
Definition: hw_pcm.h:128
HW_PCM_INPUT_MUX_SRC2_OUT
Definition: hw_pcm.h:232
HW_PCM_INPUT_MUX_OFF
Definition: hw_pcm.h:228
REG_GETF
#define REG_GETF(base, reg, field)
Return the value of a register field.
Definition: sdk_defs.h:711
hw_pcm_config_generic_pcm_t::fsc_div
uint16_t fsc_div
Definition: hw_pcm.h:263
HW_PCM_MODE_MASTER
Definition: hw_pcm.h:144
hw_pcm_config_t::gpio_output_mode
HW_PCM_DO_OUTPUT_MODE gpio_output_mode
Definition: hw_pcm.h:329
hw_pcm_config_iom_mode_t
PCM configuration in IOM2 mode.
Definition: hw_pcm.h:301
HW_PCM_INPUT_REG_1
Definition: hw_pcm.h:210
HW_PCM_ERROR_INVALID_CHANNELS
Definition: hw_pcm.h:131
HW_PCM_CLOCK
HW_PCM_CLOCK
PCM system clock source.
Definition: hw_pcm.h:151
hw_pcm_config_t
PCM interface mode configuration.
Definition: hw_pcm.h:325
HW_PCM_SRC_REG_CLR_BIT
#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_config_generic_pcm_t::fsc_delay
HW_PCM_FSC_DELAY fsc_delay
Definition: hw_pcm.h:264
hw_pcm_enable
__STATIC_INLINE void hw_pcm_enable(void)
Enable the PCM interface.
Definition: hw_pcm.h:387
REG_SET_FIELD
#define REG_SET_FIELD(base, reg, field, var, val)
Set register field value.
Definition: sdk_defs.h:626
HW_PCM_SRC_REG_SETF
#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_OUTPUT_REG_2
Definition: hw_pcm.h:220
HW_PCM_CLK_DIV1
Definition: hw_pcm.h:153
HW_PCM_CONFIG_MODE
HW_PCM_CONFIG_MODE
PCM interface modes.
Definition: hw_pcm.h:311
hw_pcm_clk_cfg_t::div
HW_PCM_CLK_GENERATION div
Definition: hw_pcm.h:351
HW_PCM_INPUT
HW_PCM_INPUT
PCM input register.
Definition: hw_pcm.h:209
hw_pcm_clk_cfg_t::slot
uint8_t slot
Definition: hw_pcm.h:349
HW_PCM_ERROR_NA_DIV
Definition: hw_pcm.h:135
HW_PCM_FSC_EDGE_RISING
Definition: hw_pcm.h:191
HW_PCM_CRG_REG_CLR_BIT
#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_INPUT_REG_2
Definition: hw_pcm.h:211
hw_pcm_init_clk
HW_PCM_ERROR_CODE hw_pcm_init_clk(hw_pcm_clk_cfg_t *pcm_clk)
Initialize PCM clock registers.
hw_pcm_get_mode
__STATIC_INLINE HW_PCM_MODE hw_pcm_get_mode(void)
Get PCM master/slave mode.
Definition: hw_pcm.h:544