📄 deviceop.h
字号:
//you can add request that yourself defined,this request will
//send to driver by DeviceIoControl,and device will see a
//vendor defined request.
#ifndef _DEVICEOP_H_
#define _DEVICEOP_H_
//device control will implement use vendor request
typedef struct _DEVICE_CONTROL {
// IN UCHAR bRequestType //setup: bRequestType,it can not set by user soft.
IN USHORT wValue; //setup: wValue,
//when ram read or write,used for RAM length will to read/write,must larg than 0
//also used led status when send NOTIFY_APP_START request.
IN USHORT wLength; //setup: wLength,used for SetDevieSerialNumber(),NotifyAppStart(),.etc
//contransfer which contain a data stage
IN OUT PUCHAR pBuffer; //if vendor defined control transfer contain a data stage,
//this is a data buffer
IN USHORT wIndex; //setup: wIndex,point out start address of ram will to read/write
IN UCHAR bRequest; //setup: bRequest,device control request code
} DEVICE_CONTROL, *PDEVICE_CONTROL;
//vendor defined request:
#define RAM_COMMAND_LOOPBACK 0xA0 //for RAM_COMMAND_LOOPBACK,RAM_COMMAND_READ and RAM_COMMAND_WRITE
#define RAM_COMMAND_READ 0xA1 //must set DEVICE_CONTROL.wLength = 0
#define RAM_COMMAND_WRITE 0xA2
#define GET_FIRMWARE_VERSION 0xB0 //must set DEVICE_CONTROL.wLength = 1
#define SET_DEVICE_SERIAL_NUMBER 0xB1 //must set DEVICE_CONTROL.wLength = 4
#define NOTIFY_APP_START 0xB2 //must set DEVICE_CONTROL.wLength = 1
HANDLE open_file( char *filename);
HANDLE open_dev();
void reset_pipe(HANDLE hHandle);
//In our demo,for the second parameter of device_ctl,
//except NOTIFY_APP_START and GET_FIRMWARE_VERSION,all other io control must set false
BOOL device_ctl(PDEVICE_CONTROL pDeviceControl,BOOL bRead);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -