📄 globals.hpp
字号:
struct {
USHORT PortConnected:1; // wPortStatus bit 0
USHORT PortEnabled:1; // wPortStatus bit 1
USHORT PortSuspended:1; // wPortStatus bit 2
USHORT PortOverCurrent:1; // wPortStatus bit 3
USHORT PortReset:1; // wPortStatus bit 4
USHORT Reserved:3; // wPortStatus bits 5-7
USHORT PortPower:1; // wPortStatus bit 8
USHORT DeviceIsLowSpeed:1; // wPortStatus bit 9
USHORT Reserved2:6; // wPortStatus bits 10-15
} port;
USHORT word;
} status;
union {
struct {
USHORT LocalPowerChange:1; // wHubChange bit 0
USHORT OverCurrentIndicatorChange:1; // wHubChange bit 1
USHORT Reserved2:14; // wHubChange bits 2-15
} hub;
struct {
USHORT ConnectStatusChange:1; // wPortChange bit 0
USHORT PortEnableChange:1; // wPortChange bit 1
USHORT SuspendChange:1; // wPortChange bit 2
USHORT OverCurrentChange:1; // wPortChange bit 3
USHORT ResetChange:1; // wPortChange bit 4
USHORT Reserved:11; // wPortChange bits 5-15
} port;
USHORT word;
} change;
} USB_HUB_AND_PORT_STATUS, *PUSB_HUB_AND_PORT_STATUS;
// this is the minimum packet size which can be safely scheduled
// for bandwidth reclamation
#define UHCD_MAX_RECLAMATION_PACKET_SIZE USHORT(64)
#ifdef __cplusplus
extern "C" DWORD g_IstThreadPriority;
#endif
#ifdef CE_PREv3
// CE versions prior to 3.0 only have eight priorities
#define DEFAULT_UHCD_IST_PRIORITY THREAD_PRIORITY_HIGHEST
#define RELATIVE_PRIO_ADJUST_FRAME 2 // UsbAdjustFrameLengthThread (low pri!)
#define RELATIVE_PRIO_STSCHG 1 // HubStatusChangeThread
#define RELATIVE_PRIO_DOWNSTREAM 1 // DetachDownstreamDeviceThread
#define RELATIVE_PRIO_CHECKDONE 0 // CheckForDoneTransfersThread
// Pre-3.0 versions also don't use the newer Get/SetPriority calls:
#define CeSetThreadPriority(t,p) SetThreadPriority(t,p)
#define CeGetThreadPriority(t) GetThreadPriority(t)
#else // 3.0 versions and later use a wider spread of priorities:
#define DEFAULT_UHCD_IST_PRIORITY 101 // UsbInterruptThread
#define RELATIVE_PRIO_ADJUST_FRAME 7 // UsbAdjustFrameLengthThread (low pri!)
#define RELATIVE_PRIO_STSCHG 5 // HubStatusChangeThread
#define RELATIVE_PRIO_DOWNSTREAM 3 // DetachDownstreamDeviceThread
#define RELATIVE_PRIO_CHECKDONE 1 // CheckForDoneTransfersThread
#endif // not PREv3 //
#ifdef OSV_LOCAL_MERLIN
// from usbtypes.h
#define USB_NOT_ACCESSED_ALT 0x0000000F // HCD maps this to E when encountered
#endif
#ifdef OSV_LOCAL_MERLIN
// from devload.h
#define DEVKEY_LEN 256 // Max length of registry key path name
#endif
#ifdef OSV_LOCAL_MERLIN
// from ohcdddsi.h
#ifdef __cplusplus
extern "C" {
#endif
/* @topic OHCD PDD functions |
* The following functions must be provided by the OHCD PDD code.
*
*/
/* @func BOOL | HcdPdd_DllMain | DLL Entry point for PDD portion of OHCI driver.
*
* @comm This function is provided to allow the PDD to perform any processing at
* DLL entry time. Generally, this function doesn't do much and most initialization
* should be performed in the <f HcdPdd_Init> routine.
*
* @rdesc Return TRUE if successful, FALSE if error occurs.
*/
BOOL HcdPdd_DllMain(
HANDLE hinstDLL, // @parm [IN] - Handle to DLL instance.
DWORD dwReason, // @parm [IN] - Reason code.
LPVOID lpvReserved);// @parm [IN] - System parameter.
/* @func DWORD | HcdPdd_Init | Initialize OHCI platform specific HW and structures.
*
* @comm PDD Entry point - called at system init to detect and configure OHCI card.
* As part of the processing for this function, the <f HcdMdd_CreateHcdObject>
* function should be called to initialize the MDD and OHCI hardware.
*
* @rdesc Return pointer to PDD specific data structure, or NULL if error.
*/
DWORD HcdPdd_Init(
DWORD dwContext); // @parm [IN] - Pointer to a string indicating our active registry key.
/* @func BOOL | HcdPdd_CheckConfigPower | Check power for requested configuration.
*
* @comm When a device is initially attached to the bus, OHCI selects a configuration based
* on the power requirements of the system, by calling this function for each
* configuration until one that can be supported is found. If no configurations
* in a device can be supported, the device is not configured.
*
* This allows the platform to perform additional processing if necessary (e.g.
* checking whether on AC or batteries, possibly sampling current system power
* status, etc).
*
* @rdesc Return TRUE if configuration can be supported, FALSE if not.
*/
BOOL HcdPdd_CheckConfigPower(
UCHAR bPort, // @parm [IN] - Root hub port # (1-N).
DWORD dwConfigPower, // @parm [IN] - Milliamps required by configuration.
DWORD dwTotalPower); // @parm [IN] - Power drawn by other devices on this port (ma).
/* @func void | HcdPdd_PowerUp | OHCD power up handler.
*
* @comm This function is called during the system power on sequence.
* In this function, the <f HcdMdd_PowerUp> function should be called to allow
* the MDD to restore state information. The OHCI memory area (as passed to
* <f HcdMdd_CreateHcdObject>) must be preserved across a suspend/resume cycle.
* Note that no system calls may be made from within this function.
*/
void HcdPdd_PowerUp(
DWORD dwDeviceContext); // @parm [IN] - Pointer to device context returned from <f HcdPdd_Init>
/* @func void | HcdPdd_PowerDown | OHCD power off handler.
*
* @comm This function is called during the system power off sequence.
* In this function, the <f HcdMdd_PowerDown> function should be called to allow
* the MDD to save state information. Then, any processing specific to the platform
* (e.g. removing power from the host controller hardware) can be done. Note that
* no system calls may be made from within this function.
*/
void HcdPdd_PowerDown(
DWORD dwDeviceContext); // @parm [IN] - Pointer to device context returned from <f HcdPdd_Init>
/* @func BOOL | HcdPdd_Deinit | OHCD deinitialization routine.
*
* @comm This function is called if the OHCI driver is unloaded. As part of the processing
* for this function, <f HcdMdd_DestroyHcdObject> should be called to allow the MDD
* to clean up internal data structures.
* @rdesc Return TRUE if deinit was successful, FALSE if error occurred.
*/
BOOL HcdPdd_Deinit(
DWORD dwDeviceContext); // @parm [IN] - Pointer to device context returned from <f HcdPdd_Init>
/* @func DWORD | HcdPdd_Open | OHCD open routine.
*
* @comm This is the standard stream interface driver open routine. It is currently unused.
* @rdesc For future compatibility, drivers should return 1.
*/
DWORD HcdPdd_Open(
DWORD dwDeviceContext, // @parm [IN] - Pointer to device context returned from <f HcdPdd_Init>
DWORD dwAccessCode, // @parm - Unused
DWORD dwShareMode); // @parm - Unused
/* @func BOOL | HcdPdd_Close | OHCD close routine.
*
* @comm This is the standard stream interface driver close routine. It is currently unused.
* @rdesc For future compatibility, drivers should return TRUE.
*/
BOOL HcdPdd_Close(
DWORD dwOpenContext); // @parm [IN] - Pointer to device context returned from <f HcdPdd_Init>
/* @func DWORD | HcdPdd_Read | OHCD read routine.
*
* @comm This is the standard stream interface driver read routine. It is currently unused.
* @rdesc For future compatibility, drivers should return -1.
*/
DWORD HcdPdd_Read(
DWORD dwOpenContext, // @parm [IN] - Pointer to device context returned from <f HcdPdd_Init>
LPVOID lpvBuffer,
DWORD dwCount);
/* @func DWORD | HcdPdd_Write | OHCD write routine.
*
* @comm This is the standard stream interface driver write routine. It is currently unused.
* @rdesc For future compatibility, drivers should return -1.
*/
DWORD HcdPdd_Write(
DWORD dwOpenContext, // @parm [IN] - Pointer to device context returned from <f HcdPdd_Init>
LPCVOID lpvSourceBytes,
DWORD dwNumberOfBytes);
/* @func DWORD | HcdPdd_Seek | OHCD seek routine.
*
* @comm This is the standard stream interface driver seek routine. It is currently unused.
* @rdesc For future compatibility, drivers should return -1.
*/
DWORD HcdPdd_Seek(
DWORD dwOpenContext, // @parm [IN] - Pointer to device context returned from <f HcdPdd_Init>
LONG lAmount,
DWORD dwType);
/* @func BOOL | HcdPdd_IOControl | OHCD ioctl routine.
*
* @comm This is the standard stream interface driver ioctl routine. It is currently unused.
* @rdesc For future compatibility, drivers should return FALSE.
*/
BOOL HcdPdd_IOControl(
DWORD dwOpenContext, // @parm [IN] - Pointer to device context returned from <f HcdPdd_Init>
DWORD dwCode,
PBYTE pbBufIn,
DWORD dwLenIn,
PBYTE pbBufOut,
DWORD dwLenOut,
PDWORD pdwActualOut);
/* @func void | HcdPdd_InitiatePowerUp.
*
* @comm This function will reinitialize the HCD after a Resume event. It should be called from the USB IST after a
* resume has been detected.
*
*/
void HcdPdd_InitiatePowerUp(DWORD dwDeviceContext);
#ifdef __cplusplus
}
#endif
#endif
// end of conditional inclusion based on OSV_LOCAL_MERLIN
#endif //_UHCD_GLOBALS_HPP_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -