Source code of Windows XP (NT5)
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.

196 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. usb2lib.h
  5. Abstract:
  6. interface to the usb2 library
  7. Environment:
  8. Kernel & user mode
  9. Revision History:
  10. 10-31-00 : created
  11. --*/
  12. #ifndef __USB2LIB_H__
  13. #define __USB2LIB_H__
  14. #define PUSB2LIB_HC_CONTEXT PVOID
  15. #define PUSB2LIB_ENDPOINT_CONTEXT PVOID
  16. #define PUSB2LIB_TT_CONTEXT PVOID
  17. #define Budget_Iso 0
  18. #define Budget_Interrupt 1
  19. #define Budget_In 0
  20. #define Budget_Out 1
  21. #define Budget_LowSpeed 0
  22. #define Budget_FullSpeed 1
  23. #define Budget_HighSpeed 2
  24. #define SIG_LIB_HC 'chbl' //lbhc
  25. #define SIG_LIB_TT 'ttbl' //lbtt
  26. #define SIG_LIB_EP 'pebl' //lbep
  27. typedef struct _REBALANCE_LIST {
  28. PVOID RebalanceContext[0];
  29. } REBALANCE_LIST, *PREBALANCE_LIST;
  30. typedef struct _USB2LIB_BUDGET_PARAMETERS {
  31. /* input */
  32. UCHAR TransferType; // Budget_Iso
  33. UCHAR Speed; // Budget_Interrupt
  34. UCHAR Direction; // Budget_FullSpeed, Budget_HighSpeed, Budget_LowSpeed
  35. UCHAR Pad1; // Round out to dword
  36. ULONG MaxPacket; // MaxPacketSize
  37. /* input, output */
  38. // period is specified in frames for FS, LS
  39. // or microframes for HS, period is set to
  40. // the actual period assigned (may be less
  41. // than requested)
  42. ULONG Period;
  43. } USB2LIB_BUDGET_PARAMETERS, *PUSB2LIB_BUDGET_PARAMETERS;
  44. #define USBP2LIBFN __stdcall
  45. /*
  46. client entry points
  47. */
  48. /*
  49. VOID
  50. USB2LIB_DbgPrint(
  51. PCH Format,
  52. PVOID Arg0,
  53. PVOID Arg1,
  54. PVOID Arg2,
  55. PVOID Arg3,
  56. PVOID Arg4,
  57. PVOID Arg5
  58. );
  59. */
  60. typedef VOID
  61. (USBP2LIBFN *PUSB2LIB_DBGPRINT) (
  62. PCHAR,
  63. int,
  64. int,
  65. int,
  66. int,
  67. int,
  68. int
  69. );
  70. /*
  71. VOID
  72. USB2LIB_DbgBreak(
  73. );
  74. */
  75. typedef VOID
  76. (USBP2LIBFN *PUSB2LIB_DBGBREAK) (
  77. );
  78. /* LIB interface functions */
  79. VOID
  80. USB2LIB_InitializeLib(
  81. PULONG HcContextSize,
  82. PULONG EndpointContextSize,
  83. PULONG TtContextSize,
  84. PUSB2LIB_DBGPRINT Usb2LibDbgPrint,
  85. PUSB2LIB_DBGBREAK Usb2LibDbgBreak
  86. );
  87. VOID
  88. USB2LIB_InitController(
  89. PUSB2LIB_HC_CONTEXT HcContext
  90. );
  91. VOID
  92. USB2LIB_InitTt(
  93. PUSB2LIB_HC_CONTEXT HcContext,
  94. PUSB2LIB_TT_CONTEXT TtContext
  95. );
  96. BOOLEAN
  97. USB2LIB_AllocUsb2BusTime(
  98. PUSB2LIB_HC_CONTEXT HcContext, // Host Controller Context
  99. PUSB2LIB_TT_CONTEXT TtContext, // Transaction Translater Context
  100. PUSB2LIB_ENDPOINT_CONTEXT EndpointContext, // Endpoint Context
  101. PUSB2LIB_BUDGET_PARAMETERS BudgetParameters, // Budget Parameters
  102. PVOID RebalanceContext, // Driver Endpoint Context
  103. PVOID RebalanceList, // List of endpoints to be rebalanced
  104. PULONG RebalanceListEntries // Number of endpoints to be rebalanced
  105. );
  106. VOID
  107. USB2LIB_FreeUsb2BusTime(
  108. PUSB2LIB_HC_CONTEXT HcContext,
  109. PUSB2LIB_TT_CONTEXT TtContext,
  110. PUSB2LIB_ENDPOINT_CONTEXT EndpointContext,
  111. PVOID RebalanceList,
  112. PULONG RebalanceListEntries
  113. );
  114. UCHAR
  115. USB2LIB_GetSMASK(PUSB2LIB_ENDPOINT_CONTEXT Context);
  116. UCHAR
  117. USB2LIB_GetCMASK(PUSB2LIB_ENDPOINT_CONTEXT Context);
  118. UCHAR
  119. USB2LIB_GetStartMicroFrame(PUSB2LIB_ENDPOINT_CONTEXT Context);
  120. UCHAR
  121. USB2LIB_GetStartFrame(PUSB2LIB_ENDPOINT_CONTEXT Context);
  122. UCHAR
  123. USB2LIB_GetPromotedThisTime(PUSB2LIB_ENDPOINT_CONTEXT EndpointContext);
  124. UCHAR
  125. USB2LIB_GetNewPeriod(PUSB2LIB_ENDPOINT_CONTEXT EndpointContext);
  126. ULONG
  127. USB2LIB_GetScheduleOffset(PUSB2LIB_ENDPOINT_CONTEXT EndpointContext);
  128. ULONG
  129. USB2LIB_GetAllocedBusTime(PUSB2LIB_ENDPOINT_CONTEXT EndpointContext);
  130. PVOID
  131. USB2LIB_GetNextEndpoint(PUSB2LIB_ENDPOINT_CONTEXT EndpointContext);
  132. // Debug only
  133. PVOID
  134. USB2LIB_GetEndpoint(PUSB2LIB_ENDPOINT_CONTEXT EndpointContext);
  135. #undef PUSB2LIB_HC_CONTEXT
  136. #undef PUSB2LIB_ENDPOINT_CONTEXT
  137. #undef PUSB2LIB_TT_CONTEXT
  138. #endif /* __USB2LIB_H__ */