HPM SDK
HPMicro Software Development Kit
hpm_pwmv2_drv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 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 /* IRQ enable bit mask */
27 #define PWM_IRQ_FAULT(chn) PWMV2_IRQ_EN_FAULT_IRQ_EN_FAULT_SET((1 << chn))
28 #define PWM_IRQ_BURSTEND(counter) PWMV2_IRQ_EN_BURSTEND_IRQ_EN_BURSTEND_SET((1 << counter))
29 #define PWM_IRQ_CAP_POS(chn) PWMV2_IRQ_EN_CAP_POS_IRQ_EN_CAP_POS_SET((1 << chn))
30 #define PWM_IRQ_CAP_NEG(chn) PWMV2_IRQ_EN_CAP_NEG_IRQ_EN_CAP_NEG_SET((1 << chn))
31 #define PWM_IRQ_RELOAD(counter) PWMV2_IRQ_EN_RELOAD_IRQ_EN_RELOAD_SET((1 << counter))
32 #define PWM_IRQ_CMP(cmp) PWMV2_IRQ_EN_CMP_IRQ_EN_CMP_SET((1 << cmp))
33 
34 /* IRQ status bit mask */
35 #define PWM_IRQ_STS_FAULT(chn) PWMV2_IRQ_STS_FAULT_IRQ_STS_FAULT_SET((1 << chn))
36 #define PWM_IRQ_STS_BURSTEND(counter) PWMV2_IRQ_STS_BURSTEND_IRQ_STS_BURSTEND_SET((1 << counter))
37 #define PWM_IRQ_STS_CAP_NEG(chn) PWMV2_IRQ_STS_CAP_NEG_IRQ_STS_CAP_NEG_SET((1 << chn))
38 #define PWM_IRQ_STS_CAP_POS(chn) PWMV2_IRQ_STS_CAP_POS_IRQ_STS_CAP_POS_SET((1 << chn))
39 #define PWM_IRQ_STS_RELOAD(counter) PWMV2_IRQ_STS_RELOAD_IRQ_STS_RELOAD_SET((1 << counter))
40 #define PWM_IRQ_STS_CMP(cmp) PWMV2_IRQ_STS_CMP_IRQ_STS_CMP_SET((1 << cmp))
41 
42 
43 /* PWM force output mask */
44 #define PWM_FORCE_OUTPUT(pwm_index, force_output) \
45  (force_output << (pwm_index << 1))
46 
47 #define PWM_DUTY_CYCLE_FP_MAX ((1U << 24) - 1)
48 
49 #ifndef PWMV2_SOC_CAL_COUNT_MAX
50  #define PWMV2_SOC_CAL_COUNT_MAX 8
51 #endif
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 {
222  uint8_t update_trigger;
223  uint8_t fault_mode;
232 
237 typedef struct pwmv2_pair_config {
240 
241 typedef struct pwmv2_cmp_calculate_cfg {
242  uint8_t counter_index;
243  uint8_t in_index;
244  uint8_t in_offset_index;
245  int8_t t_param;
246  int8_t d_param;
254 
255 
256 #ifdef __cplusplus
257 extern "C" {
258 #endif
259 
266 void pwmv2_deinit(PWMV2_Type *pwm_x);
267 
274 {
276 }
277 
283 static inline void pwmv2_shadow_register_lock(PWMV2_Type *pwm_x)
284 {
286 }
287 
295 static inline void pwmv2_set_counter_reload_trigmux_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
296 {
297  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);
298 }
299 
306 static inline void pwmv2_enable_multi_counter_sync(PWMV2_Type *pwm_x, uint8_t mask)
307 {
309  fencerw();
311 }
312 
320 static inline void pwmv2_disable_multi_counter_sync(PWMV2_Type *pwm_x, uint8_t mask)
321 {
323 }
324 
331 static inline void pwmv2_reset_multi_counter_sync(PWMV2_Type *pwm_x, uint8_t mask)
332 {
334 }
335 
336 
343 static inline void pwmv2_start_pwm_output_sync(PWMV2_Type *pwm_x, uint8_t mask)
344 {
346 }
347 
353 static inline void pwmv2_shadow_register_unlock(PWMV2_Type *pwm_x)
354 {
355  pwm_x->WORK_CTRL0 = PWM_UNLOCK_KEY;
356 }
357 
364 static inline void pwmv2_shadow_unlock_bit_mask(PWMV2_Type *pwm_x, uint32_t mask)
365 {
366  pwm_x->UNLOCK = mask;
367 }
368 
378 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)
379 {
380  pwm_x->SHADOW_VAL[index] = PWMV2_SHADOW_VAL_VALUE_SET(((value << 8) | (enable_half_cycle << 7) | (high_resolution_tick)));
381 }
382 
391 static inline void pwmv2_force_output(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_force_mode_t mode, bool invert)
392 {
393  pwm_x->FORCE_MODE = (pwm_x->FORCE_MODE & ~(PWMV2_FORCE_MODE_POLARITY_SET((1 << (chn << 1))) | PWMV2_FORCE_MODE_FORCE_MODE_SET((3 << (chn << 1))))) |
394  PWMV2_FORCE_MODE_POLARITY_SET((invert << (chn << 1))) |
395  PWMV2_FORCE_MODE_FORCE_MODE_SET((mode << (chn << 1)));
396 }
397 
404 static inline void pwmv2_enable_four_cmp(PWMV2_Type *pwm_x, pwm_channel_t chn)
405 {
406  pwm_x->PWM[chn].CFG0 |= PWMV2_PWM_CFG0_TRIG_SEL4_MASK;
407 }
408 
415 static inline void pwmv2_disable_four_cmp(PWMV2_Type *pwm_x, pwm_channel_t chn)
416 {
417  pwm_x->PWM[chn].CFG0 &= ~PWMV2_PWM_CFG0_TRIG_SEL4_MASK;
418 }
419 
427 static inline void pwmv2_async_fault_signal_select(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t pad_index)
428 {
429  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);
430 }
431 
440 {
441  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);
442 }
443 
450 static inline void pwmv2_enable_async_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
451 {
453 }
454 
455 #if defined(HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG) && HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG
456 
463 static inline void pwmv2_async_fault_polarity_multi(PWMV2_Type *pwm_x, uint16_t polarity_mask)
464 {
465  pwm_x->GLB_CTRL3 = PWMV2_GLB_CTRL3_ASYNC_FAULT_POL_SET(polarity_mask);
466 }
467 
475 static inline void pwmv2_enable_async_fault_multi(PWMV2_Type *pwm_x, pwm_channel_t chn, uint16_t pad_mask)
476 {
477  pwm_x->PWM[chn].CFG3 |= PWMV2_PWM_CFG3_ASYNC_FAULT_SEL_SET(pad_mask);
478 }
479 #endif
480 
487 static inline void pwmv2_disable_async_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
488 {
490 #if defined(HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG) && HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG
491  pwm_x->PWM[chn].CFG3 &= ~(1 << PWMV2_PWM_CFG0_FAULT_SEL_ASYNC_GET(pwm_x->PWM[chn].CFG0));
492 #endif
493 }
494 
495 #if defined(HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG) && HPM_IP_FEATURE_PWMV2_ASYNC_FAULT_CFG
503 static inline void pwmv2_disable_async_fault_multi(PWMV2_Type *pwm_x, pwm_channel_t chn, uint16_t pad_mask)
504 {
505  pwm_x->PWM[chn].CFG3 &= ~PWMV2_PWM_CFG3_ASYNC_FAULT_SEL_SET(pad_mask);
506 }
507 #endif
514 static inline void pwmv2_enable_sync_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
515 {
517 }
518 
525 static inline void pwmv2_disable_sync_fault(PWMV2_Type *pwm_x, pwm_channel_t chn)
526 {
528 }
529 
536 static inline void pwmv2_enable_output_invert(PWMV2_Type *pwm_x, pwm_channel_t chn)
537 {
539 }
540 
547 static inline void pwmv2_disable_output_invert(PWMV2_Type *pwm_x, pwm_channel_t chn)
548 {
549  pwm_x->PWM[chn].CFG0 &= ~PWMV2_PWM_CFG0_OUT_POLARITY_MASK;
550 }
551 
560 {
562  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);
563 }
564 
572 {
574 }
575 
582 static inline void pwmv2_channel_enable_output(PWMV2_Type *pwm_x, pwm_channel_t chn)
583 {
584  pwm_x->PWM[chn].CFG1 |= PWMV2_PWM_CFG1_HIGHZ_EN_N_MASK;
585 }
586 
594 {
595  pwm_x->PWM[chn].CFG1 &= ~PWMV2_PWM_CFG1_HIGHZ_EN_N_MASK;
596 }
597 
606 {
607  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);
608 }
609 
617 static inline void pwmv2_set_fault_mode(PWMV2_Type *pwm_x, pwm_channel_t chn, pwm_fault_mode_t mode)
618 {
619  pwm_x->PWM[chn].CFG1 = (pwm_x->PWM[chn].CFG1 & ~PWMV2_PWM_CFG1_FAULT_MODE_MASK) | PWMV2_PWM_CFG1_FAULT_MODE_SET(mode);
620 }
621 
630 {
632 }
633 
641 {
642  pwm_x->PWM[chn].CFG1 &= ~PWMV2_PWM_CFG1_SW_FORCE_EN_MASK;
643 }
644 
652 {
654 }
655 
663 {
664  pwm_x->PWM[chn].CFG1 &= ~PWMV2_PWM_CFG1_SW_FORCE_EN_MASK;
665 }
666 
673 static inline void pwmv2_enable_pair_mode(PWMV2_Type *pwm_x, pwm_channel_t chn)
674 {
675  pwm_x->PWM[chn].CFG1 |= PWMV2_PWM_CFG1_PAIR_MODE_MASK;
676 }
677 
684 static inline void pwmv2_disable_pair_mode(PWMV2_Type *pwm_x, pwm_channel_t chn)
685 {
686  pwm_x->PWM[chn].CFG1 &= ~PWMV2_PWM_CFG1_PAIR_MODE_MASK;
687 }
688 
697 {
698  pwm_x->PWM[chn].CFG1 = (pwm_x->PWM[chn].CFG1 & ~PWMV2_PWM_CFG1_PWM_LOGIC_MASK) | PWMV2_PWM_CFG1_PWM_LOGIC_SET(logic);
699 }
700 
709 {
710  pwm_x->PWM[chn].CFG1 = (pwm_x->PWM[chn].CFG1 & ~PWMV2_PWM_CFG1_FORCE_TIME_MASK) | PWMV2_PWM_CFG1_FORCE_TIME_SET(time);
711 }
712 
720 static inline void pwmv2_trig_force_mode_select_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
721 {
722  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);
723 }
724 
732 static inline void pwmv2_trig_force_hardware_or_software_select_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
733 {
734  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);
735 }
736 
744 static inline void pwmv2_select_force_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
745 {
746  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);
747 }
748 
756 static inline void pwmv2_select_recovery_fault_trigmux_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t trigmux_index)
757 {
758  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);
759 }
760 
768 static inline void pwmv2_set_dead_area(PWMV2_Type *pwm_x, pwm_channel_t chn, uint32_t dead)
769 {
770  pwm_x->PWM[chn].DEAD_AREA = PWMV2_PWM_DEAD_AREA_DEAD_AREA_SET((dead << 8));
771 }
772 
780 static inline void pwmv2_set_trigout_cmp_index(PWMV2_Type *pwm_x, pwm_channel_t trigmux_chn, uint8_t cmp_index)
781 {
782  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);
783 }
784 
791 static inline void pwmv2_enable_software_force(PWMV2_Type *pwm_x, pwm_channel_t chn)
792 {
793  pwm_x->GLB_CTRL |= PWMV2_GLB_CTRL_SW_FORCE_SET((1 << chn));
794 }
795 
803 {
804  pwm_x->GLB_CTRL &= ~(PWMV2_GLB_CTRL_SW_FORCE_SET((1 << chn)));
805 }
806 
807 #ifdef PWM_SOC_HRPWM_SUPPORT
808 
815 static inline void pwmv2_add_delay_tick_after_dead_area(PWMV2_Type *pwm_x, uint8_t delay_tick)
816 {
818 }
819 
825 static inline void pwmv2_enable_hrpwm(PWMV2_Type *pwm_x)
826 {
828 }
829 
835 static inline void pwmv2_disable_hrpwm(PWMV2_Type *pwm_x)
836 {
838 }
839 
840 #endif
841 
848 static inline void pwmv2_enable_software_dac_mode(PWMV2_Type *pwm_x, pwm_dac_channel_t dac_index)
849 {
850  pwm_x->GLB_CTRL2 |= PWMV2_GLB_CTRL2_DAC_SW_MODE_SET((1 << dac_index));
851 }
852 
859 static inline void pwmv2_disable_software_dac_mode(PWMV2_Type *pwm_x, pwm_dac_channel_t dac_index)
860 {
861  pwm_x->GLB_CTRL2 &= ~PWMV2_GLB_CTRL2_DAC_SW_MODE_SET((1 << dac_index));
862 }
863 
869 static inline void pwmv2_enable_debug_mode(PWMV2_Type *pwm_x)
870 {
872 }
873 
874 
880 static inline void pwmv2_disable_debug_mode(PWMV2_Type *pwm_x)
881 {
883 }
884 
891 static inline void pwmv2_clear_fault_event(PWMV2_Type *pwm_x, pwm_channel_t chn)
892 {
894 }
895 
902 {
904 }
905 
912 {
914 }
915 
923 static inline uint32_t pwmv2_get_counter_working_status(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
924 {
925  return PWMV2_CNT_RELOAD_WORK_VALUE_GET(pwm_x->CNT_RELOAD_WORK[counter_index]);
926 }
927 
935 static inline uint32_t pwmv2_get_cmp_working_status(PWMV2_Type *pwm_x, uint8_t cmp_index)
936 {
937  return PWMV2_CMP_VAL_WORK_VALUE_GET(pwm_x->CMP_VAL_WORK[cmp_index]);
938 }
939 
946 static inline uint32_t pwmv2_get_force_working_status(PWMV2_Type *pwm_x)
947 {
949 }
950 
958 {
960 }
961 
969 static inline uint32_t pwmv2_get_counter_value(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
970 {
971  return PWMV2_CNT_VAL_VALUE_GET(pwm_x->CNT_VAL[counter_index]);
972 }
973 
981 static inline void pwmv2_set_dac_value(PWMV2_Type *pwm_x, pwm_dac_channel_t dac_index, uint32_t value)
982 {
983  pwm_x->DAC_VALUE_SV[dac_index] = PWMV2_DAC_VALUE_SV_VALUE_SET(value);
984 }
985 
993 static inline uint32_t pwmv2_get_capture_posedge_value(PWMV2_Type *pwm_x, pwm_channel_t chn)
994 {
996 }
997 
1006 {
1007  pwm_x->CAPTURE_POS[chn] = (pwm_x->CAPTURE_POS[chn] & ~PWMV2_CAPTURE_POS_CAPTURE_SELGPIO_MASK) |
1009 }
1010 
1018 static inline void pwmv2_set_capture_counter_index(PWMV2_Type *pwm_x, pwm_channel_t chn, uint8_t counter_index)
1019 {
1020  pwm_x->CAPTURE_POS[chn] = (pwm_x->CAPTURE_POS[chn] & ~PWMV2_CAPTURE_POS_CNT_INDEX_MASK) |
1021  PWMV2_CAPTURE_POS_CNT_INDEX_SET(counter_index);
1022 }
1023 
1031 static inline uint32_t pwmv2_get_capture_negedge_value(PWMV2_Type *pwm_x, pwm_channel_t chn)
1032 {
1033  return PWMV2_CAPTURE_NEG_CAPTURE_NEG_GET(pwm_x->CAPTURE_NEG[chn]);
1034 }
1035 
1042 static inline uint32_t pwmv2_get_irq_status_all(PWMV2_Type *pwm_x)
1043 {
1044  return pwm_x->IRQ_STS;
1045 }
1046 
1053 {
1055 }
1056 
1063 {
1065 }
1066 
1073 {
1075 }
1076 
1083 static inline uint32_t pwmv2_get_cmp_irq_status(PWMV2_Type *pwm_x)
1084 {
1086 }
1087 
1094 static inline void pwmv2_clear_cmp_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1095 {
1097 }
1098 
1105 static inline uint32_t pwmv2_get_reload_irq_status(PWMV2_Type *pwm_x)
1106 {
1108 }
1109 
1116 static inline void pwmv2_clear_reload_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1117 {
1119 }
1120 
1127 static inline uint32_t pwmv2_get_capture_posedge_irq_status(PWMV2_Type *pwm_x)
1128 {
1130 }
1131 
1138 static inline void pwmv2_clear_capture_posedge_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1139 {
1141 }
1142 
1149 static inline uint32_t pwmv2_get_capture_negedge_irq_status(PWMV2_Type *pwm_x)
1150 {
1152 }
1153 
1160 static inline void pwmv2_clear_capture_negedge_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1161 {
1163 }
1164 
1171 static inline uint32_t pwmv2_get_fault_irq_status(PWMV2_Type *pwm_x)
1172 {
1174 }
1175 
1182 static inline void pwmv2_clear_fault_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1183 {
1185 }
1186 
1193 static inline uint32_t pwmv2_get_burstend_irq_status(PWMV2_Type *pwm_x)
1194 {
1196 }
1197 
1204 static inline void pwmv2_clear_burstend__irq_status(PWMV2_Type *pwm_x, uint32_t mask)
1205 {
1207 }
1208 
1215 static inline void pwmv2_enable_cmp_irq(PWMV2_Type *pwm_x, uint8_t cmp_index)
1216 {
1217  pwm_x->IRQ_EN_CMP |= PWMV2_IRQ_EN_CMP_IRQ_EN_CMP_SET(1 << cmp_index);
1218 }
1219 
1226 static inline void pwmv2_disable_cmp_irq(PWMV2_Type *pwm_x, uint8_t cmp_index)
1227 {
1228  pwm_x->IRQ_EN_CMP &= ~PWMV2_IRQ_EN_CMP_IRQ_EN_CMP_SET(1 << cmp_index);
1229 }
1230 
1237 static inline uint32_t pwmv2_get_enabled_cmp_irq(PWMV2_Type *pwm_x)
1238 {
1240 }
1241 
1248 static inline void pwmv2_enable_reload_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
1249 {
1250  pwm_x->IRQ_EN_RELOAD |= PWMV2_IRQ_EN_RELOAD_IRQ_EN_RELOAD_SET(1 << counter_index);
1251 }
1252 
1259 static inline void pwmv2_disable_reload_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
1260 {
1261  pwm_x->IRQ_EN_RELOAD &= ~PWMV2_IRQ_EN_RELOAD_IRQ_EN_RELOAD_SET(1 << counter_index);
1262 }
1263 
1270 static inline void pwmv2_enable_capture_posedge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1271 {
1272  pwm_x->IRQ_EN_CAP_POS |= PWMV2_IRQ_EN_CAP_POS_IRQ_EN_CAP_POS_SET(1 << channel_index);
1273 }
1274 
1281 static inline void pwmv2_disable_capture_posedge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1282 {
1283  pwm_x->IRQ_EN_CAP_POS &= ~PWMV2_IRQ_EN_CAP_POS_IRQ_EN_CAP_POS_SET(1 << channel_index);
1284 }
1285 
1292 static inline void pwmv2_enable_capture_nededge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1293 {
1294  pwm_x->IRQ_EN_CAP_NEG |= PWMV2_IRQ_EN_CAP_NEG_IRQ_EN_CAP_NEG_SET(1 << channel_index);
1295 }
1296 
1303 static inline void pwmv2_disable_capture_nededge_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1304 {
1305  pwm_x->IRQ_EN_CAP_NEG &= ~PWMV2_IRQ_EN_CAP_NEG_IRQ_EN_CAP_NEG_SET(1 << channel_index);
1306 }
1307 
1314 static inline void pwmv2_enable_fault_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1315 {
1316  pwm_x->IRQ_EN_FAULT |= PWMV2_IRQ_EN_FAULT_IRQ_EN_FAULT_SET(1 << channel_index);
1317 }
1318 
1325 static inline void pwmv2_disable_fault_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
1326 {
1327  pwm_x->IRQ_EN_FAULT &= ~PWMV2_IRQ_EN_FAULT_IRQ_EN_FAULT_SET(1 << channel_index);
1328 }
1329 
1336 static inline void pwmv2_enable_burstend_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
1337 {
1338  pwm_x->IRQ_EN_BURSTEND |= PWMV2_IRQ_EN_FAULT_IRQ_EN_FAULT_SET(1 << counter_index);
1339 }
1340 
1347 static inline void pwmv2_disable_burstend_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
1348 {
1349  pwm_x->IRQ_EN_BURSTEND &= ~PWMV2_IRQ_EN_FAULT_IRQ_EN_FAULT_SET(1 << counter_index);
1350 }
1351 
1359 static inline void pwmv2_enable_dma_at_compare_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel, uint8_t cmp_index)
1360 {
1361  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))) |
1363 }
1364 
1371 static inline void pwmv2_disable_dma_at_compare_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel)
1372 {
1374 }
1375 
1383 static inline void pwmv2_enable_dma_at_reload_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel, pwm_counter_t reload_index)
1384 {
1385  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))) |
1386  ((PWMV2_DMA_EN_DMA0_SEL_SET(reload_index + 24) | PWMV2_DMA_EN_DMA0_EN_MASK) << (PWMV2_DMA_EN_DMA1_SEL_SHIFT * dma_channel));
1387 }
1388 
1395 static inline void pwmv2_disable_dma_at_reload_point(PWMV2_Type *pwm_x, pwm_dma_chn_t dma_channel)
1396 {
1398 }
1399 
1407 static inline void pwmv2_reload_select_compare_point0_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cmp_index)
1408 {
1409  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);
1410 }
1411 
1419 static inline void pwmv2_reload_select_compare_point1_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cmp_index)
1420 {
1421  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);
1422 }
1423 
1431 static inline void pwmv2_reload_select_input_trigger(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
1432 {
1433  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);
1434 }
1435 
1444 {
1445  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);
1446 }
1447 
1455 static inline void pwmv2_counter_set_dac_data_parameter(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t dac_parameter)
1456 {
1457  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);
1458 }
1459 
1467 static inline void pwmv2_conuter_select_dac_index(PWMV2_Type *pwm_x, pwm_counter_t counter, pwm_dac_channel_t dac_index)
1468 {
1469  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);
1470 }
1471 
1478 static inline void pwmv2_counter_up_limit_enable(PWMV2_Type *pwm_x, pwm_counter_t counter)
1479 {
1480  pwm_x->CNT[counter].CFG1 |= PWMV2_CNT_CFG1_CNT_LU_EN_MASK;
1481 }
1482 
1489 static inline void pwmv2_counter_up_limit_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
1490 {
1491  pwm_x->CNT[counter].CFG1 &= ~PWMV2_CNT_CFG1_CNT_LU_EN_MASK;
1492 }
1493 
1501 static inline void pwmv2_counter_select_up_limit_from_shadow_value(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t index)
1502 {
1503  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);
1504 }
1505 
1512 static inline void pwmv2_counter_low_limit_enable(PWMV2_Type *pwm_x, pwm_counter_t counter)
1513 {
1514  pwm_x->CNT[counter].CFG1 |= PWMV2_CNT_CFG1_CNT_LL_EN_MASK;
1515 }
1516 
1517 
1524 static inline void pwmv2_counter_low_limit_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
1525 {
1526  pwm_x->CNT[counter].CFG1 &= ~PWMV2_CNT_CFG1_CNT_LL_EN_MASK;
1527 }
1528 
1536 static inline void pwmv2_counter_select_low_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_LO_MASK) | PWMV2_CNT_CFG1_CNT_LIM_LO_SET(index);
1539 }
1540 
1548 static inline void pwmv2_counter_select_data_offset_from_shadow_value(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t index)
1549 {
1550  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);
1551 }
1552 
1560 {
1561  pwm_x->CNT[counter].CFG2 |= PWMV2_CNT_CFG2_CNT_RELOAD_EN_MASK;
1562 }
1563 
1571 {
1572  pwm_x->CNT[counter].CFG2 &= ~PWMV2_CNT_CFG2_CNT_RELOAD_EN_MASK;
1573 }
1574 
1582 static inline void pwmv2_counter_update_trig1(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
1583 {
1584  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);
1585 }
1586 
1594 {
1595  pwm_x->CNT[counter].CFG2 |= PWMV2_CNT_CFG2_CNT_UPDATE_EN1_MASK;
1596 }
1597 
1605 {
1606  pwm_x->CNT[counter].CFG2 &= ~PWMV2_CNT_CFG2_CNT_UPDATE_EN1_MASK;
1607 }
1608 
1616 static inline void pwmv2_counter_set_trig1_calculate_cell_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cal_index)
1617 {
1618  pwm_x->CNT[counter].CFG2 = (pwm_x->CNT[counter].CFG2 & ~PWMV2_CNT_CFG2_CNT_TRIG1_MASK) | PWMV2_CNT_CFG2_CNT_TRIG1_SET(cal_index);
1619 }
1620 
1628 static inline void pwmv2_counter_update_trig0(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
1629 {
1630  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);
1631 }
1632 
1640 {
1641  pwm_x->CNT[counter].CFG2 |= PWMV2_CNT_CFG2_CNT_UPDATE_EN0_MASK;
1642 }
1643 
1651 {
1652  pwm_x->CNT[counter].CFG2 &= ~PWMV2_CNT_CFG2_CNT_UPDATE_EN0_MASK;
1653 }
1654 
1662 static inline void pwmv2_counter_set_trig0_calculate_cell_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t cal_index)
1663 {
1664  pwm_x->CNT[counter].CFG2 = (pwm_x->CNT[counter].CFG2 & ~PWMV2_CNT_CFG2_CNT_TRIG0_MASK) | PWMV2_CNT_CFG2_CNT_TRIG0_SET(cal_index);
1665 }
1666 
1674 static inline void pwmv2_counter_start_select_trigger_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
1675 {
1676  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);
1677 }
1678 
1686 {
1687  pwm_x->CNT[counter].CFG3 |= PWMV2_CNT_CFG3_CNT_HW_START_EN_MASK;
1688 }
1689 
1697 {
1698  pwm_x->CNT[counter].CFG3 &= ~PWMV2_CNT_CFG3_CNT_HW_START_EN_MASK;
1699 }
1700 
1708 static inline void pwmv2_set_counter_burst(PWMV2_Type *pwm_x, pwm_counter_t counter, uint16_t burst)
1709 {
1710  pwm_x->CNT[counter].CFG3 = (pwm_x->CNT[counter].CFG3 & ~PWMV2_CNT_CFG3_CNT_BURST_MASK) | PWMV2_CNT_CFG3_CNT_BURST_SET(burst);
1711 }
1712 
1719 static inline void pwmv2_counter_burst_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
1720 {
1721  pwm_x->CNT[counter].CFG3 |= PWMV2_CNT_CFG3_CNT_BURST_MASK;
1722 }
1723 
1730 static inline void pwmv2_start_pwm_output(PWMV2_Type *pwm_x, pwm_counter_t counter)
1731 {
1732  pwm_x->CNT_GLBCFG |= PWMV2_CNT_GLBCFG_CNT_SW_START_SET((1 << counter));
1733 }
1734 
1741 static inline void pwmv2_reset_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
1742 {
1743  pwm_x->CNT_GLBCFG |= PWMV2_CNT_GLBCFG_TIMER_RESET_SET((1 << counter));
1744 }
1745 
1752 static inline void pwmv2_enable_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
1753 {
1754  pwm_x->CNT_GLBCFG |= PWMV2_CNT_GLBCFG_TIMER_ENABLE_SET((1 << counter));
1755 }
1756 
1763 static inline void pwmv2_disable_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
1764 {
1765  pwm_x->CNT_GLBCFG &= ~PWMV2_CNT_GLBCFG_TIMER_ENABLE_SET((1 << counter));
1766 }
1767 
1775 static inline void pwmv2_calculate_set_up_limit_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
1776 {
1777  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);
1778 }
1779 
1787 static inline void pwmv2_calculate_set_low_limit_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
1788 {
1789  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);
1790 }
1791 
1799 static inline void pwmv2_calculate_set_period_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
1800 {
1801  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);
1802 }
1803 
1811 static inline void pwmv2_calculate_set_dac_value_parameter(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t value)
1812 {
1813  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);
1814 }
1815 
1823 static inline void pwmv2_calculate_select_counter_calculate_index(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t counter_calculate)
1824 {
1825  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);
1826 }
1827 
1835 static inline void pwmv2_calculate_select_in_value(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t index)
1836 {
1837  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);
1838 }
1839 
1846 static inline void pwmv2_calculate_enable_up_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
1847 {
1848  pwm_x->CAL[cal_index].CFG1 |= PWMV2_CAL_CFG1_CAL_LU_EN_MASK;
1849 }
1850 
1857 static inline void pwmv2_calculate_disable_up_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
1858 {
1859  pwm_x->CAL[cal_index].CFG1 &= ~PWMV2_CAL_CFG1_CAL_LU_EN_MASK;
1860 }
1861 
1869 static inline void pwmv2_calculate_select_up_limit_offset(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t shadow_index)
1870 {
1871  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);
1872 }
1873 
1881 static inline void pwmv2_calculate_select_low_limit_offset(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t shadow_index)
1882 {
1883  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);
1884 }
1885 
1893 static inline void pwmv2_calculate_select_in_offset(PWMV2_Type *pwm_x, uint8_t cal_index, uint8_t shadow_index)
1894 {
1895  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);
1896 }
1897 
1904 static inline void pwmv2_calculate_enable_low_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
1905 {
1906  pwm_x->CAL[cal_index].CFG1 |= PWMV2_CAL_CFG1_CAL_LL_EN_MASK;
1907 }
1908 
1915 static inline void pwmv2_calculate_disable_low_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
1916 {
1917  pwm_x->CAL[cal_index].CFG1 &= ~PWMV2_CAL_CFG1_CAL_LL_EN_MASK;
1918 }
1919 
1927 static inline void pwmv2_select_cmp_trigmux(PWMV2_Type *pwm_x, uint8_t cmp_index, uint8_t trig_index)
1928 {
1929  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);
1930 }
1931 
1939 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)
1940 {
1941  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);
1942 }
1943 
1952 static inline void pwmv2_select_cmp_source(PWMV2_Type *pwm_x, uint8_t cmp_index, pwm_cmp_source_t cmp_sel, uint8_t index)
1953 {
1954  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));
1955 }
1956 
1964 static inline void pwmv2_cmp_select_counter(PWMV2_Type *pwm_x, uint8_t cmp_index, pwm_counter_t counter_index)
1965 {
1966  if (cmp_index >= 16) {
1967  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));
1968  }
1969 }
1970 
1978 void pwmv2_config_cmp(PWMV2_Type *pwm_x, uint8_t index, pwmv2_cmp_config_t *config);
1979 
1988 
1997 void pwmv2_config_pwm(PWMV2_Type *pwm_x, pwm_channel_t index, pwmv2_config_t *config, bool enable_pair_mode);
1998 
2012  uint8_t cmp_start_index, pwmv2_cmp_config_t *cmp, uint8_t cmp_num);
2013 
2026  pwmv2_pair_config_t *pwm_pair_config, uint8_t cmp_start_index,
2027  pwmv2_cmp_config_t *cmp, uint8_t cmp_num);
2028 
2036 void pwmv2_setup_cmp_calculate(PWMV2_Type *pwm_x, uint8_t cal_index, pwmv2_cmp_calculate_cfg_t *cal);
2037 
2038 #ifdef __cplusplus
2039 }
2040 #endif
2044 #endif /* HPM_PWMV2_DRV_H */
#define PWMV2_CNT_CFG2_CNT_RELOAD_TRIG_SET(x)
Definition: hpm_pwmv2_regs.h:1030
#define PWMV2_GLB_CTRL2_DAC_SW_MODE_SET(x)
Definition: hpm_pwmv2_regs.h:469
#define PWMV2_CNT_CFG3_CNT_HW_START_EN_MASK
Definition: hpm_pwmv2_regs.h:1109
#define PWMV2_CNT_CFG1_CNT_LU_EN_MASK
Definition: hpm_pwmv2_regs.h:967
#define PWMV2_IRQ_STS_CMP_IRQ_STS_CMP_GET(x)
Definition: hpm_pwmv2_regs.h:691
#define PWMV2_FORCE_WORK_OUT_POLARITY_GET(x)
Definition: hpm_pwmv2_regs.h:532
#define PWMV2_CNT_CFG0_CNT_D_PARAM_MASK
Definition: hpm_pwmv2_regs.h:946
#define PWMV2_CAL_CFG1_CAL_LIM_UP_MASK
Definition: hpm_pwmv2_regs.h:1237
#define PWMV2_CAPTURE_POS_CAPTURE_SELGPIO_SET(x)
Definition: hpm_pwmv2_regs.h:583
#define PWMV2_CNT_CFG3_CNT_START_SEL_MASK
Definition: hpm_pwmv2_regs.h:1099
#define PWMV2_IRQ_EN_CAP_POS_IRQ_EN_CAP_POS_SET(x)
Definition: hpm_pwmv2_regs.h:778
#define PWMV2_PWM_CFG0_POL_UPDATE_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:225
#define PWMV2_IRQ_STS_BURSTEND_IRQ_STS_BURSTEND_SET(x)
Definition: hpm_pwmv2_regs.h:745
#define PWMV2_IRQ_STS_IRQ_CAL_OVERFLOW_MASK
Definition: hpm_pwmv2_regs.h:612
#define PWMV2_CAL_CFG1_CAL_IN_INDEX_SET(x)
Definition: hpm_pwmv2_regs.h:1219
#define PWMV2_CNT_CFG1_CNT_IN_OFF_SET(x)
Definition: hpm_pwmv2_regs.h:1009
#define PWMV2_PWM_CFG0_TRIG_SEL4_MASK
Definition: hpm_pwmv2_regs.h:171
#define PWMV2_CMP_VAL_WORK_VALUE_GET(x)
Definition: hpm_pwmv2_regs.h:522
#define PWMV2_PWM_CFG0_FAULT_SEL_ASYNC_GET(x)
Definition: hpm_pwmv2_regs.h:184
#define PWMV2_PWM_CFG1_PAIR_MODE_MASK
Definition: hpm_pwmv2_regs.h:321
#define PWMV2_CMP_CFG_CMP_CNT_MASK
Definition: hpm_pwmv2_regs.h:1322
#define PWMV2_GLB_CTRL_HR_PWM_EN_MASK
Definition: hpm_pwmv2_regs.h:446
#define PWMV2_FORCE_MODE_FORCE_MODE_SET(x)
Definition: hpm_pwmv2_regs.h:144
#define PWMV2_CNT_CFG2_CNT_UPDATE_TRIG0_MASK
Definition: hpm_pwmv2_regs.h:1068
#define PWMV2_DMA_EN_DMA0_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:892
#define PWMV2_GLB_CTRL2_DEBUG_IN_EN_MASK
Definition: hpm_pwmv2_regs.h:477
#define PWMV2_CAL_CFG0_CAL_LU_PARAM_MASK
Definition: hpm_pwmv2_regs.h:1166
#define PWMV2_SHADOW_VAL_VALUE_SET(x)
Definition: hpm_pwmv2_regs.h:117
#define PWMV2_IRQ_EN_FAULT_IRQ_EN_FAULT_SET(x)
Definition: hpm_pwmv2_regs.h:800
#define PWMV2_IRQ_STS_FAULT_IRQ_STS_FAULT_SET(x)
Definition: hpm_pwmv2_regs.h:734
#define PWMV2_GLB_CTRL2_FAULT_CLEAR_SET(x)
Definition: hpm_pwmv2_regs.h:491
#define PWMV2_CAPTURE_POS_CNT_INDEX_SET(x)
Definition: hpm_pwmv2_regs.h:593
#define PWMV2_PWM_CFG1_FAULT_REC_SEL_MASK
Definition: hpm_pwmv2_regs.h:390
#define PWMV2_PWM_CFG1_FORCE_TIME_MASK
Definition: hpm_pwmv2_regs.h:350
#define PWMV2_IRQ_STS_CAP_POS_IRQ_STS_CAP_POS_GET(x)
Definition: hpm_pwmv2_regs.h:713
#define PWMV2_CAPTURE_POS_CAPTURE_SELGPIO_MASK
Definition: hpm_pwmv2_regs.h:581
#define PWMV2_CNT_CFG3_CNT_BURST_MASK
Definition: hpm_pwmv2_regs.h:1122
#define PWMV2_CAL_CFG0_CAL_T_PARAM_MASK
Definition: hpm_pwmv2_regs.h:1186
#define PWMV2_WORK_CTRL1_SHADOW_LOCK_MASK
Definition: hpm_pwmv2_regs.h:154
#define PWMV2_CNT_CFG1_CNT_LIM_LO_SET(x)
Definition: hpm_pwmv2_regs.h:999
#define PWMV2_PWM_CFG1_FORCE_UPDATE_TIME_SET(x)
Definition: hpm_pwmv2_regs.h:274
#define PWMV2_CNT_CFG0_RLD_UPDATE_TIME_MASK
Definition: hpm_pwmv2_regs.h:936
#define PWMV2_IRQ_STS_RELOAD_IRQ_STS_RELOAD_SET(x)
Definition: hpm_pwmv2_regs.h:701
#define PWMV2_CAL_CFG1_CAL_LL_EN_MASK
Definition: hpm_pwmv2_regs.h:1247
#define PWMV2_IRQ_STS_BURSTEND_IRQ_STS_BURSTEND_GET(x)
Definition: hpm_pwmv2_regs.h:746
#define PWMV2_CAPTURE_POS_CNT_INDEX_MASK
Definition: hpm_pwmv2_regs.h:591
#define PWMV2_CMP_CFG_CMP_IN_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:1313
#define PWMV2_CNT_CFG2_CNT_TRIG0_MASK
Definition: hpm_pwmv2_regs.h:1088
#define PWMV2_CNT_CFG1_CNT_IN_OFF_MASK
Definition: hpm_pwmv2_regs.h:1007
#define PWMV2_CAL_CFG1_CAL_LIM_LO_MASK
Definition: hpm_pwmv2_regs.h:1257
#define PWMV2_PWM_CFG1_FAULT_REC_TIME_SET(x)
Definition: hpm_pwmv2_regs.h:299
#define PWMV2_PWM_CFG1_FORCE_TRIG_SEL_MASK
Definition: hpm_pwmv2_regs.h:360
#define PWMV2_PWM_CFG0_FAULT_EN_SYNC_MASK
Definition: hpm_pwmv2_regs.h:211
#define PWMV2_FORCE_MODE_POLARITY_SET(x)
Definition: hpm_pwmv2_regs.h:129
#define PWMV2_IRQ_EN_CMP_IRQ_EN_CMP_GET(x)
Definition: hpm_pwmv2_regs.h:757
#define PWMV2_PWM_CFG1_FORCE_TIME_SET(x)
Definition: hpm_pwmv2_regs.h:352
#define PWMV2_CMP_CFG_CMP_CNT_SET(x)
Definition: hpm_pwmv2_regs.h:1324
#define PWMV2_PWM_CFG0_POLARITY_OPT0_MASK
Definition: hpm_pwmv2_regs.h:245
#define PWMV2_CMP_CFG_CMP_TRIG_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:1280
#define PWMV2_CNT_CFG2_CNT_RELOAD_EN_MASK
Definition: hpm_pwmv2_regs.h:1018
#define PWMV2_PWM_CFG1_PWM_FORCE_SEL_MASK
Definition: hpm_pwmv2_regs.h:380
#define PWMV2_PWM_CFG0_OUT_POLARITY_MASK
Definition: hpm_pwmv2_regs.h:235
#define PWMV2_CNT_CFG2_CNT_TRIG1_MASK
Definition: hpm_pwmv2_regs.h:1058
#define PWMV2_IRQ_STS_CAP_POS_IRQ_STS_CAP_POS_SET(x)
Definition: hpm_pwmv2_regs.h:712
#define PWMV2_CAL_CFG1_CAL_T_INDEX_MASK
Definition: hpm_pwmv2_regs.h:1207
#define PWMV2_CNT_CFG2_CNT_UPDATE_EN0_MASK
Definition: hpm_pwmv2_regs.h:1078
#define PWMV2_DMA_EN_DMA0_SEL_MASK
Definition: hpm_pwmv2_regs.h:890
#define PWMV2_IRQ_EN_CMP_IRQ_EN_CMP_SET(x)
Definition: hpm_pwmv2_regs.h:756
#define PWMV2_IRQ_STS_CAP_NEG_IRQ_STS_CAP_NEG_GET(x)
Definition: hpm_pwmv2_regs.h:724
#define PWMV2_PWM_CFG0_FAULT_POL_ASYNC_SET(x)
Definition: hpm_pwmv2_regs.h:193
#define PWMV2_CMP_CFG_CMP_IN_SEL_MASK
Definition: hpm_pwmv2_regs.h:1311
#define PWMV2_CNT_CFG1_CNT_DAC_INDEX_SET(x)
Definition: hpm_pwmv2_regs.h:959
#define PWMV2_CNT_GLBCFG_TIMER_RESET_SET(x)
Definition: hpm_pwmv2_regs.h:1146
#define PWMV2_CMP_CFG_CMP_TRIG_SEL_MASK
Definition: hpm_pwmv2_regs.h:1278
#define PWMV2_PWM_CFG1_FAULT_MODE_SET(x)
Definition: hpm_pwmv2_regs.h:286
#define PWMV2_CAL_CFG1_CAL_IN_INDEX_MASK
Definition: hpm_pwmv2_regs.h:1217
#define PWMV2_PWM_CFG1_FAULT_REC_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:392
#define PWMV2_PWM_CFG1_FORCE_TRIG_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:362
#define PWMV2_PWM_CFG1_FORCE_ACT_SEL_MASK
Definition: hpm_pwmv2_regs.h:370
#define PWMV2_GLB_CTRL2_FAULT_CLEAR_MASK
Definition: hpm_pwmv2_regs.h:489
#define PWMV2_CAL_CFG0_CAL_LU_PARAM_SET(x)
Definition: hpm_pwmv2_regs.h:1168
#define PWMV2_CNT_GLBCFG_TIMER_ENABLE_SET(x)
Definition: hpm_pwmv2_regs.h:1157
#define PWMV2_CNT_CFG3_CNT_BURST_SET(x)
Definition: hpm_pwmv2_regs.h:1124
#define PWMV2_GLB_CTRL_OUTPUT_DELAY_SET(x)
Definition: hpm_pwmv2_regs.h:438
#define PWMV2_IRQ_STS_CMP_IRQ_STS_CMP_SET(x)
Definition: hpm_pwmv2_regs.h:690
#define PWMV2_IRQ_EN_RELOAD_IRQ_EN_RELOAD_SET(x)
Definition: hpm_pwmv2_regs.h:767
#define PWMV2_CNT_CFG0_RLD_CMP_SEL0_SET(x)
Definition: hpm_pwmv2_regs.h:913
#define PWMV2_TRIGGER_CFG_TRIGGER_OUT_SEL_MASK
Definition: hpm_pwmv2_regs.h:415
#define PWMV2_GLB_CTRL2_SHADOW_LOCK_EN_MASK
Definition: hpm_pwmv2_regs.h:499
#define PWMV2_PWM_CFG1_PWM_LOGIC_MASK
Definition: hpm_pwmv2_regs.h:335
#define PWMV2_CAL_CFG1_CAL_LU_EN_MASK
Definition: hpm_pwmv2_regs.h:1227
#define PWMV2_CNT_CFG0_CNT_D_PARAM_SET(x)
Definition: hpm_pwmv2_regs.h:948
#define PWMV2_TRIGGER_CFG_TRIGGER_OUT_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:417
#define PWMV2_CNT_CFG1_CNT_LL_EN_MASK
Definition: hpm_pwmv2_regs.h:987
#define PWMV2_CAL_CFG0_CAL_D_PARAM_SET(x)
Definition: hpm_pwmv2_regs.h:1198
#define PWMV2_CAPTURE_NEG_CAPTURE_NEG_GET(x)
Definition: hpm_pwmv2_regs.h:604
#define PWMV2_CNT_CFG1_CNT_DAC_INDEX_MASK
Definition: hpm_pwmv2_regs.h:957
#define PWMV2_CAL_CFG0_CAL_LL_PARAM_SET(x)
Definition: hpm_pwmv2_regs.h:1178
#define PWMV2_CNT_CFG2_CNT_UPDATE_EN1_MASK
Definition: hpm_pwmv2_regs.h:1048
#define PWMV2_CNT_CFG2_CNT_TRIG0_SET(x)
Definition: hpm_pwmv2_regs.h:1090
#define PWMV2_CNT_CFG0_RLD_CMP_SEL1_SET(x)
Definition: hpm_pwmv2_regs.h:903
#define PWMV2_CNT_GLBCFG_CNT_SW_START_SET(x)
Definition: hpm_pwmv2_regs.h:1136
#define PWMV2_CNT_CFG0_RLD_TRIG_SEL_MASK
Definition: hpm_pwmv2_regs.h:921
#define PWMV2_FORCE_WORK_FORCE_MODE_GET(x)
Definition: hpm_pwmv2_regs.h:541
#define PWMV2_DMA_EN_DMA1_SEL_SHIFT
Definition: hpm_pwmv2_regs.h:871
#define PWMV2_PWM_CFG1_HIGHZ_EN_N_MASK
Definition: hpm_pwmv2_regs.h:256
#define PWMV2_CNT_CFG0_RLD_TRIG_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:923
#define PWMV2_CNT_CFG0_RLD_CMP_SEL1_MASK
Definition: hpm_pwmv2_regs.h:901
#define PWMV2_CNT_CFG1_CNT_LIM_UP_MASK
Definition: hpm_pwmv2_regs.h:977
#define PWMV2_PWM_CFG1_PWM_FORCE_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:382
#define PWMV2_IRQ_EN_CAP_NEG_IRQ_EN_CAP_NEG_SET(x)
Definition: hpm_pwmv2_regs.h:789
#define PWMV2_IRQ_STS_RELOAD_IRQ_STS_RELOAD_GET(x)
Definition: hpm_pwmv2_regs.h:702
#define PWMV2_CAL_CFG1_CAL_LIM_LO_SET(x)
Definition: hpm_pwmv2_regs.h:1259
#define PWMV2_CNT_RELOAD_WORK_VALUE_GET(x)
Definition: hpm_pwmv2_regs.h:512
#define PWMV2_IRQ_STS_FAULT_IRQ_STS_FAULT_GET(x)
Definition: hpm_pwmv2_regs.h:735
#define PWMV2_CNT_CFG0_RLD_UPDATE_TIME_SET(x)
Definition: hpm_pwmv2_regs.h:938
#define PWMV2_DAC_VALUE_SV_VALUE_SET(x)
Definition: hpm_pwmv2_regs.h:562
#define PWMV2_CNT_VAL_VALUE_GET(x)
Definition: hpm_pwmv2_regs.h:551
#define PWMV2_PWM_CFG0_FAULT_EN_ASYNC_MASK
Definition: hpm_pwmv2_regs.h:201
#define PWMV2_PWM_CFG0_FAULT_SEL_ASYNC_SET(x)
Definition: hpm_pwmv2_regs.h:183
#define PWMV2_CAL_CFG0_CAL_T_PARAM_SET(x)
Definition: hpm_pwmv2_regs.h:1188
#define PWMV2_CAL_CFG1_CAL_IN_OFF_MASK
Definition: hpm_pwmv2_regs.h:1267
#define PWMV2_IRQ_EN_IRQ_EN_OVERFLOW_MASK
Definition: hpm_pwmv2_regs.h:677
#define PWMV2_PWM_CFG0_FAULT_POL_ASYNC_MASK
Definition: hpm_pwmv2_regs.h:191
#define PWMV2_PWM_CFG1_FORCE_UPDATE_TIME_MASK
Definition: hpm_pwmv2_regs.h:272
#define PWMV2_CAPTURE_POS_CAPTURE_POS_GET(x)
Definition: hpm_pwmv2_regs.h:573
#define PWMV2_CAL_CFG0_CAL_D_PARAM_MASK
Definition: hpm_pwmv2_regs.h:1196
#define PWMV2_IRQ_STS_CAP_NEG_IRQ_STS_CAP_NEG_SET(x)
Definition: hpm_pwmv2_regs.h:723
#define PWMV2_CMP_CFG_CMP_UPDATE_TIME_MASK
Definition: hpm_pwmv2_regs.h:1295
#define PWMV2_CAL_CFG1_CAL_T_INDEX_SET(x)
Definition: hpm_pwmv2_regs.h:1209
#define PWMV2_CAL_CFG1_CAL_IN_OFF_SET(x)
Definition: hpm_pwmv2_regs.h:1269
#define PWMV2_PWM_CFG1_FORCE_ACT_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:372
#define PWMV2_PWM_CFG1_FAULT_MODE_MASK
Definition: hpm_pwmv2_regs.h:284
#define PWMV2_PWM_CFG1_SW_FORCE_EN_MASK
Definition: hpm_pwmv2_regs.h:308
#define PWMV2_CAL_CFG1_CAL_LIM_UP_SET(x)
Definition: hpm_pwmv2_regs.h:1239
#define PWMV2_CMP_CFG_CMP_UPDATE_TIME_SET(x)
Definition: hpm_pwmv2_regs.h:1297
#define PWMV2_PWM_CFG0_FAULT_SEL_ASYNC_MASK
Definition: hpm_pwmv2_regs.h:181
#define PWMV2_PWM_DEAD_AREA_DEAD_AREA_SET(x)
Definition: hpm_pwmv2_regs.h:406
#define PWMV2_CNT_CFG3_CNT_START_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:1101
#define PWMV2_CNT_CFG1_CNT_LIM_UP_SET(x)
Definition: hpm_pwmv2_regs.h:979
#define PWMV2_CNT_CFG2_CNT_UPDATE_TRIG1_MASK
Definition: hpm_pwmv2_regs.h:1038
#define PWMV2_GLB_CTRL_OUTPUT_DELAY_MASK
Definition: hpm_pwmv2_regs.h:436
#define PWMV2_CNT_CFG2_CNT_UPDATE_TRIG1_SET(x)
Definition: hpm_pwmv2_regs.h:1040
#define PWMV2_CNT_CFG2_CNT_RELOAD_TRIG_MASK
Definition: hpm_pwmv2_regs.h:1028
#define PWMV2_PWM_CFG1_FAULT_REC_TIME_MASK
Definition: hpm_pwmv2_regs.h:297
#define PWMV2_CAL_CFG0_CAL_LL_PARAM_MASK
Definition: hpm_pwmv2_regs.h:1176
#define PWMV2_PWM_CFG0_POL_UPDATE_SEL_MASK
Definition: hpm_pwmv2_regs.h:223
#define PWMV2_CNT_CFG2_CNT_UPDATE_TRIG0_SET(x)
Definition: hpm_pwmv2_regs.h:1070
#define PWMV2_CNT_CFG2_CNT_TRIG1_SET(x)
Definition: hpm_pwmv2_regs.h:1060
#define PWMV2_CNT_CFG0_RLD_CMP_SEL0_MASK
Definition: hpm_pwmv2_regs.h:911
#define PWMV2_DMA_EN_DMA0_EN_MASK
Definition: hpm_pwmv2_regs.h:880
#define PWMV2_PWM_CFG1_PWM_LOGIC_SET(x)
Definition: hpm_pwmv2_regs.h:337
#define PWMV2_CNT_CFG1_CNT_LIM_LO_MASK
Definition: hpm_pwmv2_regs.h:997
#define PWMV2_GLB_CTRL_SW_FORCE_SET(x)
Definition: hpm_pwmv2_regs.h:428
#define PWMV2_PWM_CFG3_ASYNC_FAULT_SEL_SET(x)
Definition: hpm_pwmv2_regs.h:420
#define PWMV2_GLB_CTRL3_ASYNC_FAULT_POL_SET(x)
Definition: hpm_pwmv2_regs.h:536
uint32_t hpm_stat_t
Definition: hpm_common.h:126
static uint32_t pwmv2_get_cmp_irq_status(PWMV2_Type *pwm_x)
Get cmp irq status.
Definition: hpm_pwmv2_drv.h:1083
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:1395
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:1270
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:993
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:1018
static void pwmv2_enable_output_invert(PWMV2_Type *pwm_x, pwm_channel_t chn)
Enable pwm output invert.
Definition: hpm_pwmv2_drv.h:536
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:283
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:1407
static void pwmv2_disable_burstend_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
disable burstend irq
Definition: hpm_pwmv2_drv.h:1347
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:848
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:1616
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:1952
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:1094
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:1536
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:969
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:696
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:651
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:981
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:629
static void pwmv2_enable_calculate_overflow_irq(PWMV2_Type *pwm_x)
enable calculate overflow irq
Definition: hpm_pwmv2_drv.h:1062
static uint32_t pwmv2_get_capture_negedge_irq_status(PWMV2_Type *pwm_x)
Get capture negedge irq status.
Definition: hpm_pwmv2_drv.h:1149
static void pwmv2_shadow_register_unlock(PWMV2_Type *pwm_x)
unlock all shadow register
Definition: hpm_pwmv2_drv.h:353
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:640
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:1904
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:343
static uint32_t pwmv2_get_force_working_status(PWMV2_Type *pwm_x)
Get force mode work status.
Definition: hpm_pwmv2_drv.h:946
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:780
static void pwmv2_counter_burst_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
Disable counter burst function.
Definition: hpm_pwmv2_drv.h:1719
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:1371
static void pwmv2_disable_calculate_overflow_irq(PWMV2_Type *pwm_x)
Disable calculate overflow irq.
Definition: hpm_pwmv2_drv.h:1072
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:131
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:1662
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:571
static uint32_t pwmv2_get_burstend_irq_status(PWMV2_Type *pwm_x)
Get burstend irq status.
Definition: hpm_pwmv2_drv.h:1193
static void pwmv2_enable_pair_mode(PWMV2_Type *pwm_x, pwm_channel_t chn)
Enable pwm complementary mode.
Definition: hpm_pwmv2_drv.h:673
static void pwmv2_clear_burstend__irq_status(PWMV2_Type *pwm_x, uint32_t mask)
Clear burstend irq status.
Definition: hpm_pwmv2_drv.h:1204
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:1939
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:582
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:1215
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:1604
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:1524
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:525
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:923
static void pwmv2_counter_start_select_trigger_index(PWMV2_Type *pwm_x, pwm_counter_t counter, uint8_t trig_index)
Set trigmux index to start counter.
Definition: hpm_pwmv2_drv.h:1674
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:1467
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:1501
static void pwmv2_disable_software_force(PWMV2_Type *pwm_x, pwm_channel_t chn)
Disable software forced output.
Definition: hpm_pwmv2_drv.h:802
static void pwmv2_disable_four_cmp(PWMV2_Type *pwm_x, pwm_channel_t chn)
disable four pwm outputs
Definition: hpm_pwmv2_drv.h:415
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:1005
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:1171
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:1303
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:1582
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:450
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:1775
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:547
static void pwmv2_reset_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
Reset pwm counter.
Definition: hpm_pwmv2_drv.h:1741
static void pwmv2_disable_debug_mode(PWMV2_Type *pwm_x)
Disable debug mode.
Definition: hpm_pwmv2_drv.h:880
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:744
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:306
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:911
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:378
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:617
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:662
static void pwmv2_calculate_disable_low_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
disable low limit
Definition: hpm_pwmv2_drv.h:1915
static void pwmv2_calculate_disable_up_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
disable calculate up limit
Definition: hpm_pwmv2_drv.h:1857
static uint32_t pwmv2_get_capture_posedge_irq_status(PWMV2_Type *pwm_x)
Get capture posedge irq status.
Definition: hpm_pwmv2_drv.h:1127
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:1964
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:487
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:1383
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:957
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:1031
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:1455
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:295
static uint32_t pwmv2_get_enabled_cmp_irq(PWMV2_Type *pwm_x)
get enabled compare irq
Definition: hpm_pwmv2_drv.h:1237
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:1281
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:1639
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:1650
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:1431
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:1927
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:768
static void pwmv2_enable_burstend_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
enable burstend irq
Definition: hpm_pwmv2_drv.h:1336
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:732
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:439
static void pwmv2_counter_start_trigger_enable(PWMV2_Type *pwm_x, pwm_counter_t counter)
Enable trigmux to trigger counter initiation.
Definition: hpm_pwmv2_drv.h:1685
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:935
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:514
static void pwmv2_enable_four_cmp(PWMV2_Type *pwm_x, pwm_channel_t chn)
enable four pwm outputs
Definition: hpm_pwmv2_drv.h:404
static void pwmv2_enable_reload_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
enable reload irq
Definition: hpm_pwmv2_drv.h:1248
static void pwmv2_disable_pair_mode(PWMV2_Type *pwm_x, pwm_channel_t chn)
Disable pwm complementary mode.
Definition: hpm_pwmv2_drv.h:684
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:859
static void pwmv2_issue_shadow_register_lock_event(PWMV2_Type *pwm_x)
issue all shawdow register
Definition: hpm_pwmv2_drv.h:273
static void pwmv2_enable_software_force(PWMV2_Type *pwm_x, pwm_channel_t chn)
Enable software forced output.
Definition: hpm_pwmv2_drv.h:791
static void pwmv2_counter_start_trigger_disable(PWMV2_Type *pwm_x, pwm_counter_t counter)
Disable trigmux to trigger counter initiation.
Definition: hpm_pwmv2_drv.h:1696
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:1138
static uint32_t pwmv2_get_irq_status_all(PWMV2_Type *pwm_x)
Get all interrupt status.
Definition: hpm_pwmv2_drv.h:1042
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:391
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:720
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:364
static uint32_t pwmv2_get_reload_irq_status(PWMV2_Type *pwm_x)
Get reload irq status.
Definition: hpm_pwmv2_drv.h:1105
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:1548
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:1708
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:1292
static void pwmv2_start_pwm_output(PWMV2_Type *pwm_x, pwm_counter_t counter)
start pwm output
Definition: hpm_pwmv2_drv.h:1730
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:102
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:1799
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:593
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:427
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:1811
static void pwmv2_enable_shadow_lock_feature(PWMV2_Type *pwm_x)
Using the Shadow Register Function.
Definition: hpm_pwmv2_drv.h:901
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:331
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:1593
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:1893
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:1160
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:1512
static void pwmv2_calculate_enable_up_limit(PWMV2_Type *pwm_x, uint8_t cal_index)
enable calculate up limit
Definition: hpm_pwmv2_drv.h:1846
static void pwmv2_disable_reload_irq(PWMV2_Type *pwm_x, pwm_counter_t counter_index)
disable reload irq
Definition: hpm_pwmv2_drv.h:1259
static void pwmv2_disable_cmp_irq(PWMV2_Type *pwm_x, uint8_t cmp_index)
disable cmp irq
Definition: hpm_pwmv2_drv.h:1226
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:1489
static void pwmv2_clear_fault_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
Clear fault irq status.
Definition: hpm_pwmv2_drv.h:1182
static void pwmv2_clear_reload_irq_status(PWMV2_Type *pwm_x, uint32_t mask)
Clear reload irq status.
Definition: hpm_pwmv2_drv.h:1116
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:1478
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:1419
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:1881
static void pwmv2_enable_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
Enable pwm counter.
Definition: hpm_pwmv2_drv.h:1752
static void pwmv2_enable_fault_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
enable fault irq
Definition: hpm_pwmv2_drv.h:1314
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:1359
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:320
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:116
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:708
static void pwmv2_enable_debug_mode(PWMV2_Type *pwm_x)
Enable debug mode.
Definition: hpm_pwmv2_drv.h:869
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:1570
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:1869
static void pwmv2_disable_counter(PWMV2_Type *pwm_x, pwm_counter_t counter)
Disable pwm counter.
Definition: hpm_pwmv2_drv.h:1763
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:1559
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:1628
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:891
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:756
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:1787
static void pwmv2_disable_fault_irq(PWMV2_Type *pwm_x, pwm_channel_t channel_index)
disable fault irq
Definition: hpm_pwmv2_drv.h:1325
#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:1443
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:1835
static void pwmv2_clear_calculate_overflow_irq_status(PWMV2_Type *pwm_x)
clear calculate overflow irq status
Definition: hpm_pwmv2_drv.h:1052
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:1823
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:559
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:605
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:54
__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:46
__RW uint32_t IRQ_EN_BURSTEND
Definition: hpm_pwmv2_regs.h:57
__RW uint32_t GLB_CTRL3
Definition: hpm_pwmv2_regs.h:29
__RW uint32_t CFG2
Definition: hpm_pwmv2_regs.h:64
__RW uint32_t DEAD_AREA
Definition: hpm_pwmv2_regs.h:22
__W uint32_t IRQ_STS_FAULT
Definition: hpm_pwmv2_regs.h:49
struct PWMV2_Type::@687 PWM[8]
__RW uint32_t IRQ_EN_CMP
Definition: hpm_pwmv2_regs.h:52
__RW uint32_t DAC_VALUE_SV[4]
Definition: hpm_pwmv2_regs.h:36
__R uint32_t CAPTURE_NEG[8]
Definition: hpm_pwmv2_regs.h:40
__W uint32_t IRQ_STS_BURSTEND
Definition: hpm_pwmv2_regs.h:50
__RW uint32_t UNLOCK
Definition: hpm_pwmv2_regs.h:14
__R uint32_t CMP_VAL_WORK[24]
Definition: hpm_pwmv2_regs.h:31
__RW uint32_t SHADOW_VAL[28]
Definition: hpm_pwmv2_regs.h:15
__RW uint32_t CFG0
Definition: hpm_pwmv2_regs.h:20
struct PWMV2_Type::@689 CAL[16]
__W uint32_t IRQ_STS_CMP
Definition: hpm_pwmv2_regs.h:45
__RW uint32_t CNT_GLBCFG
Definition: hpm_pwmv2_regs.h:67
__RW uint32_t WORK_CTRL1
Definition: hpm_pwmv2_regs.h:17
__R uint32_t CNT_VAL[4]
Definition: hpm_pwmv2_regs.h:35
__W uint32_t IRQ_STS_CAP_POS
Definition: hpm_pwmv2_regs.h:47
__RW uint32_t IRQ_EN_RELOAD
Definition: hpm_pwmv2_regs.h:53
__RW uint32_t CFG
Definition: hpm_pwmv2_regs.h:76
__RW uint32_t DMA_EN
Definition: hpm_pwmv2_regs.h:59
__R uint32_t FORCE_WORK
Definition: hpm_pwmv2_regs.h:33
__RW uint32_t IRQ_EN
Definition: hpm_pwmv2_regs.h:43
__RW uint32_t IRQ_STS
Definition: hpm_pwmv2_regs.h:42
__RW uint32_t GLB_CTRL
Definition: hpm_pwmv2_regs.h:27
__RW uint32_t IRQ_EN_CAP_NEG
Definition: hpm_pwmv2_regs.h:55
__RW uint32_t IRQ_EN_FAULT
Definition: hpm_pwmv2_regs.h:56
struct PWMV2_Type::@688 CNT[4]
__R uint32_t CNT_RELOAD_WORK[4]
Definition: hpm_pwmv2_regs.h:30
__RW uint32_t TRIGGER_CFG[8]
Definition: hpm_pwmv2_regs.h:25
__RW uint32_t CAPTURE_POS[8]
Definition: hpm_pwmv2_regs.h:38
struct PWMV2_Type::@690 CMP[24]
__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:48
__RW uint32_t CFG3
Definition: hpm_pwmv2_regs.h:65
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:241
uint8_t up_limit_offset_index
Definition: hpm_pwmv2_drv.h:248
uint8_t low_limit_offset_index
Definition: hpm_pwmv2_drv.h:250
int8_t d_param
Definition: hpm_pwmv2_drv.h:246
bool enable_up_limit
Definition: hpm_pwmv2_drv.h:251
int8_t t_param
Definition: hpm_pwmv2_drv.h:245
int8_t up_limit_param
Definition: hpm_pwmv2_drv.h:247
uint8_t counter_index
Definition: hpm_pwmv2_drv.h:242
int8_t low_limit_param
Definition: hpm_pwmv2_drv.h:249
uint8_t in_offset_index
Definition: hpm_pwmv2_drv.h:244
bool enbale_low_limit
Definition: hpm_pwmv2_drv.h:252
uint8_t in_index
Definition: hpm_pwmv2_drv.h:243
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:221
uint8_t force_shadow_trigmux_index
Definition: hpm_pwmv2_drv.h:226
bool enable_async_fault
Definition: hpm_pwmv2_drv.h:215
uint8_t force_trigmux_index
Definition: hpm_pwmv2_drv.h:228
bool enable_four_cmp
Definition: hpm_pwmv2_drv.h:218
pwm_force_shadow_trigger_t force_shadow_trigger
Definition: hpm_pwmv2_drv.h:227
pwm_fault_recovery_trigger_t fault_recovery_trigger
Definition: hpm_pwmv2_drv.h:224
uint8_t fault_mode
Definition: hpm_pwmv2_drv.h:223
pwmv2_async_fault_source_config_t async_fault_source
Definition: hpm_pwmv2_drv.h:219
uint32_t dead_zone_in_half_cycle
Definition: hpm_pwmv2_drv.h:230
bool enable_sync_fault
Definition: hpm_pwmv2_drv.h:216
uint8_t fault_recovery_trigmux_index
Definition: hpm_pwmv2_drv.h:225
bool enable_output
Definition: hpm_pwmv2_drv.h:214
pwm_shadow_register_output_polarity_t update_polarity_time
Definition: hpm_pwmv2_drv.h:220
bool invert_output
Definition: hpm_pwmv2_drv.h:217
pwm_force_trigger_t force_trigger
Definition: hpm_pwmv2_drv.h:229
uint8_t update_trigger
Definition: hpm_pwmv2_drv.h:222
pair pwm config
Definition: hpm_pwmv2_drv.h:237
pwmv2_config_t pwm[2]
Definition: hpm_pwmv2_drv.h:238