HPM SDK
HPMicro Software Development Kit
hpm_qeiv2_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_QEIV2_DRV_H
9 #define HPM_QEIV2_DRV_H
10 
11 #include "hpm_common.h"
12 #include "hpm_qeiv2_regs.h"
19 #define QEIV2_EVENT_WDOG_FLAG_MASK (1U << 31U)
20 #define QEIV2_EVENT_HOME_FLAG_MASK (1U << 30U)
21 #define QEIV2_EVENT_POSITION_COMPARE_FLAG_MASK (1U << 29U)
22 #define QEIV2_EVENT_Z_PHASE_FLAG_MASK (1U << 28U)
23 #define QEIV2_EVENT_Z_MISS_FLAG_MASK (1U << 27U)
24 #define QEIV2_EVENT_WIDTH_TIME_FLAG_MASK (1U << 26U)
25 #define QEIV2_EVENT_POSITION2_COMPARE_FLAG_MASK (1U << 25U)
26 #define QEIV2_EVENT_DIR_CHG_FLAG_MASK (1U << 24U)
27 #define QEIV2_EVENT_CYCLE0_FLAG_MASK (1U << 23U)
28 #define QEIV2_EVENT_CYCLE1_FLAG_MASK (1U << 22U)
29 #define QEIV2_EVENT_PULSE0_FLAG_MASK (1U << 21U)
30 #define QEIV2_EVENT_PULSE1_FLAG_MASK (1U << 20U)
31 #define QEIV2_EVENT_HOME2_FLAG_MASK (1U << 19U)
32 #define QEIV2_EVENT_FAULT_FLAG_MASK (1U << 18U)
38 typedef enum qeiv2_work_mode {
47 
52 typedef enum qeiv2_spd_tmr_content {
56 
61 typedef enum qeiv2_rotate_dir {
70 typedef enum qeiv2_position_dir {
83 
88 typedef enum qeiv2_counter_type {
94 
99 typedef enum qeiv2_filter_mode {
106 
111 typedef enum qeiv2_filter_phase {
124 typedef enum qeiv2_uvw_pos_opt {
128 
129 typedef enum qeiv2_uvw_pos_sel {
139 #define QEIV2_UVW_POS_OPT_CUR_SEL_LOW 0u
140 #define QEIV2_UVW_POS_OPT_CUR_SEL_HIGH 1u
141 #define QEIV2_UVW_POS_OPT_CUR_SEL_EDGE 2u
142 #define QEIV2_UVW_POS_OPT_NEX_SEL_LOW 0u
143 #define QEIV2_UVW_POS_OPT_NEX_SEL_HIGH 3u
144 
145 typedef enum qeiv2_uvw_pos_idx {
158 typedef struct {
159  uint32_t phcnt_cmp_value;
163  uint32_t zcmp_value;
165 
170 typedef struct {
171  uint32_t pos_cmp_value;
175 
179 typedef struct {
181  qeiv2_uvw_pos_sel_t u_pos_sel[6];
182  qeiv2_uvw_pos_sel_t v_pos_sel[6];
183  qeiv2_uvw_pos_sel_t w_pos_sel[6];
184  uint32_t pos_cfg[6];
186 
190 typedef struct {
191  uint8_t adc_select;
192  uint8_t adc_channel;
193  int16_t param0;
194  int16_t param1;
195  uint32_t offset;
197 
198 #ifdef __cplusplus
199 extern "C" {
200 #endif
201 
208 {
209  qeiv2_x->CR |= QEIV2_CR_READ_MASK;
210 }
211 
221 {
222  qeiv2_x->CR = (qeiv2_x->CR & ~QEIV2_CR_ZCNTCFG_MASK) | QEIV2_CR_ZCNTCFG_SET(mode);
223 }
224 
231 static inline void qeiv2_config_phmax_phparam(QEIV2_Type *qeiv2_x, uint32_t phmax)
232 {
233  uint32_t tmp;
234 
235  if (phmax > 0u) {
236  phmax--;
237  }
238  qeiv2_x->PHCFG = QEIV2_PHCFG_PHMAX_SET(phmax);
239  if (phmax == 0u) {
240  qeiv2_x->PHASE_PARAM = 0xFFFFFFFFu;
241  } else {
242  tmp = (0x80000000u / (phmax + 1u));
243  tmp <<= 1u;
245  }
246 }
247 
256 static inline void qeiv2_config_z_phase_calibration(QEIV2_Type *qeiv2_x, uint32_t phidx, bool enable, qeiv2_work_mode_t mode)
257 {
258  uint32_t tmp = qeiv2_x->CR;
259  qeiv2_x->PHIDX = QEIV2_PHIDX_PHIDX_SET(phidx);
260  if (enable) {
261  tmp |= QEIV2_CR_PHCALIZ_MASK;
262  } else {
263  tmp &= ~QEIV2_CR_PHCALIZ_MASK;
264  }
265  if (enable && ((mode == qeiv2_work_mode_sin) || (mode == qeiv2_work_mode_sincos))) {
267  } else {
268  tmp &= ~QEIV2_CR_Z_ONLY_EN_MASK;
269  }
270  qeiv2_x->CR = tmp;
271 }
272 
284 static inline void qeiv2_pause_counter(QEIV2_Type *qeiv2_x, uint32_t counter_mask, bool enable)
285 {
286  if (enable) {
287  qeiv2_x->CR |= counter_mask;
288  } else {
289  qeiv2_x->CR &= ~counter_mask;
290  }
291 }
292 
299 static inline void qeiv2_pause_pos_counter_on_fault(QEIV2_Type *qeiv2_x, bool enable)
300 {
301  if (enable) {
302  qeiv2_x->CR |= QEIV2_CR_FAULTPOS_MASK;
303  } else {
304  qeiv2_x->CR &= ~QEIV2_CR_FAULTPOS_MASK;
305  }
306 }
307 
313 static inline void qeiv2_enable_snap(QEIV2_Type *qeiv2_x)
314 {
315  qeiv2_x->CR |= QEIV2_CR_SNAPEN_MASK;
316 }
317 
323 static inline void qeiv2_disable_snap(QEIV2_Type *qeiv2_x)
324 {
325  qeiv2_x->CR &= ~QEIV2_CR_SNAPEN_MASK;
326 }
327 
333 static inline void qeiv2_reset_counter(QEIV2_Type *qeiv2_x)
334 {
335  qeiv2_x->CR |= QEIV2_CR_RSTCNT_MASK;
336 }
337 
343 static inline void qeiv2_release_counter(QEIV2_Type *qeiv2_x)
344 {
345  qeiv2_x->CR &= ~QEIV2_CR_RSTCNT_MASK;
346 }
347 
355 {
356  qeiv2_x->CR = (qeiv2_x->CR & ~QEIV2_CR_RD_SEL_MASK) | QEIV2_CR_RD_SEL_SET(content);
357 }
358 
365 static inline bool qeiv2_check_spd_tmr_as_pos_angle(QEIV2_Type *qeiv2_x)
366 {
367  return ((qeiv2_x->CR & QEIV2_CR_RD_SEL_MASK) != 0) ? true : false;
368 }
369 
376 static inline void qeiv2_set_work_mode(QEIV2_Type *qeiv2_x, qeiv2_work_mode_t mode)
377 {
378  qeiv2_x->CR = (qeiv2_x->CR & ~QEIV2_CR_ENCTYP_MASK) | QEIV2_CR_ENCTYP_SET(mode);
379 }
380 
391 static inline void qeiv2_config_wdog(QEIV2_Type *qeiv2_x, uint32_t timeout, uint8_t clr_phcnt, bool enable)
392 {
393  uint32_t tmp;
394  tmp = QEIV2_WDGCFG_WDGTO_SET(timeout) | QEIV2_WDGCFG_WDOG_CFG_SET(clr_phcnt);
395  if (enable) {
397  } else {
398  tmp &= ~QEIV2_WDGCFG_WDGEN_MASK;
399  }
400  qeiv2_x->WDGCFG = tmp;
401 }
402 
423 static inline void qeiv2_enable_trig_out_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
424 {
425  qeiv2_x->TRGOEN |= event_mask;
426 }
427 
448 static inline void qeiv2_disable_trig_out_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
449 {
450  qeiv2_x->TRGOEN &= ~event_mask;
451 }
452 
473 static inline void qeiv2_enable_load_read_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
474 {
475  qeiv2_x->READEN |= event_mask;
476 }
477 
498 static inline void qeiv2_disable_load_read_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
499 {
500  qeiv2_x->READEN &= ~event_mask;
501 }
502 
523 static inline void qeiv2_enable_dma_request(QEIV2_Type *qeiv2_x, uint32_t mask)
524 {
525  qeiv2_x->DMAEN |= mask;
526 }
527 
548 static inline void qeiv2_disable_dma_request(QEIV2_Type *qeiv2_x, uint32_t mask)
549 {
550  qeiv2_x->DMAEN &= ~mask;
551 }
552 
573 static inline void qeiv2_clear_status(QEIV2_Type *qeiv2_x, uint32_t mask)
574 {
575  qeiv2_x->SR = mask;
576 }
577 
598 static inline uint32_t qeiv2_get_status(QEIV2_Type *qeiv2_x)
599 {
600  return qeiv2_x->SR;
601 }
602 
624 static inline bool qeiv2_get_bit_status(QEIV2_Type *qeiv2_x, uint32_t mask)
625 {
626  return ((qeiv2_x->SR & mask) == mask) ? true : false;
627 }
628 
649 static inline void qeiv2_enable_irq(QEIV2_Type *qeiv2_x, uint32_t mask)
650 {
651  qeiv2_x->IRQEN |= mask;
652 }
653 
674 static inline void qeiv2_disable_irq(QEIV2_Type *qeiv2_x, uint32_t mask)
675 {
676  qeiv2_x->IRQEN &= ~mask;
677 }
678 
686 static inline uint32_t qeiv2_get_current_count(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
687 {
688  return *(&qeiv2_x->COUNT[QEIV2_COUNT_CURRENT].Z + type);
689 }
690 
697 static inline uint32_t qeiv2_get_current_phase_phcnt(QEIV2_Type *qeiv2_x)
698 {
700 }
701 
708 static inline bool qeiv2_get_current_phase_a_level(QEIV2_Type *qeiv2_x)
709 {
711 }
712 
719 static inline bool qeiv2_get_current_phase_b_level(QEIV2_Type *qeiv2_x)
720 {
722 }
723 
730 static inline bool qeiv2_get_current_phase_dir(QEIV2_Type *qeiv2_x)
731 {
733 }
734 
735 
743 static inline uint32_t qeiv2_get_count_on_read_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
744 {
745  return *(&(qeiv2_x->COUNT[QEIV2_COUNT_READ].Z) + type);
746 }
747 
755 static inline uint32_t qeiv2_get_count_on_snap0_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
756 {
757  return *(&qeiv2_x->COUNT[QEIV2_COUNT_SNAP0].Z + type);
758 }
759 
767 static inline uint32_t qeiv2_get_count_on_snap1_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
768 {
769  return *(&qeiv2_x->COUNT[QEIV2_COUNT_SNAP1].Z + type);
770 }
771 
778 static inline void qeiv2_set_z_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
779 {
780  qeiv2_x->ZCMP = QEIV2_ZCMP_ZCMP_SET(cmp);
781 }
782 
789 static inline void qeiv2_set_phcnt_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
790 {
791  qeiv2_x->PHCMP = QEIV2_PHCMP_PHCMP_SET(cmp);
792 }
793 
802 static inline void qeiv2_set_spd_pos_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
803 {
804  qeiv2_x->SPDCMP = QEIV2_SPDCMP_SPDCMP_SET(cmp);
805 }
806 
821 static inline void qeiv2_set_cmp_match_option(QEIV2_Type *qeiv2_x, bool ignore_zcmp, bool ignore_phcmp, bool ignore_spdposcmp,
822  bool ignore_rotate_dir, qeiv2_rotate_dir_t rotate_dir, bool ignore_pos_dir, qeiv2_position_dir_t pos_dir)
823 {
828  | QEIV2_MATCH_CFG_SPDCMPDIS_SET(ignore_spdposcmp)
829  | QEIV2_MATCH_CFG_DIRCMPDIS_SET(ignore_rotate_dir) | QEIV2_MATCH_CFG_DIRCMP_SET(rotate_dir)
831 }
832 
839 static inline void qeiv2_set_z_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
840 {
841  qeiv2_x->ZCMP2 = QEIV2_ZCMP2_ZCMP2_SET(cmp);
842 }
843 
850 static inline void qeiv2_set_phcnt_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
851 {
852  qeiv2_x->PHCMP2 = QEIV2_PHCMP2_PHCMP2_SET(cmp);
853 }
854 
861 static inline void qeiv2_set_spd_pos_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
862 {
863  qeiv2_x->SPDCMP2 = QEIV2_SPDCMP2_SPDCMP2_SET(cmp);
864 }
865 
880 static inline void qeiv2_set_cmp2_match_option(QEIV2_Type *qeiv2_x, bool ignore_zcmp, bool ignore_phcmp, bool ignore_spdposcmp,
881  bool ignore_rotate_dir, qeiv2_rotate_dir_t rotate_dir, bool ignore_pos_dir, qeiv2_position_dir_t pos_dir)
882 {
887  | QEIV2_MATCH_CFG_SPDCMP2DIS_SET(ignore_spdposcmp)
888  | QEIV2_MATCH_CFG_DIRCMP2DIS_SET(ignore_rotate_dir) | QEIV2_MATCH_CFG_DIRCMP2_SET(rotate_dir)
890 }
891 
902 static inline void qeiv2_config_abz_uvw_signal_edge(QEIV2_Type *qeiv2_x, bool siga_en, bool sigb_en, bool sigz_en, bool posedge_en, bool negedge_en)
903 {
907  | QEIV2_QEI_CFG_POSIDGE_EN_SET(posedge_en) | QEIV2_QEI_CFG_NEGEDGE_EN_SET(negedge_en));
908 }
909 
916 static inline void qeiv2_set_pulse0_num(QEIV2_Type *qeiv2_x, uint32_t pulse_num)
917 {
918  qeiv2_x->PULSE0_NUM = QEIV2_PULSE0_NUM_PULSE0_NUM_SET(pulse_num);
919 }
920 
927 static inline uint32_t qeiv2_get_pulse0_cycle_snap0(QEIV2_Type *qeiv2_x)
928 {
929  return qeiv2_x->CYCLE0_SNAP0;
930 }
931 
938 static inline uint32_t qeiv2_get_pulse0_cycle_snap1(QEIV2_Type *qeiv2_x)
939 {
940  return qeiv2_x->CYCLE0_SNAP1;
941 }
942 
949 static inline void qeiv2_set_pulse1_num(QEIV2_Type *qeiv2_x, uint32_t pulse_num)
950 {
951  qeiv2_x->PULSE1_NUM = QEIV2_PULSE1_NUM_PULSE1_NUM_SET(pulse_num);
952 }
953 
960 static inline uint32_t qeiv2_get_pulse1_cycle_snap0(QEIV2_Type *qeiv2_x)
961 {
962  return qeiv2_x->CYCLE1_SNAP0;
963 }
964 
971 static inline uint32_t qeiv2_get_pulse1_cycle_snap1(QEIV2_Type *qeiv2_x)
972 {
973  return qeiv2_x->CYCLE1_SNAP1;
974 }
975 
982 static inline void qeiv2_set_cycle0_num(QEIV2_Type *qeiv2_x, uint32_t cycle_num)
983 {
984  qeiv2_x->CYCLE0_NUM = QEIV2_CYCLE0_NUM_CYCLE0_NUM_SET(cycle_num);
985 }
986 
993 static inline uint32_t qeiv2_get_cycle0_pulse_snap0(QEIV2_Type *qeiv2_x)
994 {
995  return qeiv2_x->PULSE0_SNAP0;
996 }
997 
1004 static inline uint32_t qeiv2_get_cycle0_pulse_snap1(QEIV2_Type *qeiv2_x)
1005 {
1006  return qeiv2_x->PULSE0_SNAP1;
1007 }
1008 
1015 static inline uint32_t qeiv2_get_cycle0_pulse0cycle_snap0(QEIV2_Type *qeiv2_x)
1016 {
1017  return qeiv2_x->PULSE0CYCLE_SNAP0;
1018 }
1019 
1026 static inline uint32_t qeiv2_get_cycle0_pulse0cycle_snap1(QEIV2_Type *qeiv2_x)
1027 {
1028  return qeiv2_x->PULSE0CYCLE_SNAP1;
1029 }
1030 
1037 static inline void qeiv2_set_cycle1_num(QEIV2_Type *qeiv2_x, uint32_t cycle_num)
1038 {
1039  qeiv2_x->CYCLE1_NUM = QEIV2_CYCLE1_NUM_CYCLE1_NUM_SET(cycle_num);
1040 }
1041 
1048 static inline uint32_t qeiv2_get_cycle1_pulse_snap0(QEIV2_Type *qeiv2_x)
1049 {
1050  return qeiv2_x->PULSE1_SNAP0;
1051 }
1052 
1059 static inline uint32_t qeiv2_get_cycle1_pulse_snap1(QEIV2_Type *qeiv2_x)
1060 {
1061  return qeiv2_x->PULSE1_SNAP1;
1062 }
1063 
1070 static inline uint32_t qeiv2_get_cycle1_pulse1cycle_snap0(QEIV2_Type *qeiv2_x)
1071 {
1072  return qeiv2_x->PULSE1CYCLE_SNAP0;
1073 }
1074 
1081 static inline uint32_t qeiv2_get_cycle1_pulse1cycle_snap1(QEIV2_Type *qeiv2_x)
1082 {
1083  return qeiv2_x->PULSE1CYCLE_SNAP1;
1084 }
1085 
1092 static inline void qeiv2_clear_counter_when_dir_chg(QEIV2_Type *qeiv2_x, bool enable)
1093 {
1094  if (enable) {
1096  } else {
1098  }
1099 }
1100 
1108 static inline void qeiv2_config_adcx(QEIV2_Type *qeiv2_x, qeiv2_adc_config_t *config, bool enable)
1109 {
1110  uint32_t tmp;
1113  qeiv2_x->ADCX_CFG2 = QEIV2_ADCX_CFG2_X_OFFSET_SET(config->offset);
1114  if (enable) {
1116  } else {
1118  }
1119  qeiv2_x->ADCX_CFG0 = tmp;
1120 }
1121 
1129 static inline void qeiv2_config_adcy(QEIV2_Type *qeiv2_x, qeiv2_adc_config_t *config, bool enable)
1130 {
1131  uint32_t tmp;
1134  qeiv2_x->ADCY_CFG2 = QEIV2_ADCY_CFG2_Y_OFFSET_SET(config->offset);
1135  if (enable) {
1137  } else {
1139  }
1140  qeiv2_x->ADCY_CFG0 = tmp;
1141 }
1142 
1149 static inline void qeiv2_set_adc_xy_delay(QEIV2_Type *qeiv2_x, uint32_t delay)
1150 {
1151  qeiv2_x->CAL_CFG = QEIV2_CAL_CFG_XY_DELAY_SET(delay);
1152 }
1153 
1161 static inline void qeiv2_set_position_threshold(QEIV2_Type *qeiv2_x, uint32_t threshold)
1162 {
1164 }
1165 
1173 {
1175 }
1176 
1203 static inline void qeiv2_set_uvw_position_sel(QEIV2_Type *qeiv2_x, qeiv2_uvw_pos_idx_t idx, uint8_t u_pos_sel, uint8_t v_pos_sel,
1204  uint8_t w_pos_sel, bool enable)
1205 {
1206  uint32_t tmp;
1207  tmp = QEIV2_UVW_POS_CFG_U_POS_SEL_SET(u_pos_sel)
1208  | QEIV2_UVW_POS_CFG_V_POS_SEL_SET(v_pos_sel)
1209  | QEIV2_UVW_POS_CFG_W_POS_SEL_SET(w_pos_sel);
1210  if (enable) {
1212  } else {
1214  }
1215  qeiv2_x->UVW_POS_CFG[idx] = tmp;
1216 }
1217 
1226 static inline void qeiv2_set_uvw_position(QEIV2_Type *qeiv2_x, qeiv2_uvw_pos_idx_t idx, uint32_t pos)
1227 {
1228  qeiv2_x->UVW_POS[idx] = pos;
1229 }
1230 
1237 static inline void qeiv2_set_z_phase(QEIV2_Type *qeiv2_x, uint32_t cnt)
1238 {
1239  qeiv2_x->COUNT[QEIV2_COUNT_CURRENT].Z = cnt;
1240 }
1241 
1248 static inline void qeiv2_set_phase_cnt(QEIV2_Type *qeiv2_x, uint32_t cnt)
1249 {
1250  qeiv2_x->PHASE_CNT = cnt;
1251 }
1252 
1259 static inline uint32_t qeiv2_get_phase_cnt(QEIV2_Type *qeiv2_x)
1260 {
1261  return qeiv2_x->PHASE_CNT;
1262 }
1263 
1272 static inline void qeiv2_update_phase_cnt(QEIV2_Type *qeiv2_x, bool inc, bool dec, uint32_t value)
1273 {
1275 }
1276 
1283 static inline void qeiv2_set_position(QEIV2_Type *qeiv2_x, uint32_t pos)
1284 {
1285  qeiv2_x->POSITION = pos;
1286 }
1287 
1294 static inline uint32_t qeiv2_get_postion(QEIV2_Type *qeiv2_x)
1295 {
1296  return qeiv2_x->POSITION;
1297 }
1298 
1307 static inline void qeiv2_update_position(QEIV2_Type *qeiv2_x, bool inc, bool dec, uint32_t value)
1308 {
1310 }
1311 
1318 static inline uint32_t qeiv2_get_angle(QEIV2_Type *qeiv2_x)
1319 {
1320  return qeiv2_x->ANGLE;
1321 }
1322 
1329 static inline void qeiv2_set_angle_adjust_value(QEIV2_Type *qeiv2_x, int32_t angle_adj)
1330 {
1331  qeiv2_x->ANGLE_ADJ = QEIV2_ANGLE_ADJ_ANGLE_ADJ_SET(angle_adj);
1332 }
1333 
1341 static inline void qeiv2_config_position_timeout(QEIV2_Type *qeiv2_x, uint32_t tm, bool enable)
1342 {
1343  uint32_t tmp;
1345  if (enable) {
1347  } else {
1349  }
1350  qeiv2_x->POS_TIMEOUT = tmp;
1351 }
1352 
1361 
1370 
1379 
1388 
1395 
1404 
1416 void qeiv2_config_filter(QEIV2_Type *qeiv2_x, qeiv2_filter_phase_t phase, bool outinv, qeiv2_filter_mode_t mode, bool sync, uint32_t filtlen);
1417 
1418 #ifdef __cplusplus
1419 }
1420 #endif
1424 #endif /* HPM_QEIV2_DRV_H */
uint32_t hpm_stat_t
Definition: hpm_common.h:119
static void qeiv2_enable_irq(QEIV2_Type *qeiv2_x, uint32_t mask)
enable qeiv2 irq
Definition: hpm_qeiv2_drv.h:649
enum qeiv2_position_dir qeiv2_position_dir_t
compare match position direction
static void qeiv2_update_phase_cnt(QEIV2_Type *qeiv2_x, bool inc, bool dec, uint32_t value)
update phase counter value
Definition: hpm_qeiv2_drv.h:1272
static void qeiv2_clear_status(QEIV2_Type *qeiv2_x, uint32_t mask)
clear qeiv2 status register
Definition: hpm_qeiv2_drv.h:573
static void qeiv2_enable_snap(QEIV2_Type *qeiv2_x)
enable load phcnt, zcnt, spdcnt and tmrcnt into their snap registers
Definition: hpm_qeiv2_drv.h:313
hpm_stat_t qeiv2_config_position_cmp_match_condition(QEIV2_Type *qeiv2_x, qeiv2_pos_cmp_match_config_t *config)
config position compare match condition
Definition: hpm_qeiv2_drv.c:23
static void qeiv2_set_uvw_position_sel(QEIV2_Type *qeiv2_x, qeiv2_uvw_pos_idx_t idx, uint8_t u_pos_sel, uint8_t v_pos_sel, uint8_t w_pos_sel, bool enable)
set config uvw position
Definition: hpm_qeiv2_drv.h:1203
static uint32_t qeiv2_get_pulse0_cycle_snap1(QEIV2_Type *qeiv2_x)
get cycle0 snap1 value
Definition: hpm_qeiv2_drv.h:938
enum qeiv2_rotate_dir qeiv2_rotate_dir_t
compare match rotate direction
qeiv2_uvw_pos_opt
uvw position option
Definition: hpm_qeiv2_drv.h:124
static void qeiv2_set_z_phase(QEIV2_Type *qeiv2_x, uint32_t cnt)
set z phase counter value
Definition: hpm_qeiv2_drv.h:1237
enum qeiv2_uvw_pos_sel qeiv2_uvw_pos_sel_t
static void qeiv2_set_pulse0_num(QEIV2_Type *qeiv2_x, uint32_t pulse_num)
set pulse0 value
Definition: hpm_qeiv2_drv.h:916
hpm_stat_t qeiv2_config_phcnt_cmp_match_condition(QEIV2_Type *qeiv2_x, qeiv2_phcnt_cmp_match_config_t *config)
config phcnt compare match condition
Definition: hpm_qeiv2_drv.c:11
qeiv2_filter_phase
filter type
Definition: hpm_qeiv2_drv.h:111
enum qeiv2_filter_mode qeiv2_filter_mode_t
filter mode
static void qeiv2_config_phmax_phparam(QEIV2_Type *qeiv2_x, uint32_t phmax)
config phase max value and phase param
Definition: hpm_qeiv2_drv.h:231
static uint32_t qeiv2_get_pulse1_cycle_snap0(QEIV2_Type *qeiv2_x)
get cycle1 snap0 value
Definition: hpm_qeiv2_drv.h:960
static uint32_t qeiv2_get_cycle0_pulse0cycle_snap1(QEIV2_Type *qeiv2_x)
get pulse0cycle snap1 value
Definition: hpm_qeiv2_drv.h:1026
enum qeiv2_uvw_pos_idx qeiv2_uvw_pos_idx_t
static void qeiv2_set_phase_cnt(QEIV2_Type *qeiv2_x, uint32_t cnt)
set phase counter value
Definition: hpm_qeiv2_drv.h:1248
enum qeiv2_z_count_work_mode qeiv2_z_count_work_mode_t
counting mode of Z-phase counter
enum qeiv2_spd_tmr_content qeiv2_spd_tmr_content_t
spd and tmr read selection
static uint32_t qeiv2_get_status(QEIV2_Type *qeiv2_x)
get qeiv2 status
Definition: hpm_qeiv2_drv.h:598
static void qeiv2_set_position(QEIV2_Type *qeiv2_x, uint32_t pos)
set position value
Definition: hpm_qeiv2_drv.h:1283
static void qeiv2_config_z_phase_calibration(QEIV2_Type *qeiv2_x, uint32_t phidx, bool enable, qeiv2_work_mode_t mode)
config phase calibration value trigged by z phase
Definition: hpm_qeiv2_drv.h:256
enum qeiv2_counter_type qeiv2_counter_type_t
counter type
enum qeiv2_filter_phase qeiv2_filter_phase_t
filter type
static void qeiv2_set_cmp_match_option(QEIV2_Type *qeiv2_x, bool ignore_zcmp, bool ignore_phcmp, bool ignore_spdposcmp, bool ignore_rotate_dir, qeiv2_rotate_dir_t rotate_dir, bool ignore_pos_dir, qeiv2_position_dir_t pos_dir)
set compare match options
Definition: hpm_qeiv2_drv.h:821
static void qeiv2_update_position(QEIV2_Type *qeiv2_x, bool inc, bool dec, uint32_t value)
update position value
Definition: hpm_qeiv2_drv.h:1307
static uint32_t qeiv2_get_count_on_snap1_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
read the value of each phase snapshot 1 counter
Definition: hpm_qeiv2_drv.h:767
static void qeiv2_reset_counter(QEIV2_Type *qeiv2_x)
reset zcnt, spdcnt and tmrcnt to 0, reset phcnt to phidx.
Definition: hpm_qeiv2_drv.h:333
static void qeiv2_set_angle_adjust_value(QEIV2_Type *qeiv2_x, int32_t angle_adj)
set angle adjust value
Definition: hpm_qeiv2_drv.h:1329
static void qeiv2_enable_load_read_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
enable load read trigger event
Definition: hpm_qeiv2_drv.h:473
static void qeiv2_set_z_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set zcnt compare value
Definition: hpm_qeiv2_drv.h:778
hpm_stat_t qeiv2_config_phcnt_cmp2_match_condition(QEIV2_Type *qeiv2_x, qeiv2_phcnt_cmp_match_config_t *config)
config phcnt compare2 match condition
Definition: hpm_qeiv2_drv.c:33
static uint32_t qeiv2_get_current_phase_phcnt(QEIV2_Type *qeiv2_x)
get current phcnt value
Definition: hpm_qeiv2_drv.h:697
static bool qeiv2_get_bit_status(QEIV2_Type *qeiv2_x, uint32_t mask)
get qeiv2 bit status
Definition: hpm_qeiv2_drv.h:624
static void qeiv2_set_adc_xy_delay(QEIV2_Type *qeiv2_x, uint32_t delay)
set adcx and adcy delay
Definition: hpm_qeiv2_drv.h:1149
static void qeiv2_disable_load_read_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
disable load read trigger event
Definition: hpm_qeiv2_drv.h:498
qeiv2_filter_mode
filter mode
Definition: hpm_qeiv2_drv.h:99
qeiv2_counter_type
counter type
Definition: hpm_qeiv2_drv.h:88
static uint32_t qeiv2_get_cycle1_pulse_snap1(QEIV2_Type *qeiv2_x)
get pulse1 snap1 value
Definition: hpm_qeiv2_drv.h:1059
static void qeiv2_set_work_mode(QEIV2_Type *qeiv2_x, qeiv2_work_mode_t mode)
set qeiv2 work mode
Definition: hpm_qeiv2_drv.h:376
static uint32_t qeiv2_get_cycle0_pulse0cycle_snap0(QEIV2_Type *qeiv2_x)
get pulse0cycle snap0 value
Definition: hpm_qeiv2_drv.h:1015
static void qeiv2_select_spd_tmr_register_content(QEIV2_Type *qeiv2_x, qeiv2_spd_tmr_content_t content)
select spd and tmr register content
Definition: hpm_qeiv2_drv.h:354
static void qeiv2_load_counter_to_read_registers(QEIV2_Type *qeiv2_x)
load phcnt, zcnt, spdcnt and tmrcnt into their read registers
Definition: hpm_qeiv2_drv.h:207
static bool qeiv2_get_current_phase_dir(QEIV2_Type *qeiv2_x)
get current phase dir
Definition: hpm_qeiv2_drv.h:730
qeiv2_work_mode
qeiv2 work mode
Definition: hpm_qeiv2_drv.h:38
static void qeiv2_set_position_threshold(QEIV2_Type *qeiv2_x, uint32_t threshold)
set position threshold
Definition: hpm_qeiv2_drv.h:1161
static bool qeiv2_get_current_phase_a_level(QEIV2_Type *qeiv2_x)
get current a phase level
Definition: hpm_qeiv2_drv.h:708
static void qeiv2_config_z_phase_counter_mode(QEIV2_Type *qeiv2_x, qeiv2_z_count_work_mode_t mode)
config z phase counter increment and decrement mode
Definition: hpm_qeiv2_drv.h:220
hpm_stat_t qeiv2_config_position_cmp2_match_condition(QEIV2_Type *qeiv2_x, qeiv2_pos_cmp_match_config_t *config)
config position compare2 match condition
Definition: hpm_qeiv2_drv.c:45
enum qeiv2_uvw_pos_opt qeiv2_uvw_pos_opt_t
uvw position option
static void qeiv2_disable_dma_request(QEIV2_Type *qeiv2_x, uint32_t mask)
disable qeiv2 dma
Definition: hpm_qeiv2_drv.h:548
static void qeiv2_release_counter(QEIV2_Type *qeiv2_x)
release counter.
Definition: hpm_qeiv2_drv.h:343
static uint32_t qeiv2_get_angle(QEIV2_Type *qeiv2_x)
get angle value
Definition: hpm_qeiv2_drv.h:1318
static void qeiv2_config_wdog(QEIV2_Type *qeiv2_x, uint32_t timeout, uint8_t clr_phcnt, bool enable)
config watchdog
Definition: hpm_qeiv2_drv.h:391
qeiv2_z_count_work_mode
counting mode of Z-phase counter
Definition: hpm_qeiv2_drv.h:79
qeiv2_uvw_pos_idx
Definition: hpm_qeiv2_drv.h:145
qeiv2_spd_tmr_content
spd and tmr read selection
Definition: hpm_qeiv2_drv.h:52
qeiv2_position_dir
compare match position direction
Definition: hpm_qeiv2_drv.h:70
static uint32_t qeiv2_get_postion(QEIV2_Type *qeiv2_x)
get position value
Definition: hpm_qeiv2_drv.h:1294
static void qeiv2_set_cycle0_num(QEIV2_Type *qeiv2_x, uint32_t cycle_num)
set cycle0 value
Definition: hpm_qeiv2_drv.h:982
enum qeiv2_work_mode qeiv2_work_mode_t
qeiv2 work mode
static void qeiv2_pause_pos_counter_on_fault(QEIV2_Type *qeiv2_x, bool enable)
pause pos counter when fault assert
Definition: hpm_qeiv2_drv.h:299
static void qeiv2_set_spd_pos_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set spdcnt or position compare2 value. It's selected by CR register rd_sel bit.
Definition: hpm_qeiv2_drv.h:861
static void qeiv2_enable_trig_out_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
enable trig out trigger event
Definition: hpm_qeiv2_drv.h:423
static void qeiv2_disable_irq(QEIV2_Type *qeiv2_x, uint32_t mask)
disable qeiv2 irq
Definition: hpm_qeiv2_drv.h:674
static void qeiv2_set_z_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set zcnt compare2 value
Definition: hpm_qeiv2_drv.h:839
static bool qeiv2_get_current_phase_b_level(QEIV2_Type *qeiv2_x)
get current b phase level
Definition: hpm_qeiv2_drv.h:719
static uint32_t qeiv2_get_cycle0_pulse_snap0(QEIV2_Type *qeiv2_x)
get pulse0 snap0 value
Definition: hpm_qeiv2_drv.h:993
static void qeiv2_set_spd_pos_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set spdcnt or position compare value. It's selected by CR register rd_sel bit.
Definition: hpm_qeiv2_drv.h:802
static uint32_t qeiv2_get_cycle0_pulse_snap1(QEIV2_Type *qeiv2_x)
get pulse0 snap1 value
Definition: hpm_qeiv2_drv.h:1004
static uint32_t qeiv2_get_phase_cnt(QEIV2_Type *qeiv2_x)
get phase counter value
Definition: hpm_qeiv2_drv.h:1259
static uint32_t qeiv2_get_cycle1_pulse1cycle_snap0(QEIV2_Type *qeiv2_x)
get pulse1cycle snap0 value
Definition: hpm_qeiv2_drv.h:1070
static void qeiv2_set_phcnt_cmp_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set phcnt compare value
Definition: hpm_qeiv2_drv.h:789
hpm_stat_t qeiv2_config_uvw_position(QEIV2_Type *qeiv2_x, qeiv2_uvw_config_t *config)
config uvw position
Definition: hpm_qeiv2_drv.c:91
static uint32_t qeiv2_get_count_on_read_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
get read event count value
Definition: hpm_qeiv2_drv.h:743
static void qeiv2_set_cmp2_match_option(QEIV2_Type *qeiv2_x, bool ignore_zcmp, bool ignore_phcmp, bool ignore_spdposcmp, bool ignore_rotate_dir, qeiv2_rotate_dir_t rotate_dir, bool ignore_pos_dir, qeiv2_position_dir_t pos_dir)
set compare2 match options
Definition: hpm_qeiv2_drv.h:880
qeiv2_rotate_dir
compare match rotate direction
Definition: hpm_qeiv2_drv.h:61
static void qeiv2_set_phcnt_cmp2_value(QEIV2_Type *qeiv2_x, uint32_t cmp)
set phcnt compare2 value
Definition: hpm_qeiv2_drv.h:850
static void qeiv2_enable_dma_request(QEIV2_Type *qeiv2_x, uint32_t mask)
enable dma request
Definition: hpm_qeiv2_drv.h:523
static uint32_t qeiv2_get_cycle1_pulse1cycle_snap1(QEIV2_Type *qeiv2_x)
get pulse1cycle snap1 value
Definition: hpm_qeiv2_drv.h:1081
static void qeiv2_pause_counter(QEIV2_Type *qeiv2_x, uint32_t counter_mask, bool enable)
pause counter when pause assert
Definition: hpm_qeiv2_drv.h:284
static void qeiv2_config_abz_uvw_signal_edge(QEIV2_Type *qeiv2_x, bool siga_en, bool sigb_en, bool sigz_en, bool posedge_en, bool negedge_en)
config signal enablement and edge
Definition: hpm_qeiv2_drv.h:902
static uint32_t qeiv2_get_pulse1_cycle_snap1(QEIV2_Type *qeiv2_x)
get cycle1 snap1 value
Definition: hpm_qeiv2_drv.h:971
static uint32_t qeiv2_get_count_on_snap0_event(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
read the value of each phase snapshot 0 counter
Definition: hpm_qeiv2_drv.h:755
static uint32_t qeiv2_get_pulse0_cycle_snap0(QEIV2_Type *qeiv2_x)
get cycle0 snap0 value
Definition: hpm_qeiv2_drv.h:927
static void qeiv2_set_cycle1_num(QEIV2_Type *qeiv2_x, uint32_t cycle_num)
set cycle1 value
Definition: hpm_qeiv2_drv.h:1037
static uint32_t qeiv2_get_cycle1_pulse_snap0(QEIV2_Type *qeiv2_x)
get pulse1 snap0 value
Definition: hpm_qeiv2_drv.h:1048
static void qeiv2_set_uvw_position(QEIV2_Type *qeiv2_x, qeiv2_uvw_pos_idx_t idx, uint32_t pos)
set uvw position
Definition: hpm_qeiv2_drv.h:1226
static void qeiv2_set_uvw_position_opt(QEIV2_Type *qeiv2_x, qeiv2_uvw_pos_opt_t opt)
set uvw position option
Definition: hpm_qeiv2_drv.h:1172
static bool qeiv2_check_spd_tmr_as_pos_angle(QEIV2_Type *qeiv2_x)
check spd and tmr register content as pos and angle
Definition: hpm_qeiv2_drv.h:365
qeiv2_uvw_pos_sel
Definition: hpm_qeiv2_drv.h:129
static void qeiv2_disable_trig_out_trigger_event(QEIV2_Type *qeiv2_x, uint32_t event_mask)
disable trig out trigger event
Definition: hpm_qeiv2_drv.h:448
static void qeiv2_config_adcx(QEIV2_Type *qeiv2_x, qeiv2_adc_config_t *config, bool enable)
adcx config
Definition: hpm_qeiv2_drv.h:1108
static void qeiv2_set_pulse1_num(QEIV2_Type *qeiv2_x, uint32_t pulse_num)
set pulse1 value
Definition: hpm_qeiv2_drv.h:949
static void qeiv2_clear_counter_when_dir_chg(QEIV2_Type *qeiv2_x, bool enable)
enable or disable clear counter if detect direction change
Definition: hpm_qeiv2_drv.h:1092
static uint32_t qeiv2_get_current_count(QEIV2_Type *qeiv2_x, qeiv2_counter_type_t type)
get current counter value
Definition: hpm_qeiv2_drv.h:686
void qeiv2_config_filter(QEIV2_Type *qeiv2_x, qeiv2_filter_phase_t phase, bool outinv, qeiv2_filter_mode_t mode, bool sync, uint32_t filtlen)
config signal filter
Definition: hpm_qeiv2_drv.c:120
static void qeiv2_disable_snap(QEIV2_Type *qeiv2_x)
disable snap
Definition: hpm_qeiv2_drv.h:323
static void qeiv2_config_adcy(QEIV2_Type *qeiv2_x, qeiv2_adc_config_t *config, bool enable)
adcy config
Definition: hpm_qeiv2_drv.h:1129
void qeiv2_get_uvw_position_defconfig(qeiv2_uvw_config_t *config)
get uvw position default config
Definition: hpm_qeiv2_drv.c:55
static void qeiv2_config_position_timeout(QEIV2_Type *qeiv2_x, uint32_t tm, bool enable)
config position timeout for mmc module
Definition: hpm_qeiv2_drv.h:1341
@ qeiv2_uvw_pos_opt_current
Definition: hpm_qeiv2_drv.h:125
@ qeiv2_uvw_pos_opt_next
Definition: hpm_qeiv2_drv.h:126
@ qeiv2_filter_phase_h
Definition: hpm_qeiv2_drv.h:115
@ qeiv2_filter_phase_z
Definition: hpm_qeiv2_drv.h:114
@ qeiv2_filter_phase_f
Definition: hpm_qeiv2_drv.h:117
@ qeiv2_filter_phase_b
Definition: hpm_qeiv2_drv.h:113
@ qeiv2_filter_phase_h2
Definition: hpm_qeiv2_drv.h:116
@ qeiv2_filter_phase_a
Definition: hpm_qeiv2_drv.h:112
@ qeiv2_filter_mode_bypass
Definition: hpm_qeiv2_drv.h:100
@ qeiv2_filter_mode_burr
Definition: hpm_qeiv2_drv.h:101
@ qeiv2_filter_mode_delay
Definition: hpm_qeiv2_drv.h:102
@ qeiv2_filter_mode_peak
Definition: hpm_qeiv2_drv.h:103
@ qeiv2_filter_mode_valley
Definition: hpm_qeiv2_drv.h:104
@ qeiv2_counter_type_phase
Definition: hpm_qeiv2_drv.h:90
@ qeiv2_counter_type_timer
Definition: hpm_qeiv2_drv.h:92
@ qeiv2_counter_type_speed
Definition: hpm_qeiv2_drv.h:91
@ qeiv2_counter_type_z
Definition: hpm_qeiv2_drv.h:89
@ qeiv2_work_mode_single
Definition: hpm_qeiv2_drv.h:43
@ qeiv2_work_mode_pd
Definition: hpm_qeiv2_drv.h:40
@ qeiv2_work_mode_sincos
Definition: hpm_qeiv2_drv.h:45
@ qeiv2_work_mode_abz
Definition: hpm_qeiv2_drv.h:39
@ qeiv2_work_mode_uvw
Definition: hpm_qeiv2_drv.h:42
@ qeiv2_work_mode_sin
Definition: hpm_qeiv2_drv.h:44
@ qeiv2_work_mode_ud
Definition: hpm_qeiv2_drv.h:41
@ qeiv2_z_count_inc_on_z_input_assert
Definition: hpm_qeiv2_drv.h:80
@ qeiv2_z_count_inc_on_phase_count_max
Definition: hpm_qeiv2_drv.h:81
@ qeiv2_uvw_pos0
Definition: hpm_qeiv2_drv.h:146
@ qeiv2_uvw_pos3
Definition: hpm_qeiv2_drv.h:149
@ qeiv2_uvw_pos1
Definition: hpm_qeiv2_drv.h:147
@ qeiv2_uvw_pos4
Definition: hpm_qeiv2_drv.h:150
@ qeiv2_uvw_pos2
Definition: hpm_qeiv2_drv.h:148
@ qeiv2_uvw_pos5
Definition: hpm_qeiv2_drv.h:151
@ qeiv2_spd_tmr_as_spd_tm
Definition: hpm_qeiv2_drv.h:53
@ qeiv2_spd_tmr_as_pos_angle
Definition: hpm_qeiv2_drv.h:54
@ qeiv2_pos_dir_decrease
Definition: hpm_qeiv2_drv.h:71
@ qeiv2_pos_dir_increase
Definition: hpm_qeiv2_drv.h:72
@ qeiv2_rotate_dir_forward
Definition: hpm_qeiv2_drv.h:62
@ qeiv2_rotate_dir_reverse
Definition: hpm_qeiv2_drv.h:63
@ qeiv2_uvw_pos_sel_low
Definition: hpm_qeiv2_drv.h:130
@ qeiv2_uvw_pos_sel_high
Definition: hpm_qeiv2_drv.h:131
@ qeiv2_uvw_pos_sel_edge
Definition: hpm_qeiv2_drv.h:132
#define QEIV2_WDGCFG_WDGEN_MASK
Definition: hpm_qeiv2_regs.h:319
#define QEIV2_MATCH_CFG_ZCMP2DIS_SET(x)
Definition: hpm_qeiv2_regs.h:1251
#define QEIV2_ADCX_CFG1_X_PARAM0_SET(x)
Definition: hpm_qeiv2_regs.h:1696
#define QEIV2_MATCH_CFG_PHASE_MATCH_DIS_SET(x)
Definition: hpm_qeiv2_regs.h:1224
#define QEIV2_MATCH_CFG_ZCMPDIS_MASK
Definition: hpm_qeiv2_regs.h:1183
#define QEIV2_ZCMP2_ZCMP2_SET(x)
Definition: hpm_qeiv2_regs.h:1154
#define QEIV2_CR_ZCNTCFG_SET(x)
Definition: hpm_qeiv2_regs.h:111
#define QEIV2_ADCY_CFG1_Y_PARAM0_SET(x)
Definition: hpm_qeiv2_regs.h:1753
#define QEIV2_COUNT_PH_DIR_GET(x)
Definition: hpm_qeiv2_regs.h:1065
#define QEIV2_MATCH_CFG_DIRCMPDIS_SET(x)
Definition: hpm_qeiv2_regs.h:1195
#define QEIV2_ADCX_CFG1_X_PARAM1_SET(x)
Definition: hpm_qeiv2_regs.h:1687
#define QEIV2_PULSE1_NUM_PULSE1_NUM_SET(x)
Definition: hpm_qeiv2_regs.h:1449
#define QEIV2_PHASE_UPDATE_VALUE_SET(x)
Definition: hpm_qeiv2_regs.h:1893
#define QEIV2_MATCH_CFG_POS_MATCH2_OPT_MASK
Definition: hpm_qeiv2_regs.h:1303
#define QEIV2_QEI_CFG_SIGZ_EN_SET(x)
Definition: hpm_qeiv2_regs.h:1410
#define QEIV2_POSITION_UPDATE_DEC_SET(x)
Definition: hpm_qeiv2_regs.h:1924
#define QEIV2_MATCH_CFG_DIRCMP_MASK
Definition: hpm_qeiv2_regs.h:1204
#define QEIV2_QEI_CFG_NEGEDGE_EN_SET(x)
Definition: hpm_qeiv2_regs.h:1392
#define QEIV2_QEI_CFG_SIGZ_EN_MASK
Definition: hpm_qeiv2_regs.h:1408
#define QEIV2_QEI_CFG_SPEED_DIR_CHG_EN_MASK
Definition: hpm_qeiv2_regs.h:1361
#define QEIV2_CYCLE0_NUM_CYCLE0_NUM_SET(x)
Definition: hpm_qeiv2_regs.h:1531
#define QEIV2_UVW_POS_CFG_POS_EN_MASK
Definition: hpm_qeiv2_regs.h:1823
#define QEIV2_MATCH_CFG_ZCMP2DIS_MASK
Definition: hpm_qeiv2_regs.h:1249
#define QEIV2_MATCH_CFG_DIRCMP2_MASK
Definition: hpm_qeiv2_regs.h:1267
#define QEIV2_WDGCFG_WDGTO_SET(x)
Definition: hpm_qeiv2_regs.h:343
#define QEIV2_ADCY_CFG0_Y_ADCSEL_SET(x)
Definition: hpm_qeiv2_regs.h:1716
#define QEIV2_POS_TIMEOUT_ENABLE_MASK
Definition: hpm_qeiv2_regs.h:1952
#define QEIV2_CR_Z_ONLY_EN_MASK
Definition: hpm_qeiv2_regs.h:129
#define QEIV2_COUNT_PH_ASTAT_GET(x)
Definition: hpm_qeiv2_regs.h:1075
#define QEIV2_QEI_CFG_SIGA_EN_MASK
Definition: hpm_qeiv2_regs.h:1426
#define QEIV2_MATCH_CFG_DIRCMP2DIS_SET(x)
Definition: hpm_qeiv2_regs.h:1260
#define QEIV2_POSITION_UPDATE_VALUE_SET(x)
Definition: hpm_qeiv2_regs.h:1934
#define QEIV2_CR_ENCTYP_MASK
Definition: hpm_qeiv2_regs.h:297
#define QEIV2_QEI_CFG_SIGA_EN_SET(x)
Definition: hpm_qeiv2_regs.h:1428
#define QEIV2_ADCX_CFG0_X_CHAN_SET(x)
Definition: hpm_qeiv2_regs.h:1677
#define QEIV2_QEI_CFG_UVW_POS_OPT0_MASK
Definition: hpm_qeiv2_regs.h:1372
#define QEIV2_PHASE_UPDATE_DEC_SET(x)
Definition: hpm_qeiv2_regs.h:1883
#define QEIV2_UVW_POS_CFG_V_POS_SEL_SET(x)
Definition: hpm_qeiv2_regs.h:1843
#define QEIV2_MATCH_CFG_POS_MATCH2_DIR_MASK
Definition: hpm_qeiv2_regs.h:1294
#define QEIV2_PHCMP_PHCMP_SET(x)
Definition: hpm_qeiv2_regs.h:638
#define QEIV2_ANGLE_ADJ_ANGLE_ADJ_SET(x)
Definition: hpm_qeiv2_regs.h:1795
#define QEIV2_MATCH_CFG_DIRCMP2DIS_MASK
Definition: hpm_qeiv2_regs.h:1258
#define QEIV2_MATCH_CFG_POS_MATCH2_OPT_SET(x)
Definition: hpm_qeiv2_regs.h:1305
#define QEIV2_ADCX_CFG0_X_ADCSEL_SET(x)
Definition: hpm_qeiv2_regs.h:1659
#define QEIV2_CR_ENCTYP_SET(x)
Definition: hpm_qeiv2_regs.h:299
#define QEIV2_MATCH_CFG_SPDCMP2DIS_SET(x)
Definition: hpm_qeiv2_regs.h:1278
#define QEIV2_MATCH_CFG_POS_MATCH_DIR_SET(x)
Definition: hpm_qeiv2_regs.h:1233
#define QEIV2_SPDCMP_SPDCMP_SET(x)
Definition: hpm_qeiv2_regs.h:649
#define QEIV2_QEI_CFG_POSIDGE_EN_MASK
Definition: hpm_qeiv2_regs.h:1399
#define QEIV2_COUNT_SNAP1
Definition: hpm_qeiv2_regs.h:1973
#define QEIV2_QEI_CFG_NEGEDGE_EN_MASK
Definition: hpm_qeiv2_regs.h:1390
#define QEIV2_MATCH_CFG_POS_MATCH_OPT_SET(x)
Definition: hpm_qeiv2_regs.h:1242
#define QEIV2_CR_FAULTPOS_MASK
Definition: hpm_qeiv2_regs.h:254
#define QEIV2_QEI_CFG_SIGB_EN_SET(x)
Definition: hpm_qeiv2_regs.h:1419
#define QEIV2_ADCY_CFG0_Y_ADC_ENABLE_MASK
Definition: hpm_qeiv2_regs.h:1723
#define QEIV2_CR_ZCNTCFG_MASK
Definition: hpm_qeiv2_regs.h:109
#define QEIV2_UVW_POS_CFG_W_POS_SEL_SET(x)
Definition: hpm_qeiv2_regs.h:1852
#define QEIV2_MATCH_CFG_DIRCMP_SET(x)
Definition: hpm_qeiv2_regs.h:1206
#define QEIV2_COUNT_PH_BSTAT_GET(x)
Definition: hpm_qeiv2_regs.h:1085
#define QEIV2_QEI_CFG_SIGB_EN_MASK
Definition: hpm_qeiv2_regs.h:1417
#define QEIV2_QEI_CFG_POSIDGE_EN_SET(x)
Definition: hpm_qeiv2_regs.h:1401
#define QEIV2_MATCH_CFG_PHASE_MATCH_DIS2_MASK
Definition: hpm_qeiv2_regs.h:1285
#define QEIV2_CR_RD_SEL_SET(x)
Definition: hpm_qeiv2_regs.h:288
#define QEIV2_PHCFG_PHMAX_SET(x)
Definition: hpm_qeiv2_regs.h:310
#define QEIV2_PHASE_PARAM_PHASE_PARAM_SET(x)
Definition: hpm_qeiv2_regs.h:1785
#define QEIV2_CR_RSTCNT_MASK
Definition: hpm_qeiv2_regs.h:274
#define QEIV2_POSITION_UPDATE_INC_SET(x)
Definition: hpm_qeiv2_regs.h:1914
#define QEIV2_COUNT_CURRENT
Definition: hpm_qeiv2_regs.h:1970
#define QEIV2_COUNT_READ
Definition: hpm_qeiv2_regs.h:1971
#define QEIV2_MATCH_CFG_DIRCMP2_SET(x)
Definition: hpm_qeiv2_regs.h:1269
#define QEIV2_MATCH_CFG_SPDCMPDIS_SET(x)
Definition: hpm_qeiv2_regs.h:1215
#define QEIV2_WDGCFG_WDOG_CFG_SET(x)
Definition: hpm_qeiv2_regs.h:333
#define QEIV2_CR_SNAPEN_MASK
Definition: hpm_qeiv2_regs.h:264
#define QEIV2_SPDCMP2_SPDCMP2_SET(x)
Definition: hpm_qeiv2_regs.h:1174
#define QEIV2_CR_PHCALIZ_MASK
Definition: hpm_qeiv2_regs.h:119
#define QEIV2_COUNT_PH_PHCNT_GET(x)
Definition: hpm_qeiv2_regs.h:1094
#define QEIV2_ADCY_CFG1_Y_PARAM1_SET(x)
Definition: hpm_qeiv2_regs.h:1744
#define QEIV2_CAL_CFG_XY_DELAY_SET(x)
Definition: hpm_qeiv2_regs.h:1775
#define QEIV2_PHCMP2_PHCMP2_SET(x)
Definition: hpm_qeiv2_regs.h:1164
#define QEIV2_MATCH_CFG_POS_MATCH2_DIR_SET(x)
Definition: hpm_qeiv2_regs.h:1296
#define QEIV2_POS_TIMEOUT_TIMEOUT_SET(x)
Definition: hpm_qeiv2_regs.h:1964
#define QEIV2_ADCY_CFG0_Y_CHAN_SET(x)
Definition: hpm_qeiv2_regs.h:1734
#define QEIV2_ZCMP_ZCMP_SET(x)
Definition: hpm_qeiv2_regs.h:627
#define QEIV2_COUNT_SNAP0
Definition: hpm_qeiv2_regs.h:1972
#define QEIV2_ADCX_CFG0_X_ADC_ENABLE_MASK
Definition: hpm_qeiv2_regs.h:1666
#define QEIV2_MATCH_CFG_POS_MATCH_OPT_MASK
Definition: hpm_qeiv2_regs.h:1240
#define QEIV2_CYCLE1_NUM_CYCLE1_NUM_SET(x)
Definition: hpm_qeiv2_regs.h:1541
#define QEIV2_ADCX_CFG2_X_OFFSET_SET(x)
Definition: hpm_qeiv2_regs.h:1706
#define QEIV2_MATCH_CFG_SPDCMPDIS_MASK
Definition: hpm_qeiv2_regs.h:1213
#define QEIV2_POS_THRESHOLD_POS_THRESHOLD_SET(x)
Definition: hpm_qeiv2_regs.h:1805
#define QEIV2_PHASE_UPDATE_INC_SET(x)
Definition: hpm_qeiv2_regs.h:1873
#define QEIV2_MATCH_CFG_SPDCMP2DIS_MASK
Definition: hpm_qeiv2_regs.h:1276
#define QEIV2_QEI_CFG_UVW_POS_OPT0_SET(x)
Definition: hpm_qeiv2_regs.h:1374
#define QEIV2_PHIDX_PHIDX_SET(x)
Definition: hpm_qeiv2_regs.h:354
#define QEIV2_MATCH_CFG_POS_MATCH_DIR_MASK
Definition: hpm_qeiv2_regs.h:1231
#define QEIV2_PULSE0_NUM_PULSE0_NUM_SET(x)
Definition: hpm_qeiv2_regs.h:1439
#define QEIV2_UVW_POS_CFG_U_POS_SEL_SET(x)
Definition: hpm_qeiv2_regs.h:1834
#define QEIV2_ADCY_CFG2_Y_OFFSET_SET(x)
Definition: hpm_qeiv2_regs.h:1763
#define QEIV2_MATCH_CFG_DIRCMPDIS_MASK
Definition: hpm_qeiv2_regs.h:1193
#define QEIV2_CR_RD_SEL_MASK
Definition: hpm_qeiv2_regs.h:286
#define QEIV2_MATCH_CFG_PHASE_MATCH_DIS2_SET(x)
Definition: hpm_qeiv2_regs.h:1287
#define QEIV2_MATCH_CFG_ZCMPDIS_SET(x)
Definition: hpm_qeiv2_regs.h:1185
#define QEIV2_CR_READ_MASK
Definition: hpm_qeiv2_regs.h:98
#define QEIV2_MATCH_CFG_PHASE_MATCH_DIS_MASK
Definition: hpm_qeiv2_regs.h:1222
Definition: hpm_qeiv2_regs.h:12
__RW uint32_t PHCFG
Definition: hpm_qeiv2_regs.h:14
__RW uint32_t ADCX_CFG2
Definition: hpm_qeiv2_regs.h:68
__R uint32_t CYCLE1_SNAP1
Definition: hpm_qeiv2_regs.h:49
__RW uint32_t CYCLE1_NUM
Definition: hpm_qeiv2_regs.h:52
__R uint32_t PULSE0CYCLE_SNAP0
Definition: hpm_qeiv2_regs.h:58
__RW uint32_t SPDCMP
Definition: hpm_qeiv2_regs.h:21
__R uint32_t CYCLE0_SNAP1
Definition: hpm_qeiv2_regs.h:47
__R uint32_t PULSE0_SNAP0
Definition: hpm_qeiv2_regs.h:57
__RW uint32_t PULSE0_NUM
Definition: hpm_qeiv2_regs.h:40
__RW uint32_t ZCMP2
Definition: hpm_qeiv2_regs.h:32
__R uint32_t ANGLE
Definition: hpm_qeiv2_regs.h:87
__RW uint32_t PHIDX
Definition: hpm_qeiv2_regs.h:16
__RW uint32_t PHASE_CNT
Definition: hpm_qeiv2_regs.h:83
__RW uint32_t PHASE_PARAM
Definition: hpm_qeiv2_regs.h:76
__W uint32_t POSITION_UPDATE
Definition: hpm_qeiv2_regs.h:86
__RW uint32_t CYCLE0_NUM
Definition: hpm_qeiv2_regs.h:51
__RW uint32_t WDGCFG
Definition: hpm_qeiv2_regs.h:15
__RW uint32_t IRQEN
Definition: hpm_qeiv2_regs.h:24
__R uint32_t CYCLE1_SNAP0
Definition: hpm_qeiv2_regs.h:48
__RW uint32_t ADCX_CFG1
Definition: hpm_qeiv2_regs.h:67
__R uint32_t PULSE0CYCLE_SNAP1
Definition: hpm_qeiv2_regs.h:60
__RW uint32_t POS_THRESHOLD
Definition: hpm_qeiv2_regs.h:78
__RW uint32_t UVW_POS[6]
Definition: hpm_qeiv2_regs.h:80
__RW uint32_t TRGOEN
Definition: hpm_qeiv2_regs.h:17
struct QEIV2_Type::@442 COUNT[4]
__R uint32_t PULSE1_SNAP0
Definition: hpm_qeiv2_regs.h:61
__RW uint32_t ADCY_CFG1
Definition: hpm_qeiv2_regs.h:71
__RW uint32_t PULSE1_NUM
Definition: hpm_qeiv2_regs.h:41
__RW uint32_t DMAEN
Definition: hpm_qeiv2_regs.h:22
__RW uint32_t PHCMP
Definition: hpm_qeiv2_regs.h:20
__RW uint32_t ADCY_CFG2
Definition: hpm_qeiv2_regs.h:72
__RW uint32_t PHCMP2
Definition: hpm_qeiv2_regs.h:33
__RW uint32_t POSITION
Definition: hpm_qeiv2_regs.h:85
__RW uint32_t ZCMP
Definition: hpm_qeiv2_regs.h:19
__RW uint32_t CAL_CFG
Definition: hpm_qeiv2_regs.h:74
__R uint32_t PULSE1CYCLE_SNAP1
Definition: hpm_qeiv2_regs.h:64
__RW uint32_t READEN
Definition: hpm_qeiv2_regs.h:18
__W uint32_t PHASE_UPDATE
Definition: hpm_qeiv2_regs.h:84
__RW uint32_t MATCH_CFG
Definition: hpm_qeiv2_regs.h:35
__R uint32_t PULSE1CYCLE_SNAP0
Definition: hpm_qeiv2_regs.h:62
__RW uint32_t UVW_POS_CFG[6]
Definition: hpm_qeiv2_regs.h:81
__RW uint32_t ANGLE_ADJ
Definition: hpm_qeiv2_regs.h:77
__RW uint32_t POS_TIMEOUT
Definition: hpm_qeiv2_regs.h:88
__RW uint32_t CR
Definition: hpm_qeiv2_regs.h:13
__RW uint32_t SPDCMP2
Definition: hpm_qeiv2_regs.h:34
__RW uint32_t Z
Definition: hpm_qeiv2_regs.h:26
__RW uint32_t ADCY_CFG0
Definition: hpm_qeiv2_regs.h:70
__RW uint32_t ADCX_CFG0
Definition: hpm_qeiv2_regs.h:66
__R uint32_t PULSE0_SNAP1
Definition: hpm_qeiv2_regs.h:59
__RW uint32_t SR
Definition: hpm_qeiv2_regs.h:23
__R uint32_t PULSE1_SNAP1
Definition: hpm_qeiv2_regs.h:63
__RW uint32_t QEI_CFG
Definition: hpm_qeiv2_regs.h:38
__R uint32_t CYCLE0_SNAP0
Definition: hpm_qeiv2_regs.h:46
adc config structure
Definition: hpm_qeiv2_drv.h:190
uint8_t adc_channel
Definition: hpm_qeiv2_drv.h:192
uint8_t adc_select
Definition: hpm_qeiv2_drv.h:191
int16_t param0
Definition: hpm_qeiv2_drv.h:193
int16_t param1
Definition: hpm_qeiv2_drv.h:194
uint32_t offset
Definition: hpm_qeiv2_drv.h:195
phase counter compare match config structure
Definition: hpm_qeiv2_drv.h:158
bool ignore_zcmp
Definition: hpm_qeiv2_drv.h:162
qeiv2_rotate_dir_t rotate_dir
Definition: hpm_qeiv2_drv.h:161
uint32_t zcmp_value
Definition: hpm_qeiv2_drv.h:163
uint32_t phcnt_cmp_value
Definition: hpm_qeiv2_drv.h:159
bool ignore_rotate_dir
Definition: hpm_qeiv2_drv.h:160
position compare match config structure
Definition: hpm_qeiv2_drv.h:170
uint32_t pos_cmp_value
Definition: hpm_qeiv2_drv.h:171
qeiv2_position_dir_t pos_dir
Definition: hpm_qeiv2_drv.h:173
bool ignore_pos_dir
Definition: hpm_qeiv2_drv.h:172
uvw config structure
Definition: hpm_qeiv2_drv.h:179
qeiv2_uvw_pos_opt_t pos_opt
Definition: hpm_qeiv2_drv.h:180