Embedded Xinu Operating System
An ongoing research project and educational operating system.
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
usb_dwc_regs.h
Go to the documentation of this file.
1 
6 /* Embedded Xinu, Copyright (C) 2013. All rights reserved. */
7 
8 #ifndef _USB_DWC_REGS_H_
9 #define _USB_DWC_REGS_H_
10 
11 #include <usb_util.h>
12 
18 #define DWC_NUM_CHANNELS 8
19 
37 struct dwc_regs {
38 
39  /* 0x000 : OTG Control */
40  uint32_t otg_control;
41 
42  /* 0x004 : OTG Interrupt */
43  uint32_t otg_interrupt;
44 
51 
53 #define DWC_AHB_INTERRUPT_ENABLE (1 << 0)
54 
68 #define BCM_DWC_AHB_AXI_WAIT (1 << 4)
69 
74 #define DWC_AHB_DMA_ENABLE (1 << 5)
75 
76  /* 0x01c : Core USB configuration */
77  uint32_t core_usb_configuration;
78 
79 
85  uint32_t core_reset;
86 
90 #define DWC_AHB_MASTER_IDLE (1 << 31)
91 
97 #define DWC_SOFT_RESET (1 << 0)
98 
110  uint32_t val;
111  struct {
112  uint32_t stuff : 3;
113 
117  uint32_t sof_intr : 1;
118 
119  uint32_t morestuff : 20;
120 
127  uint32_t port_intr : 1; /* Bit 24 */
128 
135  uint32_t host_channel_intr : 1; /* Bit 25 */
136 
137  uint32_t evenmorestuff : 6;
138  };
139  } core_interrupts;
140 
149 
150  /* 0x01c : Receive Status Queue Read */
151  uint32_t receive_status;
152 
153  /* 0x020 : Receive Status Queue Read & Pop */
154  uint32_t receive_status_pop;
155 
165  uint32_t rx_fifo_size;
166 
180 
181  /* 0x02c : Non Periodic Transmit FIFO/Queue Status Register */
182  uint32_t nonperiodic_tx_fifo_status;
183 
184  /* 0x030 */
185  uint32_t i2c_control;
186 
187  /* 0x034 */
188  uint32_t phy_vendor_control;
189 
190  /* 0x038 */
191  uint32_t gpio;
192 
193  /* 0x03c */
194  uint32_t user_id;
195 
196  /* 0x040 */
197  uint32_t vendor_id;
198 
199  /* 0x044 */
200  uint32_t hwcfg1;
201 
202  /* 0x048 */
203  uint32_t hwcfg2;
204 
226  uint32_t hwcfg3;
227 
228  /* 0x050 */
229  uint32_t hwcfg4;
230 
231  /* 0x054 */
232  uint32_t core_lpm_configuration;
233 
234  /* 0x058 */
235  uint32_t global_powerDn;
236 
237  /* 0x05c */
238  uint32_t global_fifo_config;
239 
240  /* 0x060 */
241  uint32_t adp_control;
242 
243  /* 0x064 */
244  uint32_t reserved_0x64[39];
245 
259 
260  /* TODO */
261  uint32_t stuff[191];
262 
273  /* 0x400 */
274  uint32_t host_configuration;
275 
276  /* 0x404 */
277  uint32_t host_frame_interval;
278 
279  /* 0x408 */
280  uint32_t host_frame_number;
281 
282  /* 0x40c */
283  uint32_t host_reserved_0x40c;
284 
285  /* 0x410 */
286  uint32_t host_fifo_status;
287 
297 
307 
308  /* 0x41c */
309  uint32_t host_frame_list;
310 
311  /* 0x420 */
312  uint32_t host_reserved_0x420[8];
313 
327  uint32_t val;
328  struct {
335  uint32_t connected : 1; /* Bit 0 */
336 
343  uint32_t connected_changed : 1; /* Bit 1 */
344 
353  uint32_t enabled : 1; /* Bit 2 */
354 
361  uint32_t enabled_changed : 1; /* Bit 3 */
362 
369  uint32_t overcurrent : 1; /* Bit 4 */
370 
377  uint32_t overcurrent_changed : 1; /* Bit 5 */
378 
382  uint32_t resume : 1; /* Bit 6 */
383 
387  uint32_t suspended : 1; /* Bit 7 */
388 
394  uint32_t reset : 1; /* Bit 8 */
395 
396  uint32_t reserved : 1; /* Bit 9 */
397 
403  uint32_t line_status : 2; /* Bits 10-11*/
404 
412  uint32_t powered : 1; /* Bit 12 */
413 
414  uint32_t test_control : 4; /* Bits 13-16 */
415 
424  uint32_t speed : 2; /* Bits 17-18 */
425 
426  uint32_t reserved2 : 13; /* Bits 19-32 */
427 
428  };
429  } host_port_ctrlstatus;
430 
431  uint32_t host_reserved_0x444[47];
432 
442 
456  uint32_t val;
457  struct {
463  uint32_t max_packet_size : 11; /* Bits 0-10 */
464 
469  uint32_t endpoint_number : 4; /* Bits 11-14 */
470 
475  uint32_t endpoint_direction : 1; /* Bit 15 */
476 
477  uint32_t reserved : 1; /* Bit 16 */
478 
484  uint32_t low_speed : 1; /* Bit 17 */
485 
490  uint32_t endpoint_type : 2; /* Bits 18-19 */
491 
499  uint32_t packets_per_frame : 2; /* Bits 20-21 */
500 
506  uint32_t device_address : 7; /* Bits 22-28 */
507 
515  uint32_t odd_frame : 1; /* Bit 29 */
516 
522  uint32_t channel_disable : 1; /* Bit 30 */
523 
531  uint32_t channel_enable : 1; /* Bit 31 */
532  };
533  } characteristics;
534 
549  uint32_t val;
550  struct {
555  uint32_t port_address : 7; /* Bits 0-6 */
556 
566  uint32_t hub_address : 7; /* Bits 7-13 */
567 
571  uint32_t transaction_position : 2; /* Bits 14-15 */
572 
582  uint32_t complete_split : 1; /* Bit 16 */
583 
584  uint32_t reserved : 14; /* Bits 17-30 */
585 
589  uint32_t split_enable : 1; /* Bit 31 */
590  };
591  } split_control;
592 
608  uint32_t val;
609  struct {
632  uint32_t transfer_completed : 1; /* Bit 0 */
633 
667  uint32_t channel_halted : 1; /* Bit 1 */
668 
673  uint32_t ahb_error : 1; /* Bit 2 */
674 
679  uint32_t stall_response_received : 1; /* Bit 3 */
680 
692  uint32_t nak_response_received : 1; /* Bit 4 */
693 
698  uint32_t ack_response_received : 1; /* Bit 5 */
699 
703  uint32_t nyet_response_received : 1; /* Bit 6 */
704 
709  uint32_t transaction_error : 1; /* Bit 7 */
710 
714  uint32_t babble_error : 1; /* Bit 8 */
715 
719  uint32_t frame_overrun : 1; /* Bit 9 */
720 
726  uint32_t data_toggle_error : 1; /* Bit 10 */
727 
728  uint32_t buffer_not_available : 1; /* Bit 11 */
729  uint32_t excess_transaction_error : 1; /* Bit 12 */
730  uint32_t frame_list_rollover : 1; /* Bit 13 */
731  uint32_t reserved : 18; /* Bits 14-31 */
732  };
733  } interrupts;
734 
743 
751  uint32_t val;
752  struct {
778  uint32_t size : 19; /* Bits 0-18 */
779 
794  uint32_t packet_count : 10; /* Bits 19-28 */
795 
820  uint32_t packet_id : 2; /* Bits 29-30 */
821 
825  uint32_t do_ping : 1; /* Bit 31 */
826  };
827  } transfer;
828 
849  uint32_t dma_address;
850 
851  uint32_t reserved_1;
852  uint32_t reserved_2;
853  } host_channels[DWC_NUM_CHANNELS];
854 
855  uint32_t host_reserved_after_channels[(0x800 - 0x500 -
856  (DWC_NUM_CHANNELS * sizeof(struct dwc_host_channel))) /
857  sizeof(uint32_t)];
858 
861  /* 0x800 */
862 
863  uint32_t reserved_0x800[(0xe00 - 0x800) / sizeof(uint32_t)];
864 
865  /* 0xe00 : Power and Clock Gating Control Register */
866  uint32_t power;
867 };
868 
869 /* Make sure the registers are declared correctly. This is dummy code that will
870  * be compiled into nothing. */
871 static inline void _dwc_check_regs(void)
872 {
873  STATIC_ASSERT(offsetof(struct dwc_regs, vendor_id) == 0x40);
874  STATIC_ASSERT(offsetof(struct dwc_regs, host_periodic_tx_fifo_size) == 0x100);
875  STATIC_ASSERT(offsetof(struct dwc_regs, host_configuration) == 0x400);
876  STATIC_ASSERT(offsetof(struct dwc_regs, host_port_ctrlstatus) == 0x440);
877  STATIC_ASSERT(offsetof(struct dwc_regs, reserved_0x800) == 0x800);
878  STATIC_ASSERT(offsetof(struct dwc_regs, power) == 0xe00);
879 }
880 
881 #endif /* _USB_DWC_REGS_H_ */
uint32_t channel_halted
Definition: usb_dwc_regs.h:667
uint32_t do_ping
Definition: usb_dwc_regs.h:825
Definition: usb_dwc_regs.h:326
uint32_t reset
Definition: usb_dwc_regs.h:394
uint32_t endpoint_direction
Definition: usb_dwc_regs.h:475
union dwc_host_channel_interrupts interrupt_mask
Definition: usb_dwc_regs.h:742
uint32_t low_speed
Definition: usb_dwc_regs.h:484
uint32_t channel_disable
Definition: usb_dwc_regs.h:522
Definition: usb_dwc_regs.h:441
Definition: usb_dwc_regs.h:109
uint32_t speed
Definition: usb_dwc_regs.h:424
uint32_t hub_address
Definition: usb_dwc_regs.h:566
uint32_t host_channels_interrupt
Definition: usb_dwc_regs.h:296
uint32_t ahb_configuration
Definition: usb_dwc_regs.h:50
Definition: usb_dwc_regs.h:37
uint32_t suspended
Definition: usb_dwc_regs.h:387
uint32_t host_channel_intr
Definition: usb_dwc_regs.h:135
uint32_t transfer_completed
Definition: usb_dwc_regs.h:632
#define DWC_NUM_CHANNELS
Definition: usb_dwc_regs.h:18
uint32_t size
Definition: usb_dwc_regs.h:778
uint32_t connected
Definition: usb_dwc_regs.h:335
uint32_t transaction_error
Definition: usb_dwc_regs.h:709
uint32_t dma_address
Definition: usb_dwc_regs.h:849
union dwc_core_interrupts core_interrupt_mask
Definition: usb_dwc_regs.h:148
uint32_t connected_changed
Definition: usb_dwc_regs.h:343
uint32_t stall_response_received
Definition: usb_dwc_regs.h:679
uint32_t port_address
Definition: usb_dwc_regs.h:555
uint32_t endpoint_type
Definition: usb_dwc_regs.h:490
uint32_t ack_response_received
Definition: usb_dwc_regs.h:698
uint32_t enabled
Definition: usb_dwc_regs.h:353
uint32_t core_reset
Definition: usb_dwc_regs.h:85
uint32_t nonperiodic_tx_fifo_size
Definition: usb_dwc_regs.h:179
uint32_t device_address
Definition: usb_dwc_regs.h:506
uint32_t data_toggle_error
Definition: usb_dwc_regs.h:726
uint32_t rx_fifo_size
Definition: usb_dwc_regs.h:165
uint32_t nak_response_received
Definition: usb_dwc_regs.h:692
uint32_t host_channels_interrupt_mask
Definition: usb_dwc_regs.h:306
uint32_t split_enable
Definition: usb_dwc_regs.h:589
uint32_t powered
Definition: usb_dwc_regs.h:412
uint32_t resume
Definition: usb_dwc_regs.h:382
uint32_t packets_per_frame
Definition: usb_dwc_regs.h:499
uint32_t line_status
Definition: usb_dwc_regs.h:403
double power(double base, int exp)
Definition: trig.c:22
uint32_t packet_id
Definition: usb_dwc_regs.h:820
uint32_t overcurrent_changed
Definition: usb_dwc_regs.h:377
uint32_t odd_frame
Definition: usb_dwc_regs.h:515
uint32_t frame_overrun
Definition: usb_dwc_regs.h:719
uint32_t ahb_error
Definition: usb_dwc_regs.h:673
uint32_t transaction_position
Definition: usb_dwc_regs.h:571
uint32_t babble_error
Definition: usb_dwc_regs.h:714
uint32_t overcurrent
Definition: usb_dwc_regs.h:369
uint32_t hwcfg3
Definition: usb_dwc_regs.h:226
uint32_t enabled_changed
Definition: usb_dwc_regs.h:361
uint32_t port_intr
Definition: usb_dwc_regs.h:127
uint32_t complete_split
Definition: usb_dwc_regs.h:582
uint32_t endpoint_number
Definition: usb_dwc_regs.h:469
uint32_t sof_intr
Definition: usb_dwc_regs.h:117
uint32_t host_periodic_tx_fifo_size
Definition: usb_dwc_regs.h:258
uint32_t packet_count
Definition: usb_dwc_regs.h:794
uint32_t channel_enable
Definition: usb_dwc_regs.h:531
uint32_t nyet_response_received
Definition: usb_dwc_regs.h:703
uint32_t max_packet_size
Definition: usb_dwc_regs.h:463