Previous 199869 Revisions Next

r18279 Thursday 4th October, 2012 at 11:09:41 UTC by smf
renamed scsidev to scsihle (nw)
[src/emu]emu.mak
[src/emu/machine]53c810.c 53c810.h am53cf96.c am53cf96.h ncr539x.c ncr539x.h scsibus.c scsibus.h scsicd.c scsicd.h scsidev.c scsidev.h scsihd.c scsihd.h scsihle.c* scsihle.h* wd33c93.c wd33c93.h
[src/mame/drivers]firebeat.c konamigv.c ksys573.c twinkle.c
[src/mame/machine]gdrom.c gdrom.h
[src/mess/machine]fm_scsi.c fm_scsi.h mb89352.c mb89352.h ncr5380.c ncr5380.h

trunk/src/emu/emu.mak
r18278r18279
252252   $(EMUMACHINE)/scsicb.o      \
253253   $(EMUMACHINE)/scsibus.o      \
254254   $(EMUMACHINE)/scsicd.o      \
255   $(EMUMACHINE)/scsidev.o      \
256255   $(EMUMACHINE)/scsihd.o      \
256   $(EMUMACHINE)/scsihle.o      \
257257   $(EMUMACHINE)/secflash.o   \
258258   $(EMUMACHINE)/seibu_cop.o   \
259259   $(EMUMACHINE)/smc91c9x.o   \
trunk/src/emu/machine/scsidev.c
r18278r18279
1/***************************************************************************
2
3 scsidev.c - Base class for scsi devices.
4
5***************************************************************************/
6
7#include "emu.h"
8#include "scsidev.h"
9
10scsidev_device::scsidev_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
11   device_t(mconfig, type, name, tag, owner, clock)
12{
13}
14
15void scsidev_device::device_start()
16{
17   save_item( NAME( command ) );
18   save_item( NAME( commandLength ) );
19   save_item( NAME( phase ) );
20}
21
22#define SCSI_SENSE_SIZE            4
23
24void scsidev_device::ExecCommand( int *transferLength )
25{
26   UINT8 *command;
27   int commandLength;
28   GetCommand( &command, &commandLength );
29
30   switch( command[ 0 ] )
31   {
32   case SCSI_CMD_TEST_UNIT_READY:
33      SetPhase( SCSI_PHASE_STATUS );
34      *transferLength = 0;
35      break;
36
37   case SCSI_CMD_RECALIBRATE:
38      SetPhase( SCSI_PHASE_STATUS );
39      *transferLength = 0;
40      break;
41
42   case SCSI_CMD_REQUEST_SENSE:
43      SetPhase( SCSI_PHASE_DATAOUT );
44      *transferLength = SCSI_SENSE_SIZE;
45      break;
46
47   case SCSI_CMD_SEND_DIAGNOSTIC:
48      SetPhase( SCSI_PHASE_DATAOUT );
49      *transferLength = ( command[ 3 ] << 8 ) + command[ 4 ];
50      break;
51
52   default:
53      logerror( "%s: SCSIDEV unknown command %02x\n", machine().describe_context(), command[ 0 ] );
54      *transferLength = 0;
55      break;
56   }
57}
58
59void scsidev_device::ReadData( UINT8 *data, int dataLength )
60{
61   UINT8 *command;
62   int commandLength;
63   GetCommand( &command, &commandLength );
64
65   switch( command[ 0 ] )
66   {
67   case SCSI_CMD_REQUEST_SENSE:
68      data[ 0 ] = SCSI_SENSE_NO_SENSE;
69      data[ 1 ] = 0x00;
70      data[ 2 ] = 0x00;
71      data[ 3 ] = 0x00;
72      break;
73   default:
74      logerror( "%s: SCSIDEV unknown read %02x\n", machine().describe_context(), command[ 0 ] );
75      break;
76   }
77}
78
79void scsidev_device::WriteData( UINT8 *data, int dataLength )
80{
81   UINT8 *command;
82   int commandLength;
83   GetCommand( &command, &commandLength );
84
85   switch( command[ 0 ] )
86   {
87   case SCSI_CMD_SEND_DIAGNOSTIC:
88      break;
89
90   default:
91      logerror( "%s: SCSIDEV unknown write %02x\n", machine().describe_context(), command[ 0 ] );
92      break;
93   }
94}
95
96void scsidev_device::SetPhase( int _phase )
97{
98   phase = _phase;
99}
100
101void scsidev_device::GetPhase( int *_phase)
102{
103   *_phase = phase;
104}
105
106void scsidev_device::SetCommand( UINT8 *_command, int _commandLength )
107{
108   if( _commandLength > sizeof( command ) )
109   {
110      /// TODO: output an error.
111      return;
112   }
113
114   memcpy( command, _command, _commandLength );
115   commandLength = _commandLength;
116
117   SetPhase( SCSI_PHASE_COMMAND );
118}
119
120void scsidev_device::GetCommand( UINT8 **_command, int *_commandLength )
121{
122   *_command = command;
123   *_commandLength = commandLength;
124}
125
126int scsidev_device::GetDeviceID()
127{
128   return scsiID;
129}
130
131int scsidev_device::GetSectorBytes()
132{
133   return 0;
134}
135
136void scsidev_device::static_set_deviceid( device_t &device, int _scsiID )
137{
138   scsidev_device &scsidev = downcast<scsidev_device &>(device);
139   scsidev.scsiID = _scsiID;
140}
141
142int SCSILengthFromUINT8( UINT8 *length )
143{
144   if( *length == 0 )
145   {
146      return 256;
147   }
148
149   return *length;
150}
151
152int SCSILengthFromUINT16( UINT8 *length )
153{
154   return ( *(length) << 8 ) | *(length + 1 );
155}
trunk/src/emu/machine/scsidev.h
r18278r18279
1/***************************************************************************
2
3 scsidev.h
4
5***************************************************************************/
6
7#ifndef _SCSIDEV_H_
8#define _SCSIDEV_H_
9
10// base handler
11class scsidev_device : public device_t
12{
13public:
14   // construction/destruction
15   scsidev_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
16
17   virtual void SetDevice( void *device ) = 0;
18   virtual void GetDevice( void **device ) = 0;
19   virtual void SetCommand( UINT8 *command, int commandLength );
20   virtual void GetCommand( UINT8 **command, int *commandLength );
21   virtual void ExecCommand( int *transferLength );
22   virtual void WriteData( UINT8 *data, int dataLength );
23   virtual void ReadData( UINT8 *data, int dataLength );
24   virtual void SetPhase( int phase );
25   virtual void GetPhase( int *phase );
26   virtual int GetDeviceID();
27   virtual int GetSectorBytes();
28
29   // configuration helpers
30   static void static_set_deviceid(device_t &device, int _scsiID);
31
32protected:
33   // device-level overrides
34   virtual void device_start();
35
36private:
37   UINT8 command[16];
38   int commandLength;
39   int phase;
40   int scsiID;
41};
42
43extern int SCSILengthFromUINT8( UINT8 *length );
44extern int SCSILengthFromUINT16( UINT8 *length );
45
46#define SCSI_PHASE_DATAOUT ( 0 )
47#define SCSI_PHASE_DATAIN ( 1 )
48#define SCSI_PHASE_COMMAND ( 2 )
49#define SCSI_PHASE_STATUS ( 3 )
50#define SCSI_PHASE_MESSAGE_OUT ( 6 )
51#define SCSI_PHASE_MESSAGE_IN ( 7 )
52
53#define SCSI_CMD_TEST_UNIT_READY ( 0x00 )
54#define SCSI_CMD_RECALIBRATE ( 0x01 )
55#define SCSI_CMD_REQUEST_SENSE ( 0x03 )
56#define SCSI_CMD_MODE_SELECT ( 0x15 )
57#define SCSI_CMD_SEND_DIAGNOSTIC ( 0x1d )
58
59//
60// Status / Sense data taken from Adaptec ACB40x0 documentation.
61//
62
63#define SCSI_STATUS_OK            0x00
64#define SCSI_STATUS_CHECK         0x02
65#define SCSI_STATUS_EQUAL         0x04
66#define SCSI_STATUS_BUSY         0x08
67
68#define SCSI_SENSE_ADDR_VALID      0x80
69#define SCSI_SENSE_NO_SENSE         0x00
70#define SCSI_SENSE_NO_INDEX         0x01
71#define SCSI_SENSE_SEEK_NOT_COMP   0x02
72#define SCSI_SENSE_WRITE_FAULT      0x03
73#define SCSI_SENSE_DRIVE_NOT_READY   0x04
74#define SCSI_SENSE_NO_TRACK0      0x06
75#define SCSI_SENSE_ID_CRC_ERROR      0x10
76#define SCSI_SENSE_UNCORRECTABLE   0x11
77#define SCSI_SENSE_ADDRESS_NF      0x12
78#define SCSI_SENSE_RECORD_NOT_FOUND   0x14
79#define SCSI_SENSE_SEEK_ERROR      0x15
80#define SCSI_SENSE_DATA_CHECK_RETRY   0x18
81#define SCSI_SENSE_ECC_VERIFY      0x19
82#define SCSI_SENSE_INTERLEAVE_ERROR   0x1A
83#define SCSI_SENSE_UNFORMATTED      0x1C
84#define SCSI_SENSE_ILLEGAL_COMMAND   0x20
85#define SCSI_SENSE_ILLEGAL_ADDRESS   0x21
86#define SCSI_SENSE_VOLUME_OVERFLOW   0x23
87#define SCSI_SENSE_BAD_ARGUMENT      0x24
88#define SCSI_SENSE_INVALID_LUN      0x25
89#define SCSI_SENSE_CART_CHANGED      0x28
90#define SCSI_SENSE_ERROR_OVERFLOW   0x2C
91
92// SCSI IDs
93enum
94{
95   SCSI_ID_0 = 0,
96   SCSI_ID_1,
97   SCSI_ID_2,
98   SCSI_ID_3,
99   SCSI_ID_4,
100   SCSI_ID_5,
101   SCSI_ID_6,
102   SCSI_ID_7
103};
104
105#define MCFG_SCSIDEV_ADD(_tag, _type, _id) \
106   MCFG_DEVICE_ADD(_tag, _type, 0) \
107   scsidev_device::static_set_deviceid(*device, _id);
108
109#endif
trunk/src/emu/machine/am53cf96.c
r18278r18279
1111
1212#include "emu.h"
1313#include "am53cf96.h"
14#include "machine/scsidev.h"
14#include "machine/scsihle.h"
1515
1616READ8_MEMBER( am53cf96_device::read )
1717{
r18278r18279
180180   // try to open the devices
181181   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
182182   {
183      scsidev_device *scsidev = dynamic_cast<scsidev_device *>(device);
183      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
184184      if( scsidev != NULL )
185185      {
186186         devices[scsidev->GetDeviceID()] = scsidev;
trunk/src/emu/machine/am53cf96.h
r18278r18279
66#ifndef _AM53CF96_H_
77#define _AM53CF96_H_
88
9#include "scsidev.h"
9#include "machine/scsihle.h"
1010
1111struct AM53CF96interface
1212{
r18278r18279
6161private:
6262   static const device_timer_id TIMER_TRANSFER = 0;
6363
64   scsidev_device *devices[8];
64   scsihle_device *devices[8];
6565
6666   UINT8 scsi_regs[32];
6767   UINT8 fifo[16];
trunk/src/emu/machine/scsihd.c
r18278r18279
55***************************************************************************/
66
77#include "emu.h"
8#include "scsidev.h"
8#include "machine/scsihle.h"
99#include "harddisk.h"
1010#include "imagedev/harddriv.h"
1111#include "scsihd.h"
r18278r18279
1414const device_type SCSIHD = &device_creator<scsihd_device>;
1515
1616scsihd_device::scsihd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
17   : scsidev_device(mconfig, SCSIHD, "SCSIHD", tag, owner, clock)
17   : scsihle_device(mconfig, SCSIHD, "SCSIHD", tag, owner, clock)
1818{
1919}
2020
2121scsihd_device::scsihd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
22   scsidev_device(mconfig, type, name, tag, owner, clock)
22   scsihle_device(mconfig, type, name, tag, owner, clock)
2323{
2424}
2525
r18278r18279
3131
3232void scsihd_device::device_reset()
3333{
34   scsidev_device::device_reset();
34   scsihle_device::device_reset();
3535
3636   is_image_device = true;
3737   disk = subdevice<harddisk_image_device>("image")->get_hard_disk_file();
r18278r18279
174174         break;
175175
176176      default:
177         scsidev_device::ExecCommand( transferLength );
177         scsihle_device::ExecCommand( transferLength );
178178         break;
179179   }
180180}
r18278r18279
272272         break;
273273
274274      default:
275         scsidev_device::ReadData( data, dataLength );
275         scsihle_device::ReadData( data, dataLength );
276276         break;
277277   }
278278}
r18278r18279
309309         break;
310310
311311      default:
312         scsidev_device::WriteData( data, dataLength );
312         scsihle_device::WriteData( data, dataLength );
313313         break;
314314   }
315315}
trunk/src/emu/machine/scsihd.h
r18278r18279
77#ifndef _SCSIHD_H_
88#define _SCSIHD_H_
99
10#include "machine/scsidev.h"
10#include "machine/scsihle.h"
1111#include "harddisk.h"
1212
13class scsihd_device : public scsidev_device
13class scsihd_device : public scsihle_device
1414{
1515public:
1616   // construction/destruction
trunk/src/emu/machine/scsicd.c
r18278r18279
55***************************************************************************/
66
77#include "emu.h"
8#include "scsidev.h"
8#include "machine/scsihle.h"
99#include "cdrom.h"
1010#include "sound/cdda.h"
1111#include "imagedev/chd_cd.h"
r18278r18279
2323const device_type SCSICD = &device_creator<scsicd_device>;
2424
2525scsicd_device::scsicd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
26   : scsidev_device(mconfig, SCSICD, "SCSICD", tag, owner, clock)
26   : scsihle_device(mconfig, SCSICD, "SCSICD", tag, owner, clock)
2727{
2828}
2929
3030scsicd_device::scsicd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
31   scsidev_device(mconfig, type, name, tag, owner, clock)
31   scsihle_device(mconfig, type, name, tag, owner, clock)
3232{
3333}
3434
r18278r18279
4545
4646void scsicd_device::device_reset()
4747{
48   scsidev_device::device_reset();
48   scsihle_device::device_reset();
4949
5050   is_file = TRUE;
5151   cdrom = subdevice<cdrom_image_device>("image")->get_cdrom_file();
r18278r18279
375375         break;
376376
377377      default:
378         scsidev_device::ExecCommand( transferLength );
378         scsihle_device::ExecCommand( transferLength );
379379   }
380380}
381381
r18278r18279
711711         break;
712712
713713      default:
714         scsidev_device::ReadData( data, dataLength );
714         scsihle_device::ReadData( data, dataLength );
715715         break;
716716   }
717717}
r18278r18279
759759         break;
760760
761761      default:
762         scsidev_device::WriteData( data, dataLength );
762         scsihle_device::WriteData( data, dataLength );
763763         break;
764764   }
765765}
trunk/src/emu/machine/scsicd.h
r18278r18279
77#ifndef _SCSICD_H_
88#define _SCSICD_H_
99
10#include "machine/scsidev.h"
10#include "machine/scsihle.h"
1111#include "cdrom.h"
1212
13class scsicd_device : public scsidev_device
13class scsicd_device : public scsihle_device
1414{
1515public:
1616   // construction/destruction
trunk/src/emu/machine/53c810.c
r18278r18279
22
33#include "emu.h"
44#include "53c810.h"
5#include "machine/scsidev.h"
5#include "machine/scsihle.h"
66
77#define DMA_MAX_ICOUNT   512      /* Maximum number of DMA Scripts opcodes to run */
88#define DASM_OPCODES 0
r18278r18279
664664   // try to open the devices
665665   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
666666   {
667      scsidev_device *scsidev = dynamic_cast<scsidev_device *>(device);
667      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
668668      if( scsidev != NULL )
669669      {
670670         devices[scsidev->GetDeviceID()] = scsidev;
trunk/src/emu/machine/53c810.h
r18278r18279
11#ifndef LSI53C810_H
22#define LSI53C810_H
33
4#include "scsidev.h"
4#include "machine/scsihle.h"
55
66struct LSI53C810interface
77{
r18278r18279
6262   UINT32 lsi53c810_dasm_fetch(UINT32 pc);
6363   unsigned lsi53c810_dasm(char *buf, UINT32 pc);
6464
65   scsidev_device *devices[8];   /* SCSI IDs 0-7 */
65   scsihle_device *devices[8];   /* SCSI IDs 0-7 */
6666   UINT8 last_id;
6767
6868   UINT8 scntl0;
trunk/src/emu/machine/scsibus.c
r18278r18279
88*/
99
1010#include "emu.h"
11#include "machine/scsidev.h"
11#include "machine/scsihle.h"
1212#include "machine/scsibus.h"
1313#include "debugger.h"
1414#include "debug/debugcpu.h"
r18278r18279
685685
686686   for( device_t *device = first_subdevice(); device != NULL; device = device->next() )
687687   {
688      scsidev_device *scsidev = dynamic_cast<scsidev_device *>(device);
688      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
689689      if( scsidev != NULL )
690690      {
691691         devices[scsidev->GetDeviceID()] = scsidev;
trunk/src/emu/machine/scsibus.h
r18278r18279
99#define _SCSIBUS_H_
1010
1111#include "machine/scsicb.h"
12#include "machine/scsidev.h"
12#include "machine/scsihle.h"
1313
1414
1515/***************************************************************************
r18278r18279
141141   void dump_data_bytes(int count);
142142   void dump_bytes(UINT8 *buff, int count);
143143
144   scsidev_device          *devices[8];
144   scsihle_device          *devices[8];
145145   scsicb_device *m_scsicb;
146146
147147   UINT8       linestate;
trunk/src/emu/machine/scsihle.c
r0r18279
1/***************************************************************************
2
3 scsidev.c - Base class for scsi devices.
4
5***************************************************************************/
6
7#include "emu.h"
8#include "machine/scsihle.h"
9
10scsihle_device::scsihle_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
11   device_t(mconfig, type, name, tag, owner, clock)
12{
13}
14
15void scsihle_device::device_start()
16{
17   save_item( NAME( command ) );
18   save_item( NAME( commandLength ) );
19   save_item( NAME( phase ) );
20}
21
22#define SCSI_SENSE_SIZE            4
23
24void scsihle_device::ExecCommand( int *transferLength )
25{
26   UINT8 *command;
27   int commandLength;
28   GetCommand( &command, &commandLength );
29
30   switch( command[ 0 ] )
31   {
32   case SCSI_CMD_TEST_UNIT_READY:
33      SetPhase( SCSI_PHASE_STATUS );
34      *transferLength = 0;
35      break;
36
37   case SCSI_CMD_RECALIBRATE:
38      SetPhase( SCSI_PHASE_STATUS );
39      *transferLength = 0;
40      break;
41
42   case SCSI_CMD_REQUEST_SENSE:
43      SetPhase( SCSI_PHASE_DATAOUT );
44      *transferLength = SCSI_SENSE_SIZE;
45      break;
46
47   case SCSI_CMD_SEND_DIAGNOSTIC:
48      SetPhase( SCSI_PHASE_DATAOUT );
49      *transferLength = ( command[ 3 ] << 8 ) + command[ 4 ];
50      break;
51
52   default:
53      logerror( "%s: SCSIDEV unknown command %02x\n", machine().describe_context(), command[ 0 ] );
54      *transferLength = 0;
55      break;
56   }
57}
58
59void scsihle_device::ReadData( UINT8 *data, int dataLength )
60{
61   UINT8 *command;
62   int commandLength;
63   GetCommand( &command, &commandLength );
64
65   switch( command[ 0 ] )
66   {
67   case SCSI_CMD_REQUEST_SENSE:
68      data[ 0 ] = SCSI_SENSE_NO_SENSE;
69      data[ 1 ] = 0x00;
70      data[ 2 ] = 0x00;
71      data[ 3 ] = 0x00;
72      break;
73   default:
74      logerror( "%s: SCSIDEV unknown read %02x\n", machine().describe_context(), command[ 0 ] );
75      break;
76   }
77}
78
79void scsihle_device::WriteData( UINT8 *data, int dataLength )
80{
81   UINT8 *command;
82   int commandLength;
83   GetCommand( &command, &commandLength );
84
85   switch( command[ 0 ] )
86   {
87   case SCSI_CMD_SEND_DIAGNOSTIC:
88      break;
89
90   default:
91      logerror( "%s: SCSIDEV unknown write %02x\n", machine().describe_context(), command[ 0 ] );
92      break;
93   }
94}
95
96void scsihle_device::SetPhase( int _phase )
97{
98   phase = _phase;
99}
100
101void scsihle_device::GetPhase( int *_phase)
102{
103   *_phase = phase;
104}
105
106void scsihle_device::SetCommand( UINT8 *_command, int _commandLength )
107{
108   if( _commandLength > sizeof( command ) )
109   {
110      /// TODO: output an error.
111      return;
112   }
113
114   memcpy( command, _command, _commandLength );
115   commandLength = _commandLength;
116
117   SetPhase( SCSI_PHASE_COMMAND );
118}
119
120void scsihle_device::GetCommand( UINT8 **_command, int *_commandLength )
121{
122   *_command = command;
123   *_commandLength = commandLength;
124}
125
126int scsihle_device::GetDeviceID()
127{
128   return scsiID;
129}
130
131int scsihle_device::GetSectorBytes()
132{
133   return 0;
134}
135
136void scsihle_device::static_set_deviceid( device_t &device, int _scsiID )
137{
138   scsihle_device &scsidev = downcast<scsihle_device &>(device);
139   scsidev.scsiID = _scsiID;
140}
141
142int SCSILengthFromUINT8( UINT8 *length )
143{
144   if( *length == 0 )
145   {
146      return 256;
147   }
148
149   return *length;
150}
151
152int SCSILengthFromUINT16( UINT8 *length )
153{
154   return ( *(length) << 8 ) | *(length + 1 );
155}
trunk/src/emu/machine/scsihle.h
r0r18279
1/***************************************************************************
2
3 scsidev.h
4
5***************************************************************************/
6
7#ifndef _SCSIDEV_H_
8#define _SCSIDEV_H_
9
10// base handler
11class scsihle_device : public device_t
12{
13public:
14   // construction/destruction
15   scsihle_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
16
17   virtual void SetDevice( void *device ) = 0;
18   virtual void GetDevice( void **device ) = 0;
19   virtual void SetCommand( UINT8 *command, int commandLength );
20   virtual void GetCommand( UINT8 **command, int *commandLength );
21   virtual void ExecCommand( int *transferLength );
22   virtual void WriteData( UINT8 *data, int dataLength );
23   virtual void ReadData( UINT8 *data, int dataLength );
24   virtual void SetPhase( int phase );
25   virtual void GetPhase( int *phase );
26   virtual int GetDeviceID();
27   virtual int GetSectorBytes();
28
29   // configuration helpers
30   static void static_set_deviceid(device_t &device, int _scsiID);
31
32protected:
33   // device-level overrides
34   virtual void device_start();
35
36private:
37   UINT8 command[16];
38   int commandLength;
39   int phase;
40   int scsiID;
41};
42
43extern int SCSILengthFromUINT8( UINT8 *length );
44extern int SCSILengthFromUINT16( UINT8 *length );
45
46#define SCSI_PHASE_DATAOUT ( 0 )
47#define SCSI_PHASE_DATAIN ( 1 )
48#define SCSI_PHASE_COMMAND ( 2 )
49#define SCSI_PHASE_STATUS ( 3 )
50#define SCSI_PHASE_MESSAGE_OUT ( 6 )
51#define SCSI_PHASE_MESSAGE_IN ( 7 )
52
53#define SCSI_CMD_TEST_UNIT_READY ( 0x00 )
54#define SCSI_CMD_RECALIBRATE ( 0x01 )
55#define SCSI_CMD_REQUEST_SENSE ( 0x03 )
56#define SCSI_CMD_MODE_SELECT ( 0x15 )
57#define SCSI_CMD_SEND_DIAGNOSTIC ( 0x1d )
58
59//
60// Status / Sense data taken from Adaptec ACB40x0 documentation.
61//
62
63#define SCSI_STATUS_OK            0x00
64#define SCSI_STATUS_CHECK         0x02
65#define SCSI_STATUS_EQUAL         0x04
66#define SCSI_STATUS_BUSY         0x08
67
68#define SCSI_SENSE_ADDR_VALID      0x80
69#define SCSI_SENSE_NO_SENSE         0x00
70#define SCSI_SENSE_NO_INDEX         0x01
71#define SCSI_SENSE_SEEK_NOT_COMP   0x02
72#define SCSI_SENSE_WRITE_FAULT      0x03
73#define SCSI_SENSE_DRIVE_NOT_READY   0x04
74#define SCSI_SENSE_NO_TRACK0      0x06
75#define SCSI_SENSE_ID_CRC_ERROR      0x10
76#define SCSI_SENSE_UNCORRECTABLE   0x11
77#define SCSI_SENSE_ADDRESS_NF      0x12
78#define SCSI_SENSE_RECORD_NOT_FOUND   0x14
79#define SCSI_SENSE_SEEK_ERROR      0x15
80#define SCSI_SENSE_DATA_CHECK_RETRY   0x18
81#define SCSI_SENSE_ECC_VERIFY      0x19
82#define SCSI_SENSE_INTERLEAVE_ERROR   0x1A
83#define SCSI_SENSE_UNFORMATTED      0x1C
84#define SCSI_SENSE_ILLEGAL_COMMAND   0x20
85#define SCSI_SENSE_ILLEGAL_ADDRESS   0x21
86#define SCSI_SENSE_VOLUME_OVERFLOW   0x23
87#define SCSI_SENSE_BAD_ARGUMENT      0x24
88#define SCSI_SENSE_INVALID_LUN      0x25
89#define SCSI_SENSE_CART_CHANGED      0x28
90#define SCSI_SENSE_ERROR_OVERFLOW   0x2C
91
92// SCSI IDs
93enum
94{
95   SCSI_ID_0 = 0,
96   SCSI_ID_1,
97   SCSI_ID_2,
98   SCSI_ID_3,
99   SCSI_ID_4,
100   SCSI_ID_5,
101   SCSI_ID_6,
102   SCSI_ID_7
103};
104
105#define MCFG_SCSIDEV_ADD(_tag, _type, _id) \
106   MCFG_DEVICE_ADD(_tag, _type, 0) \
107   scsihle_device::static_set_deviceid(*device, _id);
108
109#endif
trunk/src/emu/machine/wd33c93.c
r18278r18279
762762   // try to open the devices
763763   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
764764   {
765      scsidev_device *scsidev = dynamic_cast<scsidev_device *>(device);
765      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
766766      if( scsidev != NULL )
767767      {
768768         devices[scsidev->GetDeviceID()] = scsidev;
trunk/src/emu/machine/wd33c93.h
r18278r18279
66#ifndef _WD33C93_H_
77#define _WD33C93_H_
88
9#include "scsidev.h"
9#include "machine/scsihle.h"
1010
1111struct WD33C93interface
1212{
r18278r18279
9393   void xferinfo_cmd();
9494   void dispatch_command();
9595
96   scsidev_device *devices[8];   // SCSI IDs 0-7
96   scsihle_device *devices[8];   // SCSI IDs 0-7
9797
9898   UINT8      sasr;
9999   UINT8      regs[WD_AUXILIARY_STATUS+1];
trunk/src/emu/machine/ncr539x.c
r18278r18279
157157   // try to open the devices
158158   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
159159   {
160      scsidev_device *scsidev = dynamic_cast<scsidev_device *>(device);
160      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
161161      if( scsidev != NULL )
162162      {
163163         m_scsi_devices[scsidev->GetDeviceID()] = scsidev;
trunk/src/emu/machine/ncr539x.h
r18278r18279
66#ifndef _NCR539x_H_
77#define _NCR539x_H_
88
9#include "machine/scsidev.h"
9#include "machine/scsihle.h"
1010
1111struct NCR539Xinterface
1212{
r18278r18279
5151    void exec_fifo();
5252    void update_fifo_internal_state(int bytes);
5353
54   scsidev_device *m_scsi_devices[8];
54   scsihle_device *m_scsi_devices[8];
5555
5656    UINT32 m_xfer_count;
5757    UINT32 m_dma_size;
trunk/src/mess/machine/fm_scsi.c
r18278r18279
7575   // try to open the devices
7676   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
7777   {
78      scsidev_device *scsidev = dynamic_cast<scsidev_device *>(device);
78      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
7979      if( scsidev != NULL )
8080      {
8181         m_SCSIdevices[scsidev->GetDeviceID()] = scsidev;
trunk/src/mess/machine/fm_scsi.h
r18278r18279
88#ifndef FM_SCSI_H_
99#define FM_SCSI_H_
1010
11#include "machine/scsidev.h"
11#include "machine/scsihle.h"
1212
1313// SCSI input lines (from target)
1414#define FMSCSI_LINE_REQ   0x80
r18278r18279
8383    devcb_resolved_write_line m_irq_func;
8484    devcb_resolved_write_line m_drq_func;
8585
86    scsidev_device* m_SCSIdevices[8];
86    scsihle_device* m_SCSIdevices[8];
8787    UINT8 m_command[32];
8888    UINT8 m_result[32];
8989    UINT8 m_command_index;
trunk/src/mess/machine/ncr5380.c
r18278r18279
124124   // try to open the devices
125125   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
126126   {
127      scsidev_device *scsidev = dynamic_cast<scsidev_device *>(device);
127      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
128128      if( scsidev != NULL )
129129      {
130130         m_scsi_devices[scsidev->GetDeviceID()] = scsidev;
trunk/src/mess/machine/ncr5380.h
r18278r18279
66#ifndef _NCR5380_H_
77#define _NCR5380_H_
88
9#include "machine/scsidev.h"
9#include "machine/scsihle.h"
1010
1111struct NCR5380interface
1212{
r18278r18279
6262   virtual void device_config_complete();
6363
6464private:
65   scsidev_device *m_scsi_devices[8];
65   scsihle_device *m_scsi_devices[8];
6666
6767   UINT8 m_5380_Registers[8];
6868   UINT8 m_last_id;
trunk/src/mess/machine/mb89352.c
r18278r18279
157157   // try to open the devices
158158   for( device_t *device = owner()->first_subdevice(); device != NULL; device = device->next() )
159159   {
160      scsidev_device *scsidev = dynamic_cast<scsidev_device *>(device);
160      scsihle_device *scsidev = dynamic_cast<scsihle_device *>(device);
161161      if( scsidev != NULL )
162162      {
163163         m_SCSIdevices[scsidev->GetDeviceID()] = scsidev;
trunk/src/mess/machine/mb89352.h
r18278r18279
77#ifndef MB89352_H_
88#define MB89352_H_
99
10#include "machine/scsidev.h"
10#include "machine/scsihle.h"
1111
1212// SCSI lines readable via PSNS register (reg 5)
1313#define MB89352_LINE_REQ 0x80
r18278r18279
9494    devcb_resolved_write_line m_irq_func;
9595    devcb_resolved_write_line m_drq_func;
9696
97    scsidev_device* m_SCSIdevices[8];
97    scsihle_device* m_SCSIdevices[8];
9898
9999    UINT8 m_phase;  // current SCSI phase
100100    UINT8 m_target; // current SCSI target
trunk/src/mame/drivers/firebeat.c
r18278r18279
158158   int m_tick;
159159   int m_layer;
160160   UINT8 m_atapi_regs[16];
161   scsidev_device *m_atapi_device_data[2];
161   scsihle_device *m_atapi_device_data[2];
162162   UINT16 m_atapi_data[32*1024];
163163   UINT8 m_atapi_scsi_packet[32*1024];
164164   int m_atapi_data_ptr;
r18278r18279
962962   state->m_atapi_data_ptr = 0;
963963   state->m_atapi_cdata_wait = 0;
964964
965   state->m_atapi_device_data[0] = machine.device<scsidev_device>( "scsi0" );
966   state->m_atapi_device_data[1] = machine.device<scsidev_device>( "scsi1" );
965   state->m_atapi_device_data[0] = machine.device<scsihle_device>( "scsi0" );
966   state->m_atapi_device_data[1] = machine.device<scsihle_device>( "scsi1" );
967967}
968968
969969static void atapi_reset(running_machine &machine)
trunk/src/mame/drivers/twinkle.c
r18278r18279
875875{
876876   /* also hook up CDDA audio to the CD-ROM drive */
877877   void *cdrom;
878   scsidev_device *scsidev = machine().device<scsidev_device>("scsi:cdrom");
878   scsihle_device *scsidev = machine().device<scsihle_device>("scsi:cdrom");
879879   scsidev->GetDevice( &cdrom );
880880   cdda_set_cdrom(machine().device("cdda"), cdrom);
881881}
trunk/src/mame/drivers/konamigv.c
r18278r18279
323323{
324324   /* also hook up CDDA audio to the CD-ROM drive */
325325   void *cdrom;
326   scsidev_device *scsidev = machine().device<scsidev_device>("scsi:cdrom");
326   scsihle_device *scsidev = machine().device<scsihle_device>("scsi:cdrom");
327327   scsidev->GetDevice( &cdrom );
328328   cdda_set_cdrom(machine().device("cdda"), cdrom);
329329}
trunk/src/mame/drivers/ksys573.c
r18278r18279
488488   UINT32 m_control;
489489
490490   emu_timer *m_atapi_timer;
491   scsidev_device *m_inserted_cdrom;
492   scsidev_device *m_available_cdroms[ 2 ];
491   scsihle_device *m_inserted_cdrom;
492   scsihle_device *m_available_cdroms[ 2 ];
493493   int m_atapi_data_ptr;
494494   int m_atapi_data_len;
495495   int m_atapi_xferlen;
r18278r18279
11341134   state->m_atapi_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(ksys573_state::atapi_xfer_end),state));
11351135   state->m_atapi_timer->adjust(attotime::never);
11361136
1137   state->m_available_cdroms[ 0 ] = machine.device<scsidev_device>( ":cdrom0" );
1137   state->m_available_cdroms[ 0 ] = machine.device<scsihle_device>( ":cdrom0" );
11381138   if( get_disk_handle( machine, ":cdrom1" ) != NULL )
11391139   {
1140      state->m_available_cdroms[ 1 ] = machine.device<scsidev_device>( ":cdrom1" );
1140      state->m_available_cdroms[ 1 ] = machine.device<scsihle_device>( ":cdrom1" );
11411141   }
11421142   else
11431143   {
r18278r18279
13651365   ksys573_state *state = machine.driver_data<ksys573_state>();
13661366   int cart = state->ioport("CART")->read();
13671367   int cd = state->ioport( "CD" )->read();
1368   scsidev_device *new_cdrom;
1368   scsihle_device *new_cdrom;
13691369
13701370   if( state->machine().device<device_secure_serial_flash>("game_eeprom") )
13711371   {
trunk/src/mame/machine/gdrom.c
r18278r18279
55***************************************************************************/
66
77#include "emu.h"
8#include "machine/scsidev.h"
8#include "machine/scsihle.h"
99#include "cdrom.h"
1010#include "sound/cdda.h"
1111#include "imagedev/chd_cd.h"
r18278r18279
2929const device_type GDROM = &device_creator<gdrom_device>;
3030
3131gdrom_device::gdrom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
32   : scsidev_device(mconfig, GDROM, "GDROM", tag, owner, clock)
32   : scsihle_device(mconfig, GDROM, "GDROM", tag, owner, clock)
3333{
3434}
3535
r18278r18279
4646
4747void gdrom_device::device_reset()
4848{
49   scsidev_device::device_reset();
49   scsihle_device::device_reset();
5050
5151   is_file = TRUE;
5252   cdrom = subdevice<cdrom_image_device>("image")->get_cdrom_file();
r18278r18279
434434         break;
435435
436436      default:
437         scsidev_device::ExecCommand( transferLength );
437         scsihle_device::ExecCommand( transferLength );
438438         break;
439439   }
440440}
r18278r18279
786786         break;
787787
788788      default:
789         scsidev_device::ReadData( data, dataLength );
789         scsihle_device::ReadData( data, dataLength );
790790         break;
791791   }
792792}
r18278r18279
834834         break;
835835
836836      default:
837         scsidev_device::WriteData( data, dataLength );
837         scsihle_device::WriteData( data, dataLength );
838838         break;
839839   }
840840}
trunk/src/mame/machine/gdrom.h
r18278r18279
77#ifndef _GDROM_H_
88#define _GDROM_H_
99
10#include "machine/scsidev.h"
10#include "machine/scsihle.h"
1111
1212// Sega GD-ROM handler
13class gdrom_device : public scsidev_device
13class gdrom_device : public scsihle_device
1414{
1515public:
1616   // construction/destruction

Previous 199869 Revisions Next


© 1997-2024 The MAME Team