initiator_mode_req_sen.c
来自「基于FAS466的SCSI控制器的启动器模式的C源代码。」· C语言 代码 · 共 99 行
C
99 行
#define GLB extern
#include <stdio.h>
#include <conio.h>
#include <sys\types.h>
#include <sys\timeb.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <dos.h>
#include "fas466defs.h"
#include "fas466regs.h"
#include "fas466globalvars.h"
void Initiator_Mode_req_sen()
{
// set up some vars to handle the loop below
unsigned char req_sen_i = 0x0;
unsigned char req_sen_value = 0x0;
unsigned char req_sen_x = 0x0;
unsigned int temp1, temp2;
RegWrite(SC_Command , 01);
printf(" Request Sense Data\n");
RegWrite(SC_FIFO , 0x80) ; // msg1
RegWrite(SC_FIFO , 0x3) ; // cdb1
RegWrite(SC_FIFO , 0x0) ; // cdb2
RegWrite(SC_FIFO , 0x0) ; // cdb3
RegWrite(SC_FIFO , 0x0) ; // cdb4
RegWrite(SC_FIFO , 0xff) ; // cdb5
RegWrite(SC_FIFO , 0x0) ; // cdb6
verify (SC_FIFO_Count , 0x7) ;
printf(" Issue SelWAtn Command 1 messages\n");
RegWrite(SC_Command , SC_CMD_Select1_With_ATN_Seq); //
ExpCmdCmptStat = SC_Function_Complete;
Cmd_Complete466();
verify (SC_Command_Status , 0x9); // SC_STS_SeqStep_9) ;
verifym(SC_SCSI_Control , SC_CTRL_PhaseMask , SC_CTRL_DataInPhase) ;
// RegWrite(SC_Command , 0x98);
// ExpCmdCmptStat = SC_Bus_Service;
// Cmd_Complete466();
// receive the additional sense data
req_sen_i = 0;
RegWrite(SC_Command , 0x98);
ExpCmdCmptStat = SC_Bus_Service;
Cmd_Complete466();
RegWrite(SC_Command , 01);
RegWrite(SC_Command , SC_CMD_Xfer_Information_Non_DMA);
ExpCmdCmptStat = SC_Function_Complete | SC_Bus_Service;
Cmd_Complete466();
RegWrite(SC_Command , SC_CMD_Xfer_Information_Non_DMA);
ExpCmdCmptStat = SC_Function_Complete;
Cmd_Complete466();
RegWrite(SC_Command , SC_CMD_Message_Accepted);
ExpCmdCmptStat = SC_Function_Complete | SC_SCSI_Disconnect;
Cmd_Complete466();
// read the status/message from the fifo to empty it.
temp1 = RegRead(SC_FIFO);
temp2 = RegRead(SC_FIFO);
printf("Status = %0x Message = %0x\n", temp1,temp2);
} // Initiator_Mode_req_sen
/* ***********************************************************
There are many ways to recieve data in this case:
1. Set block size = 0x200, block count = FFFF, use DMA command to
receive data until bus service (target change phase). Check
SS FIFO Count and add more pad bytes to make it even boundary before
issue a drain FIFO command to drain data from SC FIFO to DMA.
External DMA controller need to set up to receice exact data before
issue the command. After draining, data will land into buffer through
external DMA. This method works for all asynch and synch mode.
2. Use Loop of Non DMA command to receive one byte of data until recieve
a bus service interrupt.Data land into SC FIFO. This method works good
in asynch mode.
3. Use loop of Non DMA command to recieve a N number of data then issue
Transfer Pad command to regard the rest until target change phase.
This method works good in asynch mode.
*****************************************************************/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?