📄 cuhcd.hpp
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Module Name:
// CUhcd.hpp
//
// Abstract: CUhcd implements the HCDI interface. It mostly
// just passes requests on to other objects, which
// do the real work.
//
// Notes:
//
#ifndef __CUHCD_HPP__
#define __CUHCD_HPP__
#include "globals.hpp"
class CUhcd;
// this class gets passed into the CUhcd Initialize routine
class CPhysMem;
// this class is our access point to all USB devices
class CRootHub;
class CUhcd
{
public:
// ****************************************************
// Public Functions for CUhcd
// ****************************************************
CUhcd();
~CUhcd();
// These functions are called by the HCDI interface
BOOL Initialize( IN LPVOID pvUhcdPddObject,
IN CPhysMem * pCPhysMem,
IN LPCWSTR szDriverRegistryKey,
IN REGISTER portBase,
IN DWORD dwSysIntr);
BOOL GetFrameNumber( OUT LPDWORD lpdwFrameNumber );
BOOL GetFrameLength( OUT LPUSHORT lpuFrameLength );
BOOL SetFrameLength( IN HANDLE hEvent,
IN USHORT uFrameLength );
BOOL StopAdjustingFrame( void );
BOOL OpenPipe( IN UINT address,
IN LPCUSB_ENDPOINT_DESCRIPTOR lpEndpointDescriptor,
OUT LPUINT lpPipeIndex );
BOOL ClosePipe( IN UINT address,
IN UINT pipeIndex );
BOOL IssueTransfer( IN UINT address,
IN UINT pipeIndex,
IN LPTRANSFER_NOTIFY_ROUTINE lpStartAddress,
IN LPVOID lpvNotifyParameter,
IN DWORD dwFlags,
IN LPCVOID lpvControlHeader,
IN DWORD dwStartingFrame,
IN DWORD dwFrames,
IN LPCDWORD aLengths,
IN DWORD dwBufferSize,
IN_OUT LPVOID lpvBuffer,
IN ULONG paBuffer,
IN LPCVOID lpvCancelId,
OUT LPDWORD adwIsochErrors,
OUT LPDWORD adwIsochLengths,
OUT LPBOOL lpfComplete,
OUT LPDWORD lpdwBytesTransfered,
OUT LPDWORD lpdwError );
BOOL AbortTransfer( IN UINT address,
IN UINT pipeIndex,
IN LPTRANSFER_NOTIFY_ROUTINE lpCancelAddress,
IN LPVOID lpvNotifyParameter,
IN LPCVOID lpvCancelId );
BOOL IsPipeHalted( IN UINT address,
IN UINT pipeIndex,
OUT LPBOOL lpbHalted );
BOOL ResetPipe( IN UINT address,
IN UINT pipeIndex );
VOID PowerMgmtCallback( IN BOOL bOff );
// ****************************************************
// Public Variables for CUhcd
// ****************************************************
// no public variables
private:
// ****************************************************
// Private Functions for CUhcd
// ****************************************************
// ****************************************************
// Private Variables for CUhcd
// ****************************************************
CRITICAL_SECTION m_csHCLock; // serialize client access to the Host Controller
CRootHub* m_pCRootHub; // pointer to CRootHub object, which represents
// the built-in hardware USB ports
DWORD m_dwSysIntr;
REGISTER m_portBase;
};
extern "C"
{
BOOL HcdGetFrameNumber(LPVOID lpvHcd, LPDWORD lpdwFrameNumber);
BOOL HcdGetFrameLength(LPVOID lpvHcd, LPUSHORT lpuFrameLength);
BOOL HcdSetFrameLength(LPVOID lpvHcd, HANDLE hEvent, USHORT uFrameLength);
BOOL HcdStopAdjustingFrame(LPVOID lpvHcd);
BOOL HcdOpenPipe(LPVOID lpvHcd, UINT iDevice,
LPCUSB_ENDPOINT_DESCRIPTOR lpEndpointDescriptor,
LPUINT lpiEndpointIndex);
BOOL HcdClosePipe(LPVOID lpvHcd, UINT iDevice, UINT iEndpointIndex);
BOOL HcdResetPipe(LPVOID lpvHcd, UINT iDevice, UINT iEndpointIndex);
BOOL HcdIsPipeHalted(LPVOID lpvHcd, UINT iDevice, UINT iEndpointIndex,
LPBOOL lpbHalted);
BOOL HcdIssueTransfer(LPVOID lpvHcd, UINT iDevice, UINT iEndpointIndex,
LPTRANSFER_NOTIFY_ROUTINE lpStartAddress,
LPVOID lpvNotifyParameter, DWORD dwFlags,
LPCVOID lpvControlHeader, DWORD dwStartingFrame,
DWORD dwFrames, LPCDWORD aLengths, DWORD dwBufferSize,
LPVOID lpvBuffer, ULONG paBuffer, LPCVOID lpvCancelId,
LPDWORD adwIsochErrors, LPDWORD adwIsochLengths,
LPBOOL lpfComplete, LPDWORD lpdwBytesTransfered,
LPDWORD lpdwError);
BOOL HcdAbortTransfer(LPVOID lpvHcd, UINT iDevice, UINT iEndpointIndex,
LPTRANSFER_NOTIFY_ROUTINE lpStartAddress,
LPVOID lpvNotifyParameter, LPCVOID lpvCancelId);
}
#endif // __CUHCD_HPP__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -