diff options
Diffstat (limited to 'usb/usb_nrf_def.h')
-rw-r--r-- | usb/usb_nrf_def.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/usb/usb_nrf_def.h b/usb/usb_nrf_def.h new file mode 100644 index 0000000..0d56807 --- /dev/null +++ b/usb/usb_nrf_def.h @@ -0,0 +1,97 @@ +#ifndef LAKS_USB_USB_NRF_DEF_H +#define LAKS_USB_USB_NRF_DEF_H + +#include <stdint.h> + +class USB_NRF_t { + private: + struct tasks_t { + uint32_t _reserved; + volatile uint32_t STARTEPIN[8]; + volatile uint32_t STARTISOIN; + volatile uint32_t STARTEPOUT[8]; + volatile uint32_t STARTISOOUT; + volatile uint32_t EP0RCVOUT; + volatile uint32_t EP0STATUS; + volatile uint32_t EP0STALL; + volatile uint32_t DPDMDRIVE; + volatile uint32_t DPDMNODRIVE; + }; + + struct events_t { + volatile uint32_t USBRESET; + volatile uint32_t STARTED; + volatile uint32_t ENDEPIN[8]; + volatile uint32_t EP0DATADONE; + volatile uint32_t ENDISOIN; + volatile uint32_t ENDEPOUT[8]; + volatile uint32_t ENDISOOUT; + volatile uint32_t SOF; + volatile uint32_t USBEVENT; + volatile uint32_t EP0SETUP; + volatile uint32_t EPDATA; + }; + + struct reg_t { + volatile uint32_t SHORTS; + uint32_t _reserved[63]; + volatile uint32_t INTEN; + volatile uint32_t INTENSET; + volatile uint32_t INTENCLR; + uint32_t _reserved_1[61]; + volatile uint32_t EVENTCAUSE; + uint32_t _reserved_2[7]; + volatile uint32_t HALTED_EPIN[9]; + volatile uint32_t HALTED_EPOUT[9]; + volatile uint32_t EPSTATUS; + volatile uint32_t EPDATASTATUS; + volatile uint32_t USBADDR; + uint32_t _reserved_3[3]; + volatile uint32_t BMREQUESTTYPE; + volatile uint32_t BREQUEST; + volatile uint32_t WVALUEL; + volatile uint32_t WVALUEH; + volatile uint32_t WINDEXL; + volatile uint32_t WINDEXH; + volatile uint32_t WLENGTHL; + volatile uint32_t WLENGTHH; + volatile uint32_t SIZE_EPOUT[8]; + volatile uint32_t SIZE_ISOOUT; + uint32_t _reserved_4[15]; + volatile uint32_t ENABLE; + volatile uint32_t USBPULLUP; + volatile uint32_t DPDMVALUE; + volatile uint32_t DTOGGLE; + volatile uint32_t EPINEN; + volatile uint32_t EPOUTEN; + volatile uint32_t EPSTALL; + volatile uint32_t ISOSPLIT; + volatile uint32_t FRAMECNTR; + uint32_t _reserved_5[2]; + volatile uint32_t LOWPOWER; + volatile uint32_t ISOINCONFIG; + }; + + struct ep_reg_t { + volatile uint32_t PTR; + volatile uint32_t MAXCNT; + volatile uint32_t AMOUNT; + uint32_t _reserved[2]; + }; + + public: + tasks_t& tasks; + events_t& events; + reg_t& reg; + ep_reg_t* reg_in; + ep_reg_t* reg_out; + + USB_NRF_t(uint32_t reg_addr) : + tasks(*(tasks_t*)(reg_addr + 0x0)), + events(*(events_t*)(reg_addr + 0x100)), + reg(*(reg_t*)(reg_addr + 0x200)), + reg_in((ep_reg_t*)(reg_addr + 0x600)), + reg_out((ep_reg_t*)(reg_addr + 0x700)) {} +}; + +#endif |