![]() |
||
07/16/07 |
|
|
OS/2 Device Driver Library and ToolkitOS/2 Device Driver Library and Toolkit The OS/2 Device Driver Library and Toolkit is a software package that consists of a C callable library of functions that translate the C calls into the corresponding OS/2 Device Helper calls. The OS/2 Device Helper calls are register-based, so the library allows users to write OS/2 device drivers using only C. This makes driver writing much easier with a faster time to market. The Device Driver Library and Toolkit complements the book Writing OS/2 Device Drivers in C, ISBN 0-442-01729-4, and includes all the sample code listed in the book. The library also includes new code for functions introduced after the book was printed, and the new functions for OS/2 Warp and OS/2 SMP. Despite occasional criticism by assembly language zealots, 99% of all OS/2 device drivers run fine when written in C. There are two reasons for this. The first is that the optimizations done by the compiler are very good. The second reason is that the architecture of the device driver is basically a big switch statement, where the operation is decoded, performed, and the driver exited. Of course, there are exceptions to this rule, but in general, you will find writing your OS/2 device drivers much more rewarding and fun if you write them in C. For an example of how to write your OS/2 device drivers in C, you can download the sample code (185K bytes). OS/2 has undergone enormous changes over the past several years, but one thing that has not changed since the release of OS/2 1.0 is the base device driver model. Even with the recent introduction of OS/2 Warp and OS/2 Warp Connect, the device driver model has remained unchanged. So even though the OS/2 version number in the title of the book is dated, the information contained in the book is still valid. The software in the Device Driver Library has been updated to include the new Device Helper calls for OS/2 For Symmetric Multiprocessing, OS/2 Warp, and OS/2 Warp Connect. The library is comes ready to use in LIB form. If you wish to reassemble the library, you will need Microsoft MASM 6.0. The library includes both a small model and large model version and consists of the following functions:
MicroChannel specific
GetLIDEntry (USHORT, USHORT, USHORT, FPUSHORT); FreeLIDEntry (USHORT); ABIOSCall (USHORT, USHORT, FARPOINTER); ABIOSComm (USHORT, FARPOINTER); GetDeviceBlock(USHORT, FARPOINTER); Special routines INT3 (void); Enable (void); Disable (void); Abort (void); SegLimit (SEL, OFF far *); MoveBytes (FARPOINTER,FARPOINTER,USHORT); MoveData (FARPOINTER, FARPOINTER, USHORT, USHORT); System Services and Misc. GetDOSVar (USHORT, FPFARPOINTER); SendEvent (USHORT, USHORT); SchedClockAddr (PFARPOINTER); AttachDD (FARPOINTER, PATTACHAREA); InternalError(PSTRING,USHORT); SaveMessage(FPSTRING); ProtToReal(void); RealToProt(void); SetROMVector(USHORT,PFUNCTION,PFUNCTION,FARPOINTER); Process Mangement Yield (void); TCYield (void); Block (ULONG, ULONG, USHORT, FARPOINTER); Run (ULONG); DevDone (PREQPACKET); VideoPause(USHORT); Memory Management AllocPhys (ULONG, USHORT, PPHYSADDR); FreePhys (PHYSADDR); VerifyAccess (SEL, OFF, USHORT, USHORT); LockSeg (SEL, USHORT, USHORT, PLHANDLE); UnLockSeg (LHANDLE); Address Conversion AllocGDTSelector(USHORT, FARPOINTER); PhysToGDTSelector(PHYSADDR, USHORT, SEL, PERRCODE); VirtToPhys (FARPOINTER, PPHYSADDR); PhysToUVirt (PHYSADDR, USHORT, USHORT, FARPOINTER); PhysToVirt (PHYSADDR, USHORT, USHORT, FARPOINTER); UnPhysToVirt (void); Request packet queue stuff AllocReqPacket (USHORT, PPREQPACKET); FreeReqPacket (PREQPACKET); PushReqPacket (PQHEAD, PREQPACKET); SortReqPacket (PQHEAD, PREQPACKET); PullReqPacket (PQHEAD, PPREQPACKET); PullParticular (PQHEAD, PREQPACKET); User semaphores SemHandle (LHANDLE, FLAG, PLHANDLE); SemRequest (LHANDLE, ULONG, FARPOINTER); SemClear (LHANDLE); Circular character queues QueueInit (PCHARQUEUE); QueueFlush (PCHARQUEUE); QueueWrite (PCHARQUEUE, UCHAR); QueueRead (PCHARQUEUE, FPUCHAR); Interrupt stuff SetIRQ (USHORT, PFUNCTION, USHORT); UnSetIRQ (USHORT); EOI (USHORT); ClaimInterrupt(void); RefuseInterrupt(void); RegisterStackUsage(PREGSTACK); Timer stuff SetTimer (PFUNCTION); ResetTimer (PFUNCTION); TickCount (PFUNCTION, USHORT); Device monitors MonCreate (PSHANDLE, FARPOINTER, FARPOINTER, PERRCODE); Register (SHANDLE, USHORT, PID, FARPOINTER, OFF, PERRCODE); MonWrite (SHANDLE, POINTER, USHORT, USHORT, ULONG, PERRCODE); MonFlush (SHANDLE, PERRCODE); DeRegister (SHANDLE, PID, PERRCODE); OS/2 3.0 and Greater RegisterPDD(FPUCHAR,FPFUNCTION); RegisterBeep(FPFUNCTION); Beep(USHORT,USHORT); FreeGDTSelector(USHORT); PhysToGDTSel(PHYSADDR,ULONG,SEL,USHORT,FPUSHORT); VMLock(LINADDR,ULONG,LINADDR,LINADDR,ULONG,FPULONG); VMUnlock(PLINADDR); VMAlloc(LINADDR,ULONG,ULONG,PLINADDR); VMFree(PHYSADDR); VMProcessToGlobal(LINADDR,ULONG,ULONG,PLINADDR); VMGlobalToProcess(LINADDR,ULONG,ULONG,PLINADDR); VirtToLin(FARPOINTER,PLINADDR); LinToGDTSelector(SEL,LINADDR,ULONG); GetDescInfo(SEL,FPUSHORT,FPULONG,FPULONG); LinToPageList(LINADDR,ULONG,LINADDR,FPULONG); PageListToLin(ULONG,LINADDR,PLINADDR); PageListToGDTSelector(SEL,ULONG,LINADDR,USHORT,FPUSHORT); RegisterTmrDD(FPFUNCTION,FPFARPOINTER,FPFARPOINTER); AllocCtxHook(OFF,ULONG,PLHANDLE); FreeCtxHook(LHANDLE); ArmCtxHook(ULONG,LHANDLE,ULONG); VMSetMem(LINADDR,ULONG,ULONG); OpenEventSem(LHANDLE); CloseEventSem(LHANDLE); PostEventSem(LHANDLE); ResetEventSem(LHANDLE,LINADDR); DynamicAPI(FARPOINTER,USHORT,USHORT,FPUSHORT); SMP DevHlps CreateSpinLock(PHSPINLOCK); FreeSpinLock(HSPINLOCK); AcquireSpinLock(HSPINLOCK); ReleaseSpinLock(HSPINLOCK); PortIO(PPORTIO_STRUCT); SetIRQMask(USHORT,USHORT); GetIRQMask(USHORT,FARPOINTER); Advanced Power Management APMInit(FARPOINTER); APMDeReg(FARPOINTER); NoError(); GetMachine(FARPOINTER); Pricing The device driver library and toolkit is priced at U.S. $149, plus $5.00 shipping when purchased using MasterCard, Visa, or American Express. We accept domestic corporate purchase orders only. We do not accept foreign purchase orders or checks! You can email us with your order. Please allow one week for delivery (email orders shipped immediately). If you are located outside the U.S, you must send a check payable in U.S. dollars, drawn on a U.S. bank for U.S. $179.00. |