void wd33c93_get_dma_data( int bytes, UINT8 *pData ) { int len = bytes; if ( len >= wd33c93_get_xfer_count() ) len = wd33c93_get_xfer_count(); if ( len == 0 ) return; if ( (scsi_data.temp_input_pos+len) >= TEMP_INPUT_LEN ) { logerror( "Reading past end of buffer, increase TEMP_INPUT_LEN size\n" ); len = TEMP_INPUT_LEN - len; } memcpy( pData, &scsi_data.temp_input[scsi_data.temp_input_pos], len ); scsi_data.temp_input_pos += len; len = wd33c93_get_xfer_count() - len; wd33c93_set_xfer_count(len); }
void wd33c93_clear_dma(void) { /* indicate DMA completed by clearing the transfer count */ wd33c93_set_xfer_count(0); scsi_data.regs[WD_AUXILIARY_STATUS] &= ~ASR_DBR; }
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); }