Previous 15994 Revisions Next

r9544 Monday 8th November, 2010 at 19:36:50 UTC by Barry Rodewald
[FMTOWNS] Put SCSI phase changes on a timer. SCSI with interrupts enabled still don't work, though.
[src/mess/machine]fm_scsi.c fm_scsi.h

src/mess/machine/fm_scsi.c
r9543r9544
8787
8888    // allocate read timer
8989    m_transfer_timer = device_timer_alloc(*this,TIMER_TRANSFER);
90    m_phase_timer = device_timer_alloc(*this,TIMER_PHASE);
9091}
9192
9293void fmscsi_device::device_reset()
r9543r9544
162163         devcb_call_write_line(&m_drq_func,1);
163164      }
164165      break;
166   case TIMER_PHASE:
167      set_phase(param);
168      break;
165169   }
166170}
167171
r9543r9544
196200   if(m_phase == SCSI_PHASE_MESSAGE_IN)
197201   {
198202      m_data = 0;  // command complete message
199      set_phase(SCSI_PHASE_BUS_FREE);
203      timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),SCSI_PHASE_BUS_FREE);
200204      m_command_index = 0;
201205      return m_data;
202206   }
203207
204208   if(m_phase == SCSI_PHASE_STATUS)
205209   {
206      m_data = 0;  // no errors
210      m_data = 0;  // GOOD status
207211      // no command complete message?
208      set_phase(SCSI_PHASE_BUS_FREE);
212      timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),SCSI_PHASE_BUS_FREE);
209213      m_command_index = 0;
210214      //set_input_line(FMSCSI_LINE_REQ,1);  // raise REQ yet again
211215      return m_data;
r9543r9544
248252         SCSISetCommand(m_SCSIdevices[m_target],m_command,m_command_index);
249253         SCSIExecCommand(m_SCSIdevices[m_target],&m_result_length);
250254         SCSIGetPhase(m_SCSIdevices[m_target],&phase);
251         set_phase(phase);
252255         if(m_command[0] == 1)  // rezero unit command - not implemented in SCSI code
253            set_phase(SCSI_PHASE_STATUS);
256            timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),SCSI_PHASE_STATUS);
257         else
258            timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),phase);
259
254260         if(phase == SCSI_PHASE_STATUS)
255261            set_input_line(FMSCSI_LINE_REQ,1);
256262         if(phase == SCSI_PHASE_DATAIN)
r9543r9544
336342   {
337343      if(state != 0 && !(m_input_lines & FMSCSI_LINE_REQ))  // low to high
338344      {
339         if(m_output_lines & FMSCSI_LINE_IMSK && m_phase == SCSI_PHASE_COMMAND)
345         if(m_output_lines & FMSCSI_LINE_IMSK && m_phase != SCSI_PHASE_DATAIN && m_phase != SCSI_PHASE_DATAOUT)
340346         {
341            //set_input_line(FMSCSI_LINE_INT,1);
347            set_input_line(FMSCSI_LINE_INT,1);
342348            devcb_call_write_line(&m_irq_func,1);
343349         }
344350      }
345351      if(state == 0 && (m_input_lines & FMSCSI_LINE_REQ))  // high to low
346352      {
347         if(m_output_lines & FMSCSI_LINE_IMSK && m_phase == SCSI_PHASE_COMMAND)
353         if(m_output_lines & FMSCSI_LINE_IMSK && m_phase != SCSI_PHASE_DATAIN && m_phase != SCSI_PHASE_DATAOUT)
348354         {
349            //set_input_line(FMSCSI_LINE_INT,0);
355            set_input_line(FMSCSI_LINE_INT,0);
350356            devcb_call_write_line(&m_irq_func,0);
351357         }
352358      }
r9543r9544
380386      {
381387         if (image->exists())  // if device is mounted
382388         {
383            set_phase(SCSI_PHASE_COMMAND);
389            timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),SCSI_PHASE_COMMAND);
384390            m_data = 0x08;
385391         }
386392      }
src/mess/machine/fm_scsi.h
r9543r9544
9393    // internal device state goes here
9494    const fmscsi_device_config &m_config;
9595    static const device_timer_id TIMER_TRANSFER = 0;
96    static const device_timer_id TIMER_PHASE = 1;
9697
9798    void fmscsi_rescan(void);
9899    int get_scsi_cmd_len(UINT8 cbyte);
r9543r9544
114115    UINT8 m_target;
115116    UINT8 m_buffer[512];
116117    emu_timer* m_transfer_timer;
118    emu_timer* m_phase_timer;
117119};
118120
119121extern const device_type FMSCSI;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team