Changeset 564
- Timestamp:
- Jul 7, 2012, 2:07:58 AM (13 years ago)
- Location:
- OCO/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
OCO/trunk/drv16/header.c
r33 r564 40 40 {'U','N','I','A','U','D','1','$'}, 41 41 0,0, 42 DC_INITCPLT | DC_IOCTL2 | DC_32BIT 42 DC_INITCPLT | DC_IOCTL2 | DC_32BIT | 0x20 /* Save/Restore */ 43 43 }, 44 44 { -1, -
OCO/trunk/drv16/strategy.cpp
r534 r564 3 3 /* SCCSID = %W% %E% */ 4 4 /**************************************************************************** 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 * 9 9 * 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 * * 13 13 ****************************************************************************/ 14 14 /**@internal %W% … … 17 17 * @version %I% 18 18 * @context Unless otherwise noted, all interfaces are Ring-0, 16-bit, 19 * 19 * kernel stack. 20 20 * @history 21 21 * 22 22 */ 23 extern "C" { 23 extern "C" { // 16-bit header files are not C++ aware 24 24 #define INCL_NOPMAPI 25 25 #define INCL_DOSINFOSEG … … 33 33 #include <devhelp.h> 34 34 #include "strategy.h" 35 #include "rtmidi.hpp" 35 #include "rtmidi.hpp" // Object definition 36 36 #include "end.h" 37 37 … … 45 45 #include "fmsynth.hpp" 46 46 #include "mpu401.hpp" 47 #include "apm.h" 47 48 48 49 … … 85 86 extern "C" char szAZX[]; 86 87 87 static char *pszIntelICH 88 static char *pszIntelICH = (char *)szINTEL_ICH; 88 89 static char *pszSigmatel9721_23 = (char *)szSIGMATEL_9721_23; 89 static char *pszSBLive 90 static char *pszCMedia 91 static char *pszCrystal4281 92 static char *pszALS4000 93 static char *pszCrystal46XX 94 static char *pszVIA82XX 95 static char *pszESS1938 96 static char *pszVORTEX 97 static char *pszES1371 98 static char *pszES1370 99 static char *pszYAMAHA 100 static char *pszMAESTRO 101 static char *pszMAESTRO3 102 static char *pszALLEGRO 103 static char *pszALI5451 104 static char *pszSI7012 105 static char *pszALI5455 106 static char *pszNVIDIA 107 static char *pszAMD 108 static char *pszTRIDENT 109 static char *pszNEOMAGIC 110 static char *pszFM801 111 static char *pszATIIXP 112 static char *pszAUDIGYLS 113 static char *pszBT87X 114 static char *pszAZX 90 static char *pszSBLive = (char *)szSBLIVE; 91 static char *pszCMedia = (char *)szCMEDIA; 92 static char *pszCrystal4281 = (char *)szCS4281; 93 static char *pszALS4000 = (char *)szALS4000; 94 static char *pszCrystal46XX = (char *)szCS46XX; 95 static char *pszVIA82XX = (char *)szVIA82XX; 96 static char *pszESS1938 = (char *)szESS1938; 97 static char *pszVORTEX = (char *)szVORTEX; 98 static char *pszES1371 = (char *)szES1371; 99 static char *pszES1370 = (char *)szES1370; 100 static char *pszYAMAHA = (char *)szYAMAHA; 101 static char *pszMAESTRO = (char *)szMAESTRO; 102 static char *pszMAESTRO3 = (char *)szMAESTRO3; 103 static char *pszALLEGRO = (char *)szALLEGRO; 104 static char *pszALI5451 = (char *)szALI5451; 105 static char *pszSI7012 = (char *)szSI7012; 106 static char *pszALI5455 = (char *)szALI5455; 107 static char *pszNVIDIA = (char *)szNVIDIA; 108 static char *pszAMD = (char *)szAMD; 109 static char *pszTRIDENT = (char *)szTRIDENT; 110 static char *pszNEOMAGIC = (char *)szNEOMAGIC; 111 static char *pszFM801 = (char *)szFM801; 112 static char *pszATIIXP = (char *)szATIIXP; 113 static char *pszAUDIGYLS = (char *)szAUDIGYLS; 114 static char *pszBT87X = (char *)szBT87X; 115 static char *pszAZX = (char *)szAZX; 115 116 #endif /* ENABLE_HW_CERTIFICATION */ 116 117 117 BOOL fNoHardware= FALSE;118 BOOL fNoHardware = FALSE; 118 119 119 120 extern void DBGCALLCONV APM_Init(); … … 127 128 int d; 128 129 for (;;) 129 130 // 131 132 133 134 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 } 136 137 } 137 138 //****************************************************************************** … … 142 143 143 144 while (count != 0) 144 145 //d = (int)(unsigned char)*string1 - (int)(unsigned char)(*string2 ^ 0x81);146 147 148 149 150 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 } 152 153 return 0; 153 154 } … … 161 162 if(OSS16_AttachToPdd() != OSSERR_SUCCESS) 162 163 { 163 164 // 165 164 DebugInt3(); 165 // DevHelp_Beep(500, 100); 166 goto failure; 166 167 } 167 168 #ifdef DEBUG 168 169 rprintf(("Uniaud16 v"UNIAUD_VERSION"-DEBUG")); 169 170 #else 170 171 rprintf(("Uniaud16 v"UNIAUD_VERSION)); 171 172 #endif 172 173 … … 174 175 if(OSS16_QueryDevCaps(current_device, &devCaps[0]) != OSSERR_SUCCESS) 175 176 { 176 177 //DevHelp_Beep(2000, 100);178 177 DebugInt3(); 178 // DevHelp_Beep(2000, 100); 179 goto failure; 179 180 } 180 181 dprintf(("Device 0 name: %s", (char FAR *)devCaps[0].szDeviceName)); 181 182 if(devCaps[0].nrDevices > OSS32_MAX_AUDIOCARDS) 182 183 { 183 184 184 DebugInt3(); 185 devCaps[0].nrDevices = OSS32_MAX_AUDIOCARDS; 185 186 } 186 187 //Get caps of other devices (if present) 187 188 for(i=1;i<devCaps[0].nrDevices;i++) 188 189 { 189 190 191 192 190 if(OSS16_QueryDevCaps(i, &devCaps[i]) != OSSERR_SUCCESS) { 191 DebugInt3(); 192 goto failure; 193 } 193 194 } 194 195 … … 197 198 //Check for certified audiocard/chipsets 198 199 if(!xorstrncmp(devCaps[0].szDeviceName, pszIntelICH, 6) || 199 200 201 202 203 { 204 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; 205 206 } 206 207 else 207 208 if(!xorstrcmp(devCaps[0].szDeviceName, pszSBLive)) 208 209 { 209 210 soundCard = SBLIVE; 210 211 } 211 212 else 212 213 if(!xorstrncmp(devCaps[0].szDeviceName, pszCMedia, 11)) 213 214 { 214 215 soundCard = CMEDIA; 215 216 } 216 217 else 217 218 if(!xorstrcmp(devCaps[0].szDeviceName, pszCrystal4281)) 218 219 { 219 220 soundCard = CS4281; 220 221 } 221 222 else 222 223 if(!xorstrcmp(devCaps[0].szDeviceName, pszALS4000)) 223 224 { 224 225 226 227 228 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; 229 230 } 230 231 else 231 232 if(!xorstrcmp(devCaps[0].szDeviceName, pszCrystal46XX)) 232 233 { 233 234 soundCard = CS46XX; 234 235 } 235 236 else 236 237 if(!xorstrncmp(devCaps[0].szDeviceName, pszVIA82XX, 6)) 237 238 { 238 239 soundCard = VIA82XX; 239 240 } 240 241 else 241 242 if(!xorstrcmp(devCaps[0].szDeviceName, pszESS1938)) 242 243 { 243 244 soundCard = ESS1938; 244 245 } 245 246 else 246 247 if(!xorstrncmp(devCaps[0].szDeviceName, pszVORTEX, 6)) 247 248 { 248 249 soundCard = VORTEX; 249 250 } 250 251 else 251 252 if(!xorstrncmp(devCaps[0].szDeviceName, pszYAMAHA,6)) 252 253 { 253 254 soundCard = YAMAHA; 254 255 } 255 256 else 256 257 if(!xorstrcmp(devCaps[0].szDeviceName, pszMAESTRO)) 257 258 { 258 259 } 260 else 261 262 263 { 264 265 } 266 else 267 268 269 { 270 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; 271 272 } 272 273 else 273 274 if(!xorstrcmp(devCaps[0].szDeviceName, pszALI5451)) 274 275 { 275 276 soundCard = ALI5451; 276 277 } 277 278 else 278 279 if(!xorstrncmp(devCaps[0].szDeviceName, pszTRIDENT,7)) 279 280 { 280 281 soundCard = TRIDENT; 281 282 } 282 283 else 283 284 if(!xorstrncmp(devCaps[0].szDeviceName, pszNEOMAGIC,5)) 284 285 { 285 286 soundCard = NEOMAGIC; 286 287 } 287 288 else 288 289 if(!xorstrncmp(devCaps[0].szDeviceName, pszFM801,5)) 289 290 { 290 291 soundCard = FM801; 291 292 } 292 293 else 293 294 if(!xorstrncmp(devCaps[0].szDeviceName, pszATIIXP,7)) 294 295 { 295 296 soundCard = ATIIXP; 296 297 } 297 298 else 298 299 if(!xorstrncmp(devCaps[0].szDeviceName, pszAUDIGYLS,6)) 299 300 { 300 301 soundCard = AUDIGYLS; 301 302 } 302 303 else 303 304 if(!xorstrncmp(devCaps[0].szDeviceName, pszBT87X,5)) 304 305 { 305 306 soundCard = BT87X; 306 307 } 307 308 else 308 309 if(!xorstrncmp(devCaps[0].szDeviceName, pszAZX,9)) 309 310 { 310 311 soundCard = AZX; 311 312 } 312 313 else { 313 314 315 316 314 rprintf(("Soundcard %s not supported", (char FAR *)devCaps[0].szDeviceName)); 315 //DevHelp_Beep(1000, 50); 316 DebugInt3(); 317 goto failure; 317 318 } 318 319 #endif /* ENABLE_HW_CERTIFICATION */ … … 320 321 321 322 failure: 322 // 323 324 323 // DevHelp_Beep(1000, 50); 324 fNoHardware = TRUE; 325 return FALSE; 325 326 } 326 327 … … 334 335 { 335 336 if(InitializeAudio() == FALSE) { 336 337 return; 337 338 } 338 339 if(fNoHardware) return; … … 343 344 if(devCaps[0].ulCaps & OSS32_CAPS_FMSYNTH_PLAYBACK) 344 345 { 345 346 347 348 349 350 351 352 353 354 355 356 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); 357 358 } 358 359 359 360 if((devCaps[0].ulCaps & OSS32_CAPS_MPU401_PLAYBACK) && 360 361 { 362 363 364 365 366 // vladestnew TIMER(NULL, MIDI_TimerInterval, STREAM_MPU401_PLAY );367 368 369 370 371 372 // 373 // 374 375 376 377 378 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(); 379 380 } 380 381 APM_Init(); … … 385 386 * Purpose: Worker rountine for the Strategy Open function. 386 387 * 387 * Notes: 388 * and the function is treated as a NOP.The first allocation of389 * 390 * 391 * 392 * 393 * 394 * 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.. 395 396 * 396 397 * … … 400 401 { 401 402 if (usVDDHasHardware) { 402 403 prp->usStatus = RPDONE | RPERR | RPBUSY; 403 404 } 404 405 else { 405 406 ++usInUseCount; 406 407 } 407 408 } … … 410 411 void StrategyClose(PREQPACKET prp) 411 412 { 412 413 414 415 416 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. 418 419 } 419 420 //****************************************************************************** … … 421 422 void StrategyDeinstall(PREQPACKET prp) 422 423 { 423 424 424 while (pAudioHWList->IsElements()) 425 pAudioHWList->DestroyElement(pAudioHWList->PopHead()); 425 426 } 426 427 //****************************************************************************** … … 428 429 void StrategyShutdown(PREQPACKET prp) 429 430 { 430 431 dprintf(("StrategyShutdown %d", prp->s.shutdown.Function)); 431 432 } 432 433 //****************************************************************************** … … 448 449 { 449 450 450 prp->usStatus = RPDONE;451 452 if(fNoHardware) {453 454 455 }451 prp->usStatus = RPDONE; 452 453 if(fNoHardware) { 454 prp->usStatus = RPDONE | RPERR | RPGENFAIL; 455 return; 456 } 456 457 457 458 #ifdef DEBUG 458 459 DbgU16StrategyCnt++; 459 460 #endif 460 461 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 } 487 493 #ifdef DEBUG 488 494 DbgU16StrategyCnt--; 489 495 #endif 490 496 } … … 498 504 499 505 if(fNoHardware) { 500 501 502 503 504 505 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; 506 512 } 507 513 508 514 #ifdef DEBUG 509 515 DbgU16StrategyCnt++; 510 516 #endif 511 517 512 518 switch (prp->bCommand) { 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 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; 535 541 } 536 542 #ifdef DEBUG 537 543 DbgU16StrategyCnt--; 538 544 #endif 539 545 } -
OCO/trunk/runtime/strategy.h
r33 r564 76 76 ULONG Reserved; // Reserved 77 77 } shutdown; 78 struct { 79 BYTE Function; 80 } save_restore; 78 81 } s; 79 82 } REQPACKET, __far *PREQPACKET;
Note:
See TracChangeset
for help on using the changeset viewer.