home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / devddemo.zip / STRATEGY.C < prev    next >
Text File  |  1991-01-31  |  5KB  |  133 lines

  1. /***************************************************************************/
  2. /* strategy_c(req_hdr)                                                     */
  3. /*  Strategy function. Called by assembler portion of strategy entry point */
  4. /*  of DD, this is functionally the strategy entry point.  It looks at the */
  5. /*  command portion of the request packet an calls the proper function.    */
  6. /*                                                                         */
  7. /*  There is only 1 command that really does anything - INIT.  Others      */
  8. /*  don't but say we did.  Finally, the rest Return BAD_CMD.               */
  9. /*                                                                         */
  10. /*  All commands return a value that will be ORed with the DONE bit and    */
  11. /*  set into the request packet's STATUS field via DEV_DONE.               */
  12. /*                                                                         */
  13. /***************************************************************************/
  14. #include "demo.h"
  15.  
  16. int far strategy_c(req_hdr)
  17. struct reqhdr *req_hdr;
  18. {
  19.   word rc;
  20.   boolean entered_real;
  21.  
  22.   /* Insure that we are in protect mode */
  23.   entered_real = to_prot_mode();
  24.  
  25.   /* Check to see if the command is outside the range of valid commands */
  26.   if (req_hdr->rh_cmd > MAXCMD) { rc = bad_cmd(); }
  27.   else {
  28.  
  29.   /* Different commands call for different functions */
  30.      switch (req_hdr->rh_cmd) {
  31.         case  0 :
  32.                   rc = init_mod(req_hdr);    /* Init */
  33.                   break;
  34.         case  1 :
  35.                   rc = bad_cmd();            /* Media Check */
  36.                   break;
  37.         case  2 :
  38.                   rc = bad_cmd();            /* Build BPB */
  39.                   break;
  40.         case  3 :
  41.                   rc = bad_cmd();            /* Reserved */
  42.                   break;
  43.         case  4 :
  44.                   rc = bad_cmd();            /* Read */
  45.                   break;
  46.         case  5 :
  47.                   rc = bad_cmd();            /* Non-destructive Read */
  48.                   break;
  49.         case  6 :
  50.                   rc = bad_cmd();            /* Input Status */
  51.                   break;
  52.         case  7 :
  53.                   rc = bad_cmd();            /* Input Flush */
  54.                   break;
  55.         case  8 :
  56.                   rc = 0;                    /* Write */
  57.                   break;
  58.         case  9 :
  59.                   rc = bad_cmd();            /* Write with Verify */
  60.                   break;
  61.         case 10 :
  62.                   rc = bad_cmd();            /* Output Status */
  63.                   break;
  64.         case 11 :
  65.                   rc = 0;                    /* Output Flush */
  66.                   break;
  67.         case 12 :
  68.                   rc = bad_cmd();            /* Reserved */
  69.                   break;
  70.         case 13 :
  71.                   rc = 0;                    /* Open */
  72.                   break;
  73.         case 14 :
  74.                   rc = 0;                    /* Close */
  75.                   break;
  76.         case 15 :
  77.                   rc = bad_cmd();            /* Removable Media */
  78.                   break;
  79.         case 16 :
  80.                   rc = 0;                    /* IOCtl      */
  81.                   break;
  82.         case 17 :
  83.                   rc = bad_cmd();            /* Reset media */
  84.                   break;
  85.         case 18 :
  86.                   rc = bad_cmd();            /* Get Logical Drive Map */
  87.                   break;
  88.         case 19 :
  89.                   rc = bad_cmd();            /* Set Logical Drive Map */
  90.                   break;
  91.         case 20 :
  92.                   rc = 0;                    /* De-install */
  93.                   break;
  94.         case 21 :
  95.                   rc = bad_cmd();            /* Port Access */
  96.                   break;
  97.         case 22 :
  98.                   rc = bad_cmd();            /* Partitionable Fixed Disks */
  99.                   break;
  100.         case 23 :
  101.                   rc = bad_cmd();            /* Get Logical Unit Map */
  102.                   break;
  103.         case 24 :
  104.                   rc = bad_cmd();            /* Reserved */
  105.                   break;
  106.         case 25 :
  107.                   rc = bad_cmd();            /* Reserved */
  108.                   break;
  109.         case 26 :
  110.                   rc = bad_cmd();            /* Reserved */
  111.                   break;
  112.  
  113.         case 27 :
  114.                   rc = bad_cmd();            /* Reserved */
  115.                   break;
  116.  
  117.         default :                            /* Just in case */
  118.                   rc = bad_cmd();
  119.                   break;
  120.      } /* switch */
  121.    } /* else */
  122.  
  123.   /* Unblock the waiting app */
  124.   if (req_hdr->rh_cmd) { dev_done(req_hdr,rc); }
  125.   else { req_hdr->rh_stat = DONE; }
  126.  
  127.   /* Go back to real mode if we entered in real mode */
  128.   if (entered_real) {to_real_moda(); }
  129.  
  130.   return(SUCCESS);
  131.  
  132. }
  133.