Ignore:
Timestamp:
Jun 9, 2016, 10:38:13 PM (9 years ago)
Author:
David Azarewicz
Message:

Rearrange directory structure
rework makefiles
cleanup files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk/drv32/strategy.c

    r549 r587  
    55 * (C) 2000-2002 InnoTek Systemberatung GmbH
    66 * (C) 2000-2001 Sander van Leeuwen (sandervl@xs4all.nl)
     7 * Copyright (c) 2013-2015 David Azarewicz david@88watts.net
    78 *
    89 * This program is free software; you can redistribute it and/or
     
    2425
    2526#define INCL_NOPMAPI
    26 #define INCL_DOSINFOSEG         // Need Global info seg in rm.cpp algorithms
     27#define INCL_DOSINFOSEG   // Need Global info seg in rm.cpp algorithms
    2728#include <os2.h>
    2829
    2930#include <devhelp.h>
    30 #include <devrp.h>
     31//DAZ #include <devrp.h>
    3132#include <devown.h>
    3233#include "strategy.h"
     
    3536#include <string.h>
    3637
    37 ULONG StratRead(RP __far *_rp);
    38 ULONG StratIOCtl(RP __far *_rp);
    39 ULONG StratClose(RP __far *_rp);
     38ULONG StratRead(REQPACKET __far *_rp);
     39ULONG StratIOCtl(REQPACKET __far *_rp);
     40ULONG StratClose(REQPACKET __far *_rp);
    4041
    41 ULONG DiscardableInit(RPInit __far*);
     42ULONG DiscardableInit(REQPACKET __far*);
    4243ULONG deviceOwner = DEV_NO_OWNER;
    4344ULONG numOS2Opens = 0;
    44 extern "C" BOOL fRewired; //pci.c
     45extern BOOL fRewired; //pci.c
    4546
    46 extern "C" DBGINT DbgInt;
     47extern DBGINT DbgInt;
    4748
    4849//******************************************************************************
     50ULONG StratOpen(REQPACKET __far* rp)
     51{
     52  if (numOS2Opens == 0)
     53  {
     54    deviceOwner = DEV_PDD_OWNER;
     55  }
     56  numOS2Opens++;
     57  return RPDONE;
     58}
     59
    4960//******************************************************************************
    50 ULONG StratOpen(RP __far*)
    51 {
    52         if (numOS2Opens == 0) {
    53                 deviceOwner = DEV_PDD_OWNER;
    54         }
    55         numOS2Opens++;
    56                 return RPDONE;
    57 }
    58 //******************************************************************************
    59 //******************************************************************************
    60 #pragma off (unreferenced)
    61 static ULONG StratWrite(RP __far* _rp)
    62 #pragma on (unreferenced)
     61//DAZ #pragma off (unreferenced)
     62static ULONG StratWrite(REQPACKET __far* rp)
     63//DAZ #pragma on (unreferenced)
    6364{
    6465  return RPDONE | RPERR;
    6566}
     67
    6668//******************************************************************************
    6769// External initialization entry-point
    6870//******************************************************************************
    69 ULONG StratInit(RP __far* _rp)
     71ULONG StratInit(REQPACKET __far* rp)
    7072{
    71         ULONG rc;
     73  ULONG rc;
    7274
    73         memset(&DbgInt, 0, sizeof(DbgInt));
    74         DbgPrintIrq();
     75  memset(&DbgInt, 0, sizeof(DbgInt));
     76  DbgPrintIrq();
    7577
    76         RPInit __far* rp = (RPInit __far*)_rp;
    77         rc = DiscardableInit(rp);
    78         //dprintf(("StratInit End rc=%d", rc));
    79         DbgPrintIrq();
    80         DbgInt.ulState = 1;
    81         return rc;
     78  //DAZ RPInit __far* rp = (RPInit __far*)_rp;
     79  rc = DiscardableInit(rp);
     80  //dprintf(("StratInit End rc=%d", rc));
     81  DbgPrintIrq();
     82  DbgInt.ulState = 1;
     83  return rc;
    8284}
     85
    8386//******************************************************************************
    8487// External initialization complete entry-point
    85 #ifdef ACPI
    86 #include "irqos2.h"
    87 #endif //ACPI
    8888//******************************************************************************
    89 #pragma off (unreferenced)
    90 ULONG StratInitComplete(RP __far* _rp)
    91 #pragma on (unreferenced)
     89//DAZ #pragma off (unreferenced)
     90ULONG StratInitComplete(REQPACKET __far* rp)
     91//DAZ #pragma on (unreferenced)
    9292{
    93         DbgInt.ulState = 2;
    94 #ifdef ACPI
    95         PciAdjustInterrupts();
    96 #endif
    97         DbgPrintIrq();
    98         //dprintf(("StratInitComplete"));
    99         return(RPDONE);
     93  DbgInt.ulState = 2;
     94  DbgPrintIrq();
     95  //dprintf(("StratInitComplete"));
     96  return(RPDONE);
    10097}
     98
    10199//******************************************************************************
    102 //******************************************************************************
    103 #pragma off (unreferenced)
    104 ULONG StratShutdown(RP __far *_rp)
    105 #pragma on (unreferenced)
     100//DAZ #pragma off (unreferenced)
     101ULONG StratShutdown(REQPACKET __far *rp)
     102//DAZ #pragma on (unreferenced)
    106103{
    107         RPShutdown __far *rp = (RPShutdown __far *)_rp;
     104  //DAZ RPShutdown __far *rp = (RPShutdown __far *)_rp;
    108105
    109         //dprintf(("StratShutdown %d", rp->Function));
    110         if(rp->Function == 1) {//end of shutdown
    111                 OSS32_Shutdown();
    112         }
    113         return(RPDONE);
     106  //dprintf(("StratShutdown %d", rp->Function));
     107  if(rp->shutdown.Function == 1) //end of shutdown
     108  {
     109    OSS32_Shutdown();
     110  }
     111  return(RPDONE);
    114112}
    115 //******************************************************************************
     113
    116114//******************************************************************************
    117115// Handle unsupported requests
    118 static ULONG StratError(RP __far*)
     116static ULONG StratError(REQPACKET __far* rp)
    119117{
    120   return RPERR_COMMAND | RPDONE;
     118  return RPERR_BADCOMMAND | RPDONE;
    121119}
     120
    122121//******************************************************************************
    123122// Strategy dispatch table
     
    125124// This table is used by the strategy routine to dispatch strategy requests
    126125//******************************************************************************
    127 typedef ULONG (*RPHandler)(RP __far* rp);
     126typedef ULONG (*RPHandler)(REQPACKET __far* rp);
    128127RPHandler StratDispatch[] =
    129128{
    130   StratInit,                              // 00 (BC): Initialization
    131   StratError,                             // 01 (B ): Media check
    132   StratError,                             // 02 (B ): Build BIOS parameter block
    133   StratError,                             // 03 (  ): Unused
    134   StratRead,                              // 04 (BC): Read
    135   StratError,                             // 05 ( C): Nondestructive read with no wait
    136   StratError,                             // 06 ( C): Input status
    137   StratError,                             // 07 ( C): Input flush
    138   StratWrite,                             // 08 (BC): Write
    139   StratError,                             // 09 (BC): Write verify
    140   StratError,                             // 0A ( C): Output status
    141   StratError,                             // 0B ( C): Output flush
    142   StratError,                             // 0C (  ): Unused
    143   StratOpen,                              // 0D (BC): Open
    144   StratClose,                             // 0E (BC): Close
    145   StratError,                             // 0F (B ): Removable media check
    146   StratIOCtl,                             // 10 (BC): IO Control
    147   StratError,                             // 11 (B ): Reset media
    148   StratError,                             // 12 (B ): Get logical unit
    149   StratError,                             // 13 (B ): Set logical unit
    150   StratError,                             // 14 ( C): Deinstall character device driver
    151   StratError,                             // 15 (  ): Unused
    152   StratError,                             // 16 (B ): Count partitionable fixed disks
    153   StratError,                             // 17 (B ): Get logical unit mapping of fixed disk
    154   StratError,                             // 18 (  ): Unused
    155   StratError,                             // 19 (  ): Unused
    156   StratError,                             // 1A (  ): Unused
    157   StratError,                             // 1B (  ): Unused
    158   StratShutdown,                          // 1C (BC): Notify start or end of system shutdown
    159   StratError,                             // 1D (B ): Get driver capabilities
    160   StratError,                             // 1E (  ): Unused
    161   StratInitComplete               // 1F (BC): Notify end of initialization
     129  StratInit,          // 00 (BC): Initialization
     130  StratError,         // 01 (B ): Media check
     131  StratError,         // 02 (B ): Build BIOS parameter block
     132  StratError,         // 03 (  ): Unused
     133  StratRead,          // 04 (BC): Read
     134  StratError,         // 05 ( C): Nondestructive read with no wait
     135  StratError,         // 06 ( C): Input status
     136  StratError,         // 07 ( C): Input flush
     137  StratWrite,         // 08 (BC): Write
     138  StratError,         // 09 (BC): Write verify
     139  StratError,         // 0A ( C): Output status
     140  StratError,         // 0B ( C): Output flush
     141  StratError,         // 0C (  ): Unused
     142  StratOpen,          // 0D (BC): Open
     143  StratClose,         // 0E (BC): Close
     144  StratError,         // 0F (B ): Removable media check
     145  StratIOCtl,         // 10 (BC): IO Control
     146  StratError,         // 11 (B ): Reset media
     147  StratError,         // 12 (B ): Get logical unit
     148  StratError,         // 13 (B ): Set logical unit
     149  StratError,         // 14 ( C): Deinstall character device driver
     150  StratError,         // 15 (  ): Unused
     151  StratError,         // 16 (B ): Count partitionable fixed disks
     152  StratError,         // 17 (B ): Get logical unit mapping of fixed disk
     153  StratError,         // 18 (  ): Unused
     154  StratError,         // 19 (  ): Unused
     155  StratError,         // 1A (  ): Unused
     156  StratError,         // 1B (  ): Unused
     157  StratShutdown,        // 1C (BC): Notify start or end of system shutdown
     158  StratError,         // 1D (B ): Get driver capabilities
     159  StratError,         // 1E (  ): Unused
     160  StratInitComplete       // 1F (BC): Notify end of initialization
    162161};
     162
    163163//******************************************************************************
    164164// Strategy entry point
     
    167167// calling convention, which fetches arguments from the correct registers.
    168168//******************************************************************************
    169 ULONG Strategy(RP __far* rp);
    170169#pragma aux (STRATEGY) Strategy "ALSA_STRATEGY";
    171 ULONG Strategy(RP __far* rp)
     170ULONG Strategy(REQPACKET __far* rp)
    172171{
    173         if (fRewired) {
    174                 fRewired = FALSE;
    175                 rprintf(("Strategy: Resuming"));
    176                 OSS32_APMResume();
    177                 DbgPrintIrq();
    178         }
     172  if (fRewired)
     173  {
     174    fRewired = FALSE;
     175    rprintf(("Strategy: Resuming"));
     176    OSS32_APMResume();
     177    DbgPrintIrq();
     178  }
    179179
    180         if (rp->Command < sizeof(StratDispatch)/sizeof(StratDispatch[0]))
    181                 return(StratDispatch[rp->Command](rp));
    182         else return(RPERR_COMMAND | RPDONE);
     180  if (rp->bCommand < sizeof(StratDispatch)/sizeof(StratDispatch[0])) return(StratDispatch[rp->bCommand](rp));
     181  else return(RPERR_BADCOMMAND | RPDONE);
    183182}
    184 //******************************************************************************
    185 //******************************************************************************
     183
Note: See TracChangeset for help on using the changeset viewer.