⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 initiator_mode_mode_select.c

📁 基于FAS466的SCSI控制器的启动器模式的C源代码。
💻 C
字号:
#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_mode_select()
{

		unsigned int temp1, temp2;
		unsigned long Word_Cnt = 0;
		unsigned short tempval;

        RegWrite(SC_Command , 01);

        printf(" Issue Mode select command \n"); 

	RegWrite(SC_FIFO , 0x80) ;  // msg1
    RegWrite(SC_FIFO , 0x15) ;  // cdb1
	RegWrite(SC_FIFO , 0x0) ;  // cdb2
	RegWrite(SC_FIFO , 0x0) ;  // cdb3
	RegWrite(SC_FIFO , 0x0) ;  // cdb4
    RegWrite(SC_FIFO , 0xC) ; // 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_DataOutPhase) ;
        verify (SC_FIFO_Count , 0x0 );

        RegWrite(SC_Command , 01);

 	printf("    Set Up to Send Mode request data\n");
	Word_Cnt = 0x10  ; // Provide extra data just in case target request more

	IsaWrite((unsigned short) RAM_ADDR_LO, (unsigned short) (Word_Cnt & 0x0FF));
	IsaWrite((unsigned short) RAM_ADDR_HI, (unsigned short) ((Word_Cnt & 0xFF00) >> 8));
	tempval = IsaRead((unsigned short) EVAL_CONFIG);
	IsaWrite((unsigned short) EVAL_CONFIG, (unsigned short) (tempval | Load_Counter));
	IsaWrite((unsigned short) EVAL_CONFIG, tempval);

    IsaWrite((unsigned short) EVAL_CONFIG, (unsigned short) (tempval | Send_Data));
	 
// Set up the SCSI Controller

	RegWrite(SC_Block_Size , BlockSize) ;		// set maximum data length
	RegWrite(SC_Block_Count_Counter , 0xFFFF) ;   //  BlockCnt (target controls data length)
	RegWrite(SC_Command , SC_CMD_Xfer_Information_DMA );
	ExpCmdCmptStat =  SC_Bus_Service;	 // Send until target change phase
	Cmd_Complete466();

        verifym(SC_Command_Status, 0xff ,0x0) ;
		RegWrite(SC_Command , SC_CMD_Flush_FIFO); // flush extra data from DMA Interface

         verifym(SC_SCSI_Control,0xfffc , SC_CTRL_StatusPhase | SC_REQ | SC_EIGS) ;
       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);


} // 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -