使用起来填一张表(URB),再呼叫INT65就可以 in/out USB 设备了.
参考代码
/* ENUM.C -- retrieves the device descriptor of a USB device
using the DOSUSB driver.
Done with an old Borland C compiler to be able to use
FP_SEG and FP_OFF. DOSUSB needs real mode segment/offset address.
*/
#include <stdio.h>
#include <dos.h>
union REGS regs;
struct urbtype {
char transaction_token;
char chain_end_flag;
char dev_add;
char end_point;
char error_code;
char status;
unsigned int transaction_flags;
unsigned int buffer_off;
unsigned int buffer_seg;
unsigned int buffer_length;
unsigned int actual_length;
unsigned int setup_buffer_off;
unsigned int setup_buffer_seg;
unsigned int start_frame;
unsigned int nr_of_packets;
char int_interval;
char error_count;
unsigned int timeout;
unsigned int next_urb_off;
unsigned int next_urb_seg; /* reserved */
} ;
struct setuptype {
char bmRequestType;
char bRequest;
unsigned int wValue;
unsigned int wIndex;
unsigned int wLength;
};
/* set up request */
urb.transaction_token=0x69;
urb.chain_end_flag=0;
urb.dev_add=2; //update to 2 for 2nd usb device
urb.end_point=2; // update from 0 to 1
urb.error_code=0;
urb.status=0;
urb.transaction_flags=0;
urb.buffer_seg=FP_SEG(&buffer);
urb.buffer_off=FP_OFF(&buffer);
urb.buffer_length=9;
urb.actual_length=9;
urb.setup_buffer_seg=FP_SEG(&device_request);
urb.setup_buffer_off=FP_OFF(&device_request);
urb.start_frame=0;
urb.nr_of_packets=0;//1. plan to change to 64
urb.int_interval=0;
urb.error_count=0;
urb.timeout=0;
urb.next_urb_seg=0;
urb.next_urb_off=0;
/* DS does not need to be set here */
regs.x.dx = FP_OFF(&urb);
int86(0x65, ®s, ®s); /* call DosUHCI */