?? dosusb.htm
字號:
<!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> </p>
<p><font face="Arial" size="5"> </font> <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 The
driver<br>
dosusb.htm This file, the documentation for DOSUSB.COM<br>
licence.txt Licence information about DOSUSB.COM<br>
usbview.exe Application which displays the descriptors
of<br>
a
device<br>
mouse.exe USB mouse demo application<br>
restart.exe Enumerates all devices connected<br>
prnusb.sys Device driver for printers using DosUSB<br>
lpt1usb.sys Device driver for printers replacing the
LPT1: device<br>
hplaser.exe Prints the file dosusb.txt on a HP laserprinter<br>
usbdisk.sys 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 Source
code for usbview.exe in Powerbasic<br>
mouse.bas Source code for mouse.exe in Powerbasic<br>
keyboard.bas Source code for reading a USB keyboard in
Powerbasic<br>
hplaser.bas Source for an application to print the file
dosusb.txt<br>
to
an HP Laserjet printer<br>
lq590.bas Source for a sample to print to
an Epson LQ-590 printer<br>
setalt.bas Source code to set alternate interface
for a device<br>
enum.c Turbo C program
to retrieve a device descriptor<br>
enum.bas Powerbasic sample to retrieve
a device descriptor<br>
enum.asm Assembler sample to retrieve
a device descriptor<br>
hplaser.pas Pascal sample to print dosusb.txt to an
HP Laserjet printer<br>
hplaserv.bas VBDOS sample to print dosusb.txt to an HP Laserjet
printer<br>
hplaserv.mak VBDOS project file for hplaserv.bas<br>
hplaserq.bas Quickbasic sample to print dosusb.txt to an HP
Laserjet printer<br>
reset.bas Powerbasic source for a reset
command<br>
reset.pas Pascal source for reset command<br>
restart.bas Powerbasic source for restart.exe<br>
restart.pas Pascal source for restart command<br>
icheck.bas Powerbasic source for an installation
check<br>
cable.bas Sample to send data via a PC connect
USB cable<br>
reader.bas Sample to read sector zero of a memory
card<br>
stick.bas Sample to read sector zero of
a USB flash drive.<br>
stick.pas Sample in Pascal to read sector
of a USB flash drive<br>
floppy.bas Sample to read sector zero of a floppy
drive<br>
camera.bas Read isochronous traffic from a camera<br>
scanner.bas Sample which reads the identity of an Epson
1670 scanner<br>
serial.bas Sample terminal program using a USB/serial
adapter<br>
prnusb.asm 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>
</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>
transaction_type byte ;control (2Dh), in (69h),
out (E1h) as hex code<br>
chain_end_flag byte ;reserved<br>
dev_add byte<br>
end_point byte<br>
error_code byte
;returned by dosuhci<br>
status byte
;returned by dosuhci<br>
transaction_flags word ;reserved<br>
buffer_off word
;for in/out<br>
buffer_seg word
;for in/out<br>
buffer_length word ;for in/out<br>
actual_length word ;for in/out,
(maximum length / bytes returned)<br>
setup_buffer_off word ;for control<br>
setup_buffer_seg word ;for control<br>
start_frame word ;reserved<br>
nr_of_packets word ;isochronous
if set to one<br>
int_interval byte ;reserved<br>
error_count byte ;number
of retries<br>
timeout word
;reserved<br>
next_urb_off word ;reserved<br>
next_urb_seg word ;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, 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 + -