SCOUG Logo


Next Meeting: Sat, TBD
Meeting Directions


Be a Member
Join SCOUG

Navigation:


Help with Searching

20 Most Recent Documents
Search Archives
Index by date, title, author, category.


Features:

Mr. Know-It-All
Ink
Download!










SCOUG:

Home

Email Lists

SIGs (Internet, General Interest, Programming, Network, more..)

Online Chats

Business

Past Presentations

Credits

Submissions

Contact SCOUG

Copyright SCOUG



warp expowest
Pictures from Sept. 1999

The views expressed in articles on this site are those of their authors.

warptech
SCOUG was there!


Copyright 1998-2024, Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.

The Southern California OS/2 User Group
USA
A Warpstock '98 Special Report
Lecturer:  Timur Tabi

Introduction To Device Driver Programming

Who Said There's A Driver Dilemma?

Roll your own USB


by Peter Skye

W
ARPSTOCK --- Timur Tabi again taught his popular device driver programming class, this time to several dozen low-level coders who woke early for the 8 a.m. session.  It was quite a contrast, sitting in the venue's Grand Ballroom under ten-foot chandeliers while listening to Timur describe the internals of PDD's and driver headers.

           For all the yelling and screaming about the lack of OS/2 drivers, remember one thing:  a device driver is a relatively simple and very small program that does a dozen or so well-defined functions and whose basic code skeleton is available for free from IBM.  If you're a programmer and you haven't written one OS/2 device driver just to say "I've done it!", well, maybe you need to count your fingers.  If you haven't written that one "I've done it!" driver (you can write it in C), maybe you're not as good as the next guy.

           There's a device driver mailing list.  Join it.  Timur teaches an on-line device driver programming class through EDM/2 Magazine.  Take it.  There's a somewhat-dated but worth-reading book on Writing OS/2 2.1 Device Drivers In C (by Steven Mastrianni, 1993).  Buy it.

           And write a driver.  Do something simple, like a driver for your mouse.  Sure, that's a simple "undignified" project.  But it'll get you started.

           Timur's lecture covered a lot of the esoteric stuff that a device driver programmer will eventually need.  There are various contexts, there are rings, there are Global and Local Descriptor Tables.  And you should know these things.  Eventually.

           But for right now, just grab the skeleton code off the IBM site and compile it.  Once it compiles and you've got it in your CONFIG.SYS, you'll be hooked for life.  Every piece of hardware you've got will soon have a custom device driver, doing exactly what you want in the way you want to do it.

           Ahh, I digress.  This is supposed to be about Timur's lecture.

           Timur puts on a good show, with detailed slides and his years of driver experience (he wrote OS/2's TIMER0 and RTMIDI) spread wide on the screen for the audience to see.  In fact, he covers so much so quickly it's hard to keep up.  Here's what you'll need to get started.

           1.  Two computers, a "host" and a "victim" so you can run the debugger.  (You run a serial COM1-COM2 cable between the two.)  The victim can be any old machine in your closet, as long as it runs OS/2.

           2.  The free OS/2 Debug Kernel.  This replaces the standard OS/2 Kernel and has hooks that the free ICAT debugger uses.

           3.  TVFS, the Toronto Virtual File System, to keep your files organized.  It's free and it's on Hobbes.

           4.  The Watcom C/C++ compiler.  It's at version 11.0a (I think), and is the compiler of choice for device driver writers.  Prices are wide-ranging; try Provantage at http://www.provantage.com/.

           5.  The DDK Device Development Kit, free from IBM at http://service.boulder.ibm.com/ddk/.

           The DDK comes with the Microsoft C 6.0 compiler, but Timur strongly recommends Watcom.  With Watcom you can write C++ drivers, and that's becoming pretty common.  "You don't have a performance penalty," says Timur, "because you're not using the parts of C++ that slow you down."

           Timur showed the audience how to structure a driver, explained a driver's code sections and entry points, and reviewed how to decide if your driver should be 16-bit or 32-bit.

           Next he discussed the ISR interrupt handler and the WDDPLIB runtime library.  (WDDPLIB comes with the Watcom library; it was written by Timur.)  Following this was a more detailed presentation, with slides showing some actual C code, and the OS/2 kernel's API.  Next was driver initialization including the Resource Manager, Plug 'n' Play support, DosPutMsg, and Return.  Then came the strategy entry point, IOCtl, DosDevIOCtl, inter-device communication and interrupt handlers.

           It was quite an overview, and if Mr. Tabi had a bit more time we probably could have coded up a small driver by the end of the session.  As for me, I'm going to code up that mouse driver, just so I can say "I've done it!"


           For other Warpstock '98 articles see the Warpstock '98 Article Index.


References

OS/2 Programming Web Site, http://www.edm2.com/common/links.html

EDM/2 Magazine, http://www.edm2.com/

OS/2 PDD mailing list, http://www.tabi.org/timur/os2pdd.html

DDK Device Development Kit, http://service.boulder.ibm.com/ddk/

#os2prog IRC channel, http://www.tabi.org/timur/OS2prog.html

News Group for this subject, comp.os.os2.programmer.misc

News Group archives, search comp.os.os2.programmer.misc at http://www.dejanews.com/

Provantage, http://www.provantage.com/


The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA

Copyright 1998 the Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG is a trademark of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation.
All other trademarks remain the property of their respective owners.