Loading...
Searching...
No Matches
pwm.h
1// THIS HEADER FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
2
8#ifndef _HARDWARE_STRUCTS_PWM_H
9#define _HARDWARE_STRUCTS_PWM_H
10
14
16#include "hardware/regs/pwm.h"
17
18// Reference to datasheet: https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf#tab-registerlist_pwm
19//
20// The _REG_ macro is intended to help make the register navigable in your IDE (for example, using the "Go to Definition" feature)
21// _REG_(x) will link to the corresponding register in hardware/regs/pwm.h.
22//
23// Bit-field descriptions are of the form:
24// BITMASK [BITRANGE] FIELDNAME (RESETVALUE) DESCRIPTION
25
26typedef struct {
27 _REG_(PWM_CH0_CSR_OFFSET) // PWM_CH0_CSR
28 // Control and status register
29 // 0x00000080 [7] PH_ADV (0) Advance the phase of the counter by 1 count, while it is running
30 // 0x00000040 [6] PH_RET (0) Retard the phase of the counter by 1 count, while it is running
31 // 0x00000030 [5:4] DIVMODE (0x0)
32 // 0x00000008 [3] B_INV (0) Invert output B
33 // 0x00000004 [2] A_INV (0) Invert output A
34 // 0x00000002 [1] PH_CORRECT (0) 1: Enable phase-correct modulation
35 // 0x00000001 [0] EN (0) Enable the PWM channel
36 io_rw_32 csr;
37
38 _REG_(PWM_CH0_DIV_OFFSET) // PWM_CH0_DIV
39 // INT and FRAC form a fixed-point fractional number
40 // 0x00000ff0 [11:4] INT (0x01)
41 // 0x0000000f [3:0] FRAC (0x0)
42 io_rw_32 div;
43
44 _REG_(PWM_CH0_CTR_OFFSET) // PWM_CH0_CTR
45 // Direct access to the PWM counter
46 // 0x0000ffff [15:0] CH0_CTR (0x0000)
47 io_rw_32 ctr;
48
49 _REG_(PWM_CH0_CC_OFFSET) // PWM_CH0_CC
50 // Counter compare values
51 // 0xffff0000 [31:16] B (0x0000)
52 // 0x0000ffff [15:0] A (0x0000)
53 io_rw_32 cc;
54
55 _REG_(PWM_CH0_TOP_OFFSET) // PWM_CH0_TOP
56 // Counter wrap value
57 // 0x0000ffff [15:0] CH0_TOP (0xffff)
58 io_rw_32 top;
60
61typedef struct {
62 _REG_(PWM_IRQ0_INTE_OFFSET) // PWM_IRQ0_INTE
63 // Interrupt Enable for irq0
64 // 0x00000800 [11] CH11 (0)
65 // 0x00000400 [10] CH10 (0)
66 // 0x00000200 [9] CH9 (0)
67 // 0x00000100 [8] CH8 (0)
68 // 0x00000080 [7] CH7 (0)
69 // 0x00000040 [6] CH6 (0)
70 // 0x00000020 [5] CH5 (0)
71 // 0x00000010 [4] CH4 (0)
72 // 0x00000008 [3] CH3 (0)
73 // 0x00000004 [2] CH2 (0)
74 // 0x00000002 [1] CH1 (0)
75 // 0x00000001 [0] CH0 (0)
76 io_rw_32 inte;
77
78 _REG_(PWM_IRQ0_INTF_OFFSET) // PWM_IRQ0_INTF
79 // Interrupt Force for irq0
80 // 0x00000800 [11] CH11 (0)
81 // 0x00000400 [10] CH10 (0)
82 // 0x00000200 [9] CH9 (0)
83 // 0x00000100 [8] CH8 (0)
84 // 0x00000080 [7] CH7 (0)
85 // 0x00000040 [6] CH6 (0)
86 // 0x00000020 [5] CH5 (0)
87 // 0x00000010 [4] CH4 (0)
88 // 0x00000008 [3] CH3 (0)
89 // 0x00000004 [2] CH2 (0)
90 // 0x00000002 [1] CH1 (0)
91 // 0x00000001 [0] CH0 (0)
92 io_rw_32 intf;
93
94 _REG_(PWM_IRQ0_INTS_OFFSET) // PWM_IRQ0_INTS
95 // Interrupt status after masking & forcing for irq0
96 // 0x00000800 [11] CH11 (0)
97 // 0x00000400 [10] CH10 (0)
98 // 0x00000200 [9] CH9 (0)
99 // 0x00000100 [8] CH8 (0)
100 // 0x00000080 [7] CH7 (0)
101 // 0x00000040 [6] CH6 (0)
102 // 0x00000020 [5] CH5 (0)
103 // 0x00000010 [4] CH4 (0)
104 // 0x00000008 [3] CH3 (0)
105 // 0x00000004 [2] CH2 (0)
106 // 0x00000002 [1] CH1 (0)
107 // 0x00000001 [0] CH0 (0)
108 io_ro_32 ints;
110
111typedef struct {
112 pwm_slice_hw_t slice[12];
113
114 _REG_(PWM_EN_OFFSET) // PWM_EN
115 // This register aliases the CSR_EN bits for all channels
116 // 0x00000800 [11] CH11 (0)
117 // 0x00000400 [10] CH10 (0)
118 // 0x00000200 [9] CH9 (0)
119 // 0x00000100 [8] CH8 (0)
120 // 0x00000080 [7] CH7 (0)
121 // 0x00000040 [6] CH6 (0)
122 // 0x00000020 [5] CH5 (0)
123 // 0x00000010 [4] CH4 (0)
124 // 0x00000008 [3] CH3 (0)
125 // 0x00000004 [2] CH2 (0)
126 // 0x00000002 [1] CH1 (0)
127 // 0x00000001 [0] CH0 (0)
128 io_rw_32 en;
129
130 _REG_(PWM_INTR_OFFSET) // PWM_INTR
131 // Raw Interrupts
132 // 0x00000800 [11] CH11 (0)
133 // 0x00000400 [10] CH10 (0)
134 // 0x00000200 [9] CH9 (0)
135 // 0x00000100 [8] CH8 (0)
136 // 0x00000080 [7] CH7 (0)
137 // 0x00000040 [6] CH6 (0)
138 // 0x00000020 [5] CH5 (0)
139 // 0x00000010 [4] CH4 (0)
140 // 0x00000008 [3] CH3 (0)
141 // 0x00000004 [2] CH2 (0)
142 // 0x00000002 [1] CH1 (0)
143 // 0x00000001 [0] CH0 (0)
144 io_rw_32 intr;
145
146 union {
147 struct {
148 _REG_(PWM_IRQ0_INTE_OFFSET) // PWM_IRQ0_INTE
149 // Interrupt Enable for irq0
150 // 0x00000800 [11] CH11 (0)
151 // 0x00000400 [10] CH10 (0)
152 // 0x00000200 [9] CH9 (0)
153 // 0x00000100 [8] CH8 (0)
154 // 0x00000080 [7] CH7 (0)
155 // 0x00000040 [6] CH6 (0)
156 // 0x00000020 [5] CH5 (0)
157 // 0x00000010 [4] CH4 (0)
158 // 0x00000008 [3] CH3 (0)
159 // 0x00000004 [2] CH2 (0)
160 // 0x00000002 [1] CH1 (0)
161 // 0x00000001 [0] CH0 (0)
162 io_rw_32 inte;
163
164 _REG_(PWM_IRQ0_INTF_OFFSET) // PWM_IRQ0_INTF
165 // Interrupt Force for irq0
166 // 0x00000800 [11] CH11 (0)
167 // 0x00000400 [10] CH10 (0)
168 // 0x00000200 [9] CH9 (0)
169 // 0x00000100 [8] CH8 (0)
170 // 0x00000080 [7] CH7 (0)
171 // 0x00000040 [6] CH6 (0)
172 // 0x00000020 [5] CH5 (0)
173 // 0x00000010 [4] CH4 (0)
174 // 0x00000008 [3] CH3 (0)
175 // 0x00000004 [2] CH2 (0)
176 // 0x00000002 [1] CH1 (0)
177 // 0x00000001 [0] CH0 (0)
178 io_rw_32 intf;
179
180 _REG_(PWM_IRQ0_INTS_OFFSET) // PWM_IRQ0_INTS
181 // Interrupt status after masking & forcing for irq0
182 // 0x00000800 [11] CH11 (0)
183 // 0x00000400 [10] CH10 (0)
184 // 0x00000200 [9] CH9 (0)
185 // 0x00000100 [8] CH8 (0)
186 // 0x00000080 [7] CH7 (0)
187 // 0x00000040 [6] CH6 (0)
188 // 0x00000020 [5] CH5 (0)
189 // 0x00000010 [4] CH4 (0)
190 // 0x00000008 [3] CH3 (0)
191 // 0x00000004 [2] CH2 (0)
192 // 0x00000002 [1] CH1 (0)
193 // 0x00000001 [0] CH0 (0)
194 io_rw_32 ints;
195
196 _REG_(PWM_IRQ1_INTE_OFFSET) // PWM_IRQ1_INTE
197 // Interrupt Enable for irq1
198 // 0x00000800 [11] CH11 (0)
199 // 0x00000400 [10] CH10 (0)
200 // 0x00000200 [9] CH9 (0)
201 // 0x00000100 [8] CH8 (0)
202 // 0x00000080 [7] CH7 (0)
203 // 0x00000040 [6] CH6 (0)
204 // 0x00000020 [5] CH5 (0)
205 // 0x00000010 [4] CH4 (0)
206 // 0x00000008 [3] CH3 (0)
207 // 0x00000004 [2] CH2 (0)
208 // 0x00000002 [1] CH1 (0)
209 // 0x00000001 [0] CH0 (0)
210 io_rw_32 inte1;
211
212 _REG_(PWM_IRQ1_INTF_OFFSET) // PWM_IRQ1_INTF
213 // Interrupt Force for irq1
214 // 0x00000800 [11] CH11 (0)
215 // 0x00000400 [10] CH10 (0)
216 // 0x00000200 [9] CH9 (0)
217 // 0x00000100 [8] CH8 (0)
218 // 0x00000080 [7] CH7 (0)
219 // 0x00000040 [6] CH6 (0)
220 // 0x00000020 [5] CH5 (0)
221 // 0x00000010 [4] CH4 (0)
222 // 0x00000008 [3] CH3 (0)
223 // 0x00000004 [2] CH2 (0)
224 // 0x00000002 [1] CH1 (0)
225 // 0x00000001 [0] CH0 (0)
226 io_rw_32 intf1;
227
228 _REG_(PWM_IRQ1_INTS_OFFSET) // PWM_IRQ1_INTS
229 // Interrupt status after masking & forcing for irq1
230 // 0x00000800 [11] CH11 (0)
231 // 0x00000400 [10] CH10 (0)
232 // 0x00000200 [9] CH9 (0)
233 // 0x00000100 [8] CH8 (0)
234 // 0x00000080 [7] CH7 (0)
235 // 0x00000040 [6] CH6 (0)
236 // 0x00000020 [5] CH5 (0)
237 // 0x00000010 [4] CH4 (0)
238 // 0x00000008 [3] CH3 (0)
239 // 0x00000004 [2] CH2 (0)
240 // 0x00000002 [1] CH1 (0)
241 // 0x00000001 [0] CH0 (0)
242 io_rw_32 ints1;
243 };
244 pwm_irq_ctrl_hw_t irq_ctrl[2];
245 };
246} pwm_hw_t;
247
248#define pwm_hw ((pwm_hw_t *)PWM_BASE)
249static_assert(sizeof (pwm_hw_t) == 0x0110, "");
250
251#endif // _HARDWARE_STRUCTS_PWM_H
Definition pwm.h:111
Definition pwm.h:61
Definition pwm.h:26