• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 
9 #ifndef HPM_PWM_H
10 #define HPM_PWM_H
11 
12 typedef struct {
13     __RW uint32_t UNLK;                        /* 0x0: Shadow registers unlock register */
14     __RW uint32_t STA;                         /* 0x4: Counter start register */
15     __RW uint32_t RLD;                         /* 0x8: Counter reload register */
16     __RW uint32_t CMP[24];                     /* 0xC - 0x68: Comparator register */
17     __R  uint8_t  RESERVED0[12];               /* 0x6C - 0x77: Reserved */
18     __RW uint32_t FRCMD;                       /* 0x78: Force output mode register */
19     __RW uint32_t SHLK;                        /* 0x7C: Shadow registers lock register */
20     __RW uint32_t CHCFG[24];                   /* 0x80 - 0xDC: Output channel configure register */
21     __R  uint8_t  RESERVED1[16];               /* 0xE0 - 0xEF: Reserved */
22     __RW uint32_t GCR;                         /* 0xF0: Global control register */
23     __RW uint32_t SHCR;                        /* 0xF4: Shadow register control register */
24     __R  uint8_t  RESERVED2[8];                /* 0xF8 - 0xFF: Reserved */
25     __R  uint32_t CAPPOS[24];                  /* 0x100 - 0x15C: Capture rising edge register */
26     __R  uint8_t  RESERVED3[16];               /* 0x160 - 0x16F: Reserved */
27     __R  uint32_t CNT;                         /* 0x170: Counter */
28     __R  uint8_t  RESERVED4[12];               /* 0x174 - 0x17F: Reserved */
29     __R  uint32_t CAPNEG[24];                  /* 0x180 - 0x1DC: Capture falling edge register */
30     __R  uint8_t  RESERVED5[16];               /* 0x1E0 - 0x1EF: Reserved */
31     __R  uint32_t CNTCOPY;                     /* 0x1F0: Counter copy */
32     __R  uint8_t  RESERVED6[12];               /* 0x1F4 - 0x1FF: Reserved */
33     __RW uint32_t PWMCFG[8];                   /* 0x200 - 0x21C: PWM channel configure register */
34     __W  uint32_t SR;                          /* 0x220: Status register */
35     __RW uint32_t IRQEN;                       /* 0x224: Interrupt request enable register */
36     __R  uint8_t  RESERVED7[4];                /* 0x228 - 0x22B: Reserved */
37     __RW uint32_t DMAEN;                       /* 0x22C: DMA request enable register */
38     __RW uint32_t CMPCFG[24];                  /* 0x230 - 0x28C: Comparator configure register */
39 } PWM_Type;
40 
41 
42 /* Bitfield definition for register: UNLK */
43 /*
44  * SHUNLK (RW)
45  *
46  * write 0xB0382607 to unlock the shadow registers of register offset from 0x04 to 0x78, otherwise the shadow registers can not be written.
47  */
48 #define PWM_UNLK_SHUNLK_MASK (0xFFFFFFFFUL)
49 #define PWM_UNLK_SHUNLK_SHIFT (0U)
50 #define PWM_UNLK_SHUNLK_SET(x) (((uint32_t)(x) << PWM_UNLK_SHUNLK_SHIFT) & PWM_UNLK_SHUNLK_MASK)
51 #define PWM_UNLK_SHUNLK_GET(x) (((uint32_t)(x) & PWM_UNLK_SHUNLK_MASK) >> PWM_UNLK_SHUNLK_SHIFT)
52 
53 /* Bitfield definition for register: STA */
54 /*
55  * XSTA (RW)
56  *
57  * pwm timer counter extended start point, should back to this value after reach xrld
58  */
59 #define PWM_STA_XSTA_MASK (0xF0000000UL)
60 #define PWM_STA_XSTA_SHIFT (28U)
61 #define PWM_STA_XSTA_SET(x) (((uint32_t)(x) << PWM_STA_XSTA_SHIFT) & PWM_STA_XSTA_MASK)
62 #define PWM_STA_XSTA_GET(x) (((uint32_t)(x) & PWM_STA_XSTA_MASK) >> PWM_STA_XSTA_SHIFT)
63 
64 /*
65  * STA (RW)
66  *
67  * pwm timer counter start value
68  *  sta/rld will be loaded from shadow register to work register at main counter reload time, or software write unlk.shunlk
69  */
70 #define PWM_STA_STA_MASK (0xFFFFFF0UL)
71 #define PWM_STA_STA_SHIFT (4U)
72 #define PWM_STA_STA_SET(x) (((uint32_t)(x) << PWM_STA_STA_SHIFT) & PWM_STA_STA_MASK)
73 #define PWM_STA_STA_GET(x) (((uint32_t)(x) & PWM_STA_STA_MASK) >> PWM_STA_STA_SHIFT)
74 
75 /* Bitfield definition for register: RLD */
76 /*
77  * XRLD (RW)
78  *
79  * timeout counter extended reload point, counter will reload to xsta after reach this point
80  */
81 #define PWM_RLD_XRLD_MASK (0xF0000000UL)
82 #define PWM_RLD_XRLD_SHIFT (28U)
83 #define PWM_RLD_XRLD_SET(x) (((uint32_t)(x) << PWM_RLD_XRLD_SHIFT) & PWM_RLD_XRLD_MASK)
84 #define PWM_RLD_XRLD_GET(x) (((uint32_t)(x) & PWM_RLD_XRLD_MASK) >> PWM_RLD_XRLD_SHIFT)
85 
86 /*
87  * RLD (RW)
88  *
89  * pwm timer counter reload value
90  */
91 #define PWM_RLD_RLD_MASK (0xFFFFFF0UL)
92 #define PWM_RLD_RLD_SHIFT (4U)
93 #define PWM_RLD_RLD_SET(x) (((uint32_t)(x) << PWM_RLD_RLD_SHIFT) & PWM_RLD_RLD_MASK)
94 #define PWM_RLD_RLD_GET(x) (((uint32_t)(x) & PWM_RLD_RLD_MASK) >> PWM_RLD_RLD_SHIFT)
95 
96 /* Bitfield definition for register array: CMP */
97 /*
98  * XCMP (RW)
99  *
100  * extended counter compare value
101  */
102 #define PWM_CMP_XCMP_MASK (0xF0000000UL)
103 #define PWM_CMP_XCMP_SHIFT (28U)
104 #define PWM_CMP_XCMP_SET(x) (((uint32_t)(x) << PWM_CMP_XCMP_SHIFT) & PWM_CMP_XCMP_MASK)
105 #define PWM_CMP_XCMP_GET(x) (((uint32_t)(x) & PWM_CMP_XCMP_MASK) >> PWM_CMP_XCMP_SHIFT)
106 
107 /*
108  * CMP (RW)
109  *
110  * clock counter compare value, the compare output is 0 at default, set to 1 when compare value meet, and clr to 0 when timer reload. Software can invert the output by setting chan_cfg.out_polarity.
111  */
112 #define PWM_CMP_CMP_MASK (0xFFFFFF0UL)
113 #define PWM_CMP_CMP_SHIFT (4U)
114 #define PWM_CMP_CMP_SET(x) (((uint32_t)(x) << PWM_CMP_CMP_SHIFT) & PWM_CMP_CMP_MASK)
115 #define PWM_CMP_CMP_GET(x) (((uint32_t)(x) & PWM_CMP_CMP_MASK) >> PWM_CMP_CMP_SHIFT)
116 
117 /*
118  * CMPHLF (RW)
119  *
120  * half clock counter compare value
121  */
122 #define PWM_CMP_CMPHLF_MASK (0x8U)
123 #define PWM_CMP_CMPHLF_SHIFT (3U)
124 #define PWM_CMP_CMPHLF_SET(x) (((uint32_t)(x) << PWM_CMP_CMPHLF_SHIFT) & PWM_CMP_CMPHLF_MASK)
125 #define PWM_CMP_CMPHLF_GET(x) (((uint32_t)(x) & PWM_CMP_CMPHLF_MASK) >> PWM_CMP_CMPHLF_SHIFT)
126 
127 /*
128  * CMPJIT (RW)
129  *
130  * jitter counter compare value
131  */
132 #define PWM_CMP_CMPJIT_MASK (0x7U)
133 #define PWM_CMP_CMPJIT_SHIFT (0U)
134 #define PWM_CMP_CMPJIT_SET(x) (((uint32_t)(x) << PWM_CMP_CMPJIT_SHIFT) & PWM_CMP_CMPJIT_MASK)
135 #define PWM_CMP_CMPJIT_GET(x) (((uint32_t)(x) & PWM_CMP_CMPJIT_MASK) >> PWM_CMP_CMPJIT_SHIFT)
136 
137 /* Bitfield definition for register: FRCMD */
138 /*
139  * FRCMD (RW)
140  *
141  * 2bit for each PWM output channel (0~7);
142  * 00:  force output 0
143  * 01:  force output 1
144  * 10:  output highz
145  * 11:  no force
146  */
147 #define PWM_FRCMD_FRCMD_MASK (0xFFFFU)
148 #define PWM_FRCMD_FRCMD_SHIFT (0U)
149 #define PWM_FRCMD_FRCMD_SET(x) (((uint32_t)(x) << PWM_FRCMD_FRCMD_SHIFT) & PWM_FRCMD_FRCMD_MASK)
150 #define PWM_FRCMD_FRCMD_GET(x) (((uint32_t)(x) & PWM_FRCMD_FRCMD_MASK) >> PWM_FRCMD_FRCMD_SHIFT)
151 
152 /* Bitfield definition for register: SHLK */
153 /*
154  * SHLK (RW)
155  *
156  * write 1 to lock all shawdow register, wirte access is not permitted
157  */
158 #define PWM_SHLK_SHLK_MASK (0x80000000UL)
159 #define PWM_SHLK_SHLK_SHIFT (31U)
160 #define PWM_SHLK_SHLK_SET(x) (((uint32_t)(x) << PWM_SHLK_SHLK_SHIFT) & PWM_SHLK_SHLK_MASK)
161 #define PWM_SHLK_SHLK_GET(x) (((uint32_t)(x) & PWM_SHLK_SHLK_MASK) >> PWM_SHLK_SHLK_SHIFT)
162 
163 /* Bitfield definition for register array: CHCFG */
164 /*
165  * CMPSELEND (RW)
166  *
167  * assign the last comparator for this output channel
168  */
169 #define PWM_CHCFG_CMPSELEND_MASK (0x1F000000UL)
170 #define PWM_CHCFG_CMPSELEND_SHIFT (24U)
171 #define PWM_CHCFG_CMPSELEND_SET(x) (((uint32_t)(x) << PWM_CHCFG_CMPSELEND_SHIFT) & PWM_CHCFG_CMPSELEND_MASK)
172 #define PWM_CHCFG_CMPSELEND_GET(x) (((uint32_t)(x) & PWM_CHCFG_CMPSELEND_MASK) >> PWM_CHCFG_CMPSELEND_SHIFT)
173 
174 /*
175  * CMPSELBEG (RW)
176  *
177  * assign the first comparator for this output channel
178  */
179 #define PWM_CHCFG_CMPSELBEG_MASK (0x1F0000UL)
180 #define PWM_CHCFG_CMPSELBEG_SHIFT (16U)
181 #define PWM_CHCFG_CMPSELBEG_SET(x) (((uint32_t)(x) << PWM_CHCFG_CMPSELBEG_SHIFT) & PWM_CHCFG_CMPSELBEG_MASK)
182 #define PWM_CHCFG_CMPSELBEG_GET(x) (((uint32_t)(x) & PWM_CHCFG_CMPSELBEG_MASK) >> PWM_CHCFG_CMPSELBEG_SHIFT)
183 
184 /*
185  * OUTPOL (RW)
186  *
187  * output polarity, set to 1 will invert the output
188  */
189 #define PWM_CHCFG_OUTPOL_MASK (0x2U)
190 #define PWM_CHCFG_OUTPOL_SHIFT (1U)
191 #define PWM_CHCFG_OUTPOL_SET(x) (((uint32_t)(x) << PWM_CHCFG_OUTPOL_SHIFT) & PWM_CHCFG_OUTPOL_MASK)
192 #define PWM_CHCFG_OUTPOL_GET(x) (((uint32_t)(x) & PWM_CHCFG_OUTPOL_MASK) >> PWM_CHCFG_OUTPOL_SHIFT)
193 
194 /* Bitfield definition for register: GCR */
195 /*
196  * FAULTI3EN (RW)
197  *
198  * 1- enable the internal fault input 3
199  */
200 #define PWM_GCR_FAULTI3EN_MASK (0x80000000UL)
201 #define PWM_GCR_FAULTI3EN_SHIFT (31U)
202 #define PWM_GCR_FAULTI3EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTI3EN_SHIFT) & PWM_GCR_FAULTI3EN_MASK)
203 #define PWM_GCR_FAULTI3EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTI3EN_MASK) >> PWM_GCR_FAULTI3EN_SHIFT)
204 
205 /*
206  * FAULTI2EN (RW)
207  *
208  * 1- enable the internal fault input 2
209  */
210 #define PWM_GCR_FAULTI2EN_MASK (0x40000000UL)
211 #define PWM_GCR_FAULTI2EN_SHIFT (30U)
212 #define PWM_GCR_FAULTI2EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTI2EN_SHIFT) & PWM_GCR_FAULTI2EN_MASK)
213 #define PWM_GCR_FAULTI2EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTI2EN_MASK) >> PWM_GCR_FAULTI2EN_SHIFT)
214 
215 /*
216  * FAULTI1EN (RW)
217  *
218  * 1- enable the internal fault input 1
219  */
220 #define PWM_GCR_FAULTI1EN_MASK (0x20000000UL)
221 #define PWM_GCR_FAULTI1EN_SHIFT (29U)
222 #define PWM_GCR_FAULTI1EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTI1EN_SHIFT) & PWM_GCR_FAULTI1EN_MASK)
223 #define PWM_GCR_FAULTI1EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTI1EN_MASK) >> PWM_GCR_FAULTI1EN_SHIFT)
224 
225 /*
226  * FAULTI0EN (RW)
227  *
228  * 1- enable the internal fault input 0
229  */
230 #define PWM_GCR_FAULTI0EN_MASK (0x10000000UL)
231 #define PWM_GCR_FAULTI0EN_SHIFT (28U)
232 #define PWM_GCR_FAULTI0EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTI0EN_SHIFT) & PWM_GCR_FAULTI0EN_MASK)
233 #define PWM_GCR_FAULTI0EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTI0EN_MASK) >> PWM_GCR_FAULTI0EN_SHIFT)
234 
235 /*
236  * DEBUGFAULT (RW)
237  *
238  * 1- enable debug mode output protection
239  */
240 #define PWM_GCR_DEBUGFAULT_MASK (0x8000000UL)
241 #define PWM_GCR_DEBUGFAULT_SHIFT (27U)
242 #define PWM_GCR_DEBUGFAULT_SET(x) (((uint32_t)(x) << PWM_GCR_DEBUGFAULT_SHIFT) & PWM_GCR_DEBUGFAULT_MASK)
243 #define PWM_GCR_DEBUGFAULT_GET(x) (((uint32_t)(x) & PWM_GCR_DEBUGFAULT_MASK) >> PWM_GCR_DEBUGFAULT_SHIFT)
244 
245 /*
246  * FRCPOL (RW)
247  *
248  * polarity of input pwm_force,
249  * 1- active low
250  * 0- active high
251  */
252 #define PWM_GCR_FRCPOL_MASK (0x4000000UL)
253 #define PWM_GCR_FRCPOL_SHIFT (26U)
254 #define PWM_GCR_FRCPOL_SET(x) (((uint32_t)(x) << PWM_GCR_FRCPOL_SHIFT) & PWM_GCR_FRCPOL_MASK)
255 #define PWM_GCR_FRCPOL_GET(x) (((uint32_t)(x) & PWM_GCR_FRCPOL_MASK) >> PWM_GCR_FRCPOL_SHIFT)
256 
257 /*
258  * HWSHDWEDG (RW)
259  *
260  * When hardware event is selected as shawdow register effective time and the select comparator is configured as input capture mode. This bit assign its which edge is used as shadow register hardware load event.
261  * 1- Falling edge
262  * 0- Rising edge
263  */
264 #define PWM_GCR_HWSHDWEDG_MASK (0x1000000UL)
265 #define PWM_GCR_HWSHDWEDG_SHIFT (24U)
266 #define PWM_GCR_HWSHDWEDG_SET(x) (((uint32_t)(x) << PWM_GCR_HWSHDWEDG_SHIFT) & PWM_GCR_HWSHDWEDG_MASK)
267 #define PWM_GCR_HWSHDWEDG_GET(x) (((uint32_t)(x) & PWM_GCR_HWSHDWEDG_MASK) >> PWM_GCR_HWSHDWEDG_SHIFT)
268 
269 /*
270  * CMPSHDWSEL (RW)
271  *
272  * This bitfield select one of the comparators as hardware event time to load comparator shadow registers
273  */
274 #define PWM_GCR_CMPSHDWSEL_MASK (0xF80000UL)
275 #define PWM_GCR_CMPSHDWSEL_SHIFT (19U)
276 #define PWM_GCR_CMPSHDWSEL_SET(x) (((uint32_t)(x) << PWM_GCR_CMPSHDWSEL_SHIFT) & PWM_GCR_CMPSHDWSEL_MASK)
277 #define PWM_GCR_CMPSHDWSEL_GET(x) (((uint32_t)(x) & PWM_GCR_CMPSHDWSEL_MASK) >> PWM_GCR_CMPSHDWSEL_SHIFT)
278 
279 /*
280  * FAULTRECEDG (RW)
281  *
282  * When hardware load is selected as output fault recover trigger and the selected channel is capture mode. This bit assign its effective edge of fault recover trigger.
283  * 1- Falling edge
284  * 0- Rising edge
285  */
286 #define PWM_GCR_FAULTRECEDG_MASK (0x40000UL)
287 #define PWM_GCR_FAULTRECEDG_SHIFT (18U)
288 #define PWM_GCR_FAULTRECEDG_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTRECEDG_SHIFT) & PWM_GCR_FAULTRECEDG_MASK)
289 #define PWM_GCR_FAULTRECEDG_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTRECEDG_MASK) >> PWM_GCR_FAULTRECEDG_SHIFT)
290 
291 /*
292  * FAULTRECHWSEL (RW)
293  *
294  * Selec one of the 24 comparators as fault output recover trigger.
295  */
296 #define PWM_GCR_FAULTRECHWSEL_MASK (0x3E000UL)
297 #define PWM_GCR_FAULTRECHWSEL_SHIFT (13U)
298 #define PWM_GCR_FAULTRECHWSEL_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTRECHWSEL_SHIFT) & PWM_GCR_FAULTRECHWSEL_MASK)
299 #define PWM_GCR_FAULTRECHWSEL_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTRECHWSEL_MASK) >> PWM_GCR_FAULTRECHWSEL_SHIFT)
300 
301 /*
302  * FAULTE1EN (RW)
303  *
304  * 1- enable the external fault input 1
305  */
306 #define PWM_GCR_FAULTE1EN_MASK (0x1000U)
307 #define PWM_GCR_FAULTE1EN_SHIFT (12U)
308 #define PWM_GCR_FAULTE1EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTE1EN_SHIFT) & PWM_GCR_FAULTE1EN_MASK)
309 #define PWM_GCR_FAULTE1EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTE1EN_MASK) >> PWM_GCR_FAULTE1EN_SHIFT)
310 
311 /*
312  * FAULTE0EN (RW)
313  *
314  * 1- enable the external fault input 0
315  */
316 #define PWM_GCR_FAULTE0EN_MASK (0x800U)
317 #define PWM_GCR_FAULTE0EN_SHIFT (11U)
318 #define PWM_GCR_FAULTE0EN_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTE0EN_SHIFT) & PWM_GCR_FAULTE0EN_MASK)
319 #define PWM_GCR_FAULTE0EN_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTE0EN_MASK) >> PWM_GCR_FAULTE0EN_SHIFT)
320 
321 /*
322  * FAULTEXPOL (RW)
323  *
324  * external fault polarity
325  * 1-active low
326  * 0-active high
327  */
328 #define PWM_GCR_FAULTEXPOL_MASK (0x600U)
329 #define PWM_GCR_FAULTEXPOL_SHIFT (9U)
330 #define PWM_GCR_FAULTEXPOL_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTEXPOL_SHIFT) & PWM_GCR_FAULTEXPOL_MASK)
331 #define PWM_GCR_FAULTEXPOL_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTEXPOL_MASK) >> PWM_GCR_FAULTEXPOL_SHIFT)
332 
333 /*
334  * RLDSYNCEN (RW)
335  *
336  * 1- pwm timer counter reset to reload value (rld) by synci is enabled
337  */
338 #define PWM_GCR_RLDSYNCEN_MASK (0x100U)
339 #define PWM_GCR_RLDSYNCEN_SHIFT (8U)
340 #define PWM_GCR_RLDSYNCEN_SET(x) (((uint32_t)(x) << PWM_GCR_RLDSYNCEN_SHIFT) & PWM_GCR_RLDSYNCEN_MASK)
341 #define PWM_GCR_RLDSYNCEN_GET(x) (((uint32_t)(x) & PWM_GCR_RLDSYNCEN_MASK) >> PWM_GCR_RLDSYNCEN_SHIFT)
342 
343 /*
344  * CEN (RW)
345  *
346  * 1- enable the pwm timer counter
347  * 0- stop the pwm timer counter
348  */
349 #define PWM_GCR_CEN_MASK (0x80U)
350 #define PWM_GCR_CEN_SHIFT (7U)
351 #define PWM_GCR_CEN_SET(x) (((uint32_t)(x) << PWM_GCR_CEN_SHIFT) & PWM_GCR_CEN_MASK)
352 #define PWM_GCR_CEN_GET(x) (((uint32_t)(x) & PWM_GCR_CEN_MASK) >> PWM_GCR_CEN_SHIFT)
353 
354 /*
355  * FAULTCLR (RW)
356  *
357  * 1- Write 1 to clear the fault condition. The output will recover if FAULTRECTIME is set to 2b'11. User should write 1 to this bit after the active FAULT signal de-assert and before it re-assert again.
358  */
359 #define PWM_GCR_FAULTCLR_MASK (0x40U)
360 #define PWM_GCR_FAULTCLR_SHIFT (6U)
361 #define PWM_GCR_FAULTCLR_SET(x) (((uint32_t)(x) << PWM_GCR_FAULTCLR_SHIFT) & PWM_GCR_FAULTCLR_MASK)
362 #define PWM_GCR_FAULTCLR_GET(x) (((uint32_t)(x) & PWM_GCR_FAULTCLR_MASK) >> PWM_GCR_FAULTCLR_SHIFT)
363 
364 /*
365  * XRLDSYNCEN (RW)
366  *
367  * 1- pwm timer extended counter (xcnt) reset to extended reload value (xrld) by synci is enabled
368  */
369 #define PWM_GCR_XRLDSYNCEN_MASK (0x20U)
370 #define PWM_GCR_XRLDSYNCEN_SHIFT (5U)
371 #define PWM_GCR_XRLDSYNCEN_SET(x) (((uint32_t)(x) << PWM_GCR_XRLDSYNCEN_SHIFT) & PWM_GCR_XRLDSYNCEN_MASK)
372 #define PWM_GCR_XRLDSYNCEN_GET(x) (((uint32_t)(x) & PWM_GCR_XRLDSYNCEN_MASK) >> PWM_GCR_XRLDSYNCEN_SHIFT)
373 
374 /*
375  * FRCTIME (RW)
376  *
377  * This bit field select the force effective time
378  * 00:  force immediately
379  * 01:  force at main counter reload time
380  * 10:  force at FRCSYNCI
381  * 11: no force
382  */
383 #define PWM_GCR_FRCTIME_MASK (0x6U)
384 #define PWM_GCR_FRCTIME_SHIFT (1U)
385 #define PWM_GCR_FRCTIME_SET(x) (((uint32_t)(x) << PWM_GCR_FRCTIME_SHIFT) & PWM_GCR_FRCTIME_MASK)
386 #define PWM_GCR_FRCTIME_GET(x) (((uint32_t)(x) & PWM_GCR_FRCTIME_MASK) >> PWM_GCR_FRCTIME_SHIFT)
387 
388 /*
389  * SWFRC (RW)
390  *
391  * 1- write 1 to enable software force, if the frcsrcsel is set to 0, force will take effect
392  */
393 #define PWM_GCR_SWFRC_MASK (0x1U)
394 #define PWM_GCR_SWFRC_SHIFT (0U)
395 #define PWM_GCR_SWFRC_SET(x) (((uint32_t)(x) << PWM_GCR_SWFRC_SHIFT) & PWM_GCR_SWFRC_MASK)
396 #define PWM_GCR_SWFRC_GET(x) (((uint32_t)(x) & PWM_GCR_SWFRC_MASK) >> PWM_GCR_SWFRC_SHIFT)
397 
398 /* Bitfield definition for register: SHCR */
399 /*
400  * FRCSHDWSEL (RW)
401  *
402  * This bitfield select one of the comparators as hardware event time to load FRCMD shadow registers
403  */
404 #define PWM_SHCR_FRCSHDWSEL_MASK (0x1F00U)
405 #define PWM_SHCR_FRCSHDWSEL_SHIFT (8U)
406 #define PWM_SHCR_FRCSHDWSEL_SET(x) (((uint32_t)(x) << PWM_SHCR_FRCSHDWSEL_SHIFT) & PWM_SHCR_FRCSHDWSEL_MASK)
407 #define PWM_SHCR_FRCSHDWSEL_GET(x) (((uint32_t)(x) & PWM_SHCR_FRCSHDWSEL_MASK) >> PWM_SHCR_FRCSHDWSEL_SHIFT)
408 
409 /*
410  * CNTSHDWSEL (RW)
411  *
412  * This bitfield select one of the comparators as hardware event time to load the counter related shadow registers (STA and RLD)
413  */
414 #define PWM_SHCR_CNTSHDWSEL_MASK (0xF8U)
415 #define PWM_SHCR_CNTSHDWSEL_SHIFT (3U)
416 #define PWM_SHCR_CNTSHDWSEL_SET(x) (((uint32_t)(x) << PWM_SHCR_CNTSHDWSEL_SHIFT) & PWM_SHCR_CNTSHDWSEL_MASK)
417 #define PWM_SHCR_CNTSHDWSEL_GET(x) (((uint32_t)(x) & PWM_SHCR_CNTSHDWSEL_MASK) >> PWM_SHCR_CNTSHDWSEL_SHIFT)
418 
419 /*
420  * CNTSHDWUPT (RW)
421  *
422  * This bitfield select when the counter related shadow registers (STA and RLD) will be loaded to its work register
423  * 00:  after software set shlk bit of shlk register
424  * 01:  immediately after the register being modified
425  * 10:  after hardware event assert, user can select one of the comparators to generate this hardware event. The comparator can be either output compare mode or input capture mode.
426  * 11:  after SHSYNCI assert
427  */
428 #define PWM_SHCR_CNTSHDWUPT_MASK (0x6U)
429 #define PWM_SHCR_CNTSHDWUPT_SHIFT (1U)
430 #define PWM_SHCR_CNTSHDWUPT_SET(x) (((uint32_t)(x) << PWM_SHCR_CNTSHDWUPT_SHIFT) & PWM_SHCR_CNTSHDWUPT_MASK)
431 #define PWM_SHCR_CNTSHDWUPT_GET(x) (((uint32_t)(x) & PWM_SHCR_CNTSHDWUPT_MASK) >> PWM_SHCR_CNTSHDWUPT_SHIFT)
432 
433 /*
434  * SHLKEN (RW)
435  *
436  * 1- enable shadow registers lock feature,
437  * 0- disable shadow registers lock, shlk bit will always be 0
438  */
439 #define PWM_SHCR_SHLKEN_MASK (0x1U)
440 #define PWM_SHCR_SHLKEN_SHIFT (0U)
441 #define PWM_SHCR_SHLKEN_SET(x) (((uint32_t)(x) << PWM_SHCR_SHLKEN_SHIFT) & PWM_SHCR_SHLKEN_MASK)
442 #define PWM_SHCR_SHLKEN_GET(x) (((uint32_t)(x) & PWM_SHCR_SHLKEN_MASK) >> PWM_SHCR_SHLKEN_SHIFT)
443 
444 /* Bitfield definition for register array: CAPPOS */
445 /*
446  * CAPPOS (RO)
447  *
448  * counter value captured at input posedge
449  */
450 #define PWM_CAPPOS_CAPPOS_MASK (0xFFFFFFF0UL)
451 #define PWM_CAPPOS_CAPPOS_SHIFT (4U)
452 #define PWM_CAPPOS_CAPPOS_GET(x) (((uint32_t)(x) & PWM_CAPPOS_CAPPOS_MASK) >> PWM_CAPPOS_CAPPOS_SHIFT)
453 
454 /* Bitfield definition for register: CNT */
455 /*
456  * XCNT (RO)
457  *
458  * current extended counter  value
459  */
460 #define PWM_CNT_XCNT_MASK (0xF0000000UL)
461 #define PWM_CNT_XCNT_SHIFT (28U)
462 #define PWM_CNT_XCNT_GET(x) (((uint32_t)(x) & PWM_CNT_XCNT_MASK) >> PWM_CNT_XCNT_SHIFT)
463 
464 /*
465  * CNT (RO)
466  *
467  * current clock counter  value
468  */
469 #define PWM_CNT_CNT_MASK (0xFFFFFF0UL)
470 #define PWM_CNT_CNT_SHIFT (4U)
471 #define PWM_CNT_CNT_GET(x) (((uint32_t)(x) & PWM_CNT_CNT_MASK) >> PWM_CNT_CNT_SHIFT)
472 
473 /* Bitfield definition for register array: CAPNEG */
474 /*
475  * CAPNEG (RO)
476  *
477  * counter value captured at input signal falling edge
478  */
479 #define PWM_CAPNEG_CAPNEG_MASK (0xFFFFFFFFUL)
480 #define PWM_CAPNEG_CAPNEG_SHIFT (0U)
481 #define PWM_CAPNEG_CAPNEG_GET(x) (((uint32_t)(x) & PWM_CAPNEG_CAPNEG_MASK) >> PWM_CAPNEG_CAPNEG_SHIFT)
482 
483 /* Bitfield definition for register: CNTCOPY */
484 /*
485  * XCNT (RO)
486  *
487  * current extended counter  value
488  */
489 #define PWM_CNTCOPY_XCNT_MASK (0xF0000000UL)
490 #define PWM_CNTCOPY_XCNT_SHIFT (28U)
491 #define PWM_CNTCOPY_XCNT_GET(x) (((uint32_t)(x) & PWM_CNTCOPY_XCNT_MASK) >> PWM_CNTCOPY_XCNT_SHIFT)
492 
493 /*
494  * CNT (RO)
495  *
496  * current clock counter  value
497  */
498 #define PWM_CNTCOPY_CNT_MASK (0xFFFFFF0UL)
499 #define PWM_CNTCOPY_CNT_SHIFT (4U)
500 #define PWM_CNTCOPY_CNT_GET(x) (((uint32_t)(x) & PWM_CNTCOPY_CNT_MASK) >> PWM_CNTCOPY_CNT_SHIFT)
501 
502 /* Bitfield definition for register array: PWMCFG */
503 /*
504  * OEN (RW)
505  *
506  * PWM output enable
507  * 1- output is enabled
508  * 0- output is disabled
509  */
510 #define PWM_PWMCFG_OEN_MASK (0x10000000UL)
511 #define PWM_PWMCFG_OEN_SHIFT (28U)
512 #define PWM_PWMCFG_OEN_SET(x) (((uint32_t)(x) << PWM_PWMCFG_OEN_SHIFT) & PWM_PWMCFG_OEN_MASK)
513 #define PWM_PWMCFG_OEN_GET(x) (((uint32_t)(x) & PWM_PWMCFG_OEN_MASK) >> PWM_PWMCFG_OEN_SHIFT)
514 
515 /*
516  * FRCSHDWUPT (RW)
517  *
518  * This bitfield select when the FRCMD shadow register will be loaded to its work register
519  * 00:  after software set shlk bit of shlk register
520  * 01:  immediately after the register being modified
521  * 10:  after hardware event assert, user can select one of the comparators to generate this hardware event. The comparator can be either output compare mode or input capture mode.
522  * 11:  after SHSYNCI assert
523  */
524 #define PWM_PWMCFG_FRCSHDWUPT_MASK (0xC000000UL)
525 #define PWM_PWMCFG_FRCSHDWUPT_SHIFT (26U)
526 #define PWM_PWMCFG_FRCSHDWUPT_SET(x) (((uint32_t)(x) << PWM_PWMCFG_FRCSHDWUPT_SHIFT) & PWM_PWMCFG_FRCSHDWUPT_MASK)
527 #define PWM_PWMCFG_FRCSHDWUPT_GET(x) (((uint32_t)(x) & PWM_PWMCFG_FRCSHDWUPT_MASK) >> PWM_PWMCFG_FRCSHDWUPT_SHIFT)
528 
529 /*
530  * FAULTMODE (RW)
531  *
532  * This bitfield defines the PWM output status when fault condition happen
533  * 00:  force output 0
534  * 01:  force output 1
535  * 1x:  output highz
536  */
537 #define PWM_PWMCFG_FAULTMODE_MASK (0x3000000UL)
538 #define PWM_PWMCFG_FAULTMODE_SHIFT (24U)
539 #define PWM_PWMCFG_FAULTMODE_SET(x) (((uint32_t)(x) << PWM_PWMCFG_FAULTMODE_SHIFT) & PWM_PWMCFG_FAULTMODE_MASK)
540 #define PWM_PWMCFG_FAULTMODE_GET(x) (((uint32_t)(x) & PWM_PWMCFG_FAULTMODE_MASK) >> PWM_PWMCFG_FAULTMODE_SHIFT)
541 
542 /*
543  * FAULTRECTIME (RW)
544  *
545  * This bitfield select when to recover PWM output after fault condition removed.
546  * 00:  immediately
547  * 01:  after pwm timer counter reload time
548  * 10:  after hardware event assert, user can select one of the comparators to generate this hardware event. The comparator can be either output compare mode or input capture mode.
549  * 11:  after software write faultclr bit in GCR register
550  */
551 #define PWM_PWMCFG_FAULTRECTIME_MASK (0xC00000UL)
552 #define PWM_PWMCFG_FAULTRECTIME_SHIFT (22U)
553 #define PWM_PWMCFG_FAULTRECTIME_SET(x) (((uint32_t)(x) << PWM_PWMCFG_FAULTRECTIME_SHIFT) & PWM_PWMCFG_FAULTRECTIME_MASK)
554 #define PWM_PWMCFG_FAULTRECTIME_GET(x) (((uint32_t)(x) & PWM_PWMCFG_FAULTRECTIME_MASK) >> PWM_PWMCFG_FAULTRECTIME_SHIFT)
555 
556 /*
557  * FRCSRCSEL (RW)
558  *
559  * Select sources for force output
560  * 0- force output is enabled when FRCI assert
561  * 1- force output is enabled by software write swfrc to 1
562  */
563 #define PWM_PWMCFG_FRCSRCSEL_MASK (0x200000UL)
564 #define PWM_PWMCFG_FRCSRCSEL_SHIFT (21U)
565 #define PWM_PWMCFG_FRCSRCSEL_SET(x) (((uint32_t)(x) << PWM_PWMCFG_FRCSRCSEL_SHIFT) & PWM_PWMCFG_FRCSRCSEL_MASK)
566 #define PWM_PWMCFG_FRCSRCSEL_GET(x) (((uint32_t)(x) & PWM_PWMCFG_FRCSRCSEL_MASK) >> PWM_PWMCFG_FRCSRCSEL_SHIFT)
567 
568 /*
569  * PAIR (RW)
570  *
571  * 1- PWM output is in pair mode. Note the two PWM outputs need to be both set to pair mode.
572  * 0- PWM output is in indepandent mode.
573  */
574 #define PWM_PWMCFG_PAIR_MASK (0x100000UL)
575 #define PWM_PWMCFG_PAIR_SHIFT (20U)
576 #define PWM_PWMCFG_PAIR_SET(x) (((uint32_t)(x) << PWM_PWMCFG_PAIR_SHIFT) & PWM_PWMCFG_PAIR_MASK)
577 #define PWM_PWMCFG_PAIR_GET(x) (((uint32_t)(x) & PWM_PWMCFG_PAIR_MASK) >> PWM_PWMCFG_PAIR_SHIFT)
578 
579 /*
580  * DEADAREA (RW)
581  *
582  * This bitfield define the PWM pair deadarea length. The unit is 0.5 cycle. The minimum length of deadarea is 1 cycle.
583  * Note: user should configure pair bit and this bitfield before PWM output is enabled.
584  */
585 #define PWM_PWMCFG_DEADAREA_MASK (0xFFFFFUL)
586 #define PWM_PWMCFG_DEADAREA_SHIFT (0U)
587 #define PWM_PWMCFG_DEADAREA_SET(x) (((uint32_t)(x) << PWM_PWMCFG_DEADAREA_SHIFT) & PWM_PWMCFG_DEADAREA_MASK)
588 #define PWM_PWMCFG_DEADAREA_GET(x) (((uint32_t)(x) & PWM_PWMCFG_DEADAREA_MASK) >> PWM_PWMCFG_DEADAREA_SHIFT)
589 
590 /* Bitfield definition for register: SR */
591 /*
592  * FAULTF (W1C)
593  *
594  * fault condition flag
595  */
596 #define PWM_SR_FAULTF_MASK (0x8000000UL)
597 #define PWM_SR_FAULTF_SHIFT (27U)
598 #define PWM_SR_FAULTF_SET(x) (((uint32_t)(x) << PWM_SR_FAULTF_SHIFT) & PWM_SR_FAULTF_MASK)
599 #define PWM_SR_FAULTF_GET(x) (((uint32_t)(x) & PWM_SR_FAULTF_MASK) >> PWM_SR_FAULTF_SHIFT)
600 
601 /*
602  * XRLDF (W1C)
603  *
604  * extended reload flag, this flag set when xcnt count to xrld value or when SYNCI assert
605  */
606 #define PWM_SR_XRLDF_MASK (0x4000000UL)
607 #define PWM_SR_XRLDF_SHIFT (26U)
608 #define PWM_SR_XRLDF_SET(x) (((uint32_t)(x) << PWM_SR_XRLDF_SHIFT) & PWM_SR_XRLDF_MASK)
609 #define PWM_SR_XRLDF_GET(x) (((uint32_t)(x) & PWM_SR_XRLDF_MASK) >> PWM_SR_XRLDF_SHIFT)
610 
611 /*
612  * HALFRLDF (W1C)
613  *
614  * half reload flag, this flag set when cnt count to rld/2
615  */
616 #define PWM_SR_HALFRLDF_MASK (0x2000000UL)
617 #define PWM_SR_HALFRLDF_SHIFT (25U)
618 #define PWM_SR_HALFRLDF_SET(x) (((uint32_t)(x) << PWM_SR_HALFRLDF_SHIFT) & PWM_SR_HALFRLDF_MASK)
619 #define PWM_SR_HALFRLDF_GET(x) (((uint32_t)(x) & PWM_SR_HALFRLDF_MASK) >> PWM_SR_HALFRLDF_SHIFT)
620 
621 /*
622  * RLDF (W1C)
623  *
624  * reload flag, this flag set when cnt count to rld value or when SYNCI assert
625  */
626 #define PWM_SR_RLDF_MASK (0x1000000UL)
627 #define PWM_SR_RLDF_SHIFT (24U)
628 #define PWM_SR_RLDF_SET(x) (((uint32_t)(x) << PWM_SR_RLDF_SHIFT) & PWM_SR_RLDF_MASK)
629 #define PWM_SR_RLDF_GET(x) (((uint32_t)(x) & PWM_SR_RLDF_MASK) >> PWM_SR_RLDF_SHIFT)
630 
631 /*
632  * CMPFX (W1C)
633  *
634  * comparator output compare or input capture flag
635  */
636 #define PWM_SR_CMPFX_MASK (0xFFFFFFUL)
637 #define PWM_SR_CMPFX_SHIFT (0U)
638 #define PWM_SR_CMPFX_SET(x) (((uint32_t)(x) << PWM_SR_CMPFX_SHIFT) & PWM_SR_CMPFX_MASK)
639 #define PWM_SR_CMPFX_GET(x) (((uint32_t)(x) & PWM_SR_CMPFX_MASK) >> PWM_SR_CMPFX_SHIFT)
640 
641 /* Bitfield definition for register: IRQEN */
642 /*
643  * FAULTIRQE (RW)
644  *
645  * fault condition interrupt enable
646  */
647 #define PWM_IRQEN_FAULTIRQE_MASK (0x8000000UL)
648 #define PWM_IRQEN_FAULTIRQE_SHIFT (27U)
649 #define PWM_IRQEN_FAULTIRQE_SET(x) (((uint32_t)(x) << PWM_IRQEN_FAULTIRQE_SHIFT) & PWM_IRQEN_FAULTIRQE_MASK)
650 #define PWM_IRQEN_FAULTIRQE_GET(x) (((uint32_t)(x) & PWM_IRQEN_FAULTIRQE_MASK) >> PWM_IRQEN_FAULTIRQE_SHIFT)
651 
652 /*
653  * XRLDIRQE (RW)
654  *
655  * extended reload flag interrupt enable
656  */
657 #define PWM_IRQEN_XRLDIRQE_MASK (0x4000000UL)
658 #define PWM_IRQEN_XRLDIRQE_SHIFT (26U)
659 #define PWM_IRQEN_XRLDIRQE_SET(x) (((uint32_t)(x) << PWM_IRQEN_XRLDIRQE_SHIFT) & PWM_IRQEN_XRLDIRQE_MASK)
660 #define PWM_IRQEN_XRLDIRQE_GET(x) (((uint32_t)(x) & PWM_IRQEN_XRLDIRQE_MASK) >> PWM_IRQEN_XRLDIRQE_SHIFT)
661 
662 /*
663  * HALFRLDIRQE (RW)
664  *
665  * half reload flag interrupt enable
666  */
667 #define PWM_IRQEN_HALFRLDIRQE_MASK (0x2000000UL)
668 #define PWM_IRQEN_HALFRLDIRQE_SHIFT (25U)
669 #define PWM_IRQEN_HALFRLDIRQE_SET(x) (((uint32_t)(x) << PWM_IRQEN_HALFRLDIRQE_SHIFT) & PWM_IRQEN_HALFRLDIRQE_MASK)
670 #define PWM_IRQEN_HALFRLDIRQE_GET(x) (((uint32_t)(x) & PWM_IRQEN_HALFRLDIRQE_MASK) >> PWM_IRQEN_HALFRLDIRQE_SHIFT)
671 
672 /*
673  * RLDIRQE (RW)
674  *
675  * reload flag interrupt enable
676  */
677 #define PWM_IRQEN_RLDIRQE_MASK (0x1000000UL)
678 #define PWM_IRQEN_RLDIRQE_SHIFT (24U)
679 #define PWM_IRQEN_RLDIRQE_SET(x) (((uint32_t)(x) << PWM_IRQEN_RLDIRQE_SHIFT) & PWM_IRQEN_RLDIRQE_MASK)
680 #define PWM_IRQEN_RLDIRQE_GET(x) (((uint32_t)(x) & PWM_IRQEN_RLDIRQE_MASK) >> PWM_IRQEN_RLDIRQE_SHIFT)
681 
682 /*
683  * CMPIRQEX (RW)
684  *
685  * comparator output compare or input capture flag interrupt enable
686  */
687 #define PWM_IRQEN_CMPIRQEX_MASK (0xFFFFFFUL)
688 #define PWM_IRQEN_CMPIRQEX_SHIFT (0U)
689 #define PWM_IRQEN_CMPIRQEX_SET(x) (((uint32_t)(x) << PWM_IRQEN_CMPIRQEX_SHIFT) & PWM_IRQEN_CMPIRQEX_MASK)
690 #define PWM_IRQEN_CMPIRQEX_GET(x) (((uint32_t)(x) & PWM_IRQEN_CMPIRQEX_MASK) >> PWM_IRQEN_CMPIRQEX_SHIFT)
691 
692 /* Bitfield definition for register: DMAEN */
693 /*
694  * FAULTEN (RW)
695  *
696  * fault condition DMA request enable
697  */
698 #define PWM_DMAEN_FAULTEN_MASK (0x8000000UL)
699 #define PWM_DMAEN_FAULTEN_SHIFT (27U)
700 #define PWM_DMAEN_FAULTEN_SET(x) (((uint32_t)(x) << PWM_DMAEN_FAULTEN_SHIFT) & PWM_DMAEN_FAULTEN_MASK)
701 #define PWM_DMAEN_FAULTEN_GET(x) (((uint32_t)(x) & PWM_DMAEN_FAULTEN_MASK) >> PWM_DMAEN_FAULTEN_SHIFT)
702 
703 /*
704  * XRLDEN (RW)
705  *
706  * extended reload flag DMA request enable
707  */
708 #define PWM_DMAEN_XRLDEN_MASK (0x4000000UL)
709 #define PWM_DMAEN_XRLDEN_SHIFT (26U)
710 #define PWM_DMAEN_XRLDEN_SET(x) (((uint32_t)(x) << PWM_DMAEN_XRLDEN_SHIFT) & PWM_DMAEN_XRLDEN_MASK)
711 #define PWM_DMAEN_XRLDEN_GET(x) (((uint32_t)(x) & PWM_DMAEN_XRLDEN_MASK) >> PWM_DMAEN_XRLDEN_SHIFT)
712 
713 /*
714  * HALFRLDEN (RW)
715  *
716  * half reload flag DMA request enable
717  */
718 #define PWM_DMAEN_HALFRLDEN_MASK (0x2000000UL)
719 #define PWM_DMAEN_HALFRLDEN_SHIFT (25U)
720 #define PWM_DMAEN_HALFRLDEN_SET(x) (((uint32_t)(x) << PWM_DMAEN_HALFRLDEN_SHIFT) & PWM_DMAEN_HALFRLDEN_MASK)
721 #define PWM_DMAEN_HALFRLDEN_GET(x) (((uint32_t)(x) & PWM_DMAEN_HALFRLDEN_MASK) >> PWM_DMAEN_HALFRLDEN_SHIFT)
722 
723 /*
724  * RLDEN (RW)
725  *
726  * reload flag DMA request enable
727  */
728 #define PWM_DMAEN_RLDEN_MASK (0x1000000UL)
729 #define PWM_DMAEN_RLDEN_SHIFT (24U)
730 #define PWM_DMAEN_RLDEN_SET(x) (((uint32_t)(x) << PWM_DMAEN_RLDEN_SHIFT) & PWM_DMAEN_RLDEN_MASK)
731 #define PWM_DMAEN_RLDEN_GET(x) (((uint32_t)(x) & PWM_DMAEN_RLDEN_MASK) >> PWM_DMAEN_RLDEN_SHIFT)
732 
733 /*
734  * CMPENX (RW)
735  *
736  * comparator output compare or input capture flag DMA request enable
737  */
738 #define PWM_DMAEN_CMPENX_MASK (0xFFFFFFUL)
739 #define PWM_DMAEN_CMPENX_SHIFT (0U)
740 #define PWM_DMAEN_CMPENX_SET(x) (((uint32_t)(x) << PWM_DMAEN_CMPENX_SHIFT) & PWM_DMAEN_CMPENX_MASK)
741 #define PWM_DMAEN_CMPENX_GET(x) (((uint32_t)(x) & PWM_DMAEN_CMPENX_MASK) >> PWM_DMAEN_CMPENX_SHIFT)
742 
743 /* Bitfield definition for register array: CMPCFG */
744 /*
745  * XCNTCMPEN (RW)
746  *
747  * This bitfield enable the comparator to compare xcmp with xcnt.
748  */
749 #define PWM_CMPCFG_XCNTCMPEN_MASK (0xF0U)
750 #define PWM_CMPCFG_XCNTCMPEN_SHIFT (4U)
751 #define PWM_CMPCFG_XCNTCMPEN_SET(x) (((uint32_t)(x) << PWM_CMPCFG_XCNTCMPEN_SHIFT) & PWM_CMPCFG_XCNTCMPEN_MASK)
752 #define PWM_CMPCFG_XCNTCMPEN_GET(x) (((uint32_t)(x) & PWM_CMPCFG_XCNTCMPEN_MASK) >> PWM_CMPCFG_XCNTCMPEN_SHIFT)
753 
754 /*
755  * CMPSHDWUPT (RW)
756  *
757  * This bitfield select when the comparator shadow register will be loaded to its work register
758  * 00:  after software set shlk bit of shlk register
759  * 01:  immediately after the register being modified
760  * 10:  after hardware event assert, user can select one of the comparators to generate this hardware event. The comparator can be either output compare mode or input capture mode.
761  * 11:  after SHSYNCI assert
762  */
763 #define PWM_CMPCFG_CMPSHDWUPT_MASK (0xCU)
764 #define PWM_CMPCFG_CMPSHDWUPT_SHIFT (2U)
765 #define PWM_CMPCFG_CMPSHDWUPT_SET(x) (((uint32_t)(x) << PWM_CMPCFG_CMPSHDWUPT_SHIFT) & PWM_CMPCFG_CMPSHDWUPT_MASK)
766 #define PWM_CMPCFG_CMPSHDWUPT_GET(x) (((uint32_t)(x) & PWM_CMPCFG_CMPSHDWUPT_MASK) >> PWM_CMPCFG_CMPSHDWUPT_SHIFT)
767 
768 /*
769  * CMPMODE (RW)
770  *
771  * comparator mode
772  * 0- output compare mode
773  * 1- input capture mode
774  */
775 #define PWM_CMPCFG_CMPMODE_MASK (0x2U)
776 #define PWM_CMPCFG_CMPMODE_SHIFT (1U)
777 #define PWM_CMPCFG_CMPMODE_SET(x) (((uint32_t)(x) << PWM_CMPCFG_CMPMODE_SHIFT) & PWM_CMPCFG_CMPMODE_MASK)
778 #define PWM_CMPCFG_CMPMODE_GET(x) (((uint32_t)(x) & PWM_CMPCFG_CMPMODE_MASK) >> PWM_CMPCFG_CMPMODE_SHIFT)
779 
780 
781 
782 /* CMP register group index macro definition */
783 #define PWM_CMP_0 (0UL)
784 #define PWM_CMP_1 (1UL)
785 #define PWM_CMP_2 (2UL)
786 #define PWM_CMP_3 (3UL)
787 #define PWM_CMP_4 (4UL)
788 #define PWM_CMP_5 (5UL)
789 #define PWM_CMP_6 (6UL)
790 #define PWM_CMP_7 (7UL)
791 #define PWM_CMP_8 (8UL)
792 #define PWM_CMP_9 (9UL)
793 #define PWM_CMP_10 (10UL)
794 #define PWM_CMP_11 (11UL)
795 #define PWM_CMP_12 (12UL)
796 #define PWM_CMP_13 (13UL)
797 #define PWM_CMP_14 (14UL)
798 #define PWM_CMP_15 (15UL)
799 #define PWM_CMP_16 (16UL)
800 #define PWM_CMP_17 (17UL)
801 #define PWM_CMP_18 (18UL)
802 #define PWM_CMP_19 (19UL)
803 #define PWM_CMP_20 (20UL)
804 #define PWM_CMP_21 (21UL)
805 #define PWM_CMP_22 (22UL)
806 #define PWM_CMP_23 (23UL)
807 
808 /* CHCFG register group index macro definition */
809 #define PWM_CHCFG_0 (0UL)
810 #define PWM_CHCFG_1 (1UL)
811 #define PWM_CHCFG_2 (2UL)
812 #define PWM_CHCFG_3 (3UL)
813 #define PWM_CHCFG_4 (4UL)
814 #define PWM_CHCFG_5 (5UL)
815 #define PWM_CHCFG_6 (6UL)
816 #define PWM_CHCFG_7 (7UL)
817 #define PWM_CHCFG_8 (8UL)
818 #define PWM_CHCFG_9 (9UL)
819 #define PWM_CHCFG_10 (10UL)
820 #define PWM_CHCFG_11 (11UL)
821 #define PWM_CHCFG_12 (12UL)
822 #define PWM_CHCFG_13 (13UL)
823 #define PWM_CHCFG_14 (14UL)
824 #define PWM_CHCFG_15 (15UL)
825 #define PWM_CHCFG_16 (16UL)
826 #define PWM_CHCFG_17 (17UL)
827 #define PWM_CHCFG_18 (18UL)
828 #define PWM_CHCFG_19 (19UL)
829 #define PWM_CHCFG_20 (20UL)
830 #define PWM_CHCFG_21 (21UL)
831 #define PWM_CHCFG_22 (22UL)
832 #define PWM_CHCFG_23 (23UL)
833 
834 /* CAPPOS register group index macro definition */
835 #define PWM_CAPPOS_0 (0UL)
836 #define PWM_CAPPOS_1 (1UL)
837 #define PWM_CAPPOS_2 (2UL)
838 #define PWM_CAPPOS_3 (3UL)
839 #define PWM_CAPPOS_4 (4UL)
840 #define PWM_CAPPOS_5 (5UL)
841 #define PWM_CAPPOS_6 (6UL)
842 #define PWM_CAPPOS_7 (7UL)
843 #define PWM_CAPPOS_8 (8UL)
844 #define PWM_CAPPOS_9 (9UL)
845 #define PWM_CAPPOS_10 (10UL)
846 #define PWM_CAPPOS_11 (11UL)
847 #define PWM_CAPPOS_12 (12UL)
848 #define PWM_CAPPOS_13 (13UL)
849 #define PWM_CAPPOS_14 (14UL)
850 #define PWM_CAPPOS_15 (15UL)
851 #define PWM_CAPPOS_16 (16UL)
852 #define PWM_CAPPOS_17 (17UL)
853 #define PWM_CAPPOS_18 (18UL)
854 #define PWM_CAPPOS_19 (19UL)
855 #define PWM_CAPPOS_20 (20UL)
856 #define PWM_CAPPOS_21 (21UL)
857 #define PWM_CAPPOS_22 (22UL)
858 #define PWM_CAPPOS_23 (23UL)
859 
860 /* CAPNEG register group index macro definition */
861 #define PWM_CAPNEG_0 (0UL)
862 #define PWM_CAPNEG_1 (1UL)
863 #define PWM_CAPNEG_2 (2UL)
864 #define PWM_CAPNEG_3 (3UL)
865 #define PWM_CAPNEG_4 (4UL)
866 #define PWM_CAPNEG_5 (5UL)
867 #define PWM_CAPNEG_6 (6UL)
868 #define PWM_CAPNEG_7 (7UL)
869 #define PWM_CAPNEG_8 (8UL)
870 #define PWM_CAPNEG_9 (9UL)
871 #define PWM_CAPNEG_10 (10UL)
872 #define PWM_CAPNEG_11 (11UL)
873 #define PWM_CAPNEG_12 (12UL)
874 #define PWM_CAPNEG_13 (13UL)
875 #define PWM_CAPNEG_14 (14UL)
876 #define PWM_CAPNEG_15 (15UL)
877 #define PWM_CAPNEG_16 (16UL)
878 #define PWM_CAPNEG_17 (17UL)
879 #define PWM_CAPNEG_18 (18UL)
880 #define PWM_CAPNEG_19 (19UL)
881 #define PWM_CAPNEG_20 (20UL)
882 #define PWM_CAPNEG_21 (21UL)
883 #define PWM_CAPNEG_22 (22UL)
884 #define PWM_CAPNEG_23 (23UL)
885 
886 /* PWMCFG register group index macro definition */
887 #define PWM_PWMCFG_0 (0UL)
888 #define PWM_PWMCFG_1 (1UL)
889 #define PWM_PWMCFG_2 (2UL)
890 #define PWM_PWMCFG_3 (3UL)
891 #define PWM_PWMCFG_4 (4UL)
892 #define PWM_PWMCFG_5 (5UL)
893 #define PWM_PWMCFG_6 (6UL)
894 #define PWM_PWMCFG_7 (7UL)
895 
896 /* CMPCFG register group index macro definition */
897 #define PWM_CMPCFG_CMPCFG0 (0UL)
898 #define PWM_CMPCFG_1 (1UL)
899 #define PWM_CMPCFG_2 (2UL)
900 #define PWM_CMPCFG_3 (3UL)
901 #define PWM_CMPCFG_4 (4UL)
902 #define PWM_CMPCFG_5 (5UL)
903 #define PWM_CMPCFG_6 (6UL)
904 #define PWM_CMPCFG_7 (7UL)
905 #define PWM_CMPCFG_8 (8UL)
906 #define PWM_CMPCFG_9 (9UL)
907 #define PWM_CMPCFG_10 (10UL)
908 #define PWM_CMPCFG_11 (11UL)
909 #define PWM_CMPCFG_12 (12UL)
910 #define PWM_CMPCFG_13 (13UL)
911 #define PWM_CMPCFG_14 (14UL)
912 #define PWM_CMPCFG_15 (15UL)
913 #define PWM_CMPCFG_16 (16UL)
914 #define PWM_CMPCFG_17 (17UL)
915 #define PWM_CMPCFG_18 (18UL)
916 #define PWM_CMPCFG_19 (19UL)
917 #define PWM_CMPCFG_20 (20UL)
918 #define PWM_CMPCFG_21 (21UL)
919 #define PWM_CMPCFG_22 (22UL)
920 #define PWM_CMPCFG_23 (23UL)
921 
922 
923 #endif /* HPM_PWM_H */