Changeset 564


Ignore:
Timestamp:
Jul 7, 2012, 2:07:58 AM (13 years ago)
Author:
David Azarewicz
Message:

added support for ACPI sleep/wake

Location:
OCO/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • OCO/trunk/drv16/header.c

    r33 r564  
    4040      {'U','N','I','A','U','D','1','$'},
    4141      0,0,
    42       DC_INITCPLT | DC_IOCTL2 | DC_32BIT
     42      DC_INITCPLT | DC_IOCTL2 | DC_32BIT | 0x20 /* Save/Restore */
    4343   },
    4444   {  -1,
  • OCO/trunk/drv16/strategy.cpp

    r534 r564  
    33/* SCCSID = %W% %E% */
    44/****************************************************************************
    5  *                                                                                                                                                      *
    6  * Copyright (c) IBM Corporation 1994 - 1997.                                                           *
    7  *                                                                                                                                                      *
    8  * The following IBM OS/2 source code is provided to you solely for the         *
     5 *                                                                          *
     6 * Copyright (c) IBM Corporation 1994 - 1997.                               *
     7 *                                                                          *
     8 * The following IBM OS/2 source code is provided to you solely for the     *
    99 * the purpose of assisting you in your development of OS/2 device drivers. *
    10  * You may use this code in accordance with the IBM License Agreement           *
    11  * provided in the IBM Device Driver Source Kit for OS/2.                                       *
    12  *                                                                                                                                                      *
     10 * You may use this code in accordance with the IBM License Agreement       *
     11 * provided in the IBM Device Driver Source Kit for OS/2.                   *
     12 *                                                                          *
    1313 ****************************************************************************/
    1414/**@internal %W%
     
    1717 * @version %I%
    1818 * @context Unless otherwise noted, all interfaces are Ring-0, 16-bit,
    19  *      kernel stack.
     19 *  kernel stack.
    2020 * @history
    2121 *
    2222 */
    23 extern "C" {                       // 16-bit header files are not C++ aware
     23extern "C" {               // 16-bit header files are not C++ aware
    2424#define INCL_NOPMAPI
    2525#define INCL_DOSINFOSEG
     
    3333#include <devhelp.h>
    3434#include "strategy.h"
    35 #include "rtmidi.hpp"                              // Object definition
     35#include "rtmidi.hpp"                  // Object definition
    3636#include "end.h"
    3737
     
    4545#include "fmsynth.hpp"
    4646#include "mpu401.hpp"
     47#include "apm.h"
    4748
    4849
     
    8586extern "C" char szAZX[];
    8687
    87 static char *pszIntelICH                = (char *)szINTEL_ICH;
     88static char *pszIntelICH        = (char *)szINTEL_ICH;
    8889static char *pszSigmatel9721_23 = (char *)szSIGMATEL_9721_23;
    89 static char *pszSBLive                  = (char *)szSBLIVE;
    90 static char *pszCMedia                  = (char *)szCMEDIA;
    91 static char *pszCrystal4281     = (char *)szCS4281;
    92 static char *pszALS4000                 = (char *)szALS4000;
    93 static char *pszCrystal46XX     = (char *)szCS46XX;
    94 static char *pszVIA82XX                 = (char *)szVIA82XX;
    95 static char *pszESS1938                 = (char *)szESS1938;
    96 static char *pszVORTEX                  = (char *)szVORTEX;
    97 static char *pszES1371                  = (char *)szES1371;
    98 static char *pszES1370                  = (char *)szES1370;
    99 static char *pszYAMAHA                  = (char *)szYAMAHA;
    100 static char *pszMAESTRO                 = (char *)szMAESTRO;
    101 static char *pszMAESTRO3                = (char *)szMAESTRO3;
    102 static char *pszALLEGRO                 = (char *)szALLEGRO;
    103 static char *pszALI5451                 = (char *)szALI5451;
    104 static char *pszSI7012                  = (char *)szSI7012;
    105 static char *pszALI5455                 = (char *)szALI5455;
    106 static char *pszNVIDIA                  = (char *)szNVIDIA;
    107 static char *pszAMD                     = (char *)szAMD;
    108 static char *pszTRIDENT                 = (char *)szTRIDENT;
    109 static char *pszNEOMAGIC                = (char *)szNEOMAGIC;
    110 static char *pszFM801                   = (char *)szFM801;
    111 static char *pszATIIXP                  = (char *)szATIIXP;
    112 static char *pszAUDIGYLS                = (char *)szAUDIGYLS;
    113 static char *pszBT87X                   = (char *)szBT87X;
    114 static char *pszAZX                     = (char *)szAZX;
     90static char *pszSBLive          = (char *)szSBLIVE;
     91static char *pszCMedia          = (char *)szCMEDIA;
     92static char *pszCrystal4281     = (char *)szCS4281;
     93static char *pszALS4000         = (char *)szALS4000;
     94static char *pszCrystal46XX     = (char *)szCS46XX;
     95static char *pszVIA82XX         = (char *)szVIA82XX;
     96static char *pszESS1938         = (char *)szESS1938;
     97static char *pszVORTEX          = (char *)szVORTEX;
     98static char *pszES1371          = (char *)szES1371;
     99static char *pszES1370          = (char *)szES1370;
     100static char *pszYAMAHA          = (char *)szYAMAHA;
     101static char *pszMAESTRO         = (char *)szMAESTRO;
     102static char *pszMAESTRO3        = (char *)szMAESTRO3;
     103static char *pszALLEGRO         = (char *)szALLEGRO;
     104static char *pszALI5451         = (char *)szALI5451;
     105static char *pszSI7012          = (char *)szSI7012;
     106static char *pszALI5455         = (char *)szALI5455;
     107static char *pszNVIDIA          = (char *)szNVIDIA;
     108static char *pszAMD             = (char *)szAMD;
     109static char *pszTRIDENT         = (char *)szTRIDENT;
     110static char *pszNEOMAGIC        = (char *)szNEOMAGIC;
     111static char *pszFM801           = (char *)szFM801;
     112static char *pszATIIXP          = (char *)szATIIXP;
     113static char *pszAUDIGYLS        = (char *)szAUDIGYLS;
     114static char *pszBT87X           = (char *)szBT87X;
     115static char *pszAZX             = (char *)szAZX;
    115116#endif /* ENABLE_HW_CERTIFICATION */
    116117
    117            BOOL fNoHardware             = FALSE;
     118       BOOL fNoHardware         = FALSE;
    118119
    119120extern void DBGCALLCONV APM_Init();
     
    127128  int d;
    128129  for (;;)
    129         {
    130 //              d = (int)(unsigned char)*string1 - (int)(unsigned char)(*string2 ^ 0x81);
    131            d = (int)(unsigned char)*string1 - (int)(unsigned char)*string2;
    132            if (d != 0 || *string1 == 0 || *string2 == 0)
    133                 return d;
    134            ++string1; ++string2;
    135         }
     130    {
     131//      d = (int)(unsigned char)*string1 - (int)(unsigned char)(*string2 ^ 0x81);
     132       d = (int)(unsigned char)*string1 - (int)(unsigned char)*string2;
     133       if (d != 0 || *string1 == 0 || *string2 == 0)
     134        return d;
     135       ++string1; ++string2;
     136    }
    136137}
    137138//******************************************************************************
     
    142143
    143144  while (count != 0)
    144         {
    145                 //              d = (int)(unsigned char)*string1 - (int)(unsigned char)(*string2 ^ 0x81);
    146           d = (int)(unsigned char)*string1 - (int)(unsigned char)*string2;
    147           if (d != 0 || *string1 == 0 || *string2 == 0)
    148                 return d;
    149           ++string1; ++string2;
    150           --count;
    151         }
     145    {
     146        //      d = (int)(unsigned char)*string1 - (int)(unsigned char)(*string2 ^ 0x81);
     147      d = (int)(unsigned char)*string1 - (int)(unsigned char)*string2;
     148      if (d != 0 || *string1 == 0 || *string2 == 0)
     149        return d;
     150      ++string1; ++string2;
     151      --count;
     152    }
    152153  return 0;
    153154}
     
    161162   if(OSS16_AttachToPdd() != OSSERR_SUCCESS)
    162163   {
    163            DebugInt3();
    164 //              DevHelp_Beep(500, 100);
    165            goto failure;
     164       DebugInt3();
     165//      DevHelp_Beep(500, 100);
     166       goto failure;
    166167   }
    167168#ifdef DEBUG
    168         rprintf(("Uniaud16 v"UNIAUD_VERSION"-DEBUG"));
     169    rprintf(("Uniaud16 v"UNIAUD_VERSION"-DEBUG"));
    169170#else
    170         rprintf(("Uniaud16 v"UNIAUD_VERSION));
     171    rprintf(("Uniaud16 v"UNIAUD_VERSION));
    171172#endif
    172173
     
    174175   if(OSS16_QueryDevCaps(current_device, &devCaps[0]) != OSSERR_SUCCESS)
    175176   {
    176            DebugInt3();
    177            //           DevHelp_Beep(2000, 100);
    178            goto failure;
     177       DebugInt3();
     178       //       DevHelp_Beep(2000, 100);
     179       goto failure;
    179180   }
    180181   dprintf(("Device 0 name: %s", (char FAR *)devCaps[0].szDeviceName));
    181182   if(devCaps[0].nrDevices > OSS32_MAX_AUDIOCARDS)
    182183   {
    183            DebugInt3();
    184            devCaps[0].nrDevices = OSS32_MAX_AUDIOCARDS;
     184       DebugInt3();
     185       devCaps[0].nrDevices = OSS32_MAX_AUDIOCARDS;
    185186   }
    186187   //Get caps of other devices (if present)
    187188   for(i=1;i<devCaps[0].nrDevices;i++)
    188189   {
    189            if(OSS16_QueryDevCaps(i, &devCaps[i]) != OSSERR_SUCCESS) {
    190                    DebugInt3();
    191                    goto failure;
    192            }
     190       if(OSS16_QueryDevCaps(i, &devCaps[i]) != OSSERR_SUCCESS) {
     191           DebugInt3();
     192           goto failure;
     193       }
    193194   }
    194195
     
    197198   //Check for certified audiocard/chipsets
    198199   if(!xorstrncmp(devCaps[0].szDeviceName, pszIntelICH, 6) ||
    199           !xorstrcmp(devCaps[0].szDeviceName, pszSI7012) ||
    200           !xorstrcmp(devCaps[0].szDeviceName, pszALI5455) ||
    201           !xorstrncmp(devCaps[0].szDeviceName, pszNVIDIA, 6) ||
    202           !xorstrcmp(devCaps[0].szDeviceName, pszAMD))
    203    {
    204            soundCard = INTELICH;
     200      !xorstrcmp(devCaps[0].szDeviceName, pszSI7012) ||
     201      !xorstrcmp(devCaps[0].szDeviceName, pszALI5455) ||
     202      !xorstrncmp(devCaps[0].szDeviceName, pszNVIDIA, 6) ||
     203      !xorstrcmp(devCaps[0].szDeviceName, pszAMD))
     204   {
     205       soundCard = INTELICH;
    205206   }
    206207   else
    207208   if(!xorstrcmp(devCaps[0].szDeviceName, pszSBLive))
    208209   {
    209            soundCard = SBLIVE;
     210       soundCard = SBLIVE;
    210211   }
    211212   else
    212213   if(!xorstrncmp(devCaps[0].szDeviceName, pszCMedia, 11))
    213214   {
    214            soundCard = CMEDIA;
     215       soundCard = CMEDIA;
    215216   }
    216217   else
    217218   if(!xorstrcmp(devCaps[0].szDeviceName, pszCrystal4281))
    218219   {
    219            soundCard = CS4281;
     220       soundCard = CS4281;
    220221   }
    221222   else
    222223   if(!xorstrcmp(devCaps[0].szDeviceName, pszALS4000))
    223224   {
    224            //hardware not completely full duplex; sample rates must be identical if
    225            //both playback & recording active
    226            devCaps[0].waveInCaps.ulRateFlags  |= OSS32_CAPS_PCM_RATE_HALFDUPLEX;
    227            devCaps[0].waveOutCaps.ulRateFlags |= OSS32_CAPS_PCM_RATE_HALFDUPLEX;
    228            soundCard = ALS4000;
     225       //hardware not completely full duplex; sample rates must be identical if
     226       //both playback & recording active
     227       devCaps[0].waveInCaps.ulRateFlags  |= OSS32_CAPS_PCM_RATE_HALFDUPLEX;
     228       devCaps[0].waveOutCaps.ulRateFlags |= OSS32_CAPS_PCM_RATE_HALFDUPLEX;
     229       soundCard = ALS4000;
    229230   }
    230231   else
    231232   if(!xorstrcmp(devCaps[0].szDeviceName, pszCrystal46XX))
    232233   {
    233            soundCard = CS46XX;
     234       soundCard = CS46XX;
    234235   }
    235236   else
    236237   if(!xorstrncmp(devCaps[0].szDeviceName, pszVIA82XX, 6))
    237238   {
    238            soundCard = VIA82XX;
     239       soundCard = VIA82XX;
    239240   }
    240241   else
    241242   if(!xorstrcmp(devCaps[0].szDeviceName, pszESS1938))
    242243   {
    243            soundCard = ESS1938;
     244       soundCard = ESS1938;
    244245   }
    245246   else
    246247   if(!xorstrncmp(devCaps[0].szDeviceName, pszVORTEX, 6))
    247248   {
    248            soundCard = VORTEX;
     249       soundCard = VORTEX;
    249250   }
    250251   else
    251252   if(!xorstrncmp(devCaps[0].szDeviceName, pszYAMAHA,6))
    252253   {
    253            soundCard = YAMAHA;
     254       soundCard = YAMAHA;
    254255   }
    255256   else
    256257   if(!xorstrcmp(devCaps[0].szDeviceName, pszMAESTRO))
    257258   {
    258            soundCard = MAESTRO;
    259    }
    260    else
    261            if(!xorstrcmp(devCaps[0].szDeviceName, pszMAESTRO3) ||
    262                   !xorstrcmp(devCaps[0].szDeviceName, pszALLEGRO))
    263    {
    264            soundCard = MAESTRO3;
    265    }
    266    else
    267            if(!xorstrncmp(devCaps[0].szDeviceName, pszES1371, 6) ||
    268                   !xorstrncmp(devCaps[0].szDeviceName, pszES1370, 6))
    269    {
    270            soundCard = ENSONIQ;
     259       soundCard = MAESTRO;
     260   }
     261   else
     262       if(!xorstrcmp(devCaps[0].szDeviceName, pszMAESTRO3) ||
     263          !xorstrcmp(devCaps[0].szDeviceName, pszALLEGRO))
     264   {
     265       soundCard = MAESTRO3;
     266   }
     267   else
     268       if(!xorstrncmp(devCaps[0].szDeviceName, pszES1371, 6) ||
     269          !xorstrncmp(devCaps[0].szDeviceName, pszES1370, 6))
     270   {
     271       soundCard = ENSONIQ;
    271272   }
    272273   else
    273274   if(!xorstrcmp(devCaps[0].szDeviceName, pszALI5451))
    274275   {
    275            soundCard = ALI5451;
     276       soundCard = ALI5451;
    276277   }
    277278   else
    278279   if(!xorstrncmp(devCaps[0].szDeviceName, pszTRIDENT,7))
    279280   {
    280            soundCard = TRIDENT;
     281       soundCard = TRIDENT;
    281282   }
    282283   else
    283284   if(!xorstrncmp(devCaps[0].szDeviceName, pszNEOMAGIC,5))
    284285   {
    285            soundCard = NEOMAGIC;
     286       soundCard = NEOMAGIC;
    286287   }
    287288   else
    288289   if(!xorstrncmp(devCaps[0].szDeviceName, pszFM801,5))
    289290   {
    290            soundCard = FM801;
     291       soundCard = FM801;
    291292   }
    292293   else
    293294   if(!xorstrncmp(devCaps[0].szDeviceName, pszATIIXP,7))
    294295   {
    295            soundCard = ATIIXP;
     296       soundCard = ATIIXP;
    296297   }
    297298   else
    298299   if(!xorstrncmp(devCaps[0].szDeviceName, pszAUDIGYLS,6))
    299300   {
    300            soundCard = AUDIGYLS;
     301       soundCard = AUDIGYLS;
    301302   }
    302303   else
    303304   if(!xorstrncmp(devCaps[0].szDeviceName, pszBT87X,5))
    304305   {
    305            soundCard = BT87X;
     306       soundCard = BT87X;
    306307   }
    307308   else
    308309   if(!xorstrncmp(devCaps[0].szDeviceName, pszAZX,9))
    309310   {
    310            soundCard = AZX;
     311       soundCard = AZX;
    311312   }
    312313   else {
    313            rprintf(("Soundcard %s not supported", (char FAR *)devCaps[0].szDeviceName));
    314                 //DevHelp_Beep(1000, 50);
    315            DebugInt3();
    316            goto failure;
     314       rprintf(("Soundcard %s not supported", (char FAR *)devCaps[0].szDeviceName));
     315        //DevHelp_Beep(1000, 50);
     316       DebugInt3();
     317       goto failure;
    317318   }
    318319#endif /* ENABLE_HW_CERTIFICATION */
     
    320321
    321322failure:
    322 //        DevHelp_Beep(1000, 50);
    323         fNoHardware = TRUE;
    324         return FALSE;
     323//    DevHelp_Beep(1000, 50);
     324    fNoHardware = TRUE;
     325    return FALSE;
    325326}
    326327
     
    334335{
    335336   if(InitializeAudio() == FALSE) {
    336            return;
     337       return;
    337338   }
    338339   if(fNoHardware) return;
     
    343344   if(devCaps[0].ulCaps & OSS32_CAPS_FMSYNTH_PLAYBACK)
    344345   {
    345            dprintf(("Creating FM Synthesizer device"));
    346 
    347            // Build a FMSYNTH object.  First create a timer, then the HW object.
    348            TIMER* pFMSynthTimer =
    349                    new TIMER( NULL, MIDI_TimerInterval, STREAM_FMSYNTH_PLAY );
    350            if (pFMSynthTimer->eState() != TIMER_Disabled)
    351                    new FMSYNTH( pFMSynthTimer );
    352 
    353            SetHardwareType(AUDIOHW_FMSYNTH_PLAY, MIDI, OPERATION_PLAY, 1);
    354            SetHardwareType(AUDIOHW_FMSYNTH_PLAY, DATATYPE_MIDI, OPERATION_PLAY, 1);
    355            // MIDI on Warp 3
    356            SetHardwareType(AUDIOHW_FMSYNTH_PLAY, DATATYPE_NULL, OPERATION_PLAY, 1);
     346       dprintf(("Creating FM Synthesizer device"));
     347
     348       // Build a FMSYNTH object.  First create a timer, then the HW object.
     349       TIMER* pFMSynthTimer =
     350           new TIMER( NULL, MIDI_TimerInterval, STREAM_FMSYNTH_PLAY );
     351       if (pFMSynthTimer->eState() != TIMER_Disabled)
     352           new FMSYNTH( pFMSynthTimer );
     353
     354       SetHardwareType(AUDIOHW_FMSYNTH_PLAY, MIDI, OPERATION_PLAY, 1);
     355       SetHardwareType(AUDIOHW_FMSYNTH_PLAY, DATATYPE_MIDI, OPERATION_PLAY, 1);
     356       // MIDI on Warp 3
     357       SetHardwareType(AUDIOHW_FMSYNTH_PLAY, DATATYPE_NULL, OPERATION_PLAY, 1);
    357358   }
    358359
    359360   if((devCaps[0].ulCaps & OSS32_CAPS_MPU401_PLAYBACK) &&
    360           (devCaps[0].ulCaps & OSS32_CAPS_MPU401_CAPTURE))
    361    {
    362            dprintf(("Creating MPU401 device"));
    363 
    364            // Build the MPU401 object. First create a timer, then the HW object.
    365            TIMER* pMPUTimer =
    366                    // vladest      new TIMER(NULL, MIDI_TimerInterval, STREAM_MPU401_PLAY );
    367                    new TIMER(NULL, MIDI_TimerInterval, STREAM_MPU401_CAPTURE );
    368 
    369            if (pMPUTimer->eState() != TIMER_Disabled)
    370                    new MPU_401(pMPUTimer);
    371 
    372 //              SetHardwareType(AUDIOHW_MPU401_PLAY, MIDI, OPERATION_PLAY, 0);
    373 //              SetHardwareType(AUDIOHW_MPU401_PLAY, DATATYPE_MIDI, OPERATION_PLAY, 0);
    374 
    375            SetHardwareType(AUDIOHW_MPU401_CAPTURE, MIDI, OPERATION_RECORD, 0);
    376            SetHardwareType(AUDIOHW_MPU401_CAPTURE, DATATYPE_MIDI, OPERATION_RECORD, 0);
    377 
    378            RTMIDI::vConnect();
     361      (devCaps[0].ulCaps & OSS32_CAPS_MPU401_CAPTURE))
     362   {
     363       dprintf(("Creating MPU401 device"));
     364
     365       // Build the MPU401 object. First create a timer, then the HW object.
     366       TIMER* pMPUTimer =
     367           // vladest      new TIMER(NULL, MIDI_TimerInterval, STREAM_MPU401_PLAY );
     368           new TIMER(NULL, MIDI_TimerInterval, STREAM_MPU401_CAPTURE );
     369
     370       if (pMPUTimer->eState() != TIMER_Disabled)
     371           new MPU_401(pMPUTimer);
     372
     373//      SetHardwareType(AUDIOHW_MPU401_PLAY, MIDI, OPERATION_PLAY, 0);
     374//      SetHardwareType(AUDIOHW_MPU401_PLAY, DATATYPE_MIDI, OPERATION_PLAY, 0);
     375
     376       SetHardwareType(AUDIOHW_MPU401_CAPTURE, MIDI, OPERATION_RECORD, 0);
     377       SetHardwareType(AUDIOHW_MPU401_CAPTURE, DATATYPE_MIDI, OPERATION_RECORD, 0);
     378
     379       RTMIDI::vConnect();
    379380   }
    380381   APM_Init();
     
    385386 * Purpose:  Worker rountine for the Strategy Open function.
    386387 *
    387  * Notes:        The Strategy Open doesn't require allocation of any resources,
    388  *                       and the function is treated as a NOP.  The first allocation of
    389  *                      resources happens at Strategy IOCtl time, in the handler for
    390  *                      the AudioInit IOCtl.
    391  *                      Check to see if the VDD has claimed the hardware and return with
    392  *                      the busy bit on the the request packet.
    393  *                      Increment the InUseCount so we know that an OS/2 app has an
    394  *                      instance open and we don't let the VDD take the hardware..
     388 * Notes:    The Strategy Open doesn't require allocation of any resources,
     389 *           and the function is treated as a NOP.  The first allocation of
     390 *          resources happens at Strategy IOCtl time, in the handler for
     391 *          the AudioInit IOCtl.
     392 *          Check to see if the VDD has claimed the hardware and return with
     393 *          the busy bit on the the request packet.
     394 *          Increment the InUseCount so we know that an OS/2 app has an
     395 *          instance open and we don't let the VDD take the hardware..
    395396 *
    396397 *
     
    400401{
    401402   if (usVDDHasHardware) {
    402           prp->usStatus = RPDONE | RPERR | RPBUSY;
     403      prp->usStatus = RPDONE | RPERR | RPBUSY;
    403404   }
    404405   else {
    405           ++usInUseCount;
     406      ++usInUseCount;
    406407   }
    407408}
     
    410411void StrategyClose(PREQPACKET prp)
    411412{
    412         --usInUseCount;
    413         PSTREAM pstream = FindStream_fromFile( prp->s.open_close.usSysFileNum );
    414         if (pstream)
    415                 delete pstream;
    416         else
    417                 dprintf(("Close NULL stream"));;                //### Log unexpected condition.
     413    --usInUseCount;
     414    PSTREAM pstream = FindStream_fromFile( prp->s.open_close.usSysFileNum );
     415    if (pstream)
     416        delete pstream;
     417    else
     418        dprintf(("Close NULL stream"));;        //### Log unexpected condition.
    418419}
    419420//******************************************************************************
     
    421422void StrategyDeinstall(PREQPACKET prp)
    422423{
    423         while (pAudioHWList->IsElements())
    424                 pAudioHWList->DestroyElement(pAudioHWList->PopHead());
     424    while (pAudioHWList->IsElements())
     425        pAudioHWList->DestroyElement(pAudioHWList->PopHead());
    425426}
    426427//******************************************************************************
     
    428429void StrategyShutdown(PREQPACKET prp)
    429430{
    430         dprintf(("StrategyShutdown %d", prp->s.shutdown.Function));
     431    dprintf(("StrategyShutdown %d", prp->s.shutdown.Function));
    431432}
    432433//******************************************************************************
     
    448449{
    449450
    450    prp->usStatus = RPDONE;
    451 
    452    if(fNoHardware) {
    453            prp->usStatus = RPDONE | RPERR | RPGENFAIL;
    454            return;
    455    }
     451    prp->usStatus = RPDONE;
     452
     453    if(fNoHardware) {
     454        prp->usStatus = RPDONE | RPERR | RPGENFAIL;
     455        return;
     456    }
    456457
    457458#ifdef DEBUG
    458         DbgU16StrategyCnt++;
     459    DbgU16StrategyCnt++;
    459460#endif
    460461
    461    switch (prp->bCommand) {
    462           case STRATEGY_INIT:
    463                  StrategyInit(prp);
    464                  break;
    465           case STRATEGY_OPEN:
    466                  StrategyOpen(prp);
    467                  break;
    468           case STRATEGY_CLOSE:
    469                  StrategyClose(prp);
    470                  break;
    471           case STRATEGY_GENIOCTL:
    472                  StrategyIoctl(prp, 0);
    473                  break;
    474           case STRATEGY_DEINSTALL:
    475                  StrategyDeinstall(prp);
    476                  break;
    477           case STRATEGY_INITCOMPLETE:
    478                  StrategyInitComplete(prp);
    479                  break;
    480           case STRATEGY_SHUTDOWN:
    481                  StrategyShutdown(prp);
    482                  break;
    483           default:
    484                  rprintf(("Strategy Unk:0x%x", prp->bCommand));
    485                  prp->usStatus = RPDONE | RPERR | RPGENFAIL;
    486    }
     462    switch (prp->bCommand) {
     463    case STRATEGY_INIT:
     464        StrategyInit(prp);
     465        break;
     466    case STRATEGY_OPEN:
     467        StrategyOpen(prp);
     468        break;
     469    case STRATEGY_CLOSE:
     470        StrategyClose(prp);
     471        break;
     472    case STRATEGY_GENIOCTL:
     473        StrategyIoctl(prp, 0);
     474        break;
     475    case STRATEGY_DEINSTALL:
     476        StrategyDeinstall(prp);
     477        break;
     478    case STRATEGY_INITCOMPLETE:
     479        StrategyInitComplete(prp);
     480        break;
     481    case STRATEGY_SHUTDOWN:
     482        StrategyShutdown(prp);
     483        break;
     484    case 0x20: /* Save / Restore */
     485        /* Handle an ACPI suspend/resume. Function 0=save/suspend/sleep, 1=restore/resume/wake */
     486        if (prp->s.save_restore.Function) APM_resume(APM_STATE_READY);
     487        else APM_suspend(APM_STATE_SUSPEND);
     488        break;
     489    default:
     490        rprintf(("Strategy Unk:0x%x", prp->bCommand));
     491        prp->usStatus = RPDONE | RPERR | RPGENFAIL;
     492    }
    487493#ifdef DEBUG
    488         DbgU16StrategyCnt--;
     494    DbgU16StrategyCnt--;
    489495#endif
    490496}
     
    498504
    499505   if(fNoHardware) {
    500            prp->usStatus = RPDONE | RPERR | RPGENFAIL;
    501            if(prp->bCommand == STRATEGY_INIT) {
    502                    prp->s.init_out.usCodeEnd = 0;
    503                    prp->s.init_out.usDataEnd = 0;
    504            }
    505            return;
     506       prp->usStatus = RPDONE | RPERR | RPGENFAIL;
     507       if(prp->bCommand == STRATEGY_INIT) {
     508           prp->s.init_out.usCodeEnd = 0;
     509           prp->s.init_out.usDataEnd = 0;
     510       }
     511       return;
    506512   }
    507513
    508514#ifdef DEBUG
    509         DbgU16StrategyCnt++;
     515    DbgU16StrategyCnt++;
    510516#endif
    511517
    512518   switch (prp->bCommand) {
    513           case STRATEGY_INIT:
    514                 prp->usStatus = RPDONE;
    515                 prp->s.init_out.usCodeEnd = (USHORT) &end_of_text;
    516                 prp->s.init_out.usDataEnd = (USHORT) &end_of_heap;
    517                 break;
    518           case STRATEGY_OPEN:
    519                 StrategyOpen(prp);
    520                 break;
    521           case STRATEGY_CLOSE:
    522                 StrategyClose(prp);
    523                 break;
    524           case STRATEGY_GENIOCTL:
    525                 StrategyIoctl(prp, 1);
    526                 break;
    527           case STRATEGY_DEINSTALL:
    528                 StrategyDeinstall(prp);
    529                 break;
    530           case STRATEGY_INITCOMPLETE:
    531                 prp->usStatus = RPDONE;
    532                 break;
    533           default:
    534                 prp->usStatus = RPDONE | RPERR | RPGENFAIL;
     519      case STRATEGY_INIT:
     520        prp->usStatus = RPDONE;
     521        prp->s.init_out.usCodeEnd = (USHORT) &end_of_text;
     522        prp->s.init_out.usDataEnd = (USHORT) &end_of_heap;
     523        break;
     524      case STRATEGY_OPEN:
     525        StrategyOpen(prp);
     526        break;
     527      case STRATEGY_CLOSE:
     528        StrategyClose(prp);
     529        break;
     530      case STRATEGY_GENIOCTL:
     531        StrategyIoctl(prp, 1);
     532        break;
     533      case STRATEGY_DEINSTALL:
     534        StrategyDeinstall(prp);
     535        break;
     536      case STRATEGY_INITCOMPLETE:
     537        prp->usStatus = RPDONE;
     538        break;
     539      default:
     540        prp->usStatus = RPDONE | RPERR | RPGENFAIL;
    535541   }
    536542#ifdef DEBUG
    537         DbgU16StrategyCnt--;
     543    DbgU16StrategyCnt--;
    538544#endif
    539545}
  • OCO/trunk/runtime/strategy.h

    r33 r564  
    7676      ULONG  Reserved;       // Reserved
    7777    } shutdown;
     78    struct {
     79      BYTE Function;
     80    } save_restore;
    7881  } s;
    7982} REQPACKET, __far *PREQPACKET;
Note: See TracChangeset for help on using the changeset viewer.