📄 polarisusbinterface.h
字号:
/**************************************************************************/
/** This file and the information contain herein 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. **/
/** **/
/** This code cannot be redistributed or reused in any form whatsoever **/
/** without the explicit approval of Conexant Systems Inc. **/
/** **/
/** Copyright (C) 2008 Conexant Systems Inc. **/
/** All rights reserved. **/
/**************************************************************************/
#ifndef __POLARISUSBINTERFACE_H__
#define __POLARISUSBINTERFACE_H__
class CUsbInterface;
///////////////////////////////////
// Class Information
//
#define CLASS_DEFAULT 0xFF
typedef enum _VENDOR_REQUEST_TYPE
{
//Set/Get I2C
VRT_SET_I2C0 = 0x0,
VRT_SET_I2C1 = 0x1,
VRT_SET_I2C2 = 0x2,
VRT_GET_I2C0 = 0x4,
VRT_GET_I2C1 = 0x5,
VRT_GET_I2C2 = 0x6,
//Set/Get GPIO
VRT_SET_GPIO = 0x8,
VRT_GET_GPIO = 0x9,
//Set/Get GPIE
VRT_SET_GPIE = 0xA,
VRT_GET_GPIE = 0xB,
//Set/Get Register Control/Status
VRT_SET_REGISTER = 0xC,
VRT_GET_REGISTER = 0xD,
//Get Extended Compat ID Descriptor
VRT_GET_EXTCID_DESC = 0xFF,
} VENDOR_REQUEST_TYPE, *PVENDOR_REQUEST_TYPE;
typedef enum _BYTE_ENABLE_MASK
{
ENABLE_ONE_BYTE = 0x1,
ENABLE_TWE_BYTE = 0x3,
ENABLE_THREE_BYTE = 0x7,
ENABLE_FOUR_BYTE = 0xF,
}BYTE_ENABLE_MASK, *PBYTE_ENABLE_MASK;
/////////////////////////////////////////////////////////////////////////////
class PolarisUsbInterface
{
public:
PolarisUsbInterface(CUsbInterface *pUsbInterface);
virtual ~PolarisUsbInterface();
NTSTATUS InitDevice();
NTSTATUS Release(VOID);
NTSTATUS powerUp();
NTSTATUS powerDown();
NTSTATUS setGpio(DWORD gpio_bit, BYTE* p_gpio_value, BYTE len, BYTE request);
NTSTATUS getGpio(DWORD gpio_bit, PBYTE p_gpio_value, BYTE len, BYTE request);
NTSTATUS getPolarisRegister(WORD address, PBYTE buffer, BYTE len);
NTSTATUS setPolarisRegister(WORD address, PBYTE buffer ,BYTE len);
NTSTATUS getI2CSpeed(PBYTE pbuffer);
NTSTATUS setI2CSpeed(UCHAR i2c_period);
NTSTATUS sendCommand(
PBYTE p_out_buffer,
DWORD out_buffer_size,
PBYTE p_in_buffer,
DWORD in_buffer_size);
NTSTATUS selectInterface(UCHAR usb_interface, UCHAR alternate_setting);
NTSTATUS setCommandFormat(BOOLEAN first,BOOLEAN last);
private:
CUsbInterface *_p_usb;
BOOLEAN _is_initialized;
KMUTEX _mutex;
BYTE _i2c_period;
BYTE _i2c_nostop;
BYTE _i2c_reserve;
};
#endif //__POLARISUSBINTERFACE_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -