You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.8KB

  1. #ifndef IMXRT_USBHS_H_
  2. #define IMXRT_USBHS_H_
  3. #if defined(__IMXRT1052__) || defined(__IMXRT1062__)
  4. // Allow USB host code written for "USBHS" on Teensy 3.6 to compile for "USB2" on Teensy 4.0
  5. #define IRQ_USBHS IRQ_USB2
  6. #define USBPHY_CTRL USBPHY2_CTRL
  7. #define USBPHY_CTRL_CLR USBPHY2_CTRL_CLR
  8. #define USBPHY_CTRL_SET USBPHY2_CTRL_SET
  9. #define USBHS_USBCMD USB2_USBCMD
  10. #define USBHS_USBSTS USB2_USBSTS
  11. #define USBHS_USBINTR USB2_USBINTR
  12. #define USBHS_FRINDEX USB2_FRINDEX
  13. #define USBHS_PERIODICLISTBASE USB2_PERIODICLISTBASE
  14. #define USBHS_ASYNCLISTADDR USB2_ASYNCLISTADDR
  15. #define USBHS_PORTSC1 USB2_PORTSC1
  16. #define USBHS_USBMODE USB2_USBMODE
  17. #define USBHS_GPTIMER0CTL USB2_GPTIMER0CTRL
  18. #define USBHS_GPTIMER0LD USB2_GPTIMER0LD
  19. #define USBHS_GPTIMER1CTL USB2_GPTIMER1CTRL
  20. #define USBHS_GPTIMER1LD USB2_GPTIMER1LD
  21. #define USBHS_USBCMD_ASE USB_USBCMD_ASE
  22. #define USBHS_USBCMD_IAA USB_USBCMD_IAA
  23. #define USBHS_USBCMD_RST USB_USBCMD_RST
  24. #define USBHS_USBCMD_ITC(n) USB_USBCMD_ITC(n)
  25. #define USBHS_USBCMD_RS USB_USBCMD_RS
  26. #define USBHS_USBCMD_ASP(n) USB_USBCMD_ASP(n)
  27. #define USBHS_USBCMD_ASPE USB_USBCMD_ASPE
  28. #define USBHS_USBCMD_PSE USB_USBCMD_PSE
  29. #define USBHS_USBCMD_FS2 USB_USBCMD_FS_2
  30. #define USBHS_USBCMD_FS(n) USB_USBCMD_FS_1(n)
  31. #define USBHS_USBSTS_AAI USB_USBSTS_AAI
  32. #define USBHS_USBSTS_AS USB_USBSTS_AS
  33. // UAI & UPI bits are undocumented in IMXRT, K66 pg 1602, RT1050 pg 2374
  34. #define USBHS_USBSTS_UAI ((uint32_t)(1<<18))
  35. #define USBHS_USBSTS_UPI ((uint32_t)(1<<19))
  36. #define USBHS_USBSTS_UEI USB_USBSTS_UEI
  37. #define USBHS_USBSTS_PCI USB_USBSTS_PCI
  38. #define USBHS_USBSTS_TI0 USB_USBSTS_TI0
  39. #define USBHS_USBSTS_TI1 USB_USBSTS_TI1
  40. #define USBHS_USBSTS_SEI USB_USBSTS_SEI
  41. #define USBHS_USBSTS_URI USB_USBSTS_URI
  42. #define USBHS_USBSTS_SLI USB_USBSTS_SLI
  43. #define USBHS_USBSTS_HCH USB_USBSTS_HCH
  44. #define USBHS_USBSTS_NAKI USB_USBSTS_NAKI
  45. #define USBHS_USBINTR_PCE USB_USBINTR_PCE
  46. #define USBHS_USBINTR_TIE0 USB_USBINTR_TIE0
  47. #define USBHS_USBINTR_TIE1 USB_USBINTR_TIE1
  48. #define USBHS_USBINTR_UEE USB_USBINTR_UEE
  49. #define USBHS_USBINTR_SEE USB_USBINTR_SEE
  50. #define USBHS_USBINTR_UPIE USB_USBINTR_UPIE
  51. #define USBHS_USBINTR_UAIE USB_USBINTR_UAIE
  52. #define USBHS_PORTSC_PP USB_PORTSC1_PP
  53. #define USBHS_PORTSC_OCC USB_PORTSC1_OCC
  54. #define USBHS_PORTSC_PEC USB_PORTSC1_PEC
  55. #define USBHS_PORTSC_CSC USB_PORTSC1_CSC
  56. #define USBHS_PORTSC_CCS USB_PORTSC1_CCS
  57. #define USBHS_PORTSC_PE USB_PORTSC1_PE
  58. #define USBHS_PORTSC_HSP USB_PORTSC1_HSP
  59. #define USBHS_PORTSC_FPR USB_PORTSC1_FPR
  60. #define USBHS_PORTSC_PR USB_PORTSC1_PR
  61. #define USBHS_GPTIMERCTL_RST USB_GPTIMERCTRL_GPTRST
  62. #define USBHS_GPTIMERCTL_RUN USB_GPTIMERCTRL_GPTRUN
  63. #define USBHS_USBMODE_CM(n) USB_USBMODE_CM(n)
  64. // TODO: what is the best setting for this register on IMXRT ???
  65. #define USBHS_USB_SBUSCFG USB2_SBUSCFG
  66. #endif // __IMXRT1052__ or __IMXRT1062__
  67. #endif // IMXRT_USBHS_H_