comparison Bootloader/usbotg.h @ 308:ab4515606277

Fix whitespace Use a consistent standard - Tabs in front for indenting, spaces after for anything else. This way everything stays nice and lined up while also letting users change there prefered indent level. Most of the new files from Haata where already in this format.
author Rowan Decker <Smasher816@gmail.com>
date Sun, 08 Mar 2015 18:40:01 -0700
parents b091bb09c55f
children 66eccdd9ced5
comparison
equal deleted inserted replaced
305:4617ef5e06f1 308:ab4515606277
27 /** 27 /**
28 * Hardware structures 28 * Hardware structures
29 */ 29 */
30 30
31 struct USB_ADDINFO_t { 31 struct USB_ADDINFO_t {
32 UNION_STRUCT_START(8); 32 UNION_STRUCT_START(8);
33 uint8_t iehost : 1; 33 uint8_t iehost : 1;
34 uint8_t _rsvd0 : 2; 34 uint8_t _rsvd0 : 2;
35 uint8_t irqnum : 5; 35 uint8_t irqnum : 5;
36 UNION_STRUCT_END; 36 UNION_STRUCT_END;
37 }; 37 };
38 CTASSERT_SIZE_BIT(struct USB_ADDINFO_t, 8); 38 CTASSERT_SIZE_BIT(struct USB_ADDINFO_t, 8);
39 39
40 struct USB_OTGSTAT_t { 40 struct USB_OTGSTAT_t {
41 UNION_STRUCT_START(8); 41 UNION_STRUCT_START(8);
42 uint8_t avbus : 1; 42 uint8_t avbus : 1;
43 uint8_t _rsvd0 : 1; 43 uint8_t _rsvd0 : 1;
44 uint8_t b_sess : 1; 44 uint8_t b_sess : 1;
45 uint8_t sessvld : 1; 45 uint8_t sessvld : 1;
46 uint8_t _rsvd1 : 1; 46 uint8_t _rsvd1 : 1;
47 uint8_t line_state : 1; 47 uint8_t line_state : 1;
48 uint8_t onemsec : 1; 48 uint8_t onemsec : 1;
49 uint8_t idchg : 1; 49 uint8_t idchg : 1;
50 UNION_STRUCT_END; 50 UNION_STRUCT_END;
51 }; 51 };
52 CTASSERT_SIZE_BIT(struct USB_OTGSTAT_t, 8); 52 CTASSERT_SIZE_BIT(struct USB_OTGSTAT_t, 8);
53 53
54 struct USB_OTGCTL_t { 54 struct USB_OTGCTL_t {
55 UNION_STRUCT_START(8); 55 UNION_STRUCT_START(8);
56 uint8_t _rsvd0 : 2; 56 uint8_t _rsvd0 : 2;
57 uint8_t otgen : 1; 57 uint8_t otgen : 1;
58 uint8_t _rsvd1 : 1; 58 uint8_t _rsvd1 : 1;
59 uint8_t dmlow : 1; 59 uint8_t dmlow : 1;
60 uint8_t dplow : 1; 60 uint8_t dplow : 1;
61 uint8_t _rsvd2 : 1; 61 uint8_t _rsvd2 : 1;
62 uint8_t dphigh : 1; 62 uint8_t dphigh : 1;
63 UNION_STRUCT_END; 63 UNION_STRUCT_END;
64 }; 64 };
65 CTASSERT_SIZE_BIT(struct USB_OTGCTL_t, 8); 65 CTASSERT_SIZE_BIT(struct USB_OTGCTL_t, 8);
66 66
67 struct USB_ISTAT_t { 67 struct USB_ISTAT_t {
68 UNION_STRUCT_START(8); 68 UNION_STRUCT_START(8);
69 uint8_t usbrst : 1; 69 uint8_t usbrst : 1;
70 uint8_t error : 1; 70 uint8_t error : 1;
71 uint8_t softok : 1; 71 uint8_t softok : 1;
72 uint8_t tokdne : 1; 72 uint8_t tokdne : 1;
73 uint8_t sleep : 1; 73 uint8_t sleep : 1;
74 uint8_t resume : 1; 74 uint8_t resume : 1;
75 uint8_t attach : 1; 75 uint8_t attach : 1;
76 uint8_t stall : 1; 76 uint8_t stall : 1;
77 UNION_STRUCT_END; 77 UNION_STRUCT_END;
78 }; 78 };
79 CTASSERT_SIZE_BIT(struct USB_ISTAT_t, 8); 79 CTASSERT_SIZE_BIT(struct USB_ISTAT_t, 8);
80 80
81 struct USB_ERRSTAT_t { 81 struct USB_ERRSTAT_t {
82 UNION_STRUCT_START(8); 82 UNION_STRUCT_START(8);
83 uint8_t piderr : 1; 83 uint8_t piderr : 1;
84 uint8_t crc5eof : 1; 84 uint8_t crc5eof : 1;
85 uint8_t crc16 : 1; 85 uint8_t crc16 : 1;
86 uint8_t dfn8 : 1; 86 uint8_t dfn8 : 1;
87 uint8_t btoerr : 1; 87 uint8_t btoerr : 1;
88 uint8_t dmaerr : 1; 88 uint8_t dmaerr : 1;
89 uint8_t _rsvd0 : 1; 89 uint8_t _rsvd0 : 1;
90 uint8_t btserr : 1; 90 uint8_t btserr : 1;
91 UNION_STRUCT_END; 91 UNION_STRUCT_END;
92 }; 92 };
93 CTASSERT_SIZE_BIT(struct USB_ERRSTAT_t, 8); 93 CTASSERT_SIZE_BIT(struct USB_ERRSTAT_t, 8);
94 94
95 struct USB_STAT_t { 95 struct USB_STAT_t {
96 UNION_STRUCT_START(8); 96 UNION_STRUCT_START(8);
97 uint8_t _rsvd0 : 2; 97 uint8_t _rsvd0 : 2;
98 enum usb_ep_pingpong pingpong : 1; 98 enum usb_ep_pingpong pingpong : 1;
99 enum usb_ep_dir dir : 1; 99 enum usb_ep_dir dir : 1;
100 uint8_t ep : 4; 100 uint8_t ep : 4;
101 UNION_STRUCT_END; 101 UNION_STRUCT_END;
102 }; 102 };
103 CTASSERT_SIZE_BIT(struct USB_STAT_t, 8); 103 CTASSERT_SIZE_BIT(struct USB_STAT_t, 8);
104 104
105 struct USB_CTL_t { 105 struct USB_CTL_t {
106 union { 106 union {
107 struct /* common */ { 107 struct /* common */ {
108 uint8_t _rsvd1 : 1; 108 uint8_t _rsvd1 : 1;
109 uint8_t oddrst : 1; 109 uint8_t oddrst : 1;
110 uint8_t resume : 1; 110 uint8_t resume : 1;
111 uint8_t _rsvd2 : 3; 111 uint8_t _rsvd2 : 3;
112 uint8_t se0 : 1; 112 uint8_t se0 : 1;
113 uint8_t jstate : 1; 113 uint8_t jstate : 1;
114 }; 114 };
115 struct /* host */ { 115 struct /* host */ {
116 uint8_t sofen : 1; 116 uint8_t sofen : 1;
117 uint8_t _rsvd3 : 2; 117 uint8_t _rsvd3 : 2;
118 uint8_t hostmodeen : 1; 118 uint8_t hostmodeen : 1;
119 uint8_t reset : 1; 119 uint8_t reset : 1;
120 uint8_t token_busy : 1; 120 uint8_t token_busy : 1;
121 uint8_t _rsvd4 : 2; 121 uint8_t _rsvd4 : 2;
122 }; 122 };
123 struct /* device */ { 123 struct /* device */ {
124 uint8_t usben : 1; 124 uint8_t usben : 1;
125 uint8_t _rsvd5 : 4; 125 uint8_t _rsvd5 : 4;
126 uint8_t txd_suspend : 1; 126 uint8_t txd_suspend : 1;
127 uint8_t _rsvd6 : 2; 127 uint8_t _rsvd6 : 2;
128 }; 128 };
129 uint8_t raw; 129 uint8_t raw;
130 }; 130 };
131 }; 131 };
132 CTASSERT_SIZE_BIT(struct USB_CTL_t, 8); 132 CTASSERT_SIZE_BIT(struct USB_CTL_t, 8);
133 133
134 struct USB_ADDR_t { 134 struct USB_ADDR_t {
135 UNION_STRUCT_START(8); 135 UNION_STRUCT_START(8);
136 uint8_t addr : 7; 136 uint8_t addr : 7;
137 uint8_t lsen : 1; 137 uint8_t lsen : 1;
138 UNION_STRUCT_END; 138 UNION_STRUCT_END;
139 }; 139 };
140 CTASSERT_SIZE_BIT(struct USB_ADDR_t, 8); 140 CTASSERT_SIZE_BIT(struct USB_ADDR_t, 8);
141 141
142 struct USB_TOKEN_t { 142 struct USB_TOKEN_t {
143 UNION_STRUCT_START(8); 143 UNION_STRUCT_START(8);
144 uint8_t endpt : 4; 144 uint8_t endpt : 4;
145 enum usb_tok_pid pid : 4; 145 enum usb_tok_pid pid : 4;
146 UNION_STRUCT_END; 146 UNION_STRUCT_END;
147 }; 147 };
148 CTASSERT_SIZE_BIT(struct USB_TOKEN_t, 8); 148 CTASSERT_SIZE_BIT(struct USB_TOKEN_t, 8);
149 149
150 struct USB_ENDPT_t { 150 struct USB_ENDPT_t {
151 UNION_STRUCT_START(8); 151 UNION_STRUCT_START(8);
152 uint8_t ephshk : 1; 152 uint8_t ephshk : 1;
153 uint8_t epstall : 1; 153 uint8_t epstall : 1;
154 uint8_t eptxen : 1; 154 uint8_t eptxen : 1;
155 uint8_t eprxen : 1; 155 uint8_t eprxen : 1;
156 uint8_t epctldis : 1; 156 uint8_t epctldis : 1;
157 uint8_t _rsvd0 : 1; 157 uint8_t _rsvd0 : 1;
158 uint8_t retrydis : 1; 158 uint8_t retrydis : 1;
159 uint8_t hostwohub : 1; 159 uint8_t hostwohub : 1;
160 UNION_STRUCT_END; 160 UNION_STRUCT_END;
161 }; 161 };
162 CTASSERT_SIZE_BIT(struct USB_ENDPT_t, 8); 162 CTASSERT_SIZE_BIT(struct USB_ENDPT_t, 8);
163 163
164 struct USB_USBCTRL_t { 164 struct USB_USBCTRL_t {
165 UNION_STRUCT_START(8); 165 UNION_STRUCT_START(8);
166 uint8_t _rsvd0 : 6; 166 uint8_t _rsvd0 : 6;
167 uint8_t pde : 1; 167 uint8_t pde : 1;
168 uint8_t susp : 1; 168 uint8_t susp : 1;
169 UNION_STRUCT_END; 169 UNION_STRUCT_END;
170 }; 170 };
171 CTASSERT_SIZE_BIT(struct USB_USBCTRL_t, 8); 171 CTASSERT_SIZE_BIT(struct USB_USBCTRL_t, 8);
172 172
173 struct USB_OBSERVE_t { 173 struct USB_OBSERVE_t {
174 UNION_STRUCT_START(8); 174 UNION_STRUCT_START(8);
175 uint8_t _rsvd0 : 4; 175 uint8_t _rsvd0 : 4;
176 uint8_t dmpd : 1; 176 uint8_t dmpd : 1;
177 uint8_t _rsvd1 : 1; 177 uint8_t _rsvd1 : 1;
178 uint8_t dppd : 1; 178 uint8_t dppd : 1;
179 uint8_t dppu : 1; 179 uint8_t dppu : 1;
180 UNION_STRUCT_END; 180 UNION_STRUCT_END;
181 }; 181 };
182 CTASSERT_SIZE_BIT(struct USB_OBSERVE_t, 8); 182 CTASSERT_SIZE_BIT(struct USB_OBSERVE_t, 8);
183 183
184 struct USB_CONTROL_t { 184 struct USB_CONTROL_t {
185 UNION_STRUCT_START(8); 185 UNION_STRUCT_START(8);
186 uint8_t _rsvd0 : 4; 186 uint8_t _rsvd0 : 4;
187 uint8_t dppullupnonotg : 1; 187 uint8_t dppullupnonotg : 1;
188 uint8_t _rsvd1 : 3; 188 uint8_t _rsvd1 : 3;
189 UNION_STRUCT_END; 189 UNION_STRUCT_END;
190 }; 190 };
191 CTASSERT_SIZE_BIT(struct USB_CONTROL_t, 8); 191 CTASSERT_SIZE_BIT(struct USB_CONTROL_t, 8);
192 192
193 struct USB_USBTRC0_t { 193 struct USB_USBTRC0_t {
194 UNION_STRUCT_START(8); 194 UNION_STRUCT_START(8);
195 uint8_t usb_resume_int : 1; 195 uint8_t usb_resume_int : 1;
196 uint8_t sync_det : 1; 196 uint8_t sync_det : 1;
197 uint8_t _rsvd0 : 3; 197 uint8_t _rsvd0 : 3;
198 uint8_t usbresmen : 1; 198 uint8_t usbresmen : 1;
199 uint8_t _rsvd1 : 1; 199 uint8_t _rsvd1 : 1;
200 uint8_t usbreset : 1; 200 uint8_t usbreset : 1;
201 UNION_STRUCT_END; 201 UNION_STRUCT_END;
202 }; 202 };
203 CTASSERT_SIZE_BIT(struct USB_USBTRC0_t, 8); 203 CTASSERT_SIZE_BIT(struct USB_USBTRC0_t, 8);
204 204
205 struct USB_t { 205 struct USB_t {
206 uint8_t perid; 206 uint8_t perid;
207 uint8_t _pad0[3]; 207 uint8_t _pad0[3];
208 uint8_t idcomp; 208 uint8_t idcomp;
209 uint8_t _pad1[3]; 209 uint8_t _pad1[3];
210 uint8_t rev; 210 uint8_t rev;
211 uint8_t _pad2[3]; 211 uint8_t _pad2[3];
212 struct USB_ADDINFO_t addinfo; 212 struct USB_ADDINFO_t addinfo;
213 uint8_t _pad3[3]; 213 uint8_t _pad3[3];
214 struct USB_OTGSTAT_t otgistat; 214 struct USB_OTGSTAT_t otgistat;
215 uint8_t _pad4[3]; 215 uint8_t _pad4[3];
216 struct USB_OTGSTAT_t otgicr; 216 struct USB_OTGSTAT_t otgicr;
217 uint8_t _pad5[3]; 217 uint8_t _pad5[3];
218 struct USB_OTGSTAT_t otgstat; 218 struct USB_OTGSTAT_t otgstat;
219 uint8_t _pad6[3]; 219 uint8_t _pad6[3];
220 struct USB_OTGCTL_t otgctl; 220 struct USB_OTGCTL_t otgctl;
221 uint8_t _pad7[3]; 221 uint8_t _pad7[3];
222 uint8_t _pad8[0x80 - 0x20]; 222 uint8_t _pad8[0x80 - 0x20];
223 struct USB_ISTAT_t istat; 223 struct USB_ISTAT_t istat;
224 uint8_t _pad9[3]; 224 uint8_t _pad9[3];
225 struct USB_ISTAT_t inten; 225 struct USB_ISTAT_t inten;
226 uint8_t _pad10[3]; 226 uint8_t _pad10[3];
227 struct USB_ERRSTAT_t errstat; 227 struct USB_ERRSTAT_t errstat;
228 uint8_t _pad11[3]; 228 uint8_t _pad11[3];
229 struct USB_ERRSTAT_t erren; 229 struct USB_ERRSTAT_t erren;
230 uint8_t _pad12[3]; 230 uint8_t _pad12[3];
231 struct USB_STAT_t stat; 231 struct USB_STAT_t stat;
232 uint8_t _pad13[3]; 232 uint8_t _pad13[3];
233 struct USB_CTL_t ctl; 233 struct USB_CTL_t ctl;
234 uint8_t _pad14[3]; 234 uint8_t _pad14[3];
235 struct USB_ADDR_t addr; 235 struct USB_ADDR_t addr;
236 uint8_t _pad15[3]; 236 uint8_t _pad15[3];
237 uint8_t bdtpage1; 237 uint8_t bdtpage1;
238 uint8_t _pad16[3]; 238 uint8_t _pad16[3];
239 uint8_t frmnuml; 239 uint8_t frmnuml;
240 uint8_t _pad17[3]; 240 uint8_t _pad17[3];
241 struct { 241 struct {
242 uint8_t frmnumh : 3; 242 uint8_t frmnumh : 3;
243 uint8_t _rsvd0 : 5; 243 uint8_t _rsvd0 : 5;
244 }; 244 };
245 uint8_t _pad18[3]; 245 uint8_t _pad18[3];
246 struct USB_TOKEN_t token; 246 struct USB_TOKEN_t token;
247 uint8_t _pad19[3]; 247 uint8_t _pad19[3];
248 uint8_t softhld; 248 uint8_t softhld;
249 uint8_t _pad20[3]; 249 uint8_t _pad20[3];
250 uint8_t bdtpage2; 250 uint8_t bdtpage2;
251 uint8_t _pad21[3]; 251 uint8_t _pad21[3];
252 uint8_t bdtpage3; 252 uint8_t bdtpage3;
253 uint8_t _pad22[3]; 253 uint8_t _pad22[3];
254 uint8_t _pad23[0xc0 - 0xb8]; 254 uint8_t _pad23[0xc0 - 0xb8];
255 struct { 255 struct {
256 struct USB_ENDPT_t; 256 struct USB_ENDPT_t;
257 uint8_t _pad24[3]; 257 uint8_t _pad24[3];
258 } endpt[16]; 258 } endpt[16];
259 struct USB_USBCTRL_t usbctrl; 259 struct USB_USBCTRL_t usbctrl;
260 uint8_t _pad25[3]; 260 uint8_t _pad25[3];
261 struct USB_OBSERVE_t observe; 261 struct USB_OBSERVE_t observe;
262 uint8_t _pad26[3]; 262 uint8_t _pad26[3];
263 struct USB_CONTROL_t control; 263 struct USB_CONTROL_t control;
264 uint8_t _pad27[3]; 264 uint8_t _pad27[3];
265 struct USB_USBTRC0_t usbtrc0; 265 struct USB_USBTRC0_t usbtrc0;
266 uint8_t _pad28[3]; 266 uint8_t _pad28[3];
267 uint8_t _pad29[4]; 267 uint8_t _pad29[4];
268 uint8_t usbfrmadjust; 268 uint8_t usbfrmadjust;
269 uint8_t _pad30[3]; 269 uint8_t _pad30[3];
270 }; 270 };
271 CTASSERT_SIZE_BYTE(struct USB_t, 0x118); 271 CTASSERT_SIZE_BYTE(struct USB_t, 0x118);
272 272
273 struct USB_BD_t { 273 struct USB_BD_t {
274 struct USB_BD_BITS_t { 274 struct USB_BD_BITS_t {
275 union { 275 union {
276 struct { 276 struct {
277 uint32_t _rsvd0 : 2; 277 uint32_t _rsvd0 : 2;
278 uint32_t stall : 1; 278 uint32_t stall : 1;
279 uint32_t dts : 1; 279 uint32_t dts : 1;
280 uint32_t ninc : 1; 280 uint32_t ninc : 1;
281 uint32_t keep : 1; 281 uint32_t keep : 1;
282 enum usb_data01 data01 : 1; 282 enum usb_data01 data01 : 1;
283 uint32_t own : 1; 283 uint32_t own : 1;
284 uint32_t _rsvd1 : 8; 284 uint32_t _rsvd1 : 8;
285 uint32_t bc : 10; 285 uint32_t bc : 10;
286 uint32_t _rsvd2 : 6; 286 uint32_t _rsvd2 : 6;
287 }; 287 };
288 struct /* processor */ { 288 struct /* processor */ {
289 uint32_t _rsvd5 : 2; 289 uint32_t _rsvd5 : 2;
290 enum usb_tok_pid tok_pid : 4; 290 enum usb_tok_pid tok_pid : 4;
291 uint32_t _rsvd6 : 26; 291 uint32_t _rsvd6 : 26;
292 }; 292 };
293 uint32_t raw; 293 uint32_t raw;
294 }; 294 };
295 }; 295 };
296 void *addr; 296 void *addr;
297 }; 297 };
298 CTASSERT_SIZE_BYTE(struct USB_BD_t, 8); 298 CTASSERT_SIZE_BYTE(struct USB_BD_t, 8);
299 299
300 extern volatile struct USB_t USB0; 300 extern volatile struct USB_t USB0;
301 301