USBHost.h
上传用户:hjhsjcl
上传日期:2020-09-25
资源大小:11378k
文件大小:5k
源码类别:

压缩解压

开发平台:

C++ Builder

  1. /*******************************************************************
  2.  *
  3.  *  Copyright (C) 2002 ALI Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:   Uhc.h
  6.  *
  7.  *  Contents:    define functions in Uhc.c
  8.  *
  9.  *  History:
  10.  *   Date            By Reason
  11.  *   ===========    ======= ====================
  12.  *    12/26/2002       stonezhu       development
  13.  * 23/06/2003       Steven   modified
  14.  * 17/10/2003 Steven modified
  15. *******************************************************************/
  16. //add by tne for USB write protect
  17. //#define CMD_MODE_SENSE_10 0x5A
  18. #define NULL 0
  19. #ifdef _USB_HOST_H_
  20. #define EXTERN
  21. #else
  22. #define EXTERN extern
  23. #endif
  24. //const
  25. //DMA Control/Status Resigter
  26. #define BULK_EN 0x80
  27. #define BULK_DISJ 0x7F
  28. #define BULK_OUT 0x40
  29. #define BULK_INJ 0xB0
  30. #define HOST_STOP 0x20
  31. #define HOST_STOP_DISJ 0xDF
  32. #define FIFO_CLR_DIS 0x10
  33. #define FIFO_CLR_ENJ 0xEF
  34. #define FRC_EOT 0x08
  35. #define BUF_EMPTY 0x04
  36. // usb Host Enable/Disable interupt
  37. #define ENABLE_USB_CONNECTION       0x01
  38. #define ENABLE_USB_RESET            0x02
  39. #define ENABLE_USB_SUSPEND          0x04
  40. #define ENABLE_USB_PORT_ERROR       0x08
  41. #define ENABLE_USB_SOF              0x10
  42. #define ENABLE_USB_DMA_FINISH       0x20
  43. #define ENABLE_EPC_FINISH_ERROR     0x01
  44. #define ENABLE_EPB_FINISH_ERROR     0x02
  45. #define ENABLE_EPA_FINISH_ERROR     0x04
  46. #define ENABLE_EP0_FINISH_ERROR     0x08
  47. #define ENABLE_EPC_FINISH_OK        0x10
  48. #define ENABLE_EPB_FINISH_OK        0x20
  49. #define ENABLE_EPA_FINISH_OK        0x40
  50. #define ENABLE_EP0_FINISH_OK        0x80
  51. #define DISABLE_USB_CONNECTION      0xFE
  52. #define DISABLE_USB_RESET            0xFD
  53. #define DISABLE_USB_SUSPEND          0xFB
  54. #define DISABLE_USB_PORT_ERROR 0xF7
  55. #define DISABLE_USB_SOF              0xEF
  56. #define DISABLE_USB_DMA_FINISH       0xDF
  57. #define DISABLE_EPC_FINISH_ERROR 0xFE
  58. #define DISABLE_EPB_FINISH_ERROR 0xFD
  59. #define DISABLE_EPA_FINISH_ERROR 0xFB
  60. #define DISABLE_EP0_FINISH_ERROR 0xF7
  61. #define DISABLE_EPC_FINISH_OK 0xEF
  62. #define DISABLE_EPB_FINISH_OK 0xDF
  63. #define DISABLE_EPA_FINISH_OK 0xBF
  64. #define DISABLE_EP0_FINISH_OK 0x7F
  65. // Endpoint  Fifo Control Register
  66. #define EP0_FIFO_EMPTY          0x80
  67. #define EP0_FIFO_FULL           0x40
  68. #define EP0_FIFO_FORCE_SEND     0x20
  69. #define EP0_FIFO_CLEAR          0x10
  70. #define EP0_FIFO_NORMAL         0xEF
  71. #define EP0_FIFO_PID_SETUP      0x00
  72. #define EP0_FIFO_PID_OUT        0x01
  73. #define EP0_FIFO_PID_IN         0x02
  74. #define EP0_FIFO_PID_CLEAR      0xFC
  75. #define EPA_FIFO_EMPTY          0x80
  76. #define EPA_FIFO_FULL           0x40
  77. #define EPA_FIFO_FORCE_SEND     0x20
  78. #define EPA_FIFO_CLEAR          0x10
  79. #define EPA_FIFO_NORMAL         0xEF
  80. #define EPB_FIFO_EMPTY          0x80
  81. #define EPB_FIFO_FULL           0x40
  82. #define EPB_FIFO_FORCE_IN       0x20
  83. #define EPB_FIFO_CLEAR          0x10
  84. #define EPB_FIFO_NORMAL         0xEF
  85. // Usb setup packet bRequest
  86. #define CLEAR_FEATURE  0x01
  87. #define GET_CONFIGURATION 0x08
  88. #define GET_DESCRIPTOR    0x06
  89. #define GET_INTERFACE    10
  90. #define GET_STATUS     0
  91. #define SET_ADDRESS   5
  92. #define SET_CONFIGURATION 9
  93. #define SET_FEATURE   3
  94. #define SET_INTERFACE  11
  95. #define SYNCH_FRAME   12
  96. // Usb endpoint type
  97. #define BULK_ENDPOINT     0x02
  98. #define CONTROL_ENDPOINT  0x00
  99. #define ISO_ENDPOINT      0x01
  100. #define INT_ENDPOINT      0x03
  101. #define EP0 0x00
  102. #define EPA 0x01
  103. #define EPB 0x02
  104. #define EPC 0x03
  105. // Usb descriptor type
  106. #define DEVICE   1
  107. #define CONFIGURATION 2
  108. #define STRING  3
  109. #define INTERFACE 4
  110. #define ENDPOINT 5
  111. #define OTG 9
  112. #define MASS_STORAGE_CLASS 8
  113. #define BULK_ONLY  0x50
  114. #define CBI  0x00
  115. #define CB  0x01
  116. // Usb descriptor length
  117. #define DEVICE_LENGTH  0x12
  118. #define CONFIGURATION_LENGTH 0x9
  119. #define INTERFACE_LENGTH 0x9
  120. #define ENDPOINT_LENGTH 0x7
  121. /*==========================================================================
  122. Copyright (c) 2004 ALi Corporation. All Rights Reserved
  123. File: Host.h
  124. content: 
  125. History: Created by Ideal Xiong 2004/07/05
  126.  
  127. ==========================================================================*/
  128. /*******************************************************************
  129.  *
  130.  *  Copyright (C) 2002 ALI Corporation.  All Rights Reserved.
  131.  *
  132.  *  File:   UsbHost.h
  133.  *
  134.  *  Contents:    define m5637 some error number
  135.  *
  136.  *  History:
  137.  *   Date            By Reason
  138.  *   ===========    ======= ====================
  139.  *  23/06/2003       Steven      Development
  140.  *    17/10/2003 Steven modified
  141.  * 07/2005 Allen devolepment for 5661
  142. *******************************************************************/
  143. //functions
  144. API void UmsRequestSense(void) large;
  145. API BYTE UmsSendPIOCmd(BYTE Cmd) large;
  146. #if(_HOST_API_INIT_)
  147. EXTERN API bit UsbHostInit(void) large; //050105 050710
  148. #endif
  149. #if(_HOST_COMMON_)
  150. EXTERN API bit UsbHostRead(void) large; //050105
  151. EXTERN API bit UsbHostWrite(void) large; //050105
  152. #endif
  153. #if(_HOST_COPY_&&_HOST_COMMON_) //050919
  154. EXTERN API bit UsbHostCopyRw(bit Readflag,BYTE bType) large; //050710
  155. #endif
  156. #undef EXTERN
  157. #undef _AT_