My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

UHS_max3421e.h 9.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /* Copyright (C) 2015-2016 Andrew J. Kroll
  2. and
  3. Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
  4. This software may be distributed and modified under the terms of the GNU
  5. General Public License version 2 (GPL2) as published by the Free Software
  6. Foundation and appearing in the file GPL2.TXT included in the packaging of
  7. this file. Please note that GPL2 Section 2[b] requires that all works based
  8. on this software must also be made publicly available under the terms of
  9. the GPL2 ("Copyleft").
  10. Contact information
  11. -------------------
  12. Circuits At Home, LTD
  13. Web : https://www.circuitsathome.com
  14. e-mail : support@circuitsathome.com
  15. */
  16. #if !defined(USB_HOST_SHIELD_H) || defined(_max3421e_h_)
  17. #error "Never include UHS_max3421e.h directly; include USB_HOST_SHIELD.h instead"
  18. #else
  19. #define _max3421e_h_
  20. /* MAX3421E register/bit names and bitmasks */
  21. #define SE0 0
  22. #define SE1 1
  23. #define FSHOST 2
  24. #define LSHOST 3
  25. /* MAX3421E command byte format: rrrrr0wa where 'r' is register number */
  26. //
  27. // MAX3421E Registers in HOST mode.
  28. //
  29. #define rRCVFIFO 0x08 // Receive FIFO Register
  30. #define rSNDFIFO 0x10 // Send FIFO Register
  31. #define rSUDFIFO 0x20 // Set Up Data FIFO Register
  32. #define rRCVBC 0x30 // Receive FIFO Byte Count Register
  33. #define rSNDBC 0x38 // Send FIFO Byte Count Register
  34. // USB Interrupt Request Status (USBIRQ)
  35. #define rUSBIRQ 0x68 // USB Interrupt Request Register
  36. #define bmVBUSIRQ 0x40 // Vbus Present Interrupt Request
  37. #define bmNOVBUSIRQ 0x20 // Vbus Absent Interrupt Request
  38. #define bmOSCOKIRQ 0x01 // Oscillator OK Interrupt Request
  39. // USB Interrupt Request Control (USBIEN)
  40. #define rUSBIEN 0x70 // USB Interrupt Request Enable Register
  41. #define bmVBUSIE bmVBUSIRQ // Vbus Present Interrupt Request Enable
  42. #define bmNOVBUSIE bmNOVBUSIRQ // Vbus Absent Interrupt Request Enable
  43. #define bmOSCOKIE bmOSCOKIRQ // Oscillator OK Interrupt Request Enable
  44. // (USBCTL)
  45. #define rUSBCTL 0x78 //15<<3
  46. #define bmCHIPRES 0x20 //b5
  47. #define bmPWRDOWN 0x10 //b4
  48. // (CPUCTL)
  49. #define rCPUCTL 0x80 //16<<3
  50. #define bmPULSEWID1 0x80 //b7
  51. #define bmPULSEWID0 0x40 //b6
  52. #define bmIE 0x01 //b0
  53. // bmPULSEWID1 bmPULSEWID0 Pulse width
  54. // 0 0 10.6uS
  55. // 0 1 5.3uS
  56. // 1 0 2.6uS
  57. // 1 1 1.3uS
  58. #define PULSEWIDTH10_6 (0)
  59. #define PULSEWIDTH5_3 (bmPULSEWID0)
  60. #define PULSEWIDTH2_6 (bmPULSEWID1)
  61. #define PULSEWIDTH1_3 (bmPULSEWID0 | bmPULSEWID1)
  62. // (PINCTL)
  63. #define rPINCTL 0x88 //17<<3
  64. #define bmFDUPSPI 0x10 //b4
  65. #define bmINTLEVEL 0x08 //b3
  66. #define bmPOSINT 0x04 //b2
  67. #define bmGPXB 0x02 //b1
  68. #define bmGPXA 0x01 //b0
  69. // GPX pin selections
  70. #define GPX_OPERATE 0x00 //
  71. #define GPX_VBDET 0x01 //
  72. #define GPX_BUSACT 0x02 //
  73. #define GPX_SOF 0x03 //
  74. #define rREVISION 0x90 //18<<3
  75. // (IOPINS1)
  76. #define rIOPINS1 0xA0 //20<<3
  77. #define bmGPOUT0 0x01 //
  78. #define bmGPOUT1 0x02 //
  79. #define bmGPOUT2 0x04 //
  80. #define bmGPOUT3 0x08 //
  81. #define bmGPIN0 0x10 //
  82. #define bmGPIN1 0x20 //
  83. #define bmGPIN2 0x40 //
  84. #define bmGPIN3 0x80 //
  85. // (IOPINS2)
  86. #define rIOPINS2 0xA8 //21<<3
  87. #define bmGPOUT4 0x01 //
  88. #define bmGPOUT5 0x02 //
  89. #define bmGPOUT6 0x04 //
  90. #define bmGPOUT7 0x08 //
  91. #define bmGPIN4 0x10 //
  92. #define bmGPIN5 0x20 //
  93. #define bmGPIN6 0x40 //
  94. #define bmGPIN7 0x80 //
  95. // (GPINIRQ)
  96. #define rGPINIRQ 0xB0 //22<<3
  97. #define bmGPINIRQ0 0x01 //
  98. #define bmGPINIRQ1 0x02 //
  99. #define bmGPINIRQ2 0x04 //
  100. #define bmGPINIRQ3 0x08 //
  101. #define bmGPINIRQ4 0x10 //
  102. #define bmGPINIRQ5 0x20 //
  103. #define bmGPINIRQ6 0x40 //
  104. #define bmGPINIRQ7 0x80 //
  105. // (GPINIEN)
  106. #define rGPINIEN 0xB8 //23<<3
  107. #define bmGPINIEN0 0x01 //
  108. #define bmGPINIEN1 0x02 //
  109. #define bmGPINIEN2 0x04 //
  110. #define bmGPINIEN3 0x08 //
  111. #define bmGPINIEN4 0x10 //
  112. #define bmGPINIEN5 0x20 //
  113. #define bmGPINIEN6 0x40 //
  114. #define bmGPINIEN7 0x80 //
  115. // (GPINPOL)
  116. #define rGPINPOL 0xC0 //24<<3
  117. #define bmGPINPOL0 0x01 //
  118. #define bmGPINPOL1 0x02 //
  119. #define bmGPINPOL2 0x04 //
  120. #define bmGPINPOL3 0x08 //
  121. #define bmGPINPOL4 0x10 //
  122. #define bmGPINPOL5 0x20 //
  123. #define bmGPINPOL6 0x40 //
  124. #define bmGPINPOL7 0x80 //
  125. //
  126. // If any data transfer errors occur, the HXFRDNIRQ asserts, while the RCVDAVIRQ does not.
  127. //
  128. // The CPU clears the SNDBAVIRQ by writing the SNDBC register.
  129. // The CPU should never directly clear the SNDBAVIRQ bit.
  130. // Host Interrupt Request Status (HIRQ)
  131. #define rHIRQ 0xC8 // Host Interrupt Request Register
  132. #define bmBUSEVENTIRQ 0x01 // BUS Reset Done or BUS Resume Interrupt Request
  133. #define bmRWUIRQ 0x02 // Remote Wakeup Interrupt Request
  134. #define bmRCVDAVIRQ 0x04 // Receive FIFO Data Available Interrupt Request
  135. #define bmSNDBAVIRQ 0x08 // Send Buffer Available Interrupt Request
  136. #define bmSUSDNIRQ 0x10 // Suspend operation Done Interrupt Request
  137. #define bmCONDETIRQ 0x20 // Peripheral Connect/Disconnect Interrupt Request
  138. #define bmFRAMEIRQ 0x40 // Frame Generator Interrupt Request
  139. #define bmHXFRDNIRQ 0x80 // Host Transfer Done Interrupt Request
  140. // IRQs that are OK for the CPU to clear
  141. #define ICLRALLBITS (bmBUSEVENTIRQ | bmRWUIRQ | bmRCVDAVIRQ | bmSUSDNIRQ | bmCONDETIRQ | bmFRAMEIRQ | bmHXFRDNIRQ)
  142. // Host Interrupt Request Control (HIEN)
  143. #define rHIEN 0xD0 //
  144. #define bmBUSEVENTIE bmBUSEVENTIRQ // BUS Reset Done or BUS Resume Interrupt Request Enable
  145. #define bmRWUIE bmRWUIRQ // Remote Wakeup Interrupt Request Enable
  146. #define bmRCVDAVIE bmRCVDAVIRQ // Receive FIFO Data Available Interrupt Request Enable
  147. #define bmSNDBAVIE bmSNDBAVIRQ // Send Buffer Available Interrupt Request Enable
  148. #define bmSUSDNIE bmSUSDNIRQ // Suspend operation Done Interrupt Request Enable
  149. #define bmCONDETIE bmCONDETIRQ // Peripheral Connect/Disconnect Interrupt Request Enable
  150. #define bmFRAMEIE bmFRAMEIRQ // Frame Generator Interrupt Request Enable
  151. #define bmHXFRDNIE bmHXFRDNIRQ // Host Transfer Done Interrupt Request Enable
  152. // (MODE))
  153. #define rMODE 0xD8 //27<<3
  154. #define bmHOST 0x01 //
  155. #define bmLOWSPEED 0x02 //
  156. #define bmHUBPRE 0x04 //
  157. #define bmSOFKAENAB 0x08 //
  158. #define bmSEPIRQ 0x10 //
  159. #define bmDELAYISO 0x20 //
  160. #define bmDMPULLDN 0x40 //
  161. #define bmDPPULLDN 0x80 //
  162. #define rPERADDR 0xE0 //28<<3
  163. // (HCTL)
  164. #define rHCTL 0xE8 //29<<3
  165. #define bmBUSRST 0x01 //
  166. #define bmFRMRST 0x02 //
  167. #define bmSAMPLEBUS 0x04 //
  168. #define bmSIGRSM 0x08 //
  169. #define bmRCVTOG0 0x10 //
  170. #define bmRCVTOG1 0x20 //
  171. #define bmSNDTOG0 0x40 //
  172. #define bmSNDTOG1 0x80 //
  173. // Host transfer (HXFR)
  174. #define rHXFR 0xF0 //30<<3
  175. /* Host transfer token values for writing the HXFR register (R30) */
  176. /* OR this bit field with the endpoint number in bits 3:0 */
  177. #define MAX3421E_tokSETUP 0x10 // HS=0, ISO=0, OUTNIN=0, SETUP=1
  178. #define MAX3421E_tokIN 0x00 // HS=0, ISO=0, OUTNIN=0, SETUP=0
  179. #define MAX3421E_tokOUT 0x20 // HS=0, ISO=0, OUTNIN=1, SETUP=0
  180. #define MAX3421E_tokINHS 0x80 // HS=1, ISO=0, OUTNIN=0, SETUP=0
  181. #define MAX3421E_tokOUTHS 0xA0 // HS=1, ISO=0, OUTNIN=1, SETUP=0
  182. #define MAX3421E_tokISOIN 0x40 // HS=0, ISO=1, OUTNIN=0, SETUP=0
  183. #define MAX3421E_tokISOOUT 0x60 // HS=0, ISO=1, OUTNIN=1, SETUP=0
  184. // (HRSL)
  185. #define rHRSL 0xF8 //31<<3
  186. #define bmRCVTOGRD 0x10 //
  187. #define bmSNDTOGRD 0x20 //
  188. #define bmKSTATUS 0x40 //
  189. #define bmJSTATUS 0x80 //
  190. #define bmSE0 0x00 //SE0 - disconnect state
  191. #define bmSE1 0xC0 //SE1 - illegal state
  192. #define MODE_FS_HOST (bmDPPULLDN|bmDMPULLDN|bmHOST|bmSOFKAENAB)
  193. #define MODE_LS_HOST (bmDPPULLDN|bmDMPULLDN|bmHOST|bmLOWSPEED|bmSOFKAENAB)
  194. #endif //_max3421e_h_