static CMD_HANDLER( wd33c93_select_cmd ) { UINT8 unit = wd33c93_getunit(); UINT8 newstatus; /* see if we can select that device */ if ( devices[unit] ) { /* device is available - signal selection done */ newstatus = CSR_SELECT; /* determine the next bus phase depending on the command */ if ( (scsi_data.regs[WD_COMMAND] & 0x7f) == WD_CMD_SEL_ATN ) { /* /ATN asserted during select: Move to Message Out Phase to read identify */ scsi_data.busphase = PHS_MESS_OUT; } else { /* No /ATN asserted: Move to Command Phase */ scsi_data.busphase = PHS_COMMAND; } /* queue up a service request out in the future */ machine.scheduler().timer_set( attotime::from_usec(50), FUNC(wd33c93_service_request )); } else { /* device is not available */ newstatus = CSR_TIMEOUT; } /* complete the command */ wd33c93_complete_cmd(newstatus); }
/* command handlers */ static CMD_HANDLER( wd33c93_invalid_cmd ) { logerror( "%s:Unknown/Unimplemented SCSI controller command: %02x\n", machine.describe_context(), scsi_data.regs[WD_COMMAND] ); /* complete the command */ wd33c93_complete_cmd( CSR_INVALID ); }
/* command handlers */ static void wd33c93_invalid_cmd( void ) { logerror( "Unknown/Unimplemented SCSI controller command: %02x (PC=%x)\n", scsi_data.regs[WD_COMMAND], activecpu_get_pc() ); /* complete the command */ wd33c93_complete_cmd( CSR_INVALID ); }
static CMD_HANDLER( wd33c93_reset_cmd ) { int advanced = 0; /* see if it wants us to reset with advanced features */ if ( scsi_data.regs[WD_OWN_ID] & OWNID_EAF ) { advanced = 1; } /* clear out all registers */ memset( scsi_data.regs, 0, sizeof( scsi_data.regs ) ); /* complete the command */ wd33c93_complete_cmd(advanced ? CSR_RESET_AF : CSR_RESET); }
static CMD_HANDLER( wd33c93_selectxfer_cmd ) { UINT8 unit = wd33c93_getunit(); UINT8 newstatus; /* see if we can select that device */ if ( devices[unit] ) { if ( scsi_data.regs[WD_COMMAND_PHASE] < 0x45 ) { /* device is available */ int xfercount; int phase; /* do the request */ devices[unit]->SetCommand( &scsi_data.regs[WD_CDB_1], 12 ); devices[unit]->ExecCommand( &xfercount ); devices[unit]->GetPhase( &phase ); /* set transfer count */ if ( wd33c93_get_xfer_count() > TEMP_INPUT_LEN ) { logerror( "WD33C93: Transfer count too big. Please increase TEMP_INPUT_LEN (size=%d)\n", wd33c93_get_xfer_count() ); wd33c93_set_xfer_count( TEMP_INPUT_LEN ); } switch( phase ) { case SCSI_PHASE_DATAIN: scsi_data.read_pending = 1; break; } } if ( scsi_data.read_pending ) { int len = TEMP_INPUT_LEN; if ( wd33c93_get_xfer_count() < len ) len = wd33c93_get_xfer_count(); memset( &scsi_data.temp_input[0], 0, TEMP_INPUT_LEN ); wd33c93_read_data( len, &scsi_data.temp_input[0] ); scsi_data.temp_input_pos = 0; scsi_data.read_pending = 0; } scsi_data.regs[WD_TARGET_LUN] = 0; scsi_data.regs[WD_CONTROL] |= CTRL_EDI; scsi_data.regs[WD_COMMAND_PHASE] = 0x60; /* signal transfer ready */ newstatus = CSR_SEL_XFER_DONE; /* if allowed disconnect, queue a service request */ if ( scsi_data.identify & 0x40 ) { /* queue disconnect message in */ scsi_data.busphase = PHS_MESS_IN; /* queue up a service request out in the future */ machine.scheduler().timer_set( attotime::from_msec(50), FUNC(wd33c93_service_request )); } } else { /* device is not available */ newstatus = CSR_TIMEOUT; wd33c93_set_xfer_count( 0 ); } /* complete the command */ wd33c93_complete_cmd(newstatus); }
static CMD_HANDLER( wd33c93_abort_cmd ) { /* complete the command */ wd33c93_complete_cmd(CSR_ABORT); }
static void wd33c93_abort_cmd( void ) { /* complete the command */ wd33c93_complete_cmd(CSR_ABORT); }