阅读:1527回复:5
请问我的WRITE(10) 2Ah怎莫写不成功呢?
我用ASPI向硬盘发SCSI命令WRITE(10) 2Ah,但是值总是写不上去,请问这是怎莫回事?
|
|
最新喜欢:naokiz... |
沙发#
发布于:2003-08-05 15:21
我试过可以的,程序片断如下。你是怎么做的?
srbWrite.SRB_Cmd = SC_EXEC_SCSI_CMD; srbWrite.SRB_HaId = Adap_Id; srbWrite.SRB_Target = myDevice_Id; srbWrite.SRB_Lun = 0; srbWrite.SRB_Flags = SRB_DIR_OUT; srbWrite.SRB_SenseLen = SENSE_LEN; srbWrite.SRB_CDBLen = 10; srbWrite.SRB_PostProc = NULL; srbWrite.SRB_BufLen = 512; srbWrite.SRB_BufPointer = (BYTE*)cToWrite; srbWrite.SRB_CDBByte[0] = SCSI_WRITE10; srbWrite.SRB_CDBByte[1] = 0; srbWrite.SRB_CDBByte[2] = HIBYTE(HIWORD(block_idx)); srbWrite.SRB_CDBByte[3] = LOBYTE(HIWORD(block_idx)); srbWrite.SRB_CDBByte[4] = HIBYTE(LOWORD(block_idx)); srbWrite.SRB_CDBByte[5] = LOBYTE(LOWORD(block_idx)); srbWrite.SRB_CDBByte[6] = 0; srbWrite.SRB_CDBByte[7] = HIBYTE(access_blocks); srbWrite.SRB_CDBByte[8] = LOBYTE(access_blocks); SendASPI32Command((LPSRB)(&srbWrite)); |
|
|
板凳#
发布于:2003-08-05 21:25
谢谢你,虽然我找到问题了,但看到你的贴子还是很高兴,先给你分!
还有个问题:seek命令好像总是返回状态不成功,是不是硬盘不支持这个命令啊? |
|
地板#
发布于:2003-08-06 11:36
客气客气。
现在的硬盘都应该支持SEEK命令的。 不过我现在没办法试... 你用的ASPI多少版本? |
|
|
地下室#
发布于:2003-08-06 15:53
这是我添的SEEK命令:
srbExecSCSICmd.SRB_Cmd = SC_EXEC_SCSI_CMD; srbExecSCSICmd.SRB_HaId = HA; srbExecSCSICmd.SRB_Target = ID; srbExecSCSICmd.SRB_Lun = LN; srbExecSCSICmd.SRB_Flags = SRB_DIR_IN | SRB_EVENT_NOTIFY; srbExecSCSICmd.SRB_BufLen = 8; srbExecSCSICmd.SRB_BufPointer = buf; srbExecSCSICmd.SRB_SenseLen = SENSE_LEN; //SENSE_LEN系统定义 srbExecSCSICmd.SRB_CDBLen = 10; srbExecSCSICmd.CDBByte[0] = SEEK10; srbExecSCSICmd.CDBByte[1] = LN & 0xE0; //置LUN srbExecSCSICmd.CDBByte[2] = HIBYTE(HIWORD(CDB_LBN)); srbExecSCSICmd.CDBByte[3] = LOBYTE(HIWORD(CDB_LBN)); srbExecSCSICmd.CDBByte[4] = HIBYTE(LOWORD(CDB_LBN)); srbExecSCSICmd.CDBByte[5] = LOBYTE(LOWORD(CDB_LBN)); 好像ReadDefectData命令也没成功 srbExecSCSICmd.SRB_Cmd = SC_EXEC_SCSI_CMD; srbExecSCSICmd.SRB_HaId = HA; srbExecSCSICmd.SRB_Target = ID; srbExecSCSICmd.SRB_Lun = LN; srbExecSCSICmd.SRB_Flags = SRB_DIR_IN | SRB_EVENT_NOTIFY; srbExecSCSICmd.SRB_BufLen = 4; srbExecSCSICmd.SRB_BufPointer = buf; srbExecSCSICmd.SRB_SenseLen = SENSE_LEN; srbExecSCSICmd.SRB_CDBLen = 10; srbExecSCSICmd.CDBByte[0] = READDEFECT; srbExecSCSICmd.CDBByte[2] = 0x0D; //得到的是扇区格式的。 srbExecSCSICmd.CDBByte[8] = 4; //只取前四个字节即可。 希望大侠能给于一些看法的话,我会另外开个贴子给你分 |
|
5楼#
发布于:2003-08-06 15:54
这是我添的SEEK命令:
srbExecSCSICmd.SRB_Cmd = SC_EXEC_SCSI_CMD; srbExecSCSICmd.SRB_HaId = HA; srbExecSCSICmd.SRB_Target = ID; srbExecSCSICmd.SRB_Lun = LN; srbExecSCSICmd.SRB_Flags = SRB_DIR_IN | SRB_EVENT_NOTIFY; srbExecSCSICmd.SRB_BufLen = 8; srbExecSCSICmd.SRB_BufPointer = buf; srbExecSCSICmd.SRB_SenseLen = SENSE_LEN; //SENSE_LEN系统定义 srbExecSCSICmd.SRB_CDBLen = 10; srbExecSCSICmd.CDBByte[0] = SEEK10; srbExecSCSICmd.CDBByte[1] = LN & 0xE0; //置LUN srbExecSCSICmd.CDBByte[2] = HIBYTE(HIWORD(CDB_LBN)); srbExecSCSICmd.CDBByte[3] = LOBYTE(HIWORD(CDB_LBN)); srbExecSCSICmd.CDBByte[4] = HIBYTE(LOWORD(CDB_LBN)); srbExecSCSICmd.CDBByte[5] = LOBYTE(LOWORD(CDB_LBN)); 好像ReadDefectData命令也没成功 srbExecSCSICmd.SRB_Cmd = SC_EXEC_SCSI_CMD; srbExecSCSICmd.SRB_HaId = HA; srbExecSCSICmd.SRB_Target = ID; srbExecSCSICmd.SRB_Lun = LN; srbExecSCSICmd.SRB_Flags = SRB_DIR_IN | SRB_EVENT_NOTIFY; srbExecSCSICmd.SRB_BufLen = 4; srbExecSCSICmd.SRB_BufPointer = buf; srbExecSCSICmd.SRB_SenseLen = SENSE_LEN; srbExecSCSICmd.SRB_CDBLen = 10; srbExecSCSICmd.CDBByte[0] = READDEFECT; srbExecSCSICmd.CDBByte[2] = 0x0D; //得到的是扇区格式的。 srbExecSCSICmd.CDBByte[8] = 4; //只取前四个字节即可。 希望大侠能给于一些看法,我会另外开个贴子给你分 |
|