Library and Services
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation
A complement of library services for common adapter device driver tasks is provided in the IBM Device Driver Source Kit for OS/2. This adapter device driver library includes a set of functions that can be statically linked with an adapter device driver at build time.
These library services are provided in both source and object form. This code is in the \addcalls and \devhelp subdirectories of the \src tree. You can modify and extend this code to suit your needs.
The DevHlp services are provided with FAR code and data-calling convention support. Adapter Device Driver Calls services are generally provided with both FAR and NEAR calling-convention support.
The library services include the following:
- 'C' interface to the DevHlp kernel services
- Timer services
- Scatter/gather buffer transfers
- RBA ↔ CHS computations
- DMA setup and channel control, ISA bus machines
- Command line parsing
See the headers of the individual functions for a detailed description of function services and their calling conventions.
Command-Line Parsing
To facilitate parsing of command-line parameters and to help encourage uniformity in command-line syntax, a parser/tokenizer is provided in the IBM Device Driver Source Kit for OS/2. See Adapter Device Driver Command-Line Parameters for a command-line syntax definition.
The output of the parser/tokenizer is a stream of tokens that represent the contents of the command line. The parser/tokenizer performs preliminary syntactical checks on the command line and indicates the results of these checks in return codes.
As with the other library services provided in the IBM Device Driver Source Kit for OS/2, you can modify the parser and its included tables to add adapter-unique flags and parameters.