Previous 15994 Revisions Next

r9579 Sunday 14th November, 2010 at 11:28:08 UTC by Barry Rodewald
[FMTOWNS] Fixed SCSI interrupts, and added basic ATN line support. HDs are now usable and bootable.
[src/mess/drivers]fmtowns.c
[src/mess/machine]fm_scsi.c

src/mess/machine/fm_scsi.c
r9578r9579
2525#include "emu.h"
2626#include "fm_scsi.h"
2727#include "machine/devhelpr.h"
28#include "debugger.h"
2829
2930/*
3031 *  Device config
r9578r9579
186187      if(m_result_index >= m_result_length)
187188      {
188189         // end of data transfer
189         set_phase(SCSI_PHASE_STATUS);
190         timer_adjust_oneshot(m_transfer_timer,attotime_never,0);  // stop timer
191         timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_USEC(10),SCSI_PHASE_STATUS);
190192         if(m_output_lines & FMSCSI_LINE_DMAE)
191193         {
192194            devcb_call_write_line(&m_drq_func,0);
193195         }
194         timer_adjust_periodic(m_transfer_timer,attotime_zero,0,attotime_never);  // stop timer
195196         logerror("FMSCSI: Stopping transfer : (%i/%i)\n",m_result_index,m_result_length);
196197      }
197198      return m_data;
r9578r9579
209210   {
210211      m_data = 0;  // GOOD status
211212      // no command complete message?
212      timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),SCSI_PHASE_BUS_FREE);
213      timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),SCSI_PHASE_MESSAGE_IN);
213214      m_command_index = 0;
214215      //set_input_line(FMSCSI_LINE_REQ,1);  // raise REQ yet again
215216      return m_data;
r9578r9579
255256         if(m_command[0] == 1)  // rezero unit command - not implemented in SCSI code
256257            timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),SCSI_PHASE_STATUS);
257258         else
258            timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),phase);
259            timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_USEC(800),phase);
259260
260         if(phase == SCSI_PHASE_STATUS)
261            set_input_line(FMSCSI_LINE_REQ,1);
262         if(phase == SCSI_PHASE_DATAIN)
263         {
264            // start transfer timer
265            timer_adjust_periodic(m_transfer_timer,attotime_zero,0,ATTOTIME_IN_HZ(3000000));  // arbitrary value for now
266            SCSIReadData(m_SCSIdevices[m_target],m_buffer,512);
267            m_result_index = 0;
268            logerror("FMSCSI: Starting transfer (%i)\n",m_result_length);
269         }
270
271261         logerror("FMSCSI: Command %02x sent, result length = %i\n",m_command[0],m_result_length);
272262      }
273263      else
274264      {
275         set_input_line(FMSCSI_LINE_REQ,1);
265         timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),SCSI_PHASE_COMMAND);
276266      }
277267   }
268   if(m_phase == SCSI_PHASE_MESSAGE_OUT)
269   {
270      timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),SCSI_PHASE_STATUS);
271   }
278272}
279273
280274void fmscsi_device::set_phase(int phase)
r9578r9579
289283      set_input_line(FMSCSI_LINE_CD,0);
290284      set_input_line(FMSCSI_LINE_MSG,0);
291285      set_input_line(FMSCSI_LINE_IO,0);
292      set_input_line(FMSCSI_LINE_REQ,0);
286      //set_input_line(FMSCSI_LINE_REQ,0);
293287      break;
294288   case SCSI_PHASE_COMMAND:
295289      set_input_line(FMSCSI_LINE_BSY,1);
r9578r9579
309303      set_input_line(FMSCSI_LINE_MSG,0);
310304      set_input_line(FMSCSI_LINE_IO,1);
311305      set_input_line(FMSCSI_LINE_REQ,1);
306      // start transfer timer
307      timer_adjust_periodic(m_transfer_timer,attotime_zero,0,ATTOTIME_IN_HZ(3000000));  // arbitrary value for now
308      SCSIReadData(m_SCSIdevices[m_target],m_buffer,512);
309      m_result_index = 0;
310      logerror("FMSCSI: Starting transfer (%i)\n",m_result_length);
312311      break;
313312   case SCSI_PHASE_DATAOUT:
314313      set_input_line(FMSCSI_LINE_CD,0);
r9578r9579
346345         {
347346            set_input_line(FMSCSI_LINE_INT,1);
348347            devcb_call_write_line(&m_irq_func,1);
348            logerror("FMSCSI: IRQ high\n");
349349         }
350350      }
351351      if(state == 0 && (m_input_lines & FMSCSI_LINE_REQ))  // high to low
r9578r9579
354354         {
355355            set_input_line(FMSCSI_LINE_INT,0);
356356            devcb_call_write_line(&m_irq_func,0);
357            logerror("FMSCSI: IRQ low\n");
357358         }
358359      }
359360   }
r9578r9579
392393      }
393394   }
394395
395   // TODO: ATN functionality
396   if(line == FMSCSI_LINE_ATN)
397   {
398      if(state != 0)
399         timer_adjust_oneshot(m_phase_timer,ATTOTIME_IN_NSEC(800),SCSI_PHASE_MESSAGE_OUT);
400   }
396401
397402   if(state != 0)
398403      m_output_lines |= line;
src/mess/drivers/fmtowns.c
r9578r9579
17891789   towns_state* tstate = device->machine->driver_data<towns_state>();
17901790   upd71071_dmarq(tstate->dma_1,state,1);  // SCSI HDs use channel 1
17911791}
1792/*
1793static READ8_HANDLER(towns_scsi_r)
1794{
1795   towns_state* state = space->machine->driver_data<towns_state>();
1796   UINT8 ret = 0x00;
1797//   logerror("scsi_r (offset %i) read\n",offset);
1798   switch(offset)
1799   {
1800   case 0x00:
1801      set_scsi_line(state->scsibus,SCSI_LINE_ACK,0);
1802      return scsi_data_r(state->scsibus);
1803   case 0x02:
1804      ret |= (get_scsi_line(state->scsibus,SCSI_LINE_REQ)) ? 0x00 : 0x80;
1805      ret |= (get_scsi_line(state->scsibus,SCSI_LINE_IO)) ? 0x00 : 0x40;
1806      ret |= (get_scsi_line(state->scsibus,SCSI_LINE_MSG)) ? 0x00 : 0x20;
1807      ret |= (get_scsi_line(state->scsibus,SCSI_LINE_CD)) ? 0x00 : 0x10;
1808      ret |= (get_scsi_line(state->scsibus,SCSI_LINE_BSY)) ? 0x00 : 0x08;
1809      return ret;
1810   }
1811   return 0x00;
1812}
18131792
1814static WRITE8_HANDLER(towns_scsi_w)
1815{
1816   towns_state* state = space->machine->driver_data<towns_state>();
1817   switch(offset)
1818   {
1819   case 0x00:
1820      scsi_data_w(state->scsibus,data);
1821      logerror("SCSI data write %02x\n",data);
1822      break;
1823   case 0x02:
1824      set_scsi_line(state->scsibus,SCSI_LINE_SEL,data & 0x04);
1825      set_scsi_line(state->scsibus,SCSI_LINE_RESET,data & 0x01);
1826      if(data & 0x01)
1827         init_scsibus(state->scsibus);
1828      logerror("SCSI control write %02x\n",data);
1829      break;
1830   }
1831}
18321793
1833void towns_scsi_linechange(running_device *device, UINT8 line, UINT8 state)
1834{
1835   towns_state* tstate = device->machine->driver_data<towns_state>();
1836
1837   if(state == 0)
1838   {
1839      switch(line)
1840      {
1841      case SCSI_LINE_REQ:
1842         break;
1843      case SCSI_LINE_IO:
1844         break;
1845      case SCSI_LINE_MSG:
1846         break;
1847      case SCSI_LINE_CD:
1848         break;
1849      case SCSI_LINE_BSY:
1850         break;
1851      }
1852   }
1853   else
1854   {
1855      switch(line)
1856      {
1857      case SCSI_LINE_REQ:
1858         set_scsi_line(tstate->scsibus,SCSI_LINE_ACK,1);
1859         break;
1860      case SCSI_LINE_IO:
1861         break;
1862      case SCSI_LINE_MSG:
1863         break;
1864      case SCSI_LINE_CD:
1865         break;
1866      case SCSI_LINE_BSY:
1867         break;
1868      }
1869   }
1870
1871}
1872*/
18731794// Volume ports - I/O ports 0x4e0-0x4e3
18741795// 0x4e0 = input volume level
18751796// 0x4e1 = input channel select

Previous 15994 Revisions Next


© 1998-2018 The MESS Team