MSDOSDeviceDrivers ppt97

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 8

MS DOS Device Drivers

•• Sources
Sources of
of Information
Information
•• Device
Device driver
driver basics
basics
•• Structure
Structure and
and internal
internal routines
routines
Sources of information

John
John Angermeyer
Angermeyer and
and Kevin
Kevin Jaeger,
Jaeger, MS-DOS
MS-DOS Developer’s
Developer’s
Guide,
Guide, Howard
Howard W.
W. Sams,
Sams, Indianapolis,
Indianapolis, 1986
1986

Ray
Ray Duncan,
Duncan, Advanced
Advanced MS-DOS,
MS-DOS, Microsoft
Microsoft Press,
Press, Redmond,
Redmond,
Washington,
Washington, 1986
1986

Robert
Robert Lai,
Lai, Writing
Writing MS-DOS
MS-DOS Device
Device Drivers,
Drivers, Addison-
Addison-
Wesley,
Wesley, Reading,
Reading, Massachusetts,
Massachusetts, 1992
1992
Device driver basics

•• Operating
Operating System
System modules
modules thatthat control
control hw
hw
•• Isolate
Isolate higher
higher levels
levels from
from hwhw specifics
specifics
•• Standard
Standard interface
interface with
with OS
OS
•• Installable
Installable at
at boot
boot time
time as
as aa “chain”
“chain”
(CONFIG.SYS)
(CONFIG.SYS)
•• Not
Not necessary
necessary to to modify
modify the
the OSOS
•• Similar
Similar to
to Unix/Xenix/Linux
Unix/Xenix/Linux device device drivers
drivers
•• Two
Two types:
types: Block
Block andand Character
Character
General Structure
Device Header
Driver Data Storage
Strategy Routine
Interrupt Entry
Command Handlers
Interrupt Service Routine
Initialization Code and Driver Data Buffers
Device Header
•• 18-byte
18-byte block
block at
at beginning
beginning of
of every
every device
device driver
driver

00H Link to next driver, offset

02H Link to next driver, segment

04H Device attribute word

06H Strategy entry point, offset

08H Interrupt entry point, offset

0AH Logical name (8 bytes) if character device.


Number of units (1 byte) if block device (other 7
bytes reserved)
Strategy Routine

•• Called
Called by
by MS-DOS
MS-DOS when when driver
driver is
is first
first loaded
loaded
•• Called
Called by
by MS-DOS
MS-DOS whenever
whenever I/OI/O request
request is is
issued
issued to
to device
device
•• Request
Request call
call includes
includes aa pointer
pointer to
to aa request
request header;
header;
driver
driver saves
saves pointer
pointer and
and returns
returns to
to MS-DOS
MS-DOS
•• Request
Request header
header includes
includes command
command code code andand other
other
information
information
Interrupt Routine

•• Called
Called after
after the
the strategy
strategy routine
routine
•• Implements
Implements the the device
device driver
driver proper
proper
•• Performs
Performs the
the actual
actual I/O
I/O operations
operations
•• Collection
Collection of
of subroutines
subroutines toto implement
implement various
various
functions
functions (read,
(read, write,
write, …)
…)
•• Centralized
Centralized entry
entry routine
routine saves
saves registers
registers and
and sets
sets
up
up driver
driver ops
ops
•• Centralized
Centralized exit
exit routine
routine restores
restores registers
registers and
and sets
sets
status
status and
and error
error codes
codes
Sample Command Codes

•• 00H:
00H: Driver
Driver Initialization
Initialization
•• 01H:
01H: Media
Media Check
Check
•• 04H:
04H: Read
Read
•• 08H:
08H: Write
Write
•• 0DH:
0DH: Open
Open
•• 0EH:
0EH: Close
Close

You might also like