home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / kernex32.zip / mwdd_src.zip / 32bits / ext2-os2 / skeleton / device / dev32_strategy.c < prev    next >
C/C++ Source or Header  |  1997-03-16  |  4KB  |  90 lines

  1. //
  2. // $Header: d:\\32bits\\ext2-os2\\skeleton\\device\\rcs\\dev32_strategy.c,v 1.2 1997/03/16 13:07:14 Willm Exp $
  3. //
  4.  
  5. // 32 bits OS/2 device driver and IFS support. Provides 32 bits kernel 
  6. // services (DevHelp) and utility functions to 32 bits OS/2 ring 0 code 
  7. // (device drivers and installable file system drivers).
  8. // Copyright (C) 1995, 1996, 1997  Matthieu WILLM (willm@ibm.net)
  9. //
  10. // This program is free software; you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation; either version 2 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program; if not, write to the Free Software
  22. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  
  24. #define INCL_DOSERRORS
  25. #define INCL_DOS
  26. #define INCL_NOPMAPI
  27. #include <os2.h>
  28.  
  29. #include <os2/types.h>
  30. #include <os2/devhlp32.h>
  31. #include <reqpkt32.h>
  32.  
  33. #include "dev32.h"
  34.  
  35. static int (*driver_routing_table[32])() = {
  36.     dev32_invalid_command,  // 0 = Init (will be called directly by mwdd32.sys at ring 0, because FLAT CS in unreachable at ring 3.)
  37.     dev32_invalid_command,  // 1 = Media Check
  38.     dev32_invalid_command,  // 2 = Build BPB
  39.     dev32_invalid_command,  // 3 = Reserved
  40.     dev32_invalid_command,  // 4 = Read
  41.     dev32_invalid_command,  // 5 = Non-Destruct Read NoWait
  42.     dev32_invalid_command,  // 6 = Input Status
  43.     dev32_invalid_command,  // 7 = Input Flush
  44.     dev32_invalid_command,  // 8 = Write
  45.     dev32_invalid_command,  // 9 = Write w/Verify
  46.     dev32_invalid_command,  // A = Output Status
  47.     dev32_invalid_command,  // B = Output Flush
  48.     dev32_invalid_command,  // C = Reserved
  49.     dev32_open,             // D = Device Open (R/M)
  50.     dev32_close,            // E = Device Close (R/M)
  51.     dev32_invalid_command,  // F = Removable Media (R/M)
  52.     dev32_ioctl,            // 10 = Generic Ioctl
  53.     dev32_invalid_command,  // 11 = Reset Media
  54.     dev32_invalid_command,  // 12 = Get Logical Drive Map
  55.     dev32_invalid_command,  // 13 = Set Logical Drive Map
  56.     dev32_invalid_command,  // 14 = DeInstall
  57.     dev32_invalid_command,  // 15 = 
  58.     dev32_invalid_command,  // 16 = Get # Partitions
  59.     dev32_invalid_command,  // 17 = Get Unit map
  60.     dev32_invalid_command,  // 18 = No caching read
  61.     dev32_invalid_command,  // 19 = No caching write
  62.     dev32_invalid_command,  // 1A = No caching write w/Verify
  63.     dev32_invalid_command,  // 1B = Initialize
  64.     dev32_shutdown,         // 1C = Shutdown
  65.     dev32_invalid_command,  // 1D = Get DCS/VCS
  66.     dev32_invalid_command,  // 1E = ???
  67.     dev32_init_complete     // 1F = Init Complete
  68. };
  69.  
  70.  
  71. /*
  72.  * This is the 32 bits strategy entry point
  73.  */
  74. int DRV32ENTRY dev32_strategy(PTR16 reqpkt, int index) {
  75.     int status;
  76.  
  77.     if (index < sizeof(driver_routing_table) / sizeof(*driver_routing_table)) {
  78.         /*
  79.          * Valid command received
  80.          */
  81.         status = driver_routing_table[index](reqpkt);
  82.     } else {
  83.         /*
  84.          * Invalid command received
  85.          */
  86.         status = STDON + STERR + ERROR_I24_INVALID_PARAMETER;
  87.     }
  88.     return status;
  89. }
  90.