#define SLBUSB_IOCTL_INDEX 0 #define IOCTL_SLBUSB_GET_PIPE_INFO _IOWR('U', SLBUSB_IOCTL_INDEX+1,InterfaceInfo) #define IOCTL_SLBUSB_GET_DEVICE_DESCRIPTOR _IOWR('U', SLBUSB_IOCTL_INDEX+2, Usb_Device_Descriptor) #define IOCTL_SLBUSB_VENDOR_REQUEST _IOWR('U', SLBUSB_IOCTL_INDEX+6, VENDOR_REQUEST_IN) #define IOCTL_SLBUSB_GET_STRING_DESCRIPTOR _IOWR('U', SLBUSB_IOCTL_INDEX+12, Usb_String_Descriptor) #define IOCTL_SLBUSB_BULK_READ _IOWR('U', SLBUSB_IOCTL_INDEX+13, BULK_IOCTL) #define IOCTL_SLBUSB_BULK_WRITE _IOWR('U', SLBUSB_IOCTL_INDEX+14, BULK_IOCTL) #define IOCTL_SLBUSB_ANCHOR_DOWNLOAD _IOWR('U', SLBUSB_IOCTL_INDEX+20, BULK_IOCTL) #define IOCTL_SLBUSB_RESET_CPU _IOWR('U', SLBUSB_IOCTL_INDEX+35, BULK_IOCTL) //================ from USBDevice.h ================================================================ #define BYTE unsigned char #define WORD unsigned short #define UCHAR unsigned char #define USHORT unsigned short #define ULONG unsigned long #define PVOID void * #define WCHAR unsigned short int typedef PVOID USBD_INTERFACE_HANDLE; typedef PVOID USBD_PIPE_HANDLE; //------------------------------------------------------------------- typedef struct _BULK_TRANSFER_CONTROL { ULONG pipeNum; } BULK_TRANSFER_CONTROL, *PBULK_TRANSFER_CONTROL; //------------- bulk ioctl --------------------------------------- //#define MAX_BULK_IOCTL 256*1024 //-- ot fonarq #define MAX_BULK_IOCTL (64*1024)-1 //-- windows //#define MAX_BULK_IOCTL 64 //-- test typedef struct __bulk_ioctl { int IOCTL_SLBUSB; void* Control; int sizeControl; void* ioBuffer; //--- fsv FIXME!!! int sizeBuffer; unsigned long doneBytes; } BULK_IOCTL; typedef struct __InterfaceInfo { unsigned char IntfInfo[1024]; } InterfaceInfo; //------------------------------------------------------------------- typedef struct __usb_String_Descriptor__ { UCHAR bLength; UCHAR bDescriptorType; WCHAR bString[80]; } Usb_String_Descriptor, *pUsb_String_Descriptor; typedef struct __usb_Dev_Descriptor__ { UCHAR bLength; UCHAR bDescriptorType; USHORT bcdUSB; UCHAR bDeviceClass; UCHAR bDeviceSubClass; UCHAR bDeviceProtocol; UCHAR bMaxPacketSize0; USHORT idVendor; USHORT idProduct; USHORT bcdDevice; UCHAR iManufacturer; UCHAR iProduct; UCHAR iSerialNumber; UCHAR bNumConfigurations; } Usb_Device_Descriptor, *pUsb_Device_Descriptor; //================ from slbusbsys.h ================================================================ #define MAX_INTEL_HEX_RECORD_LENGTH 16 typedef struct _INTEL_HEX_RECORD { BYTE Length; WORD Address; BYTE Type; BYTE Data[MAX_INTEL_HEX_RECORD_LENGTH]; } INTEL_HEX_RECORD, *PINTEL_HEX_RECORD; //------------------------------------------------------------------- typedef struct _VENDOR_REQUEST_IN { BYTE bRequest; WORD wValue; WORD wIndex; WORD wLength; BYTE direction; BYTE bData; } VENDOR_REQUEST_IN, *PVENDOR_REQUEST_IN; //------------------------------------------------------------------- typedef struct _GET_STRING_DESCRIPTOR_IN { UCHAR Index; USHORT LanguageId; } GET_STRING_DESCRIPTOR_IN, *PGET_STRING_DESCRIPTOR_IN; //------------------------------------------------------------------- // // structure returned from USBD_GetVersion function // typedef struct _USBD_VERSION_INFORMATION { ULONG USBDI_Version; //BCD usb interface version number ULONG Supported_USB_Version; //BCD USB spec version number } USBD_VERSION_INFORMATION, *PUSBD_VERSION_INFORMATION; typedef enum _USBD_PIPE_TYPE { UsbdPipeTypeControl, UsbdPipeTypeIsochronous, UsbdPipeTypeBulk, UsbdPipeTypeInterrupt } USBD_PIPE_TYPE; //------------------------------------------------------------------- // // USBD pipe information structure, this structure // is returned for each pipe opened thru an // SELECT_CONFIGURATION or SELECT_INTERFACE request. // typedef struct _USBD_PIPE_INFORMATION { // // OUTPUT // These fields are filled in by USBD // USHORT MaximumPacketSize; // Maximum packet size for this pipe UCHAR EndpointAddress; // 8 bit USB endpoint address (includes direction) // taken from endpoint descriptor UCHAR Interval; // Polling interval in ms if interrupt pipe USBD_PIPE_TYPE PipeType; // PipeType identifies type of transfer valid for this pipe USBD_PIPE_HANDLE PipeHandle; // // INPUT // These fields are filled in by the client driver // ULONG MaximumTransferSize; // Maximum size for a single request // in bytes. ULONG PipeFlags; } USBD_PIPE_INFORMATION, *PUSBD_PIPE_INFORMATION; //------------------------------------------------------------------- // // USBD interface information structure, this structure // is returned for each interface opened thru an // SELECT_CONFIGURATION or SELECT_INTERFACE request. // typedef struct _USBD_INTERFACE_INFORMATION { USHORT Length; // Length of this structure, including // all pipe information structures that // follow. // // INPUT // // Interface number and Alternate setting this // structure is associated with // UCHAR InterfaceNumber; UCHAR AlternateSetting; // // OUTPUT // These fields are filled in by USBD // UCHAR Class; UCHAR SubClass; UCHAR Protocol; UCHAR Reserved; USBD_INTERFACE_HANDLE InterfaceHandle; ULONG NumberOfPipes; // // INPUT/OUPUT // see PIPE_INFORMATION USBD_PIPE_INFORMATION Pipes[1]; } USBD_INTERFACE_INFORMATION, *PUSBD_INTERFACE_INFORMATION; /////////////////////////////////////////////////////////// // // control structure for sending vendor or class specific requests // to the control endpoint. // /////////////////////////////////////////////////////////// typedef struct _VENDOR_OR_CLASS_REQUEST_CONTROL { // transfer direction (0=host to device, 1=device to host) UCHAR direction; // request type (1=class, 2=vendor) UCHAR requestType; // recipient (0=device,1=interface,2=endpoint,3=other) UCHAR recepient; // // see the USB Specification for an explanation of the // following paramaters. // UCHAR requestTypeReservedBits; UCHAR request; USHORT value; USHORT index; } VENDOR_OR_CLASS_REQUEST_CONTROL, *PVENDOR_OR_CLASS_REQUEST_CONTROL; /////////////////////////////////////////////////////////// // // control structure for isochronous data transfers // /////////////////////////////////////////////////////////// typedef struct _ISO_TRANSFER_CONTROL { // // pipe number to perform the ISO transfer to/from. Direction is // implied by the pipe number. // ULONG PipeNum; // // ISO packet size. Determines how much data is transferred each // frame. Should be less than or equal to the maxpacketsize for // the endpoint. // ULONG PacketSize; // // Total number of ISO packets to transfer. // ULONG PacketCount; // // The following two parameters detmine how buffers are managed for // an ISO transfer. In order to maintain an ISO stream, the driver // must create at least 2 transfer buffers and ping pong between them. // BufferCount determines how many buffers the driver creates to ping // pong between. FramesPerBuffer specifies how many USB frames of data // are transferred by each buffer. // ULONG FramesPerBuffer; // 10 is a good value ULONG BufferCount; // 2 is a good value } ISO_TRANSFER_CONTROL, *PISO_TRANSFER_CONTROL;