home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 4 Drivers / 04-Drivers.zip / CDRIVER.ZIP / CDRIVER.DOC < prev    next >
Text File  |  1991-01-12  |  5KB  |  115 lines

  1. 01-12-91 ras - initial entry
  2.  
  3. This set of modules comprise an example OS/2 Device Driver, written
  4. primarily in 'C'.  The purpose of this distribution is to give other
  5. OS/2 developers an example of a 'real' device driver that they can
  6. use to build other drivers.  The source code is copyrighted, and part
  7. of a product that we market for many thousands of dollars.  However,
  8. I feel that the code is so special purpose in application, that no
  9. real competitive advantage would be lost by distributing it to
  10. other interested OS/2 developers.  Feel free to use it to explore
  11. how to build OS/2 device drivers in C.  Obviously we make no warranties
  12. regarding its correctness nor usefulness, and assume no liabilities for 
  13. any uses you might make of the code.  I will not provide any support
  14. and may or may not redistribute any corrections I or others find.
  15.  
  16. If you wish to make any comments regarding the driver, I can usually
  17. be contacted as following:
  18.  
  19.     Richard Stafford
  20.     Byers Engineering Company
  21.     6285 Barfield Rd
  22.     Atlanta, GA 30328
  23.  
  24.     or: CompuServe:             73750,2305
  25.         OS/2 Shareware BBS      703-385-4325
  26.  
  27. This driver is an early version of a driver I use to control the 
  28. interface to large format, high speed raster plotters.  It is used 
  29. to output monochrome bit map images of up to about 20,000 pixels wide,
  30. by any number of pixels long, at a data rate of up to 700,000 bytes 
  31. per second.
  32.  
  33. The driver is used with an Ikon 10092 interface adaptor for the
  34. ISA bus.  This adaptor is operated under Interrupt control, and
  35. uses DMA for transferring the raster images from memory buffers
  36. to the raster plotter.  Some information regarding the operation
  37. of the adaptor can be gleaned from the BIKONC.C module #def's.
  38.  
  39. Please note that this driver is intended to operate in Protected
  40. mode only.  It does not properly handle the case of being called
  41. from the DOS box in real mode, nor does its Interrupt Service
  42. routine handle interrupts while in real mode.  The target environment
  43. for this product is a protected mode only machine, and having to handle
  44. the real mode cases would complicate the driver with no real gain.
  45.  
  46. Using this driver as an example, it should be possible to write
  47. other OS/2 drivers using only the OS/2 PM Toolkit, and the book 
  48. "Writing OS/2 Device Drivers" by Raymond Westwater.  The Microsoft 
  49. OS/2 Device Driver Kit is not necessary, though it is useful as an
  50. alternative view of some of the things in Westwater's book.  However, 
  51. neither of these sources address development of drivers in C.  
  52.  
  53. After having written several OS/2 drivers in both MASM and C, I 
  54. greatly recommend the C approach.  Only if you have to handle the 
  55. real mode case, where you have to be really careful with segment 
  56. registers, would I see any benefit to MASM code.  This driver
  57. handles a fairly complicated device, using Interrupts, DMA, and
  58. IOCTL, and still is only about 3600 bytes long, including data
  59. structures.  It would not benefit much in either speed or size
  60. by having been written solely in MASM.
  61.  
  62. The following files are included in this distribution:
  63.  
  64.     CDRIVER.DOC   this file
  65.     CDRIVER.H     general include file for writing C drivers
  66.     BYTYPES.H     include file defining some names for int, long, etc
  67.     BIKON.H       include file specific to this driver
  68.     BIKONA.ASM    primary interface between the C modules and OS/2,
  69.                   includes the strategy entry point and some interfaces
  70.                   between C and OS/2 DevHlp modules
  71.     BIKONC.C      all adaptor interface code resides in this module
  72.     BIKON.DEF     a linker .DEF file
  73.     TEST_IK.C     a module to demonstrate calls to the device driver
  74.  
  75. As we use the Polytron MAKE tool, not the Microsoft MAKE tool, I have
  76. not included the complete set of make instructions.  However, the following
  77. should be sufficient for anyone knowledgeble enough to write a driver:
  78.  
  79. To produce BIKONA.OBJ
  80.  
  81.  MASM BIKONA, BIKONA/ZI;
  82.  
  83. To produce BIKONC.OBJ
  84.  
  85.  CL -Ox -Zip -G2s -W2 -J -FPi -AL -Aw -c BIKONC.c
  86.  
  87. To produce BIKON.OS2
  88.  
  89.  LINK BIKONA+BIKONC, 
  90.       bikon.os2, 
  91.       bikon.map, 
  92.       \msc\lib\os2.lib,
  93.       bikon.def /EXEPACK/NOE/NOD
  94.  
  95. There are several methods for testing of OS/2 device drivers.  One method
  96. is to use the Debug Kernal that comes with the OS/2 2.0 SDK or the
  97. Device Driver Kit from Microsoft.  An alternative method that we used
  98. involved the RAMSCOPE tool.  This shareware tool allows you to display,
  99. in a PM window, the contents of any area of physical memory.  We used
  100. this tool to watch the driver data structures and gain hints as to
  101. what was going on.  This tool is available on the OS/2 Shareware BBS.
  102.  
  103. The following tools were used to perform this development:
  104.  
  105.   IBM OS/2 1.3 on a 486/33 clone with 8mb ram and 300mb disk
  106.   MSC 6.00A
  107.   MASM 5.10
  108.   MS Segmented-Executable Linker 5.10
  109.   MS PM Toolkit 1.2
  110.   Brief 3.0
  111.   Ramscope 2.0
  112.  
  113. I hope you find this information useful.  Good luck on your device 
  114. driver development.
  115.