HPM SDK
HPMicro Software Development Kit
hpm_pwmv2_drv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023-2025 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef HPM_PWMV2_DRV_H
9 #define HPM_PWMV2_DRV_H
10 
11 #include "hpm_common.h"
12 #include "hpm_pwmv2_regs.h"
13 #include "hpm_soc_feature.h"
14 
15 
23 #define PWM_UNLOCK_KEY (0xB0382607UL)
24 #define PWM_CMP_UNABLE_OUTPUT_INDEX (16)
25 
26 /* DMA selector offset */
27 #define PWMV2_DMA_SEL_CMP_OFFSET (0U)
28 #define PWMV2_DMA_SEL_COUNTER_RELOAD_OFFSET (24U)
29 
30 /* IRQ enable bit mask */
31 #define PWM_IRQ_FAULT(chn) PWMV2_IRQ_EN_FAULT_IRQ_EN_FAULT_SET((1 << chn))
32 #define PWM_IRQ_BURSTEND(counter) PWMV2_IRQ_EN_BURSTEND_IRQ_EN_BURSTEND_SET((1 << counter))
33 #define PWM_IRQ_CAP_POS(chn) PWMV2_IRQ_EN_CAP_POS_IRQ_EN_CAP_POS_SET((1 << chn))
34 #define PWM_IRQ_CAP_NEG(chn) PWMV2_IRQ_EN_CAP_NEG_IRQ_EN_CAP_NEG_SET((1 << chn))
35 #define PWM_IRQ_RELOAD(counter) PWMV2_IRQ_EN_RELOAD_IRQ_EN_RELOAD_SET((1 << counter))
36 #define PWM_IRQ_CMP(cmp) PWMV2_IRQ_EN_CMP_IRQ_EN_CMP_SET((1 << cmp))
37 
38 /* IRQ status bit mask */
39 #define PWM_IRQ_STS_FAULT(chn) PWMV2_IRQ_STS_FAULT_IRQ_STS_FAULT_SET((1 << chn))
40 #define PWM_IRQ_STS_BURSTEND(counter) PWMV2_IRQ_STS_BURSTEND_IRQ_STS_BURSTEND_SET((1 << counter))
41 #define PWM_IRQ_STS_CAP_NEG(chn) PWMV2_IRQ_STS_CAP_NEG_IRQ_STS_CAP_NEG_SET((1 << chn))
42 #define PWM_IRQ_STS_CAP_POS(chn) PWMV2_IRQ_STS_CAP_POS_IRQ_STS_CAP_POS_SET((1 << chn))
43 #define PWM_IRQ_STS_RELOAD(counter) PWMV2_IRQ_STS_RELOAD_IRQ_STS_RELOAD_SET((1 << counter))
44 #define PWM_IRQ_STS_CMP(cmp) PWMV2_IRQ_STS_CMP_IRQ_STS_CMP_SET((1 << cmp))
45 
46 
47 /* PWM force output mask */
48 #define PWM_FORCE_OUTPUT(pwm_index, force_output) \
49  (force_output << (pwm_index << 1))
50 
51 #define PWM_DUTY_CYCLE_FP_MAX ((1U << 24) - 1)
52 
53 #define PWMV2_SHADOW_INDEX(x) PWMV2_SHADOW_VAL_##x
54 #define PWMV2_CMP_INDEX(x) PWMV2_CMP_VAL_WORK_##x
55 #define PWMV2_CALCULATE_INDEX(x) PWMV2_CAL_##x
56 #define PWMV2_CAL_SHADOW_OFFSET_ZERO (31)
57 
58 typedef enum {
64 
65 typedef enum {
75 
76 
77 typedef enum {
83 
84 
89 typedef enum {
95 
96 typedef enum {
101 
102 typedef enum {
106 
107 typedef enum {
111 
112 typedef enum {
118 
119 typedef enum {
125 
126 
127 typedef enum {
133 
138 typedef enum {
144 
145 typedef enum {
151 
152 typedef enum {
156 
157 typedef enum {
162 } pwm_dma_chn_t;
163 
164 typedef enum {
173 
174 typedef enum {
180  cmp_value_ffffff00 = 0x3f
182 
187 typedef struct pwmv2_cmp_config {
188  uint32_t cmp;
194  uint8_t mode;
197  uint8_t hrcmp;
199 
208 
213 typedef struct pwmv2_config {
223  uint8_t update_trigger;
224  uint8_t fault_mode;
232  uint8_t dead_zone_hrpwm;
234 
239 typedef struct pwmv2_pair_config {
242 
243 typedef struct pwmv2_cmp_calculate_cfg {
244  uint8_t counter_index;
245  uint8_t in_index;
246  uint8_t in_offset_index;
247  int8_t t_param;
248  int8_t d_param;
256 
257 
258 #ifdef __cplusplus
259 extern "C" {
260 #endif
261 
268 void pwmv2_deinit(PWMV2_Type *pwm_x);
269 
270 
276 static inline void pwmv2_get_default_config(pwmv2_config_t *config)
277 {
278  *config = (pwmv2_config_t){0};
279 }
280 
281 
288 {
290 }
291 
297 static inline void pwmv2_shadow_register_lock(PWMV2_Type *pwm_x)
298 {
300 }
301 
309 static inline void pwmv2_set_counter_reload_trigmux_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
310 {
311  pwm_x->CNT[counter].CFG2 = (pwm_x->CNT[counter].CFG2 & ~PWMV2_CNT_CFG2_CNT_RELOAD_TRIG_MASK) | PWMV2_CNT_CFG2_CNT_RELOAD_TRIG_SET(trig_index);
312 }
313 
320 static inline void pwmv2_enable_multi_counter_sync(PWMV2_Type *pwm_x, uint8_t mask)
321 {
323  fencerw();
325 }
326 
334 static inline void pwmv2_disable_multi_counter_sync(PWMV2_Type *pwm_x, uint8_t mask)
335 {
337 }
338 
345 static inline void pwmv2_reset_multi_counter_sync(PWMV2_Type *pwm_x, uint8_t mask)
346 {
348 }
349 
350 
357 static inline void pwmv2_start_pwm_output_sync(PWMV2_Type *pwm_x, uint8_t mask)
358 {
360 }
361 
367 static inline void pwmv2_shadow_register_unlock(PWMV2_Type *pwm_x)
368 {
369  pwm_x->WORK_CTRL0 = PWM_UNLOCK_KEY;
370 }
371 
378 static inline void pwmv2_shadow_unlock_bit_mask(PWMV2_Type *pwm_x, uint32_t mask)
379 {
380  pwm_x->UNLOCK = mask;
381 }
382 
392 static inline void pwmv2_set_shadow_val(PWMV2_Type *pwm_x, uint8_t index, uint32_t value, uint8_t high_resolution_tick, bool enable_half_cycle)
393 {
394  pwm_x->SHADOW_VAL[index] = PWMV2_SHADOW_VAL_VALUE_SET(((value << 8) | (enable_half_cycle << 7) | (high_resolution_tick)));
395 }
396 
405 static inline void pwmv2_force_output(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_force_mode_t mode, bool invert)
406 {
407  pwm_x->FORCE_MODE = (pwm_x->FORCE_MODE & ~(PWMV2_FORCE_MODE_POLARITY_SET((1 << chn)) | PWMV2_FORCE_MODE_FORCE_MODE_SET((3 << (chn << 1))))) |
408  PWMV2_FORCE_MODE_POLARITY_SET((invert << chn)) |
409  PWMV2_FORCE_MODE_FORCE_MODE_SET((mode << (chn << 1)));
410 }
411 
418 static inline void pwmv2_enable_four_cmp(PWMV2_Type *pwm_x, pwm_channel_t chn)
419 {
420  pwm_x->PWM[chn].CFG0 |= PWMV2_PWM_CFG0_TRIG_SEL4_MASK;
421 }
422 
429 static inline void pwmv2_disable_four_cmp(PWMV2_Type *pwm_x, pwm_channel_t chn)
430 {
431  pwm_x->PWM[chn].CFG0 &= ~PWMV2_PWM_CFG0_TRIG_SEL4_MASK;
432 }
433 
441 static inline void pwmv2_async_fault_signal_select(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t pad_index)
442 {
443  pwm_x->PWM[chn].CFG0 = (pwm_x->PWM[chn].CFG0 & ~PWMV2_PWM_CFG0_FAULT_SEL_ASYNC_MASK) | PWMV2_PWM_CFG0_FAULT_SEL_ASYNC_SET(pad_index);
444 }
445 
454 {
455  pwm_x->PWM[chn].CFG0 = (pwm_x->PWM[chn].CFG0 & ~PWMV2_PWM_CFG0_FAULT_POL_ASYNC_MASK) | PWMV2_PWM_CFG0_FAULT_POL_ASYNC_SET(polarity);
456 }
457 
464 static inline void pwmv2_enable_async_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
465 {
467 }
468 
469 #if defined(HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG) && HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG
470 
477 static inline void pwmv2_async_fault_polarity_multi(PWMV2_Type *pwm_x, uint16_t polarity_mask)
478 {
479  pwm_x->GLB_CTRL3 = PWMV2_GLB_CTRL3_ASYNC_FAULT_POL_SET(polarity_mask);
480 }
481 
489 static inline void pwmv2_enable_async_fault_multi(PWMV2_Type *pwm_x, pwm_channel_t chn, uint16_t pad_mask)
490 {
491  pwm_x->PWM[chn].CFG3 |= PWMV2_PWM_CFG3_ASYNC_FAULT_SEL_SET(pad_mask);
492 }
493 #endif
494 
501 static inline void pwmv2_disable_async_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
502 {
504 #if defined(HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG) && HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG
505  pwm_x->PWM[chn].CFG3 &= ~(1 << PWMV2_PWM_CFG0_FAULT_SEL_ASYNC_GET(pwm_x->PWM[chn].CFG0));
506 #endif
507 }
508 
509 #if defined(HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG) && HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG
517 static inline void pwmv2_disable_async_fault_multi(PWMV2_Type *pwm_x, pwm_channel_t chn, uint16_t pad_mask)
518 {
519  pwm_x->PWM[chn].CFG3 &= ~PWMV2_PWM_CFG3_ASYNC_FAULT_SEL_SET(pad_mask);
520 }
521 #endif
528 static inline void pwmv2_enable_sync_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
529 {
531 }
532 
539 static inline void pwmv2_disable_sync_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
540 {
542 }
543 
550 static inline void pwmv2_enable_output_invert(PWMV2_Type *pwm_x, pwm_channel_t chn)
551 {
553 }
554 
561 static inline void pwmv2_disable_output_invert(PWMV2_Type *pwm_x, pwm_channel_t chn)
562 {
563  pwm_x->PWM[chn].CFG0 &= ~PWMV2_PWM_CFG0_OUT_POLARITY_MASK;
564 }
565 
574 {
576  pwm_x->PWM[chn].CFG0 = (pwm_x->PWM[chn].CFG0 & ~PWMV2_PWM_CFG0_POL_UPDATE_SEL_MASK) | PWMV2_PWM_CFG0_POL_UPDATE_SEL_SET(update_select);
577 }
578 
586 {
588 }
589 
596 static inline void pwmv2_channel_enable_output(PWMV2_Type *pwm_x, pwm_channel_t chn)
597 {
598  pwm_x->PWM[chn].CFG1 |= PWMV2_PWM_CFG1_HIGHZ_EN_N_MASK;
599 }
600 
608 {
609  pwm_x->PWM[chn].CFG1 &= ~PWMV2_PWM_CFG1_HIGHZ_EN_N_MASK;
610 }
611 
620 {
621  pwm_x->PWM[chn].CFG1 = (pwm_x->PWM[chn].CFG1 & ~PWMV2_PWM_CFG1_FORCE_UPDATE_TIME_MASK) | PWMV2_PWM_CFG1_FORCE_UPDATE_TIME_SET(update_time);
622 }
623 
631 static inline void pwmv2_set_fault_mode(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_fault_mode_t mode)
632 {
633  pwm_x->PWM[chn].CFG1 = (pwm_x->PWM[chn].CFG1 & ~PWMV2_PWM_CFG1_FAULT_MODE_MASK) | PWMV2_PWM_CFG1_FAULT_MODE_SET(mode);
634 }
635 
644 {
646 }
647 
655 {
656  pwm_x->PWM[chn].CFG1 &= ~PWMV2_PWM_CFG1_SW_FORCE_EN_MASK;
657 }
658 
666 {
668 }
669 
677 {
678  pwm_x->PWM[chn].CFG1 &= ~PWMV2_PWM_CFG1_SW_FORCE_EN_MASK;
679 }
680 
687 static inline void pwmv2_enable_pair_mode(PWMV2_Type *pwm_x, pwm_channel_t chn)
688 {
689  pwm_x->PWM[chn].CFG1 |= PWMV2_PWM_CFG1_PAIR_MODE_MASK;
690 }
691 
698 static inline void pwmv2_disable_pair_mode(PWMV2_Type *pwm_x, pwm_channel_t chn)
699 {
700  pwm_x->PWM[chn].CFG1 &= ~PWMV2_PWM_CFG1_PAIR_MODE_MASK;
701 }
702 
711 {
712  pwm_x->PWM[chn].CFG1 = (pwm_x->PWM[chn].CFG1 & ~PWMV2_PWM_CFG1_PWM_LOGIC_MASK) | PWMV2_PWM_CFG1_PWM_LOGIC_SET(logic);
713 }
714 
723 {
724  pwm_x->PWM[chn].CFG1 = (pwm_x->PWM[chn].CFG1 & ~PWMV2_PWM_CFG1_FORCE_TIME_MASK) | PWMV2_PWM_CFG1_FORCE_TIME_SET(time);
725 }
726 
734 static inline void pwmv2_trig_force_mode_select_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
735 {
736  pwm_x->PWM[chn].CFG1 = (pwm_x->PWM[chn].CFG1 & ~PWMV2_PWM_CFG1_FORCE_TRIG_SEL_MASK) | PWMV2_PWM_CFG1_FORCE_TRIG_SEL_SET(trigmux_index);
737 }
738 
746 static inline void pwmv2_trig_force_hardware_or_software_select_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
747 {
748  pwm_x->PWM[chn].CFG1 = (pwm_x->PWM[chn].CFG1 & ~PWMV2_PWM_CFG1_FORCE_ACT_SEL_MASK) | PWMV2_PWM_CFG1_FORCE_ACT_SEL_SET(trigmux_index);
749 }
750 
758 static inline void pwmv2_select_force_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
759 {
760  pwm_x->PWM[chn].CFG1 = (pwm_x->PWM[chn].CFG1 & ~PWMV2_PWM_CFG1_PWM_FORCE_SEL_MASK) | PWMV2_PWM_CFG1_PWM_FORCE_SEL_SET(trigmux_index);
761 }
762 
770 static inline void pwmv2_select_recovery_fault_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
771 {
772  pwm_x->PWM[chn].CFG1 = (pwm_x->PWM[chn].CFG1 & ~PWMV2_PWM_CFG1_FAULT_REC_SEL_MASK) | PWMV2_PWM_CFG1_FAULT_REC_SEL_SET(trigmux_index);
773 }
774 
782 static inline void pwmv2_set_dead_area(PWMV2_Type *pwm_x, pwm_channel_t chn, uint32_t dead)
783 {
784  pwm_x->PWM[chn].DEAD_AREA = PWMV2_PWM_DEAD_AREA_DEAD_AREA_SET((dead << 8));
785 }
786 
795 static inline void pwmv2_set_dead_area_hrpwm(PWMV2_Type *pwm_x, pwm_channel_t chn, uint16_t dead_cycle, uint8_t dead_hrpwm)
796 {
797  pwm_x->PWM[chn].DEAD_AREA = PWMV2_PWM_DEAD_AREA_DEAD_AREA_SET(((uint32_t)dead_cycle << 8) | dead_hrpwm);
798 }
799 
807 static inline void pwmv2_set_trigout_cmp_index(PWMV2_Type *pwm_x, pwm_channel_t trigmux_chn, uint8_t cmp_index)
808 {
809  pwm_x->TRIGGER_CFG[trigmux_chn] = (pwm_x->TRIGGER_CFG[trigmux_chn] & ~PWMV2_TRIGGER_CFG_TRIGGER_OUT_SEL_MASK) | PWMV2_TRIGGER_CFG_TRIGGER_OUT_SEL_SET(cmp_index);
810 }
811 
818 static inline void pwmv2_enable_software_force(PWMV2_Type *pwm_x, pwm_channel_t chn)
819 {
820  pwm_x->GLB_CTRL |= PWMV2_GLB_CTRL_SW_FORCE_SET((1 << chn));
821 }
822 
830 {
831  pwm_x->GLB_CTRL &= ~(PWMV2_GLB_CTRL_SW_FORCE_SET((1 << chn)));
832 }
833 
834 #ifdef PWM_SOC_HRPWM_SUPPORT
835 
842 static inline void pwmv2_add_delay_tick_after_dead_area(PWMV2_Type *pwm_x, uint8_t delay_tick)
843 {
845 }
846 
852 static inline void pwmv2_enable_hrpwm(PWMV2_Type *pwm_x)
853 {
855 }
856 
862 static inline void pwmv2_disable_hrpwm(PWMV2_Type *pwm_x)
863 {
865 }
866 
867 #endif
868 
875 static inline void pwmv2_enable_software_dac_mode(PWMV2_Type *pwm_x, pwm_dac_channel_t dac_index)
876 {
877  pwm_x->GLB_CTRL2 |= PWMV2_GLB_CTRL2_DAC_SW_MODE_SET((1 << dac_index));
878 }
879 
886 static inline void pwmv2_disable_software_dac_mode(PWMV2_Type *pwm_x, pwm_dac_channel_t dac_index)
887 {
888  pwm_x->GLB_CTRL2 &= ~PWMV2_GLB_CTRL2_DAC_SW_MODE_SET((1 << dac_index));
889 }
890 
896 static inline void pwmv2_enable_debug_mode(PWMV2_Type *pwm_x)
897 {
899 }
900 
901 
907 static inline void pwmv2_disable_debug_mode(PWMV2_Type *pwm_x)
908 {
910 }
911 
918 static inline void pwmv2_clear_fault_event(PWMV2_Type *pwm_x, pwm_channel_t chn)
919 {
921 }
922 
929 {
931 }
932 
939 {
941 }
942 
950 static inline uint32_t pwmv2_get_counter_working_status(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
951 {
952  return PWMV2_CNT_RELOAD_WORK_VALUE_GET(pwm_x->CNT_RELOAD_WORK[counter_index]);
953 }
954 
962 static inline uint32_t pwmv2_get_cmp_working_status(PWMV2_Type *pwm_x, uint8_t cmp_index)
963 {
964  return PWMV2_CMP_VAL_WORK_VALUE_GET(pwm_x->CMP_VAL_WORK[cmp_index]);
965 }
966 
973 static inline uint32_t pwmv2_get_force_working_status(PWMV2_Type *pwm_x)
974 {
976 }
977 
985 {
987 }
988 
996 static inline uint32_t pwmv2_get_counter_value(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
997 {
998  return PWMV2_CNT_VAL_VALUE_GET(pwm_x->CNT_VAL[counter_index]);
999 }
1000 
1008 static inline void pwmv2_set_dac_value(PWMV2_Type *pwm_x, pwm_dac_channel_t dac_index, uint32_t value)
1009 {
1010  pwm_x->DAC_VALUE_SV[dac_index] = PWMV2_DAC_VALUE_SV_VALUE_SET(value);
1011 }
1012 
1020 static inline uint32_t pwmv2_get_capture_posedge_value(PWMV2_Type *pwm_x, pwm_channel_t chn)
1021 {
1022  return PWMV2_CAPTURE_POS_CAPTURE_POS_GET(pwm_x->CAPTURE_POS[chn]);
1023 }
1024 
1033 {
1034  pwm_x->CAPTURE_POS[chn] = (pwm_x->CAPTURE_POS[chn] & ~PWMV2_CAPTURE_POS_CAPTURE_SELGPIO_MASK) |
1036 }
1037 
1045 static inline void pwmv2_set_capture_counter_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t counter_index)
1046 {
1047  pwm_x->CAPTURE_POS[chn] = (pwm_x->CAPTURE_POS[chn] & ~PWMV2_CAPTURE_POS_CNT_INDEX_MASK) |
1048  PWMV2_CAPTURE_POS_CNT_INDEX_SET(counter_index);
1049 }
1050 
1058 static inline uint32_t pwmv2_get_capture_negedge_value(PWMV2_Type *pwm_x, pwm_channel_t chn)
1059 {
1060  return PWMV2_CAPTURE_NEG_CAPTURE_NEG_GET(pwm_x->CAPTURE_NEG[chn]);
1061 }
1062 
1069 static inline uint32_t pwmv2_get_irq_status_all(PWMV2_Type *pwm_x)
1070 {
1071  return pwm_x->IRQ_STS;
1072 }
1073 
1080 {
1082 }
1083 
1090 {
1092 }
1093 
1100 {
1102 }
1103 
1110 static inline uint32_t pwmv2_get_cmp_irq_status(PWMV2_Type *pwm_x)
1111 {
1113 }
1114 
1121 static inline void pwmv2_clear_cmp_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1122 {
1124 }
1125 
1132 static inline uint32_t pwmv2_get_reload_irq_status(PWMV2_Type *pwm_x)
1133 {
1135 }
1136 
1143 static inline void pwmv2_clear_reload_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1144 {
1146 }
1147 
1154 static inline uint32_t pwmv2_get_capture_posedge_irq_status(PWMV2_Type *pwm_x)
1155 {
1157 }
1158 
1165 static inline void pwmv2_clear_capture_posedge_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1166 {
1168 }
1169 
1176 static inline uint32_t pwmv2_get_capture_negedge_irq_status(PWMV2_Type *pwm_x)
1177 {
1179 }
1180 
1187 static inline void pwmv2_clear_capture_negedge_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1188 {
1190 }
1191 
1198 static inline uint32_t pwmv2_get_fault_irq_status(PWMV2_Type *pwm_x)
1199 {
1201 }
1202 
1209 static inline void pwmv2_clear_fault_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1210 {
1212 }
1213 
1220 static inline uint32_t pwmv2_get_burstend_irq_status(PWMV2_Type *pwm_x)
1221 {
1223 }
1224 
1231 static inline void pwmv2_clear_burstend__irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1232 {
1234 }
1235 
1242 static inline void pwmv2_enable_cmp_irq(PWMV2_Type *pwm_x, uint8_t cmp_index)
1243 {
1244  pwm_x->IRQ_EN_CMP |= PWMV2_IRQ_EN_CMP_IRQ_EN_CMP_SET(1 << cmp_index);
1245 }
1246 
1253 static inline void pwmv2_disable_cmp_irq(PWMV2_Type *pwm_x, uint8_t cmp_index)
1254 {
1255  pwm_x->IRQ_EN_CMP &= ~PWMV2_IRQ_EN_CMP_IRQ_EN_CMP_SET(1 << cmp_index);
1256 }
1257 
1264 static inline uint32_t pwmv2_get_enabled_cmp_irq(PWMV2_Type *pwm_x)
1265 {
1267 }
1268 
1275 static inline void pwmv2_enable_reload_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
1276 {
1277  pwm_x->IRQ_EN_RELOAD |= PWMV2_IRQ_EN_RELOAD_IRQ_EN_RELOAD_SET(1 << counter_index);
1278 }
1279 
1286 static inline void pwmv2_disable_reload_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
1287 {
1288  pwm_x->IRQ_EN_RELOAD &= ~PWMV2_IRQ_EN_RELOAD_IRQ_EN_RELOAD_SET(1 << counter_index);
1289 }
1290 
1297 static inline void pwmv2_enable_capture_posedge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1298 {
1299  pwm_x->IRQ_EN_CAP_POS |= PWMV2_IRQ_EN_CAP_POS_IRQ_EN_CAP_POS_SET(1 << channel_index);
1300 }
1301 
1308 static inline void pwmv2_disable_capture_posedge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1309 {
1310  pwm_x->IRQ_EN_CAP_POS &= ~PWMV2_IRQ_EN_CAP_POS_IRQ_EN_CAP_POS_SET(1 << channel_index);
1311 }
1312 
1319 static inline void pwmv2_enable_capture_nededge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1320 {
1321  pwm_x->IRQ_EN_CAP_NEG |= PWMV2_IRQ_EN_CAP_NEG_IRQ_EN_CAP_NEG_SET(1 << channel_index);
1322 }
1323 
1330 static inline void pwmv2_disable_capture_nededge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1331 {
1332  pwm_x->IRQ_EN_CAP_NEG &= ~PWMV2_IRQ_EN_CAP_NEG_IRQ_EN_CAP_NEG_SET(1 << channel_index);
1333 }
1334 
1341 static inline void pwmv2_enable_fault_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1342 {
1343  pwm_x->IRQ_EN_FAULT |= PWMV2_IRQ_EN_FAULT_IRQ_EN_FAULT_SET(1 << channel_index);
1344 }
1345 
1352 static inline void pwmv2_disable_fault_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1353 {
1354  pwm_x->IRQ_EN_FAULT &= ~PWMV2_IRQ_EN_FAULT_IRQ_EN_FAULT_SET(1 << channel_index);
1355 }
1356 
1363 static inline void pwmv2_enable_burstend_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
1364 {
1365  pwm_x->IRQ_EN_BURSTEND |= PWMV2_IRQ_EN_BURSTEND_IRQ_EN_BURSTEND_SET(1 << counter_index);
1366 }
1367 
1374 static inline void pwmv2_disable_burstend_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
1375 {
1376  pwm_x->IRQ_EN_BURSTEND &= ~PWMV2_IRQ_EN_BURSTEND_IRQ_EN_BURSTEND_SET(1 << counter_index);
1377 }
1378 
1386 static inline void pwmv2_enable_dma_at_compare_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel, uint8_t cmp_index)
1387 {
1388  pwm_x->DMA_EN = (pwm_x->DMA_EN & ~((PWMV2_DMA_EN_DMA0_SEL_MASK | PWMV2_DMA_EN_DMA0_EN_MASK) << (PWMV2_DMA_EN_DMA1_SEL_SHIFT * dma_channel))) |
1390 }
1391 
1398 static inline void pwmv2_disable_dma_at_compare_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel)
1399 {
1401 }
1402 
1417 static inline void pwmv2_enable_dma_at_reload_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel, pwm_counter_t reload_index)
1418 {
1419  (void)reload_index;
1420  pwm_x->DMA_EN = (pwm_x->DMA_EN & ~((PWMV2_DMA_EN_DMA0_SEL_MASK | PWMV2_DMA_EN_DMA0_EN_MASK) << (PWMV2_DMA_EN_DMA1_SEL_SHIFT * dma_channel))) |
1422 }
1423 
1430 static inline void pwmv2_disable_dma_at_reload_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel)
1431 {
1433 }
1434 
1442 static inline void pwmv2_reload_select_compare_point0_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cmp_index)
1443 {
1444  pwm_x->CNT[counter].CFG0 = (pwm_x->CNT[counter].CFG0 & ~(PWMV2_CNT_CFG0_RLD_CMP_SEL0_MASK)) | PWMV2_CNT_CFG0_RLD_CMP_SEL0_SET(cmp_index);
1445 }
1446 
1454 static inline void pwmv2_reload_select_compare_point1_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cmp_index)
1455 {
1456  pwm_x->CNT[counter].CFG0 = (pwm_x->CNT[counter].CFG0 & ~(PWMV2_CNT_CFG0_RLD_CMP_SEL1_MASK)) | PWMV2_CNT_CFG0_RLD_CMP_SEL1_SET(cmp_index);
1457 }
1458 
1466 static inline void pwmv2_reload_select_input_trigger(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
1467 {
1468  pwm_x->CNT[counter].CFG0 = (pwm_x->CNT[counter].CFG0 & ~(PWMV2_CNT_CFG0_RLD_TRIG_SEL_MASK)) | PWMV2_CNT_CFG0_RLD_TRIG_SEL_SET(trig_index);
1469 }
1470 
1479 {
1480  pwm_x->CNT[counter].CFG0 = (pwm_x->CNT[counter].CFG0 & ~(PWMV2_CNT_CFG0_RLD_UPDATE_TIME_MASK)) | PWMV2_CNT_CFG0_RLD_UPDATE_TIME_SET(update);
1481 }
1482 
1490 static inline void pwmv2_counter_set_dac_data_parameter(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t dac_parameter)
1491 {
1492  pwm_x->CNT[counter].CFG0 = (pwm_x->CNT[counter].CFG0 & ~PWMV2_CNT_CFG0_CNT_D_PARAM_MASK) | PWMV2_CNT_CFG0_CNT_D_PARAM_SET(dac_parameter);
1493 }
1494 
1502 static inline void pwmv2_conuter_select_dac_index(PWMV2_Type *pwm_x, pwm_counter_t counter, pwm_dac_channel_t dac_index)
1503 {
1504  pwm_x->CNT[counter].CFG1 = (pwm_x->CNT[counter].CFG1 & ~PWMV2_CNT_CFG1_CNT_DAC_INDEX_MASK) | PWMV2_CNT_CFG1_CNT_DAC_INDEX_SET(dac_index);
1505 }
1506 
1513 static inline void pwmv2_counter_up_limit_enable(PWMV2_Type *pwm_x, pwm_counter_t counter)
1514 {
1515  pwm_x->CNT[counter].CFG1 |= PWMV2_CNT_CFG1_CNT_LU_EN_MASK;
1516 }
1517 
1524 static inline void pwmv2_counter_up_limit_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
1525 {
1526  pwm_x->CNT[counter].CFG1 &= ~PWMV2_CNT_CFG1_CNT_LU_EN_MASK;
1527 }
1528 
1536 static inline void pwmv2_counter_select_up_limit_from_shadow_value(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t index)
1537 {
1538  pwm_x->CNT[counter].CFG1 = (pwm_x->CNT[counter].CFG1 & ~PWMV2_CNT_CFG1_CNT_LIM_UP_MASK) | PWMV2_CNT_CFG1_CNT_LIM_UP_SET(index);
1539 }
1540 
1547 static inline void pwmv2_counter_low_limit_enable(PWMV2_Type *pwm_x, pwm_counter_t counter)
1548 {
1549  pwm_x->CNT[counter].CFG1 |= PWMV2_CNT_CFG1_CNT_LL_EN_MASK;
1550 }
1551 
1552 
1559 static inline void pwmv2_counter_low_limit_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
1560 {
1561  pwm_x->CNT[counter].CFG1 &= ~PWMV2_CNT_CFG1_CNT_LL_EN_MASK;
1562 }
1563 
1571 static inline void pwmv2_counter_select_low_limit_from_shadow_value(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t index)
1572 {
1573  pwm_x->CNT[counter].CFG1 = (pwm_x->CNT[counter].CFG1 & ~PWMV2_CNT_CFG1_CNT_LIM_LO_MASK) | PWMV2_CNT_CFG1_CNT_LIM_LO_SET(index);
1574 }
1575 
1583 static inline void pwmv2_counter_select_data_offset_from_shadow_value(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t index)
1584 {
1585  pwm_x->CNT[counter].CFG1 = (pwm_x->CNT[counter].CFG1 & ~PWMV2_CNT_CFG1_CNT_IN_OFF_MASK) | PWMV2_CNT_CFG1_CNT_IN_OFF_SET(index);
1586 }
1587 
1595 {
1596  pwm_x->CNT[counter].CFG2 |= PWMV2_CNT_CFG2_CNT_RELOAD_EN_MASK;
1597 }
1598 
1606 {
1607  pwm_x->CNT[counter].CFG2 &= ~PWMV2_CNT_CFG2_CNT_RELOAD_EN_MASK;
1608 }
1609 
1617 static inline void pwmv2_counter_update_trig1(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
1618 {
1619  pwm_x->CNT[counter].CFG2 = (pwm_x->CNT[counter].CFG2 & ~PWMV2_CNT_CFG2_CNT_UPDATE_TRIG1_MASK) | PWMV2_CNT_CFG2_CNT_UPDATE_TRIG1_SET(trig_index);
1620 }
1621 
1629 {
1630  pwm_x->CNT[counter].CFG2 |= PWMV2_CNT_CFG2_CNT_UPDATE_EN1_MASK;
1631 }
1632 
1640 {
1641  pwm_x->CNT[counter].CFG2 &= ~PWMV2_CNT_CFG2_CNT_UPDATE_EN1_MASK;
1642 }
1643 
1651 static inline void pwmv2_counter_set_trig1_calculate_cell_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cal_index)
1652 {
1653  pwm_x->CNT[counter].CFG2 = (pwm_x->CNT[counter].CFG2 & ~PWMV2_CNT_CFG2_CNT_TRIG1_MASK) | PWMV2_CNT_CFG2_CNT_TRIG1_SET(cal_index);
1654 }
1655 
1663 static inline void pwmv2_counter_update_trig0(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
1664 {
1665  pwm_x->CNT[counter].CFG2 = (pwm_x->CNT[counter].CFG2 & ~PWMV2_CNT_CFG2_CNT_UPDATE_TRIG0_MASK) | PWMV2_CNT_CFG2_CNT_UPDATE_TRIG0_SET(trig_index);
1666 }
1667 
1675 {
1676  pwm_x->CNT[counter].CFG2 |= PWMV2_CNT_CFG2_CNT_UPDATE_EN0_MASK;
1677 }
1678 
1686 {
1687  pwm_x->CNT[counter].CFG2 &= ~PWMV2_CNT_CFG2_CNT_UPDATE_EN0_MASK;
1688 }
1689 
1697 static inline void pwmv2_counter_set_trig0_calculate_cell_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cal_index)
1698 {
1699  pwm_x->CNT[counter].CFG2 = (pwm_x->CNT[counter].CFG2 & ~PWMV2_CNT_CFG2_CNT_TRIG0_MASK) | PWMV2_CNT_CFG2_CNT_TRIG0_SET(cal_index);
1700 }
1701 
1709 static inline void pwmv2_counter_start_select_trigger_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
1710 {
1711  pwm_x->CNT[counter].CFG3 = (pwm_x->CNT[counter].CFG3 & ~PWMV2_CNT_CFG3_CNT_START_SEL_MASK) | PWMV2_CNT_CFG3_CNT_START_SEL_SET(trig_index);
1712 }
1713 
1721 {
1722  pwm_x->CNT[counter].CFG3 |= PWMV2_CNT_CFG3_CNT_HW_START_EN_MASK;
1723 }
1724 
1732 {
1733  pwm_x->CNT[counter].CFG3 &= ~PWMV2_CNT_CFG3_CNT_HW_START_EN_MASK;
1734 }
1735 
1743 static inline void pwmv2_set_counter_burst(PWMV2_Type *pwm_x, pwm_counter_t counter, uint16_t burst)
1744 {
1745  pwm_x->CNT[counter].CFG3 = (pwm_x->CNT[counter].CFG3 & ~PWMV2_CNT_CFG3_CNT_BURST_MASK) | PWMV2_CNT_CFG3_CNT_BURST_SET(burst);
1746 }
1747 
1754 static inline void pwmv2_counter_burst_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
1755 {
1756  pwm_x->CNT[counter].CFG3 |= PWMV2_CNT_CFG3_CNT_BURST_MASK;
1757 }
1758 
1765 static inline void pwmv2_start_pwm_output(PWMV2_Type *pwm_x, pwm_counter_t counter)
1766 {
1767  pwm_x->CNT_GLBCFG |= PWMV2_CNT_GLBCFG_CNT_SW_START_SET((1 << counter));
1768 }
1769 
1776 static inline void pwmv2_reset_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
1777 {
1778  pwm_x->CNT_GLBCFG |= PWMV2_CNT_GLBCFG_TIMER_RESET_SET((1 << counter));
1779 }
1780 
1787 static inline void pwmv2_enable_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
1788 {
1789  pwm_x->CNT_GLBCFG |= PWMV2_CNT_GLBCFG_TIMER_ENABLE_SET((1 << counter));
1790 }
1791 
1798 static inline void pwmv2_disable_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
1799 {
1800  pwm_x->CNT_GLBCFG &= ~PWMV2_CNT_GLBCFG_TIMER_ENABLE_SET((1 << counter));
1801 }
1802 
1810 static inline void pwmv2_calculate_set_up_limit_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
1811 {
1812  pwm_x->CAL[cal_index].CFG0 = (pwm_x->CAL[cal_index].CFG0 & ~PWMV2_CAL_CFG0_CAL_LU_PARAM_MASK) | PWMV2_CAL_CFG0_CAL_LU_PARAM_SET(value);
1813 }
1814 
1822 static inline void pwmv2_calculate_set_low_limit_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
1823 {
1824  pwm_x->CAL[cal_index].CFG0 = (pwm_x->CAL[cal_index].CFG0 & ~PWMV2_CAL_CFG0_CAL_LL_PARAM_MASK) | PWMV2_CAL_CFG0_CAL_LL_PARAM_SET(value);
1825 }
1826 
1834 static inline void pwmv2_calculate_set_period_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
1835 {
1836  pwm_x->CAL[cal_index].CFG0 = (pwm_x->CAL[cal_index].CFG0 & ~PWMV2_CAL_CFG0_CAL_T_PARAM_MASK) | PWMV2_CAL_CFG0_CAL_T_PARAM_SET(value);
1837 }
1838 
1846 static inline void pwmv2_calculate_set_dac_value_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
1847 {
1848  pwm_x->CAL[cal_index].CFG0 = (pwm_x->CAL[cal_index].CFG0 & ~PWMV2_CAL_CFG0_CAL_D_PARAM_MASK) | PWMV2_CAL_CFG0_CAL_D_PARAM_SET(value);
1849 }
1850 
1858 static inline void pwmv2_calculate_select_counter_calculate_index(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t counter_calculate)
1859 {
1860  pwm_x->CAL[cal_index].CFG1 = (pwm_x->CAL[cal_index].CFG1 & ~PWMV2_CAL_CFG1_CAL_T_INDEX_MASK) | PWMV2_CAL_CFG1_CAL_T_INDEX_SET(counter_calculate);
1861 }
1862 
1870 static inline void pwmv2_calculate_select_in_value(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t index)
1871 {
1872  pwm_x->CAL[cal_index].CFG1 = (pwm_x->CAL[cal_index].CFG1 & ~PWMV2_CAL_CFG1_CAL_IN_INDEX_MASK) | PWMV2_CAL_CFG1_CAL_IN_INDEX_SET(index);
1873 }
1874 
1881 static inline void pwmv2_calculate_enable_up_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
1882 {
1883  pwm_x->CAL[cal_index].CFG1 |= PWMV2_CAL_CFG1_CAL_LU_EN_MASK;
1884 }
1885 
1892 static inline void pwmv2_calculate_disable_up_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
1893 {
1894  pwm_x->CAL[cal_index].CFG1 &= ~PWMV2_CAL_CFG1_CAL_LU_EN_MASK;
1895 }
1896 
1904 static inline void pwmv2_calculate_select_up_limit_offset(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t shadow_index)
1905 {
1906  pwm_x->CAL[cal_index].CFG1 = (pwm_x->CAL[cal_index].CFG1 & ~PWMV2_CAL_CFG1_CAL_LIM_UP_MASK) | PWMV2_CAL_CFG1_CAL_LIM_UP_SET(shadow_index);
1907 }
1908 
1916 static inline void pwmv2_calculate_select_low_limit_offset(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t shadow_index)
1917 {
1918  pwm_x->CAL[cal_index].CFG1 = (pwm_x->CAL[cal_index].CFG1 & ~PWMV2_CAL_CFG1_CAL_LIM_LO_MASK) | PWMV2_CAL_CFG1_CAL_LIM_LO_SET(shadow_index);
1919 }
1920 
1928 static inline void pwmv2_calculate_select_in_offset(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t shadow_index)
1929 {
1930  pwm_x->CAL[cal_index].CFG1 = (pwm_x->CAL[cal_index].CFG1 & ~PWMV2_CAL_CFG1_CAL_IN_OFF_MASK) | PWMV2_CAL_CFG1_CAL_IN_OFF_SET(shadow_index);
1931 }
1932 
1939 static inline void pwmv2_calculate_enable_low_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
1940 {
1941  pwm_x->CAL[cal_index].CFG1 |= PWMV2_CAL_CFG1_CAL_LL_EN_MASK;
1942 }
1943 
1950 static inline void pwmv2_calculate_disable_low_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
1951 {
1952  pwm_x->CAL[cal_index].CFG1 &= ~PWMV2_CAL_CFG1_CAL_LL_EN_MASK;
1953 }
1954 
1962 static inline void pwmv2_select_cmp_trigmux(PWMV2_Type *pwm_x, uint8_t cmp_index, uint8_t trig_index)
1963 {
1964  pwm_x->CMP[cmp_index].CFG = (pwm_x->CMP[cmp_index].CFG & ~PWMV2_CMP_CFG_CMP_TRIG_SEL_MASK) | PWMV2_CMP_CFG_CMP_TRIG_SEL_SET(trig_index);
1965 }
1966 
1974 static inline void pwmv2_cmp_update_trig_time(PWMV2_Type *pwm_x, uint8_t cmp_index, pwm_cmp_shadow_register_update_trigger_t trig_time)
1975 {
1976  pwm_x->CMP[cmp_index].CFG = (pwm_x->CMP[cmp_index].CFG & ~PWMV2_CMP_CFG_CMP_UPDATE_TIME_MASK) | PWMV2_CMP_CFG_CMP_UPDATE_TIME_SET(trig_time);
1977 }
1978 
1987 static inline void pwmv2_select_cmp_source(PWMV2_Type *pwm_x, uint8_t cmp_index, pwm_cmp_source_t cmp_sel, uint8_t index)
1988 {
1989  pwm_x->CMP[cmp_index].CFG = (pwm_x->CMP[cmp_index].CFG & ~PWMV2_CMP_CFG_CMP_IN_SEL_MASK) | PWMV2_CMP_CFG_CMP_IN_SEL_SET((cmp_sel + index));
1990 }
1991 
1999 static inline void pwmv2_cmp_select_counter(PWMV2_Type *pwm_x, uint8_t cmp_index, pwm_counter_t counter_index)
2000 {
2001  if (cmp_index >= 16) {
2002  pwm_x->CMP[cmp_index].CFG = (pwm_x->CMP[cmp_index].CFG & ~PWMV2_CMP_CFG_CMP_CNT_MASK) | PWMV2_CMP_CFG_CMP_CNT_SET((counter_index));
2003  }
2004 }
2005 
2013 void pwmv2_config_cmp(PWMV2_Type *pwm_x, uint8_t index, pwmv2_cmp_config_t *config);
2014 
2023 
2032 void pwmv2_config_pwm(PWMV2_Type *pwm_x, pwm_channel_t index, pwmv2_config_t *config, bool enable_pair_mode);
2033 
2047  uint8_t cmp_start_index, pwmv2_cmp_config_t *cmp, uint8_t cmp_num);
2048 
2061  pwmv2_pair_config_t *pwm_pair_config, uint8_t cmp_start_index,
2062  pwmv2_cmp_config_t *cmp, uint8_t cmp_num);
2063 
2071 void pwmv2_setup_cmp_calculate(PWMV2_Type *pwm_x, uint8_t cal_index, pwmv2_cmp_calculate_cfg_t *cal);
2072 
2073 #ifdef __cplusplus
2074 }
2075 #endif
2079 #endif /* HPM_PWMV2_DRV_H */
#define PWMV2_CNT_CFG2_CNT_RELOAD_TRIG_SET(x)
Definition: hpm_pwmv2_regs.h:1065
#define PWMV2_GLB_CTRL2_DAC_SW_MODE_SET(x)
Definition: hpm_pwmv2_regs.h:483
#define PWMV2_CNT_CFG3_CNT_HW_START_EN_MASK
Definition: hpm_pwmv2_regs.h:1144
#define PWMV2_CNT_CFG1_CNT_LU_EN_MASK
Definition: hpm_pwmv2_regs.h:1002
#define PWMV2_IRQ_STS_CMP_IRQ_STS_CMP_GET(x)
Definition: hpm_pwmv2_regs.h:726
#define PWMV2_PWM_CFG3_ASYNC_FAULT_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:420
#define PWMV2_FORCE_WORK_OUT_POLARITY_GET(x)
Definition: hpm_pwmv2_regs.h:567
#define PWMV2_CNT_CFG0_CNT_D_PARAM_MASK
Definition: hpm_pwmv2_regs.h:981
#define PWMV2_CAL_CFG1_CAL_LIM_UP_MASK
Definition: hpm_pwmv2_regs.h:1272
#define PWMV2_CAPTURE_POS_CAPTURE_SELGPIO_SET(x)
Definition: hpm_pwmv2_regs.h:618
#define PWMV2_CNT_CFG3_CNT_START_SEL_MASK
Definition: hpm_pwmv2_regs.h:1134
#define PWMV2_IRQ_EN_CAP_POS_IRQ_EN_CAP_POS_SET(x)
Definition: hpm_pwmv2_regs.h:813
#define PWMV2_PWM_CFG0_POL_UPDATE_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:226
#define PWMV2_IRQ_STS_BURSTEND_IRQ_STS_BURSTEND_SET(x)
Definition: hpm_pwmv2_regs.h:780
#define PWMV2_GLB_CTRL3_ASYNC_FAULT_POL_SET(x)
Definition: hpm_pwmv2_regs.h:536
#define PWMV2_IRQ_STS_IRQ_CAL_OVERFLOW_MASK
Definition: hpm_pwmv2_regs.h:647
#define PWMV2_CAL_CFG1_CAL_IN_INDEX_SET(x)
Definition: hpm_pwmv2_regs.h:1254
#define PWMV2_CNT_CFG1_CNT_IN_OFF_SET(x)
Definition: hpm_pwmv2_regs.h:1044
#define PWMV2_PWM_CFG0_TRIG_SEL4_MASK
Definition: hpm_pwmv2_regs.h:172
#define PWMV2_CMP_VAL_WORK_VALUE_GET(x)
Definition: hpm_pwmv2_regs.h:557
#define PWMV2_PWM_CFG0_FAULT_SEL_ASYNC_GET(x)
Definition: hpm_pwmv2_regs.h:185
#define PWMV2_PWM_CFG1_PAIR_MODE_MASK
Definition: hpm_pwmv2_regs.h:322
#define PWMV2_CMP_CFG_CMP_CNT_MASK
Definition: hpm_pwmv2_regs.h:1357
#define PWMV2_GLB_CTRL_HR_PWM_EN_MASK
Definition: hpm_pwmv2_regs.h:460
#define PWMV2_FORCE_MODE_FORCE_MODE_SET(x)
Definition: hpm_pwmv2_regs.h:145
#define PWMV2_CNT_CFG2_CNT_UPDATE_TRIG0_MASK
Definition: hpm_pwmv2_regs.h:1103
#define PWMV2_DMA_EN_DMA0_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:927
#define PWMV2_GLB_CTRL2_DEBUG_IN_EN_MASK
Definition: hpm_pwmv2_regs.h:501
#define PWMV2_CAL_CFG0_CAL_LU_PARAM_MASK
Definition: hpm_pwmv2_regs.h:1201
#define PWMV2_SHADOW_VAL_VALUE_SET(x)
Definition: hpm_pwmv2_regs.h:118
#define PWMV2_IRQ_EN_FAULT_IRQ_EN_FAULT_SET(x)
Definition: hpm_pwmv2_regs.h:835
#define PWMV2_IRQ_STS_FAULT_IRQ_STS_FAULT_SET(x)
Definition: hpm_pwmv2_regs.h:769
#define PWMV2_GLB_CTRL2_FAULT_CLEAR_SET(x)
Definition: hpm_pwmv2_regs.h:515
#define PWMV2_CAPTURE_POS_CNT_INDEX_SET(x)
Definition: hpm_pwmv2_regs.h:628
#define PWMV2_PWM_CFG1_FAULT_REC_SEL_MASK
Definition: hpm_pwmv2_regs.h:391
#define PWMV2_PWM_CFG1_FORCE_TIME_MASK
Definition: hpm_pwmv2_regs.h:351
#define PWMV2_IRQ_STS_CAP_POS_IRQ_STS_CAP_POS_GET(x)
Definition: hpm_pwmv2_regs.h:748
#define PWMV2_CAPTURE_POS_CAPTURE_SELGPIO_MASK
Definition: hpm_pwmv2_regs.h:616
#define PWMV2_CNT_CFG3_CNT_BURST_MASK
Definition: hpm_pwmv2_regs.h:1157
#define PWMV2_CAL_CFG0_CAL_T_PARAM_MASK
Definition: hpm_pwmv2_regs.h:1221
#define PWMV2_WORK_CTRL1_SHADOW_LOCK_MASK
Definition: hpm_pwmv2_regs.h:155
#define PWMV2_CNT_CFG1_CNT_LIM_LO_SET(x)
Definition: hpm_pwmv2_regs.h:1034
#define PWMV2_PWM_CFG1_FORCE_UPDATE_TIME_SET(x)
Definition: hpm_pwmv2_regs.h:275
#define PWMV2_CNT_CFG0_RLD_UPDATE_TIME_MASK
Definition: hpm_pwmv2_regs.h:971
#define PWMV2_IRQ_STS_RELOAD_IRQ_STS_RELOAD_SET(x)
Definition: hpm_pwmv2_regs.h:736
#define PWMV2_CAL_CFG1_CAL_LL_EN_MASK
Definition: hpm_pwmv2_regs.h:1282
#define PWMV2_IRQ_STS_BURSTEND_IRQ_STS_BURSTEND_GET(x)
Definition: hpm_pwmv2_regs.h:781
#define PWMV2_CAPTURE_POS_CNT_INDEX_MASK
Definition: hpm_pwmv2_regs.h:626
#define PWMV2_CMP_CFG_CMP_IN_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:1348
#define PWMV2_CNT_CFG2_CNT_TRIG0_MASK
Definition: hpm_pwmv2_regs.h:1123
#define PWMV2_CNT_CFG1_CNT_IN_OFF_MASK
Definition: hpm_pwmv2_regs.h:1042
#define PWMV2_CAL_CFG1_CAL_LIM_LO_MASK
Definition: hpm_pwmv2_regs.h:1292
#define PWMV2_PWM_CFG1_FAULT_REC_TIME_SET(x)
Definition: hpm_pwmv2_regs.h:300
#define PWMV2_PWM_CFG1_FORCE_TRIG_SEL_MASK
Definition: hpm_pwmv2_regs.h:361
#define PWMV2_PWM_CFG0_FAULT_EN_SYNC_MASK
Definition: hpm_pwmv2_regs.h:212
#define PWMV2_FORCE_MODE_POLARITY_SET(x)
Definition: hpm_pwmv2_regs.h:130
#define PWMV2_IRQ_EN_CMP_IRQ_EN_CMP_GET(x)
Definition: hpm_pwmv2_regs.h:792
#define PWMV2_PWM_CFG1_FORCE_TIME_SET(x)
Definition: hpm_pwmv2_regs.h:353
#define PWMV2_CMP_CFG_CMP_CNT_SET(x)
Definition: hpm_pwmv2_regs.h:1359
#define PWMV2_PWM_CFG0_POLARITY_OPT0_MASK
Definition: hpm_pwmv2_regs.h:246
#define PWMV2_CMP_CFG_CMP_TRIG_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:1315
#define PWMV2_CNT_CFG2_CNT_RELOAD_EN_MASK
Definition: hpm_pwmv2_regs.h:1053
#define PWMV2_PWM_CFG1_PWM_FORCE_SEL_MASK
Definition: hpm_pwmv2_regs.h:381
#define PWMV2_PWM_CFG0_OUT_POLARITY_MASK
Definition: hpm_pwmv2_regs.h:236
#define PWMV2_CNT_CFG2_CNT_TRIG1_MASK
Definition: hpm_pwmv2_regs.h:1093
#define PWMV2_IRQ_STS_CAP_POS_IRQ_STS_CAP_POS_SET(x)
Definition: hpm_pwmv2_regs.h:747
#define PWMV2_CAL_CFG1_CAL_T_INDEX_MASK
Definition: hpm_pwmv2_regs.h:1242
#define PWMV2_CNT_CFG2_CNT_UPDATE_EN0_MASK
Definition: hpm_pwmv2_regs.h:1113
#define PWMV2_DMA_EN_DMA0_SEL_MASK
Definition: hpm_pwmv2_regs.h:925
#define PWMV2_IRQ_EN_CMP_IRQ_EN_CMP_SET(x)
Definition: hpm_pwmv2_regs.h:791
#define PWMV2_IRQ_STS_CAP_NEG_IRQ_STS_CAP_NEG_GET(x)
Definition: hpm_pwmv2_regs.h:759
#define PWMV2_PWM_CFG0_FAULT_POL_ASYNC_SET(x)
Definition: hpm_pwmv2_regs.h:194
#define PWMV2_CMP_CFG_CMP_IN_SEL_MASK
Definition: hpm_pwmv2_regs.h:1346
#define PWMV2_CNT_CFG1_CNT_DAC_INDEX_SET(x)
Definition: hpm_pwmv2_regs.h:994
#define PWMV2_CNT_GLBCFG_TIMER_RESET_SET(x)
Definition: hpm_pwmv2_regs.h:1181
#define PWMV2_CMP_CFG_CMP_TRIG_SEL_MASK
Definition: hpm_pwmv2_regs.h:1313
#define PWMV2_PWM_CFG1_FAULT_MODE_SET(x)
Definition: hpm_pwmv2_regs.h:287
#define PWMV2_CAL_CFG1_CAL_IN_INDEX_MASK
Definition: hpm_pwmv2_regs.h:1252
#define PWMV2_PWM_CFG1_FAULT_REC_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:393
#define PWMV2_PWM_CFG1_FORCE_TRIG_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:363
#define PWMV2_PWM_CFG1_FORCE_ACT_SEL_MASK
Definition: hpm_pwmv2_regs.h:371
#define PWMV2_GLB_CTRL2_FAULT_CLEAR_MASK
Definition: hpm_pwmv2_regs.h:513
#define PWMV2_CAL_CFG0_CAL_LU_PARAM_SET(x)
Definition: hpm_pwmv2_regs.h:1203
#define PWMV2_CNT_GLBCFG_TIMER_ENABLE_SET(x)
Definition: hpm_pwmv2_regs.h:1192
#define PWMV2_CNT_CFG3_CNT_BURST_SET(x)
Definition: hpm_pwmv2_regs.h:1159
#define PWMV2_GLB_CTRL_OUTPUT_DELAY_SET(x)
Definition: hpm_pwmv2_regs.h:452
#define PWMV2_IRQ_STS_CMP_IRQ_STS_CMP_SET(x)
Definition: hpm_pwmv2_regs.h:725
#define PWMV2_IRQ_EN_RELOAD_IRQ_EN_RELOAD_SET(x)
Definition: hpm_pwmv2_regs.h:802
#define PWMV2_CNT_CFG0_RLD_CMP_SEL0_SET(x)
Definition: hpm_pwmv2_regs.h:948
#define PWMV2_TRIGGER_CFG_TRIGGER_OUT_SEL_MASK
Definition: hpm_pwmv2_regs.h:429
#define PWMV2_GLB_CTRL2_SHADOW_LOCK_EN_MASK
Definition: hpm_pwmv2_regs.h:523
#define PWMV2_PWM_CFG1_PWM_LOGIC_MASK
Definition: hpm_pwmv2_regs.h:336
#define PWMV2_CAL_CFG1_CAL_LU_EN_MASK
Definition: hpm_pwmv2_regs.h:1262
#define PWMV2_CNT_CFG0_CNT_D_PARAM_SET(x)
Definition: hpm_pwmv2_regs.h:983
#define PWMV2_TRIGGER_CFG_TRIGGER_OUT_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:431
#define PWMV2_CNT_CFG1_CNT_LL_EN_MASK
Definition: hpm_pwmv2_regs.h:1022
#define PWMV2_CAL_CFG0_CAL_D_PARAM_SET(x)
Definition: hpm_pwmv2_regs.h:1233
#define PWMV2_CAPTURE_NEG_CAPTURE_NEG_GET(x)
Definition: hpm_pwmv2_regs.h:639
#define PWMV2_CNT_CFG1_CNT_DAC_INDEX_MASK
Definition: hpm_pwmv2_regs.h:992
#define PWMV2_CAL_CFG0_CAL_LL_PARAM_SET(x)
Definition: hpm_pwmv2_regs.h:1213
#define PWMV2_CNT_CFG2_CNT_UPDATE_EN1_MASK
Definition: hpm_pwmv2_regs.h:1083
#define PWMV2_CNT_CFG2_CNT_TRIG0_SET(x)
Definition: hpm_pwmv2_regs.h:1125
#define PWMV2_CNT_CFG0_RLD_CMP_SEL1_SET(x)
Definition: hpm_pwmv2_regs.h:938
#define PWMV2_CNT_GLBCFG_CNT_SW_START_SET(x)
Definition: hpm_pwmv2_regs.h:1171
#define PWMV2_CNT_CFG0_RLD_TRIG_SEL_MASK
Definition: hpm_pwmv2_regs.h:956
#define PWMV2_FORCE_WORK_FORCE_MODE_GET(x)
Definition: hpm_pwmv2_regs.h:576
#define PWMV2_DMA_EN_DMA1_SEL_SHIFT
Definition: hpm_pwmv2_regs.h:906
#define PWMV2_PWM_CFG1_HIGHZ_EN_N_MASK
Definition: hpm_pwmv2_regs.h:257
#define PWMV2_CNT_CFG0_RLD_TRIG_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:958
#define PWMV2_CNT_CFG0_RLD_CMP_SEL1_MASK
Definition: hpm_pwmv2_regs.h:936
#define PWMV2_CNT_CFG1_CNT_LIM_UP_MASK
Definition: hpm_pwmv2_regs.h:1012
#define PWMV2_PWM_CFG1_PWM_FORCE_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:383
#define PWMV2_IRQ_EN_CAP_NEG_IRQ_EN_CAP_NEG_SET(x)
Definition: hpm_pwmv2_regs.h:824
#define PWMV2_IRQ_STS_RELOAD_IRQ_STS_RELOAD_GET(x)
Definition: hpm_pwmv2_regs.h:737
#define PWMV2_CAL_CFG1_CAL_LIM_LO_SET(x)
Definition: hpm_pwmv2_regs.h:1294
#define PWMV2_CNT_RELOAD_WORK_VALUE_GET(x)
Definition: hpm_pwmv2_regs.h:547
#define PWMV2_IRQ_STS_FAULT_IRQ_STS_FAULT_GET(x)
Definition: hpm_pwmv2_regs.h:770
#define PWMV2_CNT_CFG0_RLD_UPDATE_TIME_SET(x)
Definition: hpm_pwmv2_regs.h:973
#define PWMV2_DAC_VALUE_SV_VALUE_SET(x)
Definition: hpm_pwmv2_regs.h:597
#define PWMV2_CNT_VAL_VALUE_GET(x)
Definition: hpm_pwmv2_regs.h:586
#define PWMV2_PWM_CFG0_FAULT_EN_ASYNC_MASK
Definition: hpm_pwmv2_regs.h:202
#define PWMV2_PWM_CFG0_FAULT_SEL_ASYNC_SET(x)
Definition: hpm_pwmv2_regs.h:184
#define PWMV2_CAL_CFG0_CAL_T_PARAM_SET(x)
Definition: hpm_pwmv2_regs.h:1223
#define PWMV2_CAL_CFG1_CAL_IN_OFF_MASK
Definition: hpm_pwmv2_regs.h:1302
#define PWMV2_IRQ_EN_IRQ_EN_OVERFLOW_MASK
Definition: hpm_pwmv2_regs.h:712
#define PWMV2_PWM_CFG0_FAULT_POL_ASYNC_MASK
Definition: hpm_pwmv2_regs.h:192
#define PWMV2_PWM_CFG1_FORCE_UPDATE_TIME_MASK
Definition: hpm_pwmv2_regs.h:273
#define PWMV2_CAPTURE_POS_CAPTURE_POS_GET(x)
Definition: hpm_pwmv2_regs.h:608
#define PWMV2_CAL_CFG0_CAL_D_PARAM_MASK
Definition: hpm_pwmv2_regs.h:1231
#define PWMV2_IRQ_STS_CAP_NEG_IRQ_STS_CAP_NEG_SET(x)
Definition: hpm_pwmv2_regs.h:758
#define PWMV2_CMP_CFG_CMP_UPDATE_TIME_MASK
Definition: hpm_pwmv2_regs.h:1330
#define PWMV2_CAL_CFG1_CAL_T_INDEX_SET(x)
Definition: hpm_pwmv2_regs.h:1244
#define PWMV2_CAL_CFG1_CAL_IN_OFF_SET(x)
Definition: hpm_pwmv2_regs.h:1304
#define PWMV2_PWM_CFG1_FORCE_ACT_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:373
#define PWMV2_PWM_CFG1_FAULT_MODE_MASK
Definition: hpm_pwmv2_regs.h:285
#define PWMV2_PWM_CFG1_SW_FORCE_EN_MASK
Definition: hpm_pwmv2_regs.h:309
#define PWMV2_CAL_CFG1_CAL_LIM_UP_SET(x)
Definition: hpm_pwmv2_regs.h:1274
#define PWMV2_CMP_CFG_CMP_UPDATE_TIME_SET(x)
Definition: hpm_pwmv2_regs.h:1332
#define PWMV2_PWM_CFG0_FAULT_SEL_ASYNC_MASK
Definition: hpm_pwmv2_regs.h:182
#define PWMV2_PWM_DEAD_AREA_DEAD_AREA_SET(x)
Definition: hpm_pwmv2_regs.h:407
#define PWMV2_CNT_CFG3_CNT_START_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:1136
#define PWMV2_CNT_CFG1_CNT_LIM_UP_SET(x)
Definition: hpm_pwmv2_regs.h:1014
#define PWMV2_CNT_CFG2_CNT_UPDATE_TRIG1_MASK
Definition: hpm_pwmv2_regs.h:1073
#define PWMV2_IRQ_EN_BURSTEND_IRQ_EN_BURSTEND_SET(x)
Definition: hpm_pwmv2_regs.h:846
#define PWMV2_GLB_CTRL_OUTPUT_DELAY_MASK
Definition: hpm_pwmv2_regs.h:450
#define PWMV2_CNT_CFG2_CNT_UPDATE_TRIG1_SET(x)
Definition: hpm_pwmv2_regs.h:1075
#define PWMV2_CNT_CFG2_CNT_RELOAD_TRIG_MASK
Definition: hpm_pwmv2_regs.h:1063
#define PWMV2_PWM_CFG1_FAULT_REC_TIME_MASK
Definition: hpm_pwmv2_regs.h:298
#define PWMV2_CAL_CFG0_CAL_LL_PARAM_MASK
Definition: hpm_pwmv2_regs.h:1211
#define PWMV2_PWM_CFG0_POL_UPDATE_SEL_MASK
Definition: hpm_pwmv2_regs.h:224
#define PWMV2_CNT_CFG2_CNT_UPDATE_TRIG0_SET(x)
Definition: hpm_pwmv2_regs.h:1105
#define PWMV2_CNT_CFG2_CNT_TRIG1_SET(x)
Definition: hpm_pwmv2_regs.h:1095
#define PWMV2_CNT_CFG0_RLD_CMP_SEL0_MASK
Definition: hpm_pwmv2_regs.h:946
#define PWMV2_DMA_EN_DMA0_EN_MASK
Definition: hpm_pwmv2_regs.h:915
#define PWMV2_PWM_CFG1_PWM_LOGIC_SET(x)
Definition: hpm_pwmv2_regs.h:338
#define PWMV2_CNT_CFG1_CNT_LIM_LO_MASK
Definition: hpm_pwmv2_regs.h:1032
#define PWMV2_GLB_CTRL_SW_FORCE_SET(x)
Definition: hpm_pwmv2_regs.h:442
uint32_t hpm_stat_t
Definition: hpm_common.h:135
static uint32_t pwmv2_get_cmp_irq_status(PWMV2_Type *pwm_x)
Get cmp irq status.
Definition: hpm_pwmv2_drv.h:1110
static void pwmv2_disable_dma_at_reload_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel)
disable dma at reload point
Definition: hpm_pwmv2_drv.h:1430
static void pwmv2_enable_capture_posedge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
enable capture posedge irq
Definition: hpm_pwmv2_drv.h:1297
static uint32_t pwmv2_get_capture_posedge_value(PWMV2_Type *pwm_x, pwm_channel_t chn)
get capture posedge value
Definition: hpm_pwmv2_drv.h:1020
static void pwmv2_set_capture_counter_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t counter_index)
Set the counter to be used for the capture channel.
Definition: hpm_pwmv2_drv.h:1045
static void pwmv2_enable_output_invert(PWMV2_Type *pwm_x, pwm_channel_t chn)
Enable pwm output invert.
Definition: hpm_pwmv2_drv.h:550
pwm_counter_t
Definition: hpm_pwmv2_drv.h:58
static void pwmv2_shadow_register_lock(PWMV2_Type *pwm_x)
lock all shawdow register
Definition: hpm_pwmv2_drv.h:297
pwm_cmp_source_t
Definition: hpm_pwmv2_drv.h:174
static void pwmv2_reload_select_compare_point0_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cmp_index)
select compare point 0 index
Definition: hpm_pwmv2_drv.h:1442
static void pwmv2_disable_burstend_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
disable burstend irq
Definition: hpm_pwmv2_drv.h:1374
static void pwmv2_enable_software_dac_mode(PWMV2_Type *pwm_x, pwm_dac_channel_t dac_index)
Enable the software dac mode.
Definition: hpm_pwmv2_drv.h:875
static void pwmv2_counter_set_trig1_calculate_cell_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cal_index)
Enable change counter value to one of the calculation cell output when cnt_update_triger1 issued.
Definition: hpm_pwmv2_drv.h:1651
static void pwmv2_select_cmp_source(PWMV2_Type *pwm_x, uint8_t cmp_index, pwm_cmp_source_t cmp_sel, uint8_t index)
Select cmp source.
Definition: hpm_pwmv2_drv.h:1987
void pwmv2_config_cmp(PWMV2_Type *pwm_x, uint8_t index, pwmv2_cmp_config_t *config)
config pwm cmp
Definition: hpm_pwmv2_drv.c:50
static void pwmv2_clear_cmp_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
Clear cmp irq status.
Definition: hpm_pwmv2_drv.h:1121
static void pwmv2_counter_select_low_limit_from_shadow_value(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t index)
Select the lower limit from the shadow register.
Definition: hpm_pwmv2_drv.h:1571
#define PWMV2_DMA_SEL_COUNTER_RELOAD_OFFSET
Definition: hpm_pwmv2_drv.h:28
static uint32_t pwmv2_get_counter_value(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
Getting the value of a counter.
Definition: hpm_pwmv2_drv.h:996
static void pwmv2_set_four_cmp_logic(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_logic_four_cmp_cfg_t logic)
Configure the logic between the 4 cmp, valid only if the 4 cmp output is enabled.
Definition: hpm_pwmv2_drv.h:710
static void pwmv2_enable_force_by_software(PWMV2_Type *pwm_x, pwm_channel_t chn)
Enable force mode triggered by software.
Definition: hpm_pwmv2_drv.h:665
static void pwmv2_set_dac_value(PWMV2_Type *pwm_x, pwm_dac_channel_t dac_index, uint32_t value)
set dac value
Definition: hpm_pwmv2_drv.h:1008
static void pwmv2_set_fault_recovery_time(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_fault_recovery_trigger_t trig)
Set the fault mode recovery time.
Definition: hpm_pwmv2_drv.h:643
static void pwmv2_enable_calculate_overflow_irq(PWMV2_Type *pwm_x)
enable calculate overflow irq
Definition: hpm_pwmv2_drv.h:1089
static uint32_t pwmv2_get_capture_negedge_irq_status(PWMV2_Type *pwm_x)
Get capture negedge irq status.
Definition: hpm_pwmv2_drv.h:1176
static void pwmv2_shadow_register_unlock(PWMV2_Type *pwm_x)
unlock all shadow register
Definition: hpm_pwmv2_drv.h:367
static void pwmv2_enable_force_by_hardware(PWMV2_Type *pwm_x, pwm_channel_t chn)
Trigger forced mode by hardware signal.
Definition: hpm_pwmv2_drv.h:654
struct pwmv2_cmp_config pwmv2_cmp_config_t
pwm compare config
static void pwmv2_calculate_enable_low_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
enable low limit
Definition: hpm_pwmv2_drv.h:1939
void pwmv2_config_pwm(PWMV2_Type *pwm_x, pwm_channel_t index, pwmv2_config_t *config, bool enable_pair_mode)
config pwm
Definition: hpm_pwmv2_drv.c:78
static void pwmv2_start_pwm_output_sync(PWMV2_Type *pwm_x, uint8_t mask)
Multiple pwm out at the same time.
Definition: hpm_pwmv2_drv.h:357
static uint32_t pwmv2_get_force_working_status(PWMV2_Type *pwm_x)
Get force mode work status.
Definition: hpm_pwmv2_drv.h:973
static void pwmv2_set_trigout_cmp_index(PWMV2_Type *pwm_x, pwm_channel_t trigmux_chn, uint8_t cmp_index)
Setting the comparator as an input to trigmux.
Definition: hpm_pwmv2_drv.h:807
static void pwmv2_counter_burst_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
Disable counter burst function.
Definition: hpm_pwmv2_drv.h:1754
static void pwmv2_disable_dma_at_compare_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel)
disable dma at compare point
Definition: hpm_pwmv2_drv.h:1398
static void pwmv2_disable_calculate_overflow_irq(PWMV2_Type *pwm_x)
Disable calculate overflow irq.
Definition: hpm_pwmv2_drv.h:1099
void pwmv2_setup_cmp_calculate(PWMV2_Type *pwm_x, uint8_t cal_index, pwmv2_cmp_calculate_cfg_t *cal)
Configure the cmp calculate unit.
Definition: hpm_pwmv2_drv.c:132
static void pwmv2_counter_set_trig0_calculate_cell_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cal_index)
Enable change counter value to one of the calculation cell output when cnt_update_triger0 issued.
Definition: hpm_pwmv2_drv.h:1697
static void pwmv2_disable_invert_by_shadow(PWMV2_Type *pwm_x, pwm_channel_t chn)
Disable invert operations via shadow registers.
Definition: hpm_pwmv2_drv.h:585
static uint32_t pwmv2_get_burstend_irq_status(PWMV2_Type *pwm_x)
Get burstend irq status.
Definition: hpm_pwmv2_drv.h:1220
static void pwmv2_enable_pair_mode(PWMV2_Type *pwm_x, pwm_channel_t chn)
Enable pwm complementary mode.
Definition: hpm_pwmv2_drv.h:687
static void pwmv2_clear_burstend__irq_status(PWMV2_Type *pwm_x, uint32_t mask)
Clear burstend irq status.
Definition: hpm_pwmv2_drv.h:1231
static void pwmv2_cmp_update_trig_time(PWMV2_Type *pwm_x, uint8_t cmp_index, pwm_cmp_shadow_register_update_trigger_t trig_time)
Select cmp update trigmux time.
Definition: hpm_pwmv2_drv.h:1974
void pwmv2_deinit(PWMV2_Type *pwm_x)
pwm deinitialize function
Definition: hpm_pwmv2_drv.c:11
static void pwmv2_channel_enable_output(PWMV2_Type *pwm_x, pwm_channel_t chn)
Enable pwm output.
Definition: hpm_pwmv2_drv.h:596
pwm_dac_channel_t
Definition: hpm_pwmv2_drv.h:145
static void pwmv2_enable_cmp_irq(PWMV2_Type *pwm_x, uint8_t cmp_index)
enable cmp irq
Definition: hpm_pwmv2_drv.h:1242
static void pwmv2_counter_disable_update_trig1(PWMV2_Type *pwm_x, pwm_counter_t counter)
Disable counter update by trigmux1.
Definition: hpm_pwmv2_drv.h:1639
static void pwmv2_counter_low_limit_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
Disable the lower limit of the calculation unit.
Definition: hpm_pwmv2_drv.h:1559
pwm_channel_t
Definition: hpm_pwmv2_drv.h:65
static void pwmv2_disable_sync_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
Disable the fault signal from the trigmux.
Definition: hpm_pwmv2_drv.h:539
static uint32_t pwmv2_get_counter_working_status(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
Get counter work status.
Definition: hpm_pwmv2_drv.h:950
static void pwmv2_counter_start_select_trigger_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
Set trigmux index to control channel output.
Definition: hpm_pwmv2_drv.h:1709
static void pwmv2_conuter_select_dac_index(PWMV2_Type *pwm_x, pwm_counter_t counter, pwm_dac_channel_t dac_index)
Select dac index.
Definition: hpm_pwmv2_drv.h:1502
static void pwmv2_counter_select_up_limit_from_shadow_value(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t index)
Select the upper limit from the shadow register.
Definition: hpm_pwmv2_drv.h:1536
static void pwmv2_disable_software_force(PWMV2_Type *pwm_x, pwm_channel_t chn)
Disable software forced output.
Definition: hpm_pwmv2_drv.h:829
static void pwmv2_disable_four_cmp(PWMV2_Type *pwm_x, pwm_channel_t chn)
disable four pwm outputs
Definition: hpm_pwmv2_drv.h:429
static void pwmv2_capture_selection_input_source(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_capture_input_select_t select)
Select the input source for the captured signal.
Definition: hpm_pwmv2_drv.h:1032
pwm_force_trigger_t
Definition: hpm_pwmv2_drv.h:119
static uint32_t pwmv2_get_fault_irq_status(PWMV2_Type *pwm_x)
Get fault irq status.
Definition: hpm_pwmv2_drv.h:1198
static void pwmv2_disable_capture_nededge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
disable capture nedege irq
Definition: hpm_pwmv2_drv.h:1330
static void pwmv2_counter_update_trig1(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
Select counter update by trigmux1.
Definition: hpm_pwmv2_drv.h:1617
static void pwmv2_enable_async_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
Enable the fault signal from the pin.
Definition: hpm_pwmv2_drv.h:464
static void pwmv2_calculate_set_up_limit_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
Set calculate up limit parameter.
Definition: hpm_pwmv2_drv.h:1810
pwm_shadow_register_output_polarity_t
Definition: hpm_pwmv2_drv.h:107
static void pwmv2_disable_output_invert(PWMV2_Type *pwm_x, pwm_channel_t chn)
Disable pwm output invert.
Definition: hpm_pwmv2_drv.h:561
static void pwmv2_reset_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
Reset pwm counter.
Definition: hpm_pwmv2_drv.h:1776
static void pwmv2_disable_debug_mode(PWMV2_Type *pwm_x)
Disable debug mode.
Definition: hpm_pwmv2_drv.h:907
static void pwmv2_select_force_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
Select the trigger source that forces the output to take effect.
Definition: hpm_pwmv2_drv.h:758
static void pwmv2_enable_multi_counter_sync(PWMV2_Type *pwm_x, uint8_t mask)
Multiple counters are enabled at the same time.
Definition: hpm_pwmv2_drv.h:320
pwm_capture_input_select_t
Definition: hpm_pwmv2_drv.h:152
static void pwmv2_disable_shadow_lock_feature(PWMV2_Type *pwm_x)
Do not use the shadow register function.
Definition: hpm_pwmv2_drv.h:938
static void pwmv2_set_shadow_val(PWMV2_Type *pwm_x, uint8_t index, uint32_t value, uint8_t high_resolution_tick, bool enable_half_cycle)
Set the value of the shadow register.
Definition: hpm_pwmv2_drv.h:392
static void pwmv2_set_fault_mode(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_fault_mode_t mode)
set the fault mode
Definition: hpm_pwmv2_drv.h:631
static void pwmv2_disable_force_by_software(PWMV2_Type *pwm_x, pwm_channel_t chn)
Disable force mode triggered by software.
Definition: hpm_pwmv2_drv.h:676
static void pwmv2_calculate_disable_low_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
disable low limit
Definition: hpm_pwmv2_drv.h:1950
static void pwmv2_calculate_disable_up_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
disable calculate up limit
Definition: hpm_pwmv2_drv.h:1892
static uint32_t pwmv2_get_capture_posedge_irq_status(PWMV2_Type *pwm_x)
Get capture posedge irq status.
Definition: hpm_pwmv2_drv.h:1154
static void pwmv2_cmp_select_counter(PWMV2_Type *pwm_x, uint8_t cmp_index, pwm_counter_t counter_index)
Select cmp use counter.
Definition: hpm_pwmv2_drv.h:1999
struct pwmv2_config pwmv2_config_t
pwm config data
static void pwmv2_disable_async_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
Disable the fault signal from the pin.
Definition: hpm_pwmv2_drv.h:501
static void pwmv2_enable_dma_at_reload_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel, pwm_counter_t reload_index)
enable dma at reload point
Definition: hpm_pwmv2_drv.h:1417
static uint32_t pwmv2_get_force_work_out_polarity_status(PWMV2_Type *pwm_x)
Get the status of the output polarity.
Definition: hpm_pwmv2_drv.h:984
static uint32_t pwmv2_get_capture_negedge_value(PWMV2_Type *pwm_x, pwm_channel_t chn)
get capture negedge value
Definition: hpm_pwmv2_drv.h:1058
static void pwmv2_counter_set_dac_data_parameter(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t dac_parameter)
Set dac data parameter.
Definition: hpm_pwmv2_drv.h:1490
static void pwmv2_set_counter_reload_trigmux_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
select one trigger from 8, set to use input signal(selected by cnt_reload_trig) to reload timer
Definition: hpm_pwmv2_drv.h:309
static uint32_t pwmv2_get_enabled_cmp_irq(PWMV2_Type *pwm_x)
get enabled compare irq
Definition: hpm_pwmv2_drv.h:1264
static void pwmv2_disable_capture_posedge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
disable capture posedge irq
Definition: hpm_pwmv2_drv.h:1308
static void pwmv2_counter_enable_update_trig0(PWMV2_Type *pwm_x, pwm_counter_t counter)
Enable counter update by trigmux0.
Definition: hpm_pwmv2_drv.h:1674
static void pwmv2_counter_disable_update_trig0(PWMV2_Type *pwm_x, pwm_counter_t counter)
Disable counter update by trigmux0.
Definition: hpm_pwmv2_drv.h:1685
static void pwmv2_reload_select_input_trigger(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
Select the input trigger source for the reload point.
Definition: hpm_pwmv2_drv.h:1466
static void pwmv2_select_cmp_trigmux(PWMV2_Type *pwm_x, uint8_t cmp_index, uint8_t trig_index)
Select cmp trigmux index.
Definition: hpm_pwmv2_drv.h:1962
pwm_dma_chn_t
Definition: hpm_pwmv2_drv.h:157
static void pwmv2_set_dead_area(PWMV2_Type *pwm_x, pwm_channel_t chn, uint32_t dead)
set pwm dead area
Definition: hpm_pwmv2_drv.h:782
static void pwmv2_enable_burstend_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
enable burstend irq
Definition: hpm_pwmv2_drv.h:1363
static void pwmv2_trig_force_hardware_or_software_select_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
Selection of trigger signals for software or hardware trigmux.
Definition: hpm_pwmv2_drv.h:746
static void pwmv2_async_fault_polarity(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_fault_pad_polarity_t polarity)
Configure the polarity of the fail signal.
Definition: hpm_pwmv2_drv.h:453
static void pwmv2_counter_start_trigger_enable(PWMV2_Type *pwm_x, pwm_counter_t counter)
Enable trigmux to trigger channel output.
Definition: hpm_pwmv2_drv.h:1720
static uint32_t pwmv2_get_cmp_working_status(PWMV2_Type *pwm_x, uint8_t cmp_index)
Get cmp work status.
Definition: hpm_pwmv2_drv.h:962
static void pwmv2_enable_sync_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
Enable the fault signal from the trigmux.
Definition: hpm_pwmv2_drv.h:528
static void pwmv2_enable_four_cmp(PWMV2_Type *pwm_x, pwm_channel_t chn)
enable four pwm outputs
Definition: hpm_pwmv2_drv.h:418
static void pwmv2_enable_reload_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
enable reload irq
Definition: hpm_pwmv2_drv.h:1275
static void pwmv2_disable_pair_mode(PWMV2_Type *pwm_x, pwm_channel_t chn)
Disable pwm complementary mode.
Definition: hpm_pwmv2_drv.h:698
static void pwmv2_disable_software_dac_mode(PWMV2_Type *pwm_x, pwm_dac_channel_t dac_index)
Disable the software dac mode.
Definition: hpm_pwmv2_drv.h:886
static void pwmv2_issue_shadow_register_lock_event(PWMV2_Type *pwm_x)
issue all shawdow register
Definition: hpm_pwmv2_drv.h:287
static void pwmv2_enable_software_force(PWMV2_Type *pwm_x, pwm_channel_t chn)
Enable software forced output.
Definition: hpm_pwmv2_drv.h:818
static void pwmv2_counter_start_trigger_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
Disable trigmux to trigger channel output.
Definition: hpm_pwmv2_drv.h:1731
static void pwmv2_clear_capture_posedge_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
Clear capture posedge irq status.
Definition: hpm_pwmv2_drv.h:1165
static uint32_t pwmv2_get_irq_status_all(PWMV2_Type *pwm_x)
Get all interrupt status.
Definition: hpm_pwmv2_drv.h:1069
static void pwmv2_force_output(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_force_mode_t mode, bool invert)
force pwm output
Definition: hpm_pwmv2_drv.h:405
static void pwmv2_trig_force_mode_select_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
Selecting trigmux's signal as a forced mode trigger source.
Definition: hpm_pwmv2_drv.h:734
pwm_force_shadow_trigger_t
Definition: hpm_pwmv2_drv.h:112
static void pwmv2_shadow_unlock_bit_mask(PWMV2_Type *pwm_x, uint32_t mask)
The shadow registers can be updated only when related unlock_bit is set.
Definition: hpm_pwmv2_drv.h:378
static uint32_t pwmv2_get_reload_irq_status(PWMV2_Type *pwm_x)
Get reload irq status.
Definition: hpm_pwmv2_drv.h:1132
pwm_logic_four_cmp_cfg_t
Definition: hpm_pwmv2_drv.h:127
static void pwmv2_counter_select_data_offset_from_shadow_value(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t index)
Select data offset from shadow register.
Definition: hpm_pwmv2_drv.h:1583
static void pwmv2_set_counter_burst(PWMV2_Type *pwm_x, pwm_counter_t counter, uint16_t burst)
Set counter burst value.
Definition: hpm_pwmv2_drv.h:1743
static void pwmv2_enable_capture_nededge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
enable capture nedege irq
Definition: hpm_pwmv2_drv.h:1319
static void pwmv2_start_pwm_output(PWMV2_Type *pwm_x, pwm_counter_t counter)
start pwm output
Definition: hpm_pwmv2_drv.h:1765
static void pwmv2_get_default_config(pwmv2_config_t *config)
get default pwm config
Definition: hpm_pwmv2_drv.h:276
hpm_stat_t pwmv2_setup_waveform(PWMV2_Type *pwm_x, pwm_channel_t chn, pwmv2_config_t *pwm_config, uint8_t cmp_start_index, pwmv2_cmp_config_t *cmp, uint8_t cmp_num)
Set pwm waveform.
Definition: hpm_pwmv2_drv.c:103
static void pwmv2_calculate_set_period_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
Set calculate period parameter.
Definition: hpm_pwmv2_drv.h:1834
struct pwmv2_async_fault_source_config pwmv2_async_fault_source_config_t
pwm fault source config
static void pwmv2_channel_disable_output(PWMV2_Type *pwm_x, pwm_channel_t chn)
Disable pwm output.
Definition: hpm_pwmv2_drv.h:607
static void pwmv2_async_fault_signal_select(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t pad_index)
Direct selection of the fail signal from the pin.
Definition: hpm_pwmv2_drv.h:441
static void pwmv2_calculate_set_dac_value_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
Set calculate dac value parameter.
Definition: hpm_pwmv2_drv.h:1846
static void pwmv2_enable_shadow_lock_feature(PWMV2_Type *pwm_x)
Using the Shadow Register Function.
Definition: hpm_pwmv2_drv.h:928
static void pwmv2_reset_multi_counter_sync(PWMV2_Type *pwm_x, uint8_t mask)
Multiple counters are reset at the same time.
Definition: hpm_pwmv2_drv.h:345
static void pwmv2_counter_enable_update_trig1(PWMV2_Type *pwm_x, pwm_counter_t counter)
Enable counter update by trigmux1.
Definition: hpm_pwmv2_drv.h:1628
static void pwmv2_calculate_select_in_offset(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t shadow_index)
Select offset from shadow index.
Definition: hpm_pwmv2_drv.h:1928
static void pwmv2_clear_capture_negedge_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
Clear capture negedge irq status.
Definition: hpm_pwmv2_drv.h:1187
static void pwmv2_counter_low_limit_enable(PWMV2_Type *pwm_x, pwm_counter_t counter)
Enable the lower limit of the calculation unit.
Definition: hpm_pwmv2_drv.h:1547
static void pwmv2_calculate_enable_up_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
enable calculate up limit
Definition: hpm_pwmv2_drv.h:1881
static void pwmv2_disable_reload_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
disable reload irq
Definition: hpm_pwmv2_drv.h:1286
static void pwmv2_disable_cmp_irq(PWMV2_Type *pwm_x, uint8_t cmp_index)
disable cmp irq
Definition: hpm_pwmv2_drv.h:1253
static void pwmv2_counter_up_limit_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
Disable the upper limit of the calculation unit.
Definition: hpm_pwmv2_drv.h:1524
static void pwmv2_clear_fault_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
Clear fault irq status.
Definition: hpm_pwmv2_drv.h:1209
static void pwmv2_clear_reload_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
Clear reload irq status.
Definition: hpm_pwmv2_drv.h:1143
static void pwmv2_set_dead_area_hrpwm(PWMV2_Type *pwm_x, pwm_channel_t chn, uint16_t dead_cycle, uint8_t dead_hrpwm)
set pwm dead area with high resolution
Definition: hpm_pwmv2_drv.h:795
pwm_reload_update_time_t
Definition: hpm_pwmv2_drv.h:77
static void pwmv2_counter_up_limit_enable(PWMV2_Type *pwm_x, pwm_counter_t counter)
Enable the upper limit of the calculation unit.
Definition: hpm_pwmv2_drv.h:1513
static void pwmv2_reload_select_compare_point1_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cmp_index)
select compare point 1 index
Definition: hpm_pwmv2_drv.h:1454
static void pwmv2_calculate_select_low_limit_offset(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t shadow_index)
Select low limit offset from shadow index.
Definition: hpm_pwmv2_drv.h:1916
static void pwmv2_enable_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
Enable pwm counter.
Definition: hpm_pwmv2_drv.h:1787
static void pwmv2_enable_fault_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
enable fault irq
Definition: hpm_pwmv2_drv.h:1341
pwm_force_mode_t
pwm output type
Definition: hpm_pwmv2_drv.h:89
pwm_fault_mode_t
Definition: hpm_pwmv2_drv.h:96
static void pwmv2_enable_dma_at_compare_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel, uint8_t cmp_index)
enable dma at compare point
Definition: hpm_pwmv2_drv.h:1386
static void pwmv2_disable_multi_counter_sync(PWMV2_Type *pwm_x, uint8_t mask)
Multiple counters are disabled at the same time.
Definition: hpm_pwmv2_drv.h:334
hpm_stat_t pwmv2_setup_waveform_in_pair(PWMV2_Type *pwm_x, pwm_channel_t chn, pwmv2_pair_config_t *pwm_pair_config, uint8_t cmp_start_index, pwmv2_cmp_config_t *cmp, uint8_t cmp_num)
set the pwm waveform complementary mode
Definition: hpm_pwmv2_drv.c:117
static void pwmv2_set_force_update_time(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_force_trigger_t time)
Setting the effective time of forced output.
Definition: hpm_pwmv2_drv.h:722
static void pwmv2_enable_debug_mode(PWMV2_Type *pwm_x)
Enable debug mode.
Definition: hpm_pwmv2_drv.h:896
static void pwmv2_counter_disable_reload_by_trig(PWMV2_Type *pwm_x, pwm_counter_t counter)
disable counter reload by trigmux
Definition: hpm_pwmv2_drv.h:1605
static void pwmv2_calculate_select_up_limit_offset(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t shadow_index)
Select up limit offset from shadow index.
Definition: hpm_pwmv2_drv.h:1904
static void pwmv2_disable_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
Disable pwm counter.
Definition: hpm_pwmv2_drv.h:1798
struct pwmv2_pair_config pwmv2_pair_config_t
pair pwm config
static void pwmv2_counter_enable_reload_by_trig(PWMV2_Type *pwm_x, pwm_counter_t counter)
enable counter reload by trigmux
Definition: hpm_pwmv2_drv.h:1594
static void pwmv2_counter_update_trig0(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
Select counter update by trigmux0.
Definition: hpm_pwmv2_drv.h:1663
pwm_fault_recovery_trigger_t
select when to recover PWM output after fault
Definition: hpm_pwmv2_drv.h:138
pwm_fault_pad_polarity_t
Definition: hpm_pwmv2_drv.h:102
struct pwmv2_cmp_calculate_cfg pwmv2_cmp_calculate_cfg_t
static void pwmv2_clear_fault_event(PWMV2_Type *pwm_x, pwm_channel_t chn)
Clear fault event.
Definition: hpm_pwmv2_drv.h:918
static void pwmv2_select_recovery_fault_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
Selection of trigger signal for fault recovery.
Definition: hpm_pwmv2_drv.h:770
static void pwmv2_calculate_set_low_limit_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
Set calculate low limit parameter.
Definition: hpm_pwmv2_drv.h:1822
static void pwmv2_disable_fault_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
disable fault irq
Definition: hpm_pwmv2_drv.h:1352
#define PWM_UNLOCK_KEY
Definition: hpm_pwmv2_drv.h:23
pwm_cmp_shadow_register_update_trigger_t
Definition: hpm_pwmv2_drv.h:164
static void pwmv2_set_reload_update_time(PWMV2_Type *pwm_x, pwm_counter_t counter, pwm_reload_update_time_t update)
Set reload update time.
Definition: hpm_pwmv2_drv.h:1478
static void pwmv2_calculate_select_in_value(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t index)
Select calculate input value.
Definition: hpm_pwmv2_drv.h:1870
static void pwmv2_clear_calculate_overflow_irq_status(PWMV2_Type *pwm_x)
clear calculate overflow irq status
Definition: hpm_pwmv2_drv.h:1079
static void pwmv2_calculate_select_counter_calculate_index(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t counter_calculate)
Select calculate index to counter.
Definition: hpm_pwmv2_drv.h:1858
static void pwmv2_enable_invert_by_shadow(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_shadow_register_output_polarity_t update_select)
Enable invert operations via shadow registers.
Definition: hpm_pwmv2_drv.h:573
static void pwmv2_force_update_time_by_shadow(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_force_shadow_trigger_t update_time)
Forces the output configuration to be updated from the time shadow hosting takes effect.
Definition: hpm_pwmv2_drv.h:619
void pwmv2_config_async_fault_source(PWMV2_Type *pwm_x, pwm_channel_t index, pwmv2_async_fault_source_config_t *config)
config async fault source
Definition: hpm_pwmv2_drv.c:71
@ pwm_counter_1
Definition: hpm_pwmv2_drv.h:60
@ pwm_counter_0
Definition: hpm_pwmv2_drv.h:59
@ pwm_counter_2
Definition: hpm_pwmv2_drv.h:61
@ pwm_counter_3
Definition: hpm_pwmv2_drv.h:62
@ cmp_value_fffff000
Definition: hpm_pwmv2_drv.h:179
@ cmp_value_ffffff00
Definition: hpm_pwmv2_drv.h:180
@ cmp_value_from_calculate
Definition: hpm_pwmv2_drv.h:176
@ cmp_value_from_capture_posedge
Definition: hpm_pwmv2_drv.h:177
@ cmp_value_from_counters
Definition: hpm_pwmv2_drv.h:178
@ cmp_value_from_shadow_val
Definition: hpm_pwmv2_drv.h:175
@ pwm_dac_channel_2
Definition: hpm_pwmv2_drv.h:148
@ pwm_dac_channel_1
Definition: hpm_pwmv2_drv.h:147
@ pwm_dac_channel_3
Definition: hpm_pwmv2_drv.h:149
@ pwm_dac_channel_0
Definition: hpm_pwmv2_drv.h:146
@ pwm_channel_2
Definition: hpm_pwmv2_drv.h:68
@ pwm_channel_7
Definition: hpm_pwmv2_drv.h:73
@ pwm_channel_1
Definition: hpm_pwmv2_drv.h:67
@ pwm_channel_4
Definition: hpm_pwmv2_drv.h:70
@ pwm_channel_6
Definition: hpm_pwmv2_drv.h:72
@ pwm_channel_5
Definition: hpm_pwmv2_drv.h:71
@ pwm_channel_3
Definition: hpm_pwmv2_drv.h:69
@ pwm_channel_0
Definition: hpm_pwmv2_drv.h:66
@ pwm_force_at_trigmux
Definition: hpm_pwmv2_drv.h:122
@ pwm_force_none
Definition: hpm_pwmv2_drv.h:123
@ pwm_force_immediately
Definition: hpm_pwmv2_drv.h:120
@ pwm_force_at_reload
Definition: hpm_pwmv2_drv.h:121
@ pwm_shadow_register_output_polarity_on_reload
Definition: hpm_pwmv2_drv.h:109
@ pwm_shadow_register_output_polarity_on_shlk
Definition: hpm_pwmv2_drv.h:108
@ pwm_capture_from_trigmux
Definition: hpm_pwmv2_drv.h:153
@ pwm_capture_from_gpio
Definition: hpm_pwmv2_drv.h:154
@ pwm_dma_0
Definition: hpm_pwmv2_drv.h:158
@ pwm_dma_1
Definition: hpm_pwmv2_drv.h:159
@ pwm_dma_2
Definition: hpm_pwmv2_drv.h:160
@ pwm_dma_3
Definition: hpm_pwmv2_drv.h:161
@ pwm_force_update_shadow_at_reload
Definition: hpm_pwmv2_drv.h:115
@ pwm_force_update_shadow_immediately
Definition: hpm_pwmv2_drv.h:113
@ pwm_force_update_shadow_at_cmp_point
Definition: hpm_pwmv2_drv.h:114
@ pwm_force_update_shadow_none
Definition: hpm_pwmv2_drv.h:116
@ pwm_logic_four_cmp_xor
Definition: hpm_pwmv2_drv.h:130
@ pwm_logic_four_cmp_or
Definition: hpm_pwmv2_drv.h:128
@ pwm_logic_four_cmp_and
Definition: hpm_pwmv2_drv.h:129
@ pwm_logic_four_cmp_cd
Definition: hpm_pwmv2_drv.h:131
@ pwm_reload_update_on_reload
Definition: hpm_pwmv2_drv.h:80
@ pwm_reload_update_on_compare_point
Definition: hpm_pwmv2_drv.h:79
@ pwm_reload_update_on_trigger
Definition: hpm_pwmv2_drv.h:81
@ pwm_reload_update_on_shlk
Definition: hpm_pwmv2_drv.h:78
@ pwm_force_output_no_force
Definition: hpm_pwmv2_drv.h:93
@ pwm_force_output_1
Definition: hpm_pwmv2_drv.h:91
@ pwm_force_output_high_z
Definition: hpm_pwmv2_drv.h:92
@ pwm_force_output_0
Definition: hpm_pwmv2_drv.h:90
@ pwm_fault_output_high_z
Definition: hpm_pwmv2_drv.h:99
@ pwm_fault_output_0
Definition: hpm_pwmv2_drv.h:97
@ pwm_fault_output_1
Definition: hpm_pwmv2_drv.h:98
@ pwm_fault_recovery_on_hw_event
Definition: hpm_pwmv2_drv.h:141
@ pwm_fault_recovery_on_fault_clear
Definition: hpm_pwmv2_drv.h:142
@ pwm_fault_recovery_immediately
Definition: hpm_pwmv2_drv.h:139
@ pwm_fault_recovery_on_reload
Definition: hpm_pwmv2_drv.h:140
@ pad_fault_active_high
Definition: hpm_pwmv2_drv.h:104
@ pad_fault_active_low
Definition: hpm_pwmv2_drv.h:103
@ pwm_shadow_register_update_on_trigmux
Definition: hpm_pwmv2_drv.h:168
@ pwm_shadow_register_update_on_shlk
Definition: hpm_pwmv2_drv.h:165
@ pwm_shadow_register_update_on_rld_cmp_select1
Definition: hpm_pwmv2_drv.h:170
@ pwm_shadow_register_update_on_reload
Definition: hpm_pwmv2_drv.h:167
@ pwm_shadow_register_update_on_modify
Definition: hpm_pwmv2_drv.h:166
@ pwm_shadow_register_update_on_none
Definition: hpm_pwmv2_drv.h:171
@ pwm_shadow_register_update_on_rld_cmp_select0
Definition: hpm_pwmv2_drv.h:169
#define fencerw()
execute fence rw
Definition: riscv_core.h:94
Definition: hpm_pwmv2_regs.h:12
__RW uint32_t IRQ_EN_CAP_POS
Definition: hpm_pwmv2_regs.h:55
__RW uint32_t GLB_CTRL2
Definition: hpm_pwmv2_regs.h:28
__RW uint32_t WORK_CTRL0
Definition: hpm_pwmv2_regs.h:13
__W uint32_t IRQ_STS_RELOAD
Definition: hpm_pwmv2_regs.h:47
__RW uint32_t IRQ_EN_BURSTEND
Definition: hpm_pwmv2_regs.h:58
__RW uint32_t GLB_CTRL3
Definition: hpm_pwmv2_regs.h:29
__RW uint32_t CFG2
Definition: hpm_pwmv2_regs.h:65
struct PWMV2_Type::@407 PWM[8]
__RW uint32_t DEAD_AREA
Definition: hpm_pwmv2_regs.h:22
struct PWMV2_Type::@409 CAL[16]
__W uint32_t IRQ_STS_FAULT
Definition: hpm_pwmv2_regs.h:50
__RW uint32_t IRQ_EN_CMP
Definition: hpm_pwmv2_regs.h:53
__RW uint32_t DAC_VALUE_SV[4]
Definition: hpm_pwmv2_regs.h:37
__R uint32_t CAPTURE_NEG[8]
Definition: hpm_pwmv2_regs.h:41
struct PWMV2_Type::@408 CNT[4]
__W uint32_t IRQ_STS_BURSTEND
Definition: hpm_pwmv2_regs.h:51
__RW uint32_t UNLOCK
Definition: hpm_pwmv2_regs.h:14
__R uint32_t CMP_VAL_WORK[24]
Definition: hpm_pwmv2_regs.h:32
__RW uint32_t SHADOW_VAL[28]
Definition: hpm_pwmv2_regs.h:15
__RW uint32_t CFG0
Definition: hpm_pwmv2_regs.h:20
__W uint32_t IRQ_STS_CMP
Definition: hpm_pwmv2_regs.h:46
__RW uint32_t CNT_GLBCFG
Definition: hpm_pwmv2_regs.h:68
__RW uint32_t WORK_CTRL1
Definition: hpm_pwmv2_regs.h:17
__R uint32_t CNT_VAL[4]
Definition: hpm_pwmv2_regs.h:36
struct PWMV2_Type::@410 CMP[24]
__W uint32_t IRQ_STS_CAP_POS
Definition: hpm_pwmv2_regs.h:48
__RW uint32_t IRQ_EN_RELOAD
Definition: hpm_pwmv2_regs.h:54
__RW uint32_t CFG
Definition: hpm_pwmv2_regs.h:77
__RW uint32_t DMA_EN
Definition: hpm_pwmv2_regs.h:60
__R uint32_t FORCE_WORK
Definition: hpm_pwmv2_regs.h:34
__RW uint32_t IRQ_EN
Definition: hpm_pwmv2_regs.h:44
__RW uint32_t IRQ_STS
Definition: hpm_pwmv2_regs.h:43
__RW uint32_t GLB_CTRL
Definition: hpm_pwmv2_regs.h:27
__RW uint32_t IRQ_EN_CAP_NEG
Definition: hpm_pwmv2_regs.h:56
__RW uint32_t IRQ_EN_FAULT
Definition: hpm_pwmv2_regs.h:57
__R uint32_t CNT_RELOAD_WORK[4]
Definition: hpm_pwmv2_regs.h:31
__RW uint32_t TRIGGER_CFG[8]
Definition: hpm_pwmv2_regs.h:25
__RW uint32_t CAPTURE_POS[8]
Definition: hpm_pwmv2_regs.h:39
__RW uint32_t CFG1
Definition: hpm_pwmv2_regs.h:21
__RW uint32_t FORCE_MODE
Definition: hpm_pwmv2_regs.h:16
__W uint32_t IRQ_STS_CAP_NEG
Definition: hpm_pwmv2_regs.h:49
__RW uint32_t CFG3
Definition: hpm_pwmv2_regs.h:23
pwm config data
Definition: hpm_pwm_drv.h:175
pair pwm config
Definition: hpm_pwm_drv.h:192
pwm fault source config
Definition: hpm_pwmv2_drv.h:204
uint8_t async_signal_from_pad_index
Definition: hpm_pwmv2_drv.h:205
pwm_fault_pad_polarity_t fault_async_pad_level
Definition: hpm_pwmv2_drv.h:206
Definition: hpm_pwmv2_drv.h:243
uint8_t up_limit_offset_index
Definition: hpm_pwmv2_drv.h:250
uint8_t low_limit_offset_index
Definition: hpm_pwmv2_drv.h:252
int8_t d_param
Definition: hpm_pwmv2_drv.h:248
bool enable_up_limit
Definition: hpm_pwmv2_drv.h:253
int8_t t_param
Definition: hpm_pwmv2_drv.h:247
int8_t up_limit_param
Definition: hpm_pwmv2_drv.h:249
uint8_t counter_index
Definition: hpm_pwmv2_drv.h:244
int8_t low_limit_param
Definition: hpm_pwmv2_drv.h:251
uint8_t in_offset_index
Definition: hpm_pwmv2_drv.h:246
bool enbale_low_limit
Definition: hpm_pwmv2_drv.h:254
uint8_t in_index
Definition: hpm_pwmv2_drv.h:245
pwm compare config
Definition: hpm_pwmv2_drv.h:187
pwm_cmp_shadow_register_update_trigger_t update_trigger
Definition: hpm_pwmv2_drv.h:195
uint32_t cmp
Definition: hpm_pwmv2_drv.h:188
pwm_counter_t cmp_use_counter
Definition: hpm_pwmv2_drv.h:192
bool enable_half_cmp
Definition: hpm_pwmv2_drv.h:189
uint8_t update_trigger_index
Definition: hpm_pwmv2_drv.h:196
uint8_t cmp_source_index
Definition: hpm_pwmv2_drv.h:193
uint8_t mode
Definition: hpm_pwmv2_drv.h:194
uint8_t hrcmp
Definition: hpm_pwmv2_drv.h:197
pwm_cmp_source_t cmp_source
Definition: hpm_pwmv2_drv.h:191
bool enable_hrcmp
Definition: hpm_pwmv2_drv.h:190
pwm config data
Definition: hpm_pwmv2_drv.h:213
pwm_logic_four_cmp_cfg_t logic
Definition: hpm_pwmv2_drv.h:222
uint8_t dead_zone_hrpwm
Definition: hpm_pwmv2_drv.h:232
uint8_t force_shadow_trigmux_index
Definition: hpm_pwmv2_drv.h:227
bool enable_async_fault
Definition: hpm_pwmv2_drv.h:215
uint8_t force_trigmux_index
Definition: hpm_pwmv2_drv.h:229
bool enable_four_cmp
Definition: hpm_pwmv2_drv.h:218
pwm_force_shadow_trigger_t force_shadow_trigger
Definition: hpm_pwmv2_drv.h:228
pwm_fault_recovery_trigger_t fault_recovery_trigger
Definition: hpm_pwmv2_drv.h:225
uint8_t fault_mode
Definition: hpm_pwmv2_drv.h:224
pwmv2_async_fault_source_config_t async_fault_source
Definition: hpm_pwmv2_drv.h:220
uint32_t dead_zone_in_half_cycle
Definition: hpm_pwmv2_drv.h:231
bool enable_polarity_shadow
Definition: hpm_pwmv2_drv.h:219
bool enable_sync_fault
Definition: hpm_pwmv2_drv.h:216
uint8_t fault_recovery_trigmux_index
Definition: hpm_pwmv2_drv.h:226
bool enable_output
Definition: hpm_pwmv2_drv.h:214
pwm_shadow_register_output_polarity_t update_polarity_time
Definition: hpm_pwmv2_drv.h:221
bool invert_output
Definition: hpm_pwmv2_drv.h:217
pwm_force_trigger_t force_trigger
Definition: hpm_pwmv2_drv.h:230
uint8_t update_trigger
Definition: hpm_pwmv2_drv.h:223
pair pwm config
Definition: hpm_pwmv2_drv.h:239
pwmv2_config_t pwm[2]
Definition: hpm_pwmv2_drv.h:240