⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dosusb.htm

📁 DOS下的USB驱动源码,包括UHCI
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>DosUSB driver documentation</title>
<meta name="generator" content="Namo WebEditor v3.0">
</head>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">

<p>&nbsp;</p>
<p><font face="Arial" size="5">&nbsp;</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font
 face="Arial" size="5"><b>DosUSB driver documentation</b></font></p>
<p><br>
<font face="Arial" size="4"><b>1. Introduction</b></font></p>
<p><font face="Arial">DOS support for USB is currently very limited. There are 
only a<br>
few drivers available, e.g. for mass storage devices. </font></p>
<p><font face="Arial">DOS can work with a USB keyboard and a USB mouse only 
if the BIOS<br>
features legacy support by doing a 8042 controller emulation for<br>
these devices. With legacy support enabled, the BIOS will then also<br>
support to boot from and to access a USB floppy drive or hard disk.</font></p>
<p><font face="Arial">For Linux there are UHCI, OHCI and EHCI drivers available 
and a<br>
lot of device drivers which are based on these USB controller<br>
drivers. Using DOSUSB.COM it is now possible for DOS application<br>
programs to communicate with all sorts of USB devices and to implement<br>
USB device drivers for DOS.</font></p>
<p><font face="Arial">DOSUSB.COM is a USB host controller driver for DOS. It 
is a TSR<br>
program which implements a universal host controller driver (HCD) and a<br>
universal serial bus driver (USBD). It can also be used with WIN 3.11.</font></p>
<p><font face="Arial">DOSUSB.COM provides a software layer so application programs 
and<br>
USB device drivers can be written supporting specific USB devices.</font></p>
<p><font face="Arial">It builds frame lists for the USB host controllers, sets 
up<br>
transfer descriptors and queue heads and schedules the transactions<br>
requested by the USB device drivers.</font></p>
<p><font face="Arial"><br>
</font><font face="Arial" size="4"><b>2 Installation</b></font></p>
<p><font face="Arial">Extract the zip file you have downloaded into a directory 
on your<br>
hard disk e.g. c:\dosusb. This directory will then contain the<br>
following files:</font></p>
<p><font face="Courier New" size="2">DOSUSB.COM &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The 
driver<br>
dosusb.htm &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This file, the documentation for DOSUSB.COM<br>
licence.txt &nbsp;&nbsp;&nbsp;&nbsp;Licence information about DOSUSB.COM<br>
usbview.exe &nbsp;&nbsp;&nbsp;&nbsp;Application which displays the descriptors 
of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a 
device<br>
mouse.exe &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USB mouse demo application<br>
restart.exe &nbsp;&nbsp;&nbsp;&nbsp;Enumerates all devices connected<br>
prnusb.sys &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Device driver for printers using DosUSB<br>
lpt1usb.sys &nbsp;&nbsp;&nbsp;&nbsp;Device driver for printers replacing the 
LPT1: device<br>
hplaser.exe &nbsp;&nbsp;&nbsp;&nbsp;Prints the file dosusb.txt on a HP laserprinter<br>
usbdisk.sys &nbsp;&nbsp;&nbsp;&nbsp;Device driver for mass storage devices</font></p>
<p><font face="Arial">The subdirectory SRC will contain the source-code for 
the following samples:</font></p>
<p><font face="Courier New" size="2">usbview.bas &nbsp;&nbsp;&nbsp;&nbsp;Source 
code for usbview.exe in Powerbasic<br>
mouse.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Source code for mouse.exe in Powerbasic<br>
keyboard.bas&nbsp;&nbsp;&nbsp;&nbsp;Source code for reading a USB keyboard in 
Powerbasic<br>
hplaser.bas &nbsp;&nbsp;&nbsp;&nbsp;Source for an application to print the file 
dosusb.txt<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to 
an HP Laserjet printer<br>
lq590.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Source for a sample to print to 
an Epson LQ-590 printer<br>
setalt.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Source code to set alternate interface 
for a device<br>
enum.c &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Turbo C program 
to retrieve a device descriptor<br>
enum.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Powerbasic sample to retrieve 
a device descriptor<br>
enum.asm &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Assembler sample to retrieve 
a device descriptor<br>
hplaser.pas &nbsp;&nbsp;&nbsp;&nbsp;Pascal sample to print dosusb.txt to an 
HP Laserjet printer<br>
hplaserv.bas &nbsp;&nbsp;&nbsp;VBDOS sample to print dosusb.txt to an HP Laserjet 
printer<br>
hplaserv.mak &nbsp;&nbsp;&nbsp;VBDOS project file for hplaserv.bas<br>
hplaserq.bas &nbsp;&nbsp;&nbsp;Quickbasic sample to print dosusb.txt to an HP 
Laserjet printer<br>
reset.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Powerbasic source for a reset 
command<br>
reset.pas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pascal source for reset command<br>
restart.bas &nbsp;&nbsp;&nbsp;&nbsp;Powerbasic source for restart.exe<br>
restart.pas &nbsp;&nbsp;&nbsp;&nbsp;Pascal source for restart command<br>
icheck.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Powerbasic source for an installation 
check<br>
cable.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sample to send data via a PC connect 
USB cable<br>
reader.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sample to read sector zero of a memory 
card<br>
stick.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sample to read sector zero of 
a USB flash drive.<br>
stick.pas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sample in Pascal to read sector 
of a USB flash drive<br>
floppy.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sample to read sector zero of a floppy 
drive<br>
camera.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Read isochronous traffic from a camera<br>
scanner.bas &nbsp;&nbsp;&nbsp;&nbsp;Sample which reads the identity of an Epson 
1670 scanner<br>
serial.bas &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sample terminal program using a USB/serial 
adapter<br>
prnusb.asm &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Source code for the printer device 
driver</font></p>
<p><font face="Arial"><br>
To start DosUSB enter DOSUSB.COM at the DOS prompt. DosUSB<br>
will then enumerate all the connected devices and install itself<br>
as a resident program.</font></p>
<p><font face="Arial">On laptops, the number of ports per controller may exceed 
the number of<br>
USB sockets installed. DosUSB will then show more ports than can be used<br>
with devices.</font></p>
<p><font face="Arial">DosUSB itself requires about 23k of computer memory. However, 
it<br>
also requests additional memory for each controller installed<br>
in the computer. </font></p>
<p><font face="Arial">DosUSB will work on a computer featuring UHCI or OHCI 
controllers.<br>
It will try to determine whether OHCI or UHCI controllers are installed and<br>
report this. </font></p>
<p><font face="Arial">If the PC has an Intel or VIA mainboard it will have UHCI 
controllers.<br>
These mainboards are used in most computers. If the PC has an EHCI controller<br>
for USB 2.0, DosUSB will still be able to run, since the EHCI controller<br>
works together with UHCI or OHCI controllers which DosUSB can use.</font></p>
<p><font face="Arial">Since UHCI and OHCI just support up to 12Mbit/s, this 
is the upper limit<br>
for ports supported by DosUSB. However, a 2.0 port with 480Mbit/s should also<br>
work at 12Mbit/s.<br>
&nbsp;</font></p>
<p><font face="Arial" size="4"><b>3. USB Request Block</b></font></p>
<p><font face="Arial">To request the execution of a transaction the device driver 
has<br>
to use a USB Request Block (URB) of the following structure:</font></p>
<p><font face="Courier New" size="2">urbstruc struc<br>
&nbsp;&nbsp;&nbsp;transaction_type &nbsp;byte &nbsp;;control (2Dh), in (69h), 
out (E1h) as hex code<br>
&nbsp;&nbsp;&nbsp;chain_end_flag &nbsp;&nbsp;&nbsp;byte &nbsp;;reserved<br>
&nbsp;&nbsp;&nbsp;dev_add &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte<br>
&nbsp;&nbsp;&nbsp;end_point &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte<br>
&nbsp;&nbsp;&nbsp;error_code &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte 
&nbsp;;returned by dosuhci<br>
&nbsp;&nbsp;&nbsp;status &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte 
&nbsp;;returned by dosuhci<br>
&nbsp;&nbsp;&nbsp;transaction_flags word &nbsp;;reserved<br>
&nbsp;&nbsp;&nbsp;buffer_off &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;word 
&nbsp;;for in/out<br>
&nbsp;&nbsp;&nbsp;buffer_seg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;word 
&nbsp;;for in/out<br>
&nbsp;&nbsp;&nbsp;buffer_length &nbsp;&nbsp;&nbsp;&nbsp;word &nbsp;;for in/out<br>
&nbsp;&nbsp;&nbsp;actual_length &nbsp;&nbsp;&nbsp;&nbsp;word &nbsp;;for in/out, 
(maximum length / bytes returned)<br>
&nbsp;&nbsp;&nbsp;setup_buffer_off &nbsp;word &nbsp;;for control<br>
&nbsp;&nbsp;&nbsp;setup_buffer_seg &nbsp;word &nbsp;;for control<br>
&nbsp;&nbsp;&nbsp;start_frame &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;word &nbsp;;reserved<br>
&nbsp;&nbsp;&nbsp;nr_of_packets &nbsp;&nbsp;&nbsp;&nbsp;word &nbsp;;isochronous 
if set to one<br>
&nbsp;&nbsp;&nbsp;int_interval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte &nbsp;;reserved<br>
&nbsp;&nbsp;&nbsp;error_count &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byte &nbsp;;number 
of retries<br>
&nbsp;&nbsp;&nbsp;timeout &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;word 
&nbsp;;reserved<br>
&nbsp;&nbsp;&nbsp;next_urb_off &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;word &nbsp;;reserved<br>
&nbsp;&nbsp;&nbsp;next_urb_seg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;word &nbsp;;reserved<br>
urbstruc ends ;32 byte long</font></p>
<p><font face="Arial">This URB structure is similar to the Linux URB.</font></p>
<p><font face="Arial">Using this URB it is possible to schedule control, input 
and output<br>
transactions. For control transactions, DosUSB can do the following<br>
in and out transactions required to retrieve the requested data.</font></p>
<p><font face="Arial"><br>
</font><font face="Arial" size="4"><b>3.1 Elements of the URB structure</b></font></p>
<p><font face="Arial"><br>
</font><font face="Arial"><b>transaction_type</b></font></p>
<p><font face="Arial">select the type of transaction scheduled, this can be 
either a<br>
control, in or out transaction. For a control transaction enter<br>
2D hex, for an in transaction enter 69 hex and for an out<br>
transaction enter E1 hex.</font></p>
<p><font face="Arial">You can also send commands to DosUHCI, if you enter FF 
hex as the<br>
transaction code. The commands available are explained below.</font></p>
<p><font face="Arial"><br>
</font><font face="Arial"><b>chain_end_flag</b></font></p>
<p><font face="Arial">this element is currently not used</font></p>
<p><font face="Arial"><br>
</font><font face="Arial"><b>dev_add</b></font></p>
<p><font face="Arial">enter the USB device address here of the device the scheduled<br>
transaction shall be send to.</font></p>
<p><font face="Arial">The device driver can either request the device descriptor 
for<br>
all addresses from one to invalid to find the device in question.<br>
Or you can use usbview to find the device manually.</font></p>
<p><font face="Arial"><br>
</font><font face="Arial"><b>end_point</b></font></p>
<p><font face="Arial">each device has several endpoints. The device driver has 
to<br>
select the right endpoint address for the control, in and out<br>
transactions. There are different endpoints for bulk, interrupt,<br>
control or isochronous transactions.</font></p>
<p><font face="Arial"><br>
</font><font face="Arial"><b>error_code</b></font></p>
<p><font face="Arial">in this element DosUSB will return an error code, if it<br>
encounters a problem with the scheduled transaction. The<br>
following codes are currently defined:<br>
1 - invalid device address, &nbsp;&nbsp;2 - internal error, <br>
3 - invalid transaction_type, 4 - invalid buffer length</font></p>
<p><font face="Arial"><br>
</font><font face="Arial"><b>status</b></font></p>
<p><font face="Arial">this is the status byte returned by the USB controller 
after<br>
executing the scheduled transaction. If a control transaction has<br>
been scheduled, this element has the status byte of the last<br>
transaction in the queue.<br>
See details about this byte in the Intel UHCI design guide. In short:<br>
Bit 0: Reserved, Bit 1: Bitstuff error, Bit 2: CRC/Timeout, Bit 3: NAK,<br>
Bit 4: Babble detected, Bit 5: Data Buffer error, Bit 6: Stalled,<br>
Bit 7: Active<br>
So e.g. 88 hex means a NAK received, since the active bit is set the data<br>
packet can be retried, 44 hex means a CRC/Timeout error which caused a stall.<br>
The device may need a reset.<br>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -