EDM/2
 

OS/2 Device Driver Programming

Instructor: Timur Tabi

 

Overview

The "OS/2 Device Driver Programming" course is an introduction to the world of writing device drivers for OS/2 Warp. A device driver is a program which talks directly to hardware and acts as a middle-man between the applications you use and the hardware in your computer. Every piece of hardware in your computer must have a device driver associated with it in order for it to be used. OS/2 device drivers also have special features not available to applications, so even as an application developer you might need to know how to write a device driver.

OS/2 device driver support can be sketchy, especially with esoteric hardware. If you have a piece of hardware that isn't supported, or just not supported the way you like it, you might be able to write your drivers for it! Writing OS/2 drivers is not as hard as you think, but the initial learning curve can be quite daunting. The aim of this class is to overcome that first hurdle - to allow you to understand the basics of OS/2 driver programming. There are many different types of devices, and hence there are many different types of drivers - this course covers the most basic: a 16-bit OS/2 physical character device driver. After you have completed this course, you will have the tools to either write your own custom driver, or to investigate the specialized drivers: graphics drivers, disk driver, IFS drivers, etc.

Requirements

Writing drivers is more involved than writing applications. Fortunately, there are excellent tools for OS/2 driver programming. Unfortunately, you need to download and purchase quite a bit of software and hardware.
  1. The OS/2 DDK. Go to http://service.boulder.ibm.com/ddk/ and register for access, if you haven't already. Then, download the following:
    1. ICAT for OS/2
    2. Under the section titled, "Input/Output Device Drivers and Test Tools", download the "Source Code ZIP File", the "Build Environment ZIP file" and the "Build Tools ZIP file".
    3. Under documentation, download the following Reference ZIP files: "Input/Output Device Driver" and "Physical Device Driver", and the "Using your DDK Build Instructions ZIP file".
  2. The Watcom C/C++ compiler (http://www.powersoft.com/products/languages/watccpl.html), anything from version 9.0 to 11.0, although if you have 9.x I suggest you upgrade. FYI, Watcom was purchased by PowerSoft a while ago. If you have MSC 6.0, although it is possible to write drivers with it (and in fact, most drivers have been written with it), it won't be compatible with this class.
  3. Two computers, preferably both running OS/2 Warp. If you only have one computer, or of that other computer can't run OS/2 Warp, then you'll be stuck with command-line debugging, and you'll hate it. One machine is the main development machine, where you build your driver. The other machine, which should be smaller, is where you will run and debug the driver. This machine will crash frequently and require reboots even more frequently. You'll also need a null-modem serial connection between the two. If the test machine is running Warp 3, you'll need to apply a recent fixpack.
  4. Download and install TVFS, the Toronto Virtual File System. It available from either ftp://ftp.pc.ibm.com/pub/pccbbs/os2_ews/ or ftp://hobbes.nmsu.edu/pub/os2/util/diskutil/tvfs210.zip. You can also use the TVFS_RM GUI at http://www.geocities.com/SiliconValley/Way/3792/tvfsrm.html or TVFS Link at ftp://hobbes.nmsu.edu/pub/os2/util/diskutil/tvfslink.zip. Learn how TVFS works - once the class starts, I'll tell you how to set it up.

You should know basic PC architecture. For instance, you should know the difference between DMA and IRQ's, and the difference between memory and I/O, but you don't have to know how the 8237 DMA controller works, or how to program the 8259 PIC. This class will focus on the architecture of a device driver without actually talking to a device.

Reading Material

There is a book called "Writing OS/2 2.1 Device Drivers in C" by Steve Mastrianni, but we won't be using it. Not only does this book offer little beyond what the DDK already offers, but his programming style conflicts sharply with mine, and it's also incompatible with Watcom C/C++. So if you have it or can get it cheap, that's fine, but don't buy it otherwise.
  • Writing OS/2 2.1 Device Drivers in C, 2nd Edition   (Buy)   (Review)

EDM/2 issues 4-8 to 4-10 have a column titled "A Hello World Device Driver". Although Alger's style and mine differ somewhat, please read these three articles before the class starts.

I know the setup is involved, so please email me at timur@edm2.com before you register if you have any problems, especially if you have a problem getting the software or hardware you need.

Registering for the Device Driver Programming Course

The course started December 1/1997, and registrations are now closed.

Feedback Search Top