- Timestamp:
- May 19, 2000, 3:07:00 PM (25 years ago)
- Location:
- trunk/src/wnaspi32
- Files:
-
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wnaspi32/aspilib.cpp
r3541 r3564 325 325 //* * 326 326 //*************************************************************************** 327 ULONG scsiObj::getDeviceType(UCHAR id, UCHAR lun)327 ULONG scsiObj::getDeviceType(UCHAR ha_num, UCHAR id, UCHAR lun) 328 328 { 329 329 ULONG rc; // return value … … 332 332 333 333 SRBlock.cmd=SRB_Device; // get device type 334 SRBlock.ha_num= 0;// host adapter number334 SRBlock.ha_num=ha_num; // host adapter number 335 335 SRBlock.flags=0; // no flags set 336 336 SRBlock.u.dev.target=id; // target id … … 360 360 //* * 361 361 //*************************************************************************** 362 ULONG scsiObj::resetDevice(UCHAR id, UCHAR lun)362 ULONG scsiObj::resetDevice(UCHAR ha_num,UCHAR id, UCHAR lun) 363 363 { 364 364 ULONG rc; // return value … … 368 368 369 369 SRBlock.cmd=SRB_Reset; // reset device 370 SRBlock.ha_num= 0;// host adapter number370 SRBlock.ha_num=ha_num; // host adapter number 371 371 SRBlock.flags=SRB_Post; // posting enabled 372 372 SRBlock.u.res.target=id; // target id … … 418 418 return 0; 419 419 } 420 420 //*************************************************************************** 421 //*************************************************************************** 421 422 ULONG scsiObj::getNumHosts() 422 423 { int i,j=0; … … 430 431 return j; 431 432 } 432 433 //*************************************************************************** 434 //* * 433 //*************************************************************************** 435 434 //*************************************************************************** 436 435 ULONG scsiObj::SendSRBlock(VOID) … … 448 447 &ulReturn); 449 448 } 450 449 //*************************************************************************** 450 //*************************************************************************** 451 451 BOOL fGainDrvAccess( BOOL fWait, 452 452 ULONG *phSem) … … 474 474 return TRUE; 475 475 } 476 476 //*************************************************************************** 477 //*************************************************************************** 477 478 BOOL fReleaseDrvAccess(ULONG hSem) 478 479 { -
trunk/src/wnaspi32/aspilib.h
r3541 r3564 43 43 ULONG read_position(UCHAR id, UCHAR lun, ULONG* pos, ULONG* partition, BOOL* BOP, BOOL* EOP); 44 44 ULONG HA_inquiry(UCHAR ha); 45 ULONG getDeviceType(UCHAR id, UCHAR lun);45 ULONG getDeviceType(UCHAR ha_num, UCHAR id, UCHAR lun); 46 46 ULONG testUnitReady(UCHAR id, UCHAR lun); 47 ULONG resetDevice(UCHAR id, UCHAR lun);47 ULONG resetDevice(UCHAR ha_num,UCHAR id, UCHAR lun); 48 48 ULONG abort(); 49 49 BOOL waitPost(); -
trunk/src/wnaspi32/winaspi32.cpp
r3541 r3564 1 /* 2 * WNASPI routines 3 * 4 * Copyright 1999 Markus Montkowski 5 * Copyright 2000 Przemyslaw Dobrowolski 6 * 7 * Project Odin Software License can be found in LICENSE.TXT 8 * 9 */ 1 10 #include <os2win.h> 2 11 #include <stdlib.h> … … 6 15 #include <fcntl.h> 7 16 #include <memory.h> 8 // #include <unistd.h>9 17 10 18 #include "aspi.h" … … 152 160 6* sizeof(BYTE) + sizeof(DWORD)); 153 161 aspi->SRBlock.flags |= SRB_Post; 154 aspi->SRBlock.u.cmd.sense_len = 32; // length of sense buffer 155 aspi->SRBlock.u.cmd.data_ptr = NULL; // pointer to data buffer 156 aspi->SRBlock.u.cmd.link_ptr = NULL; // pointer to next SRB 162 aspi->SRBlock.u.cmd.sense_len = lpPRB->SRB_SenseLen;; // length of sense buffer 163 aspi->SRBlock.u.cmd.data_ptr = NULL; // pointer to data buffer 164 aspi->SRBlock.u.cmd.link_ptr = NULL; // pointer to next SRB 165 aspi->SRBlock.u.cmd.data_len = lpPRB->SRB_BufLen; 157 166 aspi->SRBlock.u.cmd.cdb_len = lpPRB->SRB_CDBLen; // SCSI command length 158 167 memcpy( &aspi->SRBlock.u.cmd.cdb_st[0], … … 355 364 { 356 365 case SC_HA_INQUIRY: 357 aspi->SRBlock.cmd=SRB_Inquiry; // host adapter inquiry 358 aspi->SRBlock.ha_num=lpSRB->inquiry.SRB_HaId; // host adapter number 359 aspi->SRBlock.flags=0; // no flags set 360 rc = aspi->SendSRBlock(); 361 362 if (!rc) 363 { 364 memcpy( lpSRB, 365 &aspi->SRBlock, 366 sizeof(SRB_HaInquiry) ); 367 dwRC = aspi->SRBlock.status; 368 } 366 aspi->HA_inquiry(lpSRB->inquiry.SRB_HaId); 367 memset(lpSRB,0,sizeof(SRB_HaInquiry)); 368 memcpy( lpSRB, 369 &aspi->SRBlock, 370 sizeof(SRB_HaInquiry)-4 ); 371 // FIXME: I'dont know why in OS/2->ha_unique are filled with 0 372 // Hackmode ON ====== 373 lpSRB->inquiry.HA_Unique[6] = 0x01; // transfer only 64KB 374 lpSRB->inquiry.HA_Unique[3] = 0x10; // 16 devices. 375 // HackMode OFF ===== 376 dwRC = aspi->SRBlock.status; 369 377 break; 370 378 371 379 case SC_GET_DEV_TYPE: 372 memcpy( &aspi->SRBlock, 373 lpSRB, 374 sizeof(SRB_GDEVBlock)); 375 aspi->SRBlock.flags = 0; 376 377 rc = aspi->SendSRBlock(); 378 379 if (!rc) 380 { 381 memcpy( lpSRB, 382 &aspi->SRBlock, 383 sizeof(SRB_GDEVBlock) ); 384 385 lpSRB->devtype.SRB_Rsvd1 = 0x00; 386 dwRC = aspi->SRBlock.status; 387 } 388 380 rc=aspi->getDeviceType(lpSRB->devtype.SRB_HaId,lpSRB->devtype.SRB_Target, lpSRB->devtype.SRB_Lun); 381 dwRC = lpSRB->devtype.SRB_Status = aspi->SRBlock.status; 382 lpSRB->devtype.SRB_DeviceType = aspi->SRBlock.u.dev.devtype; 389 383 break; 384 390 385 case SC_EXEC_SCSI_CMD: 391 386 dwRC = ASPI_ExecScsiCmd( aspi, … … 398 393 399 394 case SC_RESET_DEV: 400 memset( &aspi->SRBlock, 395 aspi->resetDevice(lpSRB->reset.SRB_HaId,lpSRB->reset.SRB_Target, lpSRB->reset.SRB_Lun); 396 lpSRB->reset.SRB_Status = aspi->SRBlock.status; 397 lpSRB->reset.SRB_Flags = aspi->SRBlock.flags; 398 lpSRB->reset.SRB_Hdr_Rsvd = 0; 399 memset( lpSRB->reset.SRB_Rsvd1, 401 400 0, 402 sizeof(SRBOS2) ); 403 aspi->SRBlock.cmd = lpSRB->reset.SRB_Cmd; /* ASPI command code = SC_RESET_DEV */ 404 aspi->SRBlock.status = lpSRB->reset.SRB_Status; /* ASPI command status byte */ 405 aspi->SRBlock.ha_num = lpSRB->reset.SRB_HaId; /* ASPI host adapter number */ 406 aspi->SRBlock.flags = SRB_Post; 407 aspi->SRBlock.u.res.target = lpSRB->reset.SRB_Target; /* Target's SCSI ID */ 408 aspi->SRBlock.u.res.lun = lpSRB->reset.SRB_Lun; /* Target's LUN number */ 409 410 rc = aspi->SendSRBlock(); 411 412 if (!rc) 413 { 414 aspi->waitPost(); 415 lpSRB->reset.SRB_Status = aspi->SRBlock.status; 416 lpSRB->reset.SRB_Flags = aspi->SRBlock.flags; 417 lpSRB->reset.SRB_Hdr_Rsvd = 0; 418 memset( lpSRB->reset.SRB_Rsvd1, 419 0, 420 12 ); 421 lpSRB->reset.SRB_HaStat = aspi->SRBlock.u.res.ha_status; /* Host Adapter Status */ 422 lpSRB->reset.SRB_TargStat = aspi->SRBlock.u.res.target_status; /* Target Status */ 423 lpSRB->reset.SRB_PostProc = NULL; /* Post routine */ 424 lpSRB->reset.SRB_Rsvd2 = NULL; /* Reserved */ 425 memset( lpSRB->reset.SRB_Rsvd3, 426 0, 427 32); /* Reserved */ 428 dwRC = aspi->SRBlock.status; 429 } 430 break; 401 12 ); 402 lpSRB->reset.SRB_HaStat = aspi->SRBlock.u.res.ha_status; /* Host Adapter Status */ 403 lpSRB->reset.SRB_TargStat = aspi->SRBlock.u.res.target_status; /* Target Status */ 404 lpSRB->reset.SRB_PostProc = NULL; /* Post routine */ 405 lpSRB->reset.SRB_Rsvd2 = NULL; /* Reserved */ 406 memset( lpSRB->reset.SRB_Rsvd3, 407 0, 408 32); /* Reserved */ 409 dwRC = aspi->SRBlock.status; 410 break; 411 431 412 } // end switch (lpSRB->common.SRB_Cmd) 432 413 433 aspi->close();434 delete aspi;435 414 } 436 415 else … … 445 424 dwRC = SS_NO_ASPI; 446 425 } 426 aspi->close(); 427 delete aspi; 447 428 448 429 return dwRC;
Note:
See TracChangeset
for help on using the changeset viewer.