1 /**
2   ******************************************************************************
3   * @file    rtl8721d_qdec.h
4   * @author
5   * @version V1.0.0
6   * @date    2017-10-16
7   * @brief   This file contains all the functions prototypes for the QDecoder.
8   ******************************************************************************
9   * @attention
10   *
11   * This module is a confidential and proprietary property of RealTek and
12   * possession or use of this module requires written permission of RealTek.
13   *
14   * Copyright(c) 2017, Realtek Semiconductor Corporation. All rights reserved.
15   ******************************************************************************
16   */
17 
18 
19 #ifndef _RTL8721D_QDEC_H_
20 #define _RTL8721D_QDEC_H_
21 
22 /** @addtogroup AmebaD_Periph_Driver
23   * @{
24   */
25 
26 /** @addtogroup QDecoder QDecoder
27   * @{
28   */
29 
30 /** @addtogroup QDecoder
31   * @verbatim
32   *****************************************************************************************
33   * Introduction
34   *****************************************************************************************
35   * QDEC:
36   *		- Base Address: QDEC_DEV
37   *		- Sclk: 32K/2Mhz
38   *		- HW input : PHA, PHB, IDX
39   *		- Sample Clock:  	Configurable, up to 2Mhz
40   *		- Debounce Timer: Configurable
41   *		- IRQ: QDECODER_IRQ_LP
42   *
43   *****************************************************************************************
44   * How to use Normal QDecoder
45   *****************************************************************************************
46   *      To use the normal QDecoder mode, the following steps are mandatory:
47   *
48   *          1. configure the QDec pinmux
49   *
50   *          2. Init Qdec
51   *               QDEC_StructInit(QDEC_InitTypeDef *QDEC_InitStruct)
52   *               QDEC_Init(QDEC_TypeDef *QDec, QDEC_InitTypeDef *QDEC_InitStruct)
53   *
54   *          3. Reset sub-function if need,eg:
55   *               QDEC_RstPC(QDEC_TypeDef *QDec)
56   *               QDEC_RstRC(QDEC_TypeDef *QDec)
57   *               QDEC_RsALL(QDEC_TypeDef *QDec)
58   *
59   *          4. Set Interrupt trigger condition as needed
60   *
61   *          5. enable velocity function as needed
62   *
63   *          6. Polling status or Get stauts according to the interrupt.
64   *
65   *****************************************************************************************
66   * How to enable  velocity function
67   *****************************************************************************************
68   *      To enable the velocity function, the following steps are mandatory:
69   *
70   *      1. Init VcMod and VTmr
71   *          QDEC_SetVcMod(QDEC_TypeDef *QDec, u32 mode)
72   *          QDEC_SetVTmr(QDEC_TypeDef *QDec, u32 duration)
73   *
74   *      2. Reset velocity status if need.
75   *          QDEC_VtRst(QDEC_TypeDef *QDec)
76   *
77   *      3. Configure interrupt if needed
78   *
79   *      4. enable velocity function
80   *        QDEC_VT_Cmd(QDEC_TypeDef *QDec, u32 NewState)
81   *
82   *****************************************************************************************
83   * @endverbatim
84   */
85 
86 /* Exported types --------------------------------------------------------*/
87 /** @defgroup QDecoder_Exported_Types QDecoder Exported Types
88   * @{
89   */
90 
91 /**
92   * @brief  QDecoder Init structure definition
93   */
94 typedef struct {
95 	u32 QD_SysClk;				/*!< Specifies QDec  Bus clock .
96 							This parameter can be a value of @ref QDecoder_Bus_Clock_definitions */
97 
98 	u32 QD_SmpClk;				/*!< Specifies Qdec sample clock.
99 							This parameter must be set to a value in the (1/32 ~ 1) * QD_SysClk range. */
100 
101 	u32 QD_DebounceTmr;		/*!< Specifies glitch width under QD_DebounceTmr * Tsysclk will be filtered.
102 							This parameter must be set to a value in the 0x1-0x7ff range. */
103 
104 	u32 QD_Rc_Mod;				/*!< Specifies rotation counter calc mode.
105 							This parameter can be a value of @ref QDecoder_RC_mode_definition */
106 
107 	u32 QD_Cnt_Sc;				/*!< Specifies position counter calc mode.
108 							This parameter can be a value of @ref QDecoder_Cnt_Sc_definition */
109 
110 	u32 QD_MPC;					/*!< Specifies max position counter value
111 							This parameter must be set to a value in the 0x0-0xffff range.  */
112 
113 	u32 QD_IdxMod;					/*!< Specifies Qdecoder index signal work mode.
114 							This parameter can be a value of @ref QDecoder_IDX_Mode_definition */
115 
116 	u32 QD_PC_Rst_Mod;			/*!< Specifies Qdecoder position counter reset mode.
117 							This parameter can be a value of @ref QDecoder_PC_Reset_Mode_definition*/
118 
119 	u32 QD_PC_Rst_Phase;			/*!< Specifies Qdecoder position counter reset phase.
120 							This parameter can be a value of @ref QDecoder_PC_Reset_PHASE_definition*/
121 
122 	u32 QD_VTmr;				/*!< Specifies velocity measure timer in ms, .
123 							This parameter can be a value of in the 0x0-0xffffff*Tsysclk range */
124 
125 	u32 QD_VCMod;				/*!< Specifies velocity counter mode .
126 							This parameter can be a value of @ref QDecoder_VC_Work_Mode_definitions */
127 }QDEC_InitTypeDef;
128 /**
129   * @}
130   */
131 
132 /* Exported constants --------------------------------------------------------*/
133 /** @defgroup QDecoder_Exported_Constants Qdecoder Exported Constants
134   * @{
135   */
136 
137 /** @defgroup QDecoder_Peripheral_definitions
138   * @{
139   */
140 #define IS_QDEC_ALL_PERIPH(PERIPH) ((PERIPH) == QDEC_DEV)
141 /**
142   * @}
143   */
144 
145 /** @defgroup QDecoder_Bus_Clock_definitions
146   * @{
147   */
148 #define QD_SYS_CLK_32K			((u32)32768)
149 #define QD_SYS_CLK_2M			((u32)2000000)
150 #define IS_QD_SYS_CLK(CLK)		(((CLK) == QD_SYS_CLK_32K) || \
151                                    		((CLK) == QD_SYS_CLK_2M))
152 /**
153   * @}
154   */
155 
156 /** @defgroup QDecoder_Clock_selection
157   * @{
158   */
159 #define QDEC_CLK_SEL_32K			((u32)0x00000001)
160 #define QDEC_CLK_SEL_2M			((u32)0x00000000)
161 /**
162   * @}
163   */
164 
165 /** @defgroup QDecoder_RC_mode_definition
166   * @{
167   */
168 #define QD_RC_COUNT_IDX			((u32)0x00000000 << 28)
169 #define QD_RC_COUNT_OF				((u32)0x00000001 << 28)
170 #define IS_QD_RC_COUNT_MOD(MODE)			(((MODE) == QD_RC_COUNT_IDX) || \
171                                   			 ((MODE) == QD_RC_COUNT_OF))
172 /**
173   * @}
174   */
175 
176 /** @defgroup QDecoder_Cnt_Sc_definition
177   * @{
178   */
179 #define QD_PC_1PHSAE_1COUNTER			((u32)0x00000000 << 13)
180 #define QD_PC_2PHSAE_1COUNTER			((u32)0x00000001 << 13)
181 #define IS_QD_PC_PHASE_COUTER(CNT)			(((CNT) == QD_PC_2PHSAE_1COUNTER) || \
182                                   			 ((CNT) == QD_PC_1PHSAE_1COUNTER))
183 /**
184   * @}
185   */
186 
187 /** @defgroup QDecoder_PC_Chang_Level_definition
188   * @{
189   */
190 #define QD_PC_CHG_1COUNTER			((u32)0x00000000 << 3)
191 #define QD_PC_CHG_2COUNTER			((u32)0x00000001 << 3)
192 #define QD_PC_CHG_4COUNTER			((u32)0x00000002 << 3)
193 #define IS_QD_PC_CHG_COUTER(CNT)			(((CNT) == QD_PC_CHG_1COUNTER) || \
194                                   			 ((CNT) == QD_PC_CHG_2COUNTER) ||((CNT) == QD_PC_CHG_4COUNTER))
195 /**
196   * @}
197   */
198 
199   /** @defgroup QDecoder_IDX_Mode_definition
200   * @{
201   */
202 #define QD_IDX_DISABLE			((u32)0x00000000 << 31)
203 #define QD_IDX_NORMAL			(((u32)0x00000001 << 31) | ((u32)0x00000000 << 5))
204 #define QD_IDX_INVERSE			(((u32)0x00000001 << 31) | ((u32)0x00000001 << 5))
205 
206 #define IS_QD_IDX_MODE(MODE)			(((MODE) == QD_IDX_DISABLE) || \
207 							((MODE) == QD_IDX_NORMAL) || ((MODE) == QD_IDX_INVERSE))
208 /**
209   * @}
210   */
211 
212   /** @defgroup QDecoder_PC_Reset_PHASE_definition
213   * @{
214   */
215 #define QD_PC_RST_AUTO_IDX			((u32)0x00000001 << 6)
216 #define QD_PC_RST_PHASE_00			((u32)0x00000000 )
217 #define QD_PC_RST_PHASE_01			((u32)0x00000001)
218 #define QD_PC_RST_PHASE_10			((u32)0x00000002)
219 #define QD_PC_RST_PHASE_11			((u32)0x00000003)
220 #define IS_QD_PC_RST_PHASE(PHASE)			(((PHASE) == QD_PC_RST_AUTO_IDX) || \
221 							((PHASE) <= 0x00000003))
222 /**
223   * @}
224   */
225 
226   /** @defgroup QDecoder_PC_Reset_Mode_definition
227   * @{
228   */
229 #define QD_PC_RST_DISABLE			((u32)0x00000000 << 3)
230 #define QD_PC_RST_ONCE				((u32)0x00000001 << 3)
231 #define QD_PC_RST_ALWAYS			((u32)0x00000002 << 3)
232 
233 #define IS_QD_PC_RST_MODE(MODE)			(((MODE) == QD_PC_RST_DISABLE) || \
234 							((MODE) == QD_PC_RST_ONCE) || ((MODE) == QD_PC_RST_ALWAYS))
235 /**
236   * @}
237   */
238 
239 /** @defgroup QDecoder_VC_Work_Mode_definitions
240   * @{
241   */
242 #define QD_VC_MOD_ABS			((u32)0x00000000 << 9)
243 #define QD_VC_MOD_PC			((u32)0x00000001 << 9)
244 #define IS_QD_VC_MODE(MODE)			(((MODE) == QD_VC_MOD_ABS) || \
245                                    ((MODE) == QD_VC_MOD_PC))
246 /**
247   * @}
248   */
249 
250 /**
251   * @}
252   */
253 
254 /* Exported functions --------------------------------------------------------*/
255 /** @defgroup QDecoder_Exported_Functions QDecoder Exported Functions
256   * @{
257   */
258 
259 /** @defgroup QDecoder_Exported_Normal_Functions QDec Exported Normal Functions
260   * @{
261   */
262 void QDEC_DeInit(void);
263 void QDEC_Init(QDEC_TypeDef *QDec, QDEC_InitTypeDef *QDEC_InitStruct);
264 void QDEC_StructInit(QDEC_InitTypeDef *QDEC_InitStruct);
265 void QDEC_Cmd(QDEC_TypeDef *QDec, u32 NewState);
266 void QDEC_RstPC(QDEC_TypeDef *QDec);
267 void QDEC_RstRC(QDEC_TypeDef *QDec);
268 void QDEC_RstALL(QDEC_TypeDef *QDec);
269 void QDEC_SetCntSC(QDEC_TypeDef *QDec, u32 cnt_sc);
270 void QDEC_SetPChg(QDEC_TypeDef *QDec, u32 Pchange);
271 void QDEC_SetPCC(QDEC_TypeDef *QDec, u32 CmpPC);
272 void QDEC_SetMPC(QDEC_TypeDef *QDec, u32 MaxPC);
273 void QDEC_SetRCC(QDEC_TypeDef *QDec, u32 CmpRC);
274 u32 QDEC_GetRC(QDEC_TypeDef *QDec);
275 u32 QDEC_GetPhase(QDEC_TypeDef *QDec);
276 u32 QDEC_GetDir(QDEC_TypeDef *QDec);
277 u32 QDEC_GetPC(QDEC_TypeDef *QDec);
278 void QDEC_Idx_Cmd(QDEC_TypeDef *QDec, u32 NewState);
279 void QDEC_SetRstMod(QDEC_TypeDef *QDec, u32 mode, u32 phase);
280 void QDEC_SetVTmr(QDEC_TypeDef *QDec, u32 duration);
281 void QDEC_SetVcMod(QDEC_TypeDef *QDec, u32 mode);
282 void QDEC_VT_Cmd(QDEC_TypeDef *QDec, u32 NewState);
283 void QDEC_VtRst(QDEC_TypeDef *QDec);
284 void QDEC_SetVcUpLmt(QDEC_TypeDef *QDec, u32 limt);
285 void QDEC_SetVcLowLmt(QDEC_TypeDef *QDec, u32 limt);
286 u32 QDEC_GetVT(QDEC_TypeDef *QDec);
287 u32 QDEC_GetVC(QDEC_TypeDef *QDec);
288 u32 QDEC_GetVCCAP(QDEC_TypeDef *QDec);
289 u32 QDEC_GetPCCAP(QDEC_TypeDef *QDec);
290 void QDEC_INTConfig(QDEC_TypeDef *QDec, u32 INT, u32 newState);
291 void QDEC_INTMask(QDEC_TypeDef *QDec, u32 mask, u32 newState);
292 void QDEC_ClearINT(QDEC_TypeDef *QDec, u32 INT);
293 u32 QDEC_GetRawINT(QDEC_TypeDef *QDec);
294 u32 QDEC_GetIMR(QDEC_TypeDef *QDec);
295 /**
296   * @}
297   */
298 
299 
300 
301 /**
302   * @}
303   */
304 
305 
306 /* Registers Definitions --------------------------------------------------------*/
307 /**************************************************************************//**
308  * @defgroup QDecoder_Register_Definitions QDecoder Register Definitions
309  * @{
310  *****************************************************************************/
311 
312 /**************************************************************************//**
313  * @defgroup QDEC_CLK_CFG
314  * @{
315  *****************************************************************************/
316 #define QD_SMP_DIV						((u32)0x0001F000)		/*Bit[16:12], Divider for input signal sampling clock*/
317 #define QD_DBN_TM						((u32)0x000007FF)		/*Bit[10:0], Divider for De-bounce timer clock*/
318 /** @} */
319 
320 /**************************************************************************//**
321  * @defgroup QDEC_CTRL
322  * @{
323  *****************************************************************************/
324 #define QD_AXIS_EN					((u32)0x00000001 << 31)	/*Bit[31], Qdecoder enable control */
325 #define QD_PC_RST					((u32)0x00000001 << 30)	/*Bit[30], Qdecoder position counter reset control*/
326 #define QD_RC_RST					((u32)0x00000001 << 29)	/*Bit[29], Qdecoder rotation counter reset control*/
327 #define QD_RC_MOD					((u32)0x00000001 << 28)	/*Bit[38], Qdecoder rotation mode*/
328 #define QD_ALL_RST					((u32)0x00000001 << 27)	/*Bit[37], Qdecoder ALL reset control*/
329 
330 #define QD_RC_CMP_INT_EN			((u32)0x00000001 << 24)	/*Bit[24], Qdecoder rotation counter compare INT enable*/
331 #define QD_PC_ERR_INT_EN			((u32)0x00000001 << 23)	/*Bit[23], Qdecoder position counter error INT enable*/
332 #define QD_IDX_PULSE_INT_EN		((u32)0x00000001 << 22)	/*Bit[22], Qdecoder index pulse INT enable*/
333 #define QD_RC_UF_INT_EN			((u32)0x00000001 << 21)	/*Bit[21], Qdecoder rotation counter underflow INT enable*/
334 #define QD_RC_OF_INT_EN			((u32)0x00000001 << 20)	/*Bit[20], Qdecoder rotation counter overflow INT enable*/
335 #define QD_PC_CMP_INT_EN			((u32)0x00000001 << 19)	/*Bit[19], Qdecoder position counter compare INT enable*/
336 #define QD_DR_CH_INT_EN			((u32)0x00000001 << 18)	/*Bit[18], Qdecoder direction changed INT enable*/
337 #define QD_PC_CHG_INT_EN			((u32)0x00000001 << 17)	/*Bit[17], Qdecoder position counter changged INT enable*/
338 #define QD_PC_OF_INT_EN			((u32)0x00000001 << 16)	/*Bit[16], Qdecoder position counter overflow INT enable*/
339 #define QD_PC_UF_INT_EN			((u32)0x00000001 << 15)	/*Bit[15], Qdecoder position counter underflow INT enable*/
340 #define QD_PHASE_ILL_INT_EN		((u32)0x00000001 << 14)	/*Bit[14], Qdecoder phase changed illegal INT enable*/
341 #define QD_COUNTER_INT				((u32)0x01FFC000)			/*Qdecoder counter related INT*/
342 
343 #define QD_CNT_SC					((u32)0x00000001 << 13)	/*Bit[13], Qdecoder number of phase state changed for the position accumulation counter*/
344 #define QD_DB_EN					((u32)0x00000001 << 12)	/*Bit[12], Qdecoder de-bouncing enable*/
345 #define QD_PC_CHG_LEVEL			((u32)0x00000003 << 3)	/*Bit[4:3], Qdecoder position changed interrupt trigger level*/
346 #define QD_MANUAL_INIT				((u32)0x00000001 << 2)	/*Bit[2], Qdecoder manually initial disable*/
347 #define QD_INIT_PHASE				((u32)0x00000003)			/*Bit[1:0], Qdecoder init pahse*/
348 /** @} */
349 
350 /**************************************************************************//**
351  * @defgroup QDEC_MPC
352  * @{
353  *****************************************************************************/
354 #define QD_CMP_PC					((u32)0x0000FFFF << 16)	/*Bit[31:16], Qdecoder position compare register*/
355 #define QD_MAX_PC					((u32)0x0000FFFF)			/*Bit[15:0], Qdecoder Max position counter register*/
356 /** @} */
357 
358 /**************************************************************************//**
359  * @defgroup QDEC_RC
360  * @{
361  *****************************************************************************/
362 #define QD_CMP_RC					((u32)0x00000FFF)			/*Bit[11:0], Qdecoder rotation compare register*/
363 /** @} */
364 
365 /**************************************************************************//**
366  * @defgroup QDEC_PC
367  * @{
368  *****************************************************************************/
369 #define QD_RC						((u32)0x00000FFF << 20)	/*Bit[31:20], Qdecoder current rotation counter*/
370 #define QD_PHASE_STATE				((u32)0x00000003 << 18)	/*Bit[19:18], Qdecoder current phase state*/
371 #define QD_AL_STATUS				((u32)0x00000001 << 17)	/*Bit[17], Qdecoder auto load status*/
372 #define QD_DIR_STATE				((u32)0x00000001 <<16)	/*Bit[16], Qdecoder move direction*/
373 #define QD_PC						((u32)0x0000FFFF)			/*Bit[15:0], Qdecoder current position counter*/
374 /** @} */
375 
376 /**************************************************************************//**
377  * @defgroup QDEC_ISC
378  * @{
379  *****************************************************************************/
380 #define QD_IDX_EN					((u32)0x00000001 << 31)	/*Bit[31], Qdecoder index enable*/
381 #define QD_AUTO_IDX_EN				((u32)0x00000001 << 6)	/*Bit[6], Qdecoder Auto-index enable*/
382 #define BIT_QD_IDX_INVERSE				((u32)0x00000001 << 5)	/*Bit[5], Qdecoder index signal input inverse */
383 #define QD_POS_RST					((u32)0x00000003 << 3)	/*Bit[4:3], Qdecoder position reset control*/
384 #define QD_POS_RST_PHASE			((u32)0x00000003)			/*Bit[1:0], Qdecoder reset phase setting*/
385 /** @} */
386 
387 /**************************************************************************//**
388  * @defgroup QDEC_VCTRL
389  * @{
390  *****************************************************************************/
391 #define QD_VT_DIV					((u32)0x000000FF << 16)	/*Bit[23:16], Qdecoder Velocity clock divider*/
392 #define QD_VMUC_MOD				((u32)0x00000001 << 9)	/*Bit[9], Qdecoder Velocity counter increase mode*/
393 #define QD_VUPLMT_INT_EN			((u32)0x00000001 << 7)	/*Bit[7], Qdecoder Velocity up limit interrupt enable */
394 #define QD_VLOWLMT_INT_EN			((u32)0x00000003 << 6)	/*Bit[6], Qdecoder Velocity low limit interrupt enable*/
395 #define QD_VCCAP_INT_EN			((u32)0x00000001 << 4)	/*Bit[4], Qdecoder Velocity counter capture interrupt enable */
396 #define QD_VELOCITY_INT				((u32)0x000000D0)
397 #define QD_VMUC_RST				((u32)0x00000001 << 2)	/*Bit[2], Qdecoder Velocity reset*/
398 #define QD_VMUC_EN					((u32)0x00000001)			/*Bit[0], Qdecoder Velocity enable*/
399 /** @} */
400 
401 /**************************************************************************//**
402  * @defgroup QDEC_VC
403  * @{
404  *****************************************************************************/
405 #define QD_VC							((u32)0x0000FFFF)			/*Bit[15:0], Qdecoder velocity accumulation counter*/
406 /** @} */
407 
408 /**************************************************************************//**
409  * @defgroup QDEC_VCCAP
410  * @{
411  *****************************************************************************/
412 #define QD_VCCAP						((u32)0x0000FFFF)			/*Bit[15:0], Qdecoder velocity accumulation counter capture register*/
413 /** @} */
414 
415 /**************************************************************************//**
416  * @defgroup QDEC_PCCAP
417  * @{
418  *****************************************************************************/
419 #define QD_PCCAP						((u32)0x0000FFFF)			/*Bit[15:0], Qdecoder position counter capture register*/
420 /** @} */
421 
422 /**************************************************************************//**
423  * @defgroup QDEC_VTRLD
424  * @{
425  *****************************************************************************/
426 #define QD_VTRLD						((u32)0x0000FFFF)			/*Bit[15:0], Qdecoder velocity timer reload register*/
427 /** @} */
428 
429 /**************************************************************************//**
430  * @defgroup QDEC_VT
431  * @{
432  *****************************************************************************/
433 #define QD_VT							((u32)0x0000FFFF)			/*Bit[15:0], Qdecoder velocity timer register*/
434 /** @} */
435 
436 /**************************************************************************//**
437  * @defgroup QDEC_VCOMP
438  * @{
439  *****************************************************************************/
440 #define QD_VUP_LMT						((u32)0x0000FFFF << 16)	/*Bit[31:16], Qdecoder velocity counter up limit register*/
441 #define QD_VLOW_LMT					((u32)0x0000FFFF)			/*Bit[15:0], Qdecoder velocity counter low limit register*/
442 /** @} */
443 
444 /**************************************************************************//**
445  * @defgroup QDEC_IMR
446  * @{
447  *****************************************************************************/
448 #define QD_RC_COMP_INT_MASK			((u32)0x00000001 << 15)	/*Bit[15], Qdecoder rotation counter compare INT mask*/
449 #define QD_VUPLMT_INT_MASK			((u32)0x00000001 << 13)	/*Bit[13], Qdecoder Velocity up limit interrupt mask */
450 #define QD_VLOWLMT_INT_MASK			((u32)0x00000001 << 12)	/*Bit[12], Qdecoder Velocity low limit interrupt mask*/
451 #define QD_VCCAP_INT_MASK				((u32)0x00000001 << 10)	/*Bit[10], Qdecoder Velocity counter capture interrupt mask*/
452 #define QD_PC_ERR_INT_MASK			((u32)0x00000001 << 9)	/*Bit[9], Qdecoder position counter error INT mask*/
453 #define QD_IDX_PULSE_INT_MASK			((u32)0x00000001 << 8)	/*Bit[8], Qdecoder index pulse INT mask*/
454 #define QD_RC_UF_INT_MASK				((u32)0x00000001 << 7)	/*Bit[7], Qdecoder rotation counter underflow INT mask*/
455 #define QD_RC_OF_INT_MASK				((u32)0x00000001 << 6)	/*Bit[6], Qdecoder rotation counter overflow INT mask*/
456 #define QD_PC_CMP_INT_MASK			((u32)0x00000001 << 5)	/*Bit[5], Qdecoder position counter compare INT mask*/
457 #define QD_DR_CH_INT_MASK				((u32)0x00000001 << 4)	/*Bit[4], Qdecoder direction changed INT mask*/
458 #define QD_PHASE_ILL_INT_MASK			((u32)0x00000001 << 3)	/*Bit[3], Qdecoder phase changed illegal INT mask*/
459 #define QD_PC_UF_INT_MASK				((u32)0x00000001 << 2)	/*Bit[2], Qdecoder position counter underflow INT mask*/
460 #define QD_PC_OF_INT_MASK				((u32)0x00000001 << 1)	/*Bit[1], Qdecoder position counter overflow INT mask*/
461 #define QD_PC_CHG_INT_MASK			((u32)0x00000001 << 0)	/*Bit[0], Qdecoder position counter changed INT mask*/
462 #define QD_ALL_INT_MASK				((u32)0x0000B7FF)
463 /** @} */
464 
465 /**************************************************************************//**
466  * @defgroup QDEC_ISR
467  * @{
468  *****************************************************************************/
469 #define QD_RC_COMP_INT_STATUS			((u32)0x00000001 << 15)	/*Bit[15], Qdecoder rotation counter compare INT status*/
470 #define QD_VUPLMT_INT_STATUS			((u32)0x00000001 << 13)	/*Bit[13], Qdecoder Velocity up limit interrupt status */
471 #define QD_VLOWLMT_INT_STATUS		((u32)0x00000001 << 12)	/*Bit[12], Qdecoder Velocity low limit interrupt status*/
472 #define QD_VCCAP_INT_STATUS			((u32)0x00000001 << 10)	/*Bit[10], Qdecoder Velocity counter capture interrupt status*/
473 #define QD_PC_ERR_INT_STATUS			((u32)0x00000001 << 9)	/*Bit[9], Qdecoder position counter error INT status*/
474 #define QD_IDX_PULSE_INT_STATUS		((u32)0x00000001 << 8)	/*Bit[8], Qdecoder index pulse INT status*/
475 #define QD_RC_UF_INT_STATUS			((u32)0x00000001 << 7)	/*Bit[7], Qdecoder rotation counter underflow INT status*/
476 #define QD_RC_OF_INT_STATUS			((u32)0x00000001 << 6)	/*Bit[6], Qdecoder rotation counter overflow INT status*/
477 #define QD_PC_CMP_INT_STATUS			((u32)0x00000001 << 5)	/*Bit[5], Qdecoder position counter compare INT status*/
478 #define QD_DR_CH_INT_STATUS			((u32)0x00000001 << 4)	/*Bit[4], Qdecoder direction changed INT status*/
479 #define QD_PHASE_ILL_INT_STATUS		((u32)0x00000001 << 3)	/*Bit[3], Qdecoder phase changed illegal INT status*/
480 #define QD_PC_UF_INT_STATUS			((u32)0x00000001 << 2)	/*Bit[2], Qdecoder position counter underflow INT status*/
481 #define QD_PC_OF_INT_STATUS			((u32)0x00000001 << 1)	/*Bit[1], Qdecoder position counter overflow INT status*/
482 #define QD_PC_CHG_INT_STATUS			((u32)0x00000001 << 0)	/*Bit[0], Qdecoder position counter changed INT status*/
483 #define QD_ALL_INT_STATUS				((u32)0x0000B7FF)
484 /** @} */
485 /** @} */
486 
487 /**
488   * @}
489   */
490 
491 /**
492   * @}
493   */
494 
495 /* Other Definitions --------------------------------------------------------*/
496 
497 
498 #endif
499 
500 /******************* (C) COPYRIGHT 2017 Realtek Semiconductor *****END OF FILE****/
501 
502