Previous 199869 Revisions Next

r18706 Thursday 25th October, 2012 at 16:51:48 UTC by smf
Hooked up PSX IRQ's using DEVCB2 [smf]
[src/emu/cpu/psx]dma.c dma.h irq.c irq.h psx.c rcnt.c rcnt.h sio.c sio.h
[src/emu/machine]am53cf96.c am53cf96.h
[src/emu/sound]spu.c spu.h
[src/emu/video]psx.c psx.h
[src/mame/drivers]konamigq.c konamigv.c ksys573.c taitogn.c twinkle.c zn.c
[src/mame/machine]psx.c
[src/mess/drivers]psx.c
[src/mess/machine]psxcd.c psxcd.h

trunk/src/emu/cpu/psx/sio.c
r18705r18706
2525
2626const device_type PSX_SIO = &device_creator<psxsio_device>;
2727
28psxsio_device::psxsio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
29   : device_t(mconfig, PSX_SIO, "PSX SIO", tag, owner, clock)
28psxsio_device::psxsio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
29   device_t(mconfig, PSX_SIO, "PSX SIO", tag, owner, clock),
30   m_irq0_handler(*this),
31   m_irq1_handler(*this)
3032{
3133   int n;
3234
r18705r18706
5456{
5557   int n;
5658
59   m_irq0_handler.resolve_safe();
60   m_irq1_handler.resolve_safe();
61
5762   for( n = 0; n < 2; n++ )
5863   {
5964      port[ n ].timer = machine().scheduler().timer_alloc( timer_expired_delegate( FUNC( psxsio_device::sio_clock ), this ) );
r18705r18706
105110   sio->n_status |= SIO_STATUS_IRQ;
106111   if( n_port == 0 )
107112   {
108      psx_irq_set( machine(), PSX_IRQ_SIO0 );
113      m_irq0_handler(1);
109114   }
110115   else
111116   {
112      psx_irq_set( machine(), PSX_IRQ_SIO1 );
117      m_irq1_handler(1);
113118   }
114119}
115120
trunk/src/emu/cpu/psx/irq.c
r18705r18706
1010
1111#define VERBOSE_LEVEL ( 0 )
1212
13#define PSX_IRQ_MASK ( 0x7fd )
14
1315INLINE void ATTR_PRINTF(3,4) verboselog( running_machine& machine, int n_level, const char *s_fmt, ... )
1416{
1517   if( VERBOSE_LEVEL >= n_level )
r18705r18706
110112   }
111113   return 0;
112114}
115
116WRITE_LINE_MEMBER( psxirq_device::intin0 )
117{
118   if( state )
119   {
120      set( 1 << 0 );
121   }
122}
123
124WRITE_LINE_MEMBER( psxirq_device::intin1 )
125{
126   if( state )
127   {
128      set( 1 << 3 );
129   }
130}
131
132WRITE_LINE_MEMBER( psxirq_device::intin2 )
133{
134   if( state )
135   {
136      set( 1 << 3 );
137   }
138}
139
140WRITE_LINE_MEMBER( psxirq_device::intin3 )
141{
142   if( state )
143   {
144      set( 1 << 3 );
145   }
146}
147
148WRITE_LINE_MEMBER( psxirq_device::intin4 )
149{
150   if( state )
151   {
152      set( 1 << 3 );
153   }
154}
155
156WRITE_LINE_MEMBER( psxirq_device::intin5 )
157{
158   if( state )
159   {
160      set( 1 << 3 );
161   }
162}
163
164WRITE_LINE_MEMBER( psxirq_device::intin6 )
165{
166   if( state )
167   {
168      set( 1 << 3 );
169   }
170}
171
172WRITE_LINE_MEMBER( psxirq_device::intin7 )
173{
174   if( state )
175   {
176      set( 1 << 7 );
177   }
178}
179
180WRITE_LINE_MEMBER( psxirq_device::intin8 )
181{
182   if( state )
183   {
184      set( 1 << 8 );
185   }
186}
187
188WRITE_LINE_MEMBER( psxirq_device::intin9 )
189{
190   if( state )
191   {
192      set( 1 << 9 );
193   }
194}
195
196WRITE_LINE_MEMBER( psxirq_device::intin10 )
197{
198   if( state )
199   {
200      set( 1 << 10 );
201   }
202}
trunk/src/emu/cpu/psx/sio.h
r18705r18706
1616
1717typedef void ( *psx_sio_handler )( running_machine &, int );
1818
19#define MCFG_PSX_SIO_IRQ0_HANDLER(_devcb) \
20   devcb = &psxsio_device::set_irq0_handler(*device, DEVCB2_##_devcb); \
21
22#define MCFG_PSX_SIO_IRQ1_HANDLER(_devcb) \
23   devcb = &psxsio_device::set_irq1_handler(*device, DEVCB2_##_devcb); \
24
1925#define PSX_SIO_OUT_DATA ( 1 )   /* COMMAND */
2026#define PSX_SIO_OUT_DTR ( 2 )   /* ATT */
2127#define PSX_SIO_OUT_RTS ( 4 )
r18705r18706
6773public:
6874   psxsio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
6975
76   // static configuration helpers
77   template<class _Object> static devcb2_base &set_irq0_handler(device_t &device, _Object object) { return downcast<psxsio_device &>(device).m_irq0_handler.set_callback(object); }
78   template<class _Object> static devcb2_base &set_irq1_handler(device_t &device, _Object object) { return downcast<psxsio_device &>(device).m_irq1_handler.set_callback(object); }
79
7080   void install_handler( int n_port, psx_sio_handler p_f_sio_handler );
7181
7282   DECLARE_WRITE32_MEMBER( write );
r18705r18706
8595   TIMER_CALLBACK_MEMBER(sio_clock);
8696
8797   psx_sio port[2];
98
99   devcb2_write_line m_irq0_handler;
100   devcb2_write_line m_irq1_handler;
88101};
89102
90103DECLARE_WRITE32_HANDLER( psx_sio_w );
trunk/src/emu/cpu/psx/irq.h
r18705r18706
1212
1313#include "emu.h"
1414
15#define PSX_IRQ_VBLANK         0x0001
16#define PSX_IRQ_CDROM         0x0004
17#define PSX_IRQ_DMA            0x0008
18#define PSX_IRQ_ROOTCOUNTER0   0x0010
19#define PSX_IRQ_ROOTCOUNTER1   0x0020
20#define PSX_IRQ_ROOTCOUNTER2   0x0040
21#define PSX_IRQ_SIO0         0x0080
22#define PSX_IRQ_SIO1         0x0100
23#define PSX_IRQ_SPU            0x0200
24#define PSX_IRQ_EXTCD         0x0400
25#define PSX_IRQ_MASK         (PSX_IRQ_VBLANK | PSX_IRQ_CDROM | PSX_IRQ_DMA | PSX_IRQ_ROOTCOUNTER2 | PSX_IRQ_ROOTCOUNTER1 | PSX_IRQ_ROOTCOUNTER0 | PSX_IRQ_SIO0 | PSX_IRQ_SIO1 | PSX_IRQ_SPU | PSX_IRQ_EXTCD)
26
2715extern const device_type PSX_IRQ;
2816
2917class psxirq_device : public device_t
r18705r18706
3422   DECLARE_READ32_MEMBER( read );
3523   DECLARE_WRITE32_MEMBER( write );
3624
25   DECLARE_WRITE_LINE_MEMBER( intin0 );
26   DECLARE_WRITE_LINE_MEMBER( intin1 );
27   DECLARE_WRITE_LINE_MEMBER( intin2 );
28   DECLARE_WRITE_LINE_MEMBER( intin3 );
29   DECLARE_WRITE_LINE_MEMBER( intin4 );
30   DECLARE_WRITE_LINE_MEMBER( intin5 );
31   DECLARE_WRITE_LINE_MEMBER( intin6 );
32   DECLARE_WRITE_LINE_MEMBER( intin7 );
33   DECLARE_WRITE_LINE_MEMBER( intin8 );
34   DECLARE_WRITE_LINE_MEMBER( intin9 );
35   DECLARE_WRITE_LINE_MEMBER( intin10 );
36
3737   void set( UINT32 bitmask );
3838
3939protected:
trunk/src/emu/cpu/psx/dma.c
r18705r18706
2626
2727const device_type PSX_DMA = &device_creator<psxdma_device>;
2828
29psxdma_device::psxdma_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
30   : device_t(mconfig, PSX_DMA, "PSX DMA", tag, owner, clock)
29psxdma_device::psxdma_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
30   device_t(mconfig, PSX_DMA, "PSX DMA", tag, owner, clock),
31   m_irq_handler(*this)
3132{
3233}
3334
r18705r18706
5657
5758void psxdma_device::device_start()
5859{
60   m_irq_handler.resolve_safe();
61
5962   for( int index = 0; index < 7; index++ )
6063   {
6164      psx_dma_channel *dma = &channel[ index ];
r18705r18706
116119   {
117120      verboselog( machine(), 2, "dma_interrupt_update( %02x, %02x ) interrupt triggered\n", n_int, n_mask );
118121      n_dicr |= 0x80000000;
119      psx_irq_set( machine(), PSX_IRQ_DMA );
122      m_irq_handler(1);
120123   }
121124   else if( n_int != 0 )
122125   {
trunk/src/emu/cpu/psx/rcnt.c
r18705r18706
2525
2626const device_type PSX_RCNT = &device_creator<psxrcnt_device>;
2727
28psxrcnt_device::psxrcnt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
29   : device_t(mconfig, PSX_RCNT, "PSX RCNT", tag, owner, clock)
28psxrcnt_device::psxrcnt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
29   device_t(mconfig, PSX_RCNT, "PSX RCNT", tag, owner, clock),
30   m_irq0_handler(*this),
31   m_irq1_handler(*this),
32   m_irq2_handler(*this)
3033{
3134}
3235
r18705r18706
4750{
4851   int n;
4952
53   m_irq0_handler.resolve_safe();
54   m_irq1_handler.resolve_safe();
55   m_irq2_handler.resolve_safe();
56
5057   for( n = 0; n < 3; n++ )
5158   {
5259      root_counter[ n ].timer = machine().scheduler().timer_alloc( timer_expired_delegate( FUNC( psxrcnt_device::root_finished ), this ) );
r18705r18706
232239   if( ( root->n_mode & PSX_RC_IRQOVERFLOW ) != 0 ||
233240      ( root->n_mode & PSX_RC_IRQTARGET ) != 0 )
234241   {
235      psx_irq_set( machine(), PSX_IRQ_ROOTCOUNTER0 << n_counter );
242      switch( n_counter )
243      {
244      case 0:
245         m_irq0_handler(1);
246         break;
247      case 1:
248         m_irq1_handler(1);
249         break;
250      case 2:
251         m_irq2_handler(1);
252         break;
253      }
236254   }
237255}
trunk/src/emu/cpu/psx/dma.h
r18705r18706
1414
1515extern const device_type PSX_DMA;
1616
17#define MCFG_PSX_DMA_IRQ_HANDLER(_devcb) \
18   devcb = &psxdma_device::set_irq_handler(*device, DEVCB2_##_devcb);
19
1720typedef delegate<void (UINT32, INT32)> psx_dma_read_delegate;
1821typedef delegate<void (UINT32, INT32)> psx_dma_write_delegate;
1922
r18705r18706
3437public:
3538   psxdma_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3639
40   // static configuration helpers
41   template<class _Object> static devcb2_base &set_irq_handler(device_t &device, _Object object) { return downcast<psxdma_device &>(device).m_irq_handler.set_callback(object); }
42
3743   void install_read_handler( int n_channel, psx_dma_read_delegate p_fn_dma_read );
3844   void install_write_handler( int n_channel, psx_dma_read_delegate p_fn_dma_write );
3945
r18705r18706
5864   psx_dma_channel channel[7];
5965   UINT32 n_dpcp;
6066   UINT32 n_dicr;
67
68   devcb2_write_line m_irq_handler;
6169};
6270
6371#endif
trunk/src/emu/cpu/psx/psx.c
r18705r18706
31963196static MACHINE_CONFIG_FRAGMENT( psx )
31973197   MCFG_DEVICE_ADD("irq", PSX_IRQ, 0)
31983198   MCFG_DEVICE_ADD("dma", PSX_DMA, 0)
3199   MCFG_PSX_DMA_IRQ_HANDLER(DEVWRITELINE("irq", psxirq_device, intin3))
31993200
32003201   MCFG_DEVICE_ADD("mdec", PSX_MDEC, 0)
32013202   MCFG_PSX_DMA_CHANNEL_WRITE( DEVICE_SELF, 0, psx_dma_write_delegate( FUNC( psxmdec_device::dma_write ), (psxmdec_device *) device ) )
32023203   MCFG_PSX_DMA_CHANNEL_READ( DEVICE_SELF, 1, psx_dma_read_delegate( FUNC( psxmdec_device::dma_read ), (psxmdec_device *) device ) )
32033204
32043205   MCFG_DEVICE_ADD("rcnt", PSX_RCNT, 0)
3206   MCFG_PSX_RCNT_IRQ0_HANDLER(DEVWRITELINE("irq", psxirq_device, intin4))
3207   MCFG_PSX_RCNT_IRQ1_HANDLER(DEVWRITELINE("irq", psxirq_device, intin5))
3208   MCFG_PSX_RCNT_IRQ2_HANDLER(DEVWRITELINE("irq", psxirq_device, intin6))
3209
32053210   MCFG_DEVICE_ADD("sio", PSX_SIO, 0)
3211   MCFG_PSX_SIO_IRQ0_HANDLER(DEVWRITELINE("irq", psxirq_device, intin7))
3212   MCFG_PSX_SIO_IRQ1_HANDLER(DEVWRITELINE("irq", psxirq_device, intin8))
32063213MACHINE_CONFIG_END
32073214
32083215//-------------------------------------------------
trunk/src/emu/cpu/psx/rcnt.h
r18705r18706
1414
1515extern const device_type PSX_RCNT;
1616
17#define MCFG_PSX_RCNT_IRQ0_HANDLER(_devcb) \
18   devcb = &psxrcnt_device::set_irq0_handler(*device, DEVCB2_##_devcb); \
19
20#define MCFG_PSX_RCNT_IRQ1_HANDLER(_devcb) \
21   devcb = &psxrcnt_device::set_irq1_handler(*device, DEVCB2_##_devcb); \
22
23#define MCFG_PSX_RCNT_IRQ2_HANDLER(_devcb) \
24   devcb = &psxrcnt_device::set_irq2_handler(*device, DEVCB2_##_devcb); \
25
1726#define PSX_RC_STOP ( 0x01 )
1827#define PSX_RC_RESET ( 0x04 ) /* guess */
1928#define PSX_RC_COUNTTARGET ( 0x08 )
r18705r18706
3746public:
3847   psxrcnt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3948
49   // static configuration helpers
50   template<class _Object> static devcb2_base &set_irq0_handler(device_t &device, _Object object) { return downcast<psxrcnt_device &>(device).m_irq0_handler.set_callback(object); }
51   template<class _Object> static devcb2_base &set_irq1_handler(device_t &device, _Object object) { return downcast<psxrcnt_device &>(device).m_irq1_handler.set_callback(object); }
52   template<class _Object> static devcb2_base &set_irq2_handler(device_t &device, _Object object) { return downcast<psxrcnt_device &>(device).m_irq2_handler.set_callback(object); }
53
4054   DECLARE_WRITE32_MEMBER( write );
4155   DECLARE_READ32_MEMBER( read );
4256
r18705r18706
5468   int root_target( int n_counter );
5569   void root_timer_adjust( int n_counter );
5670   TIMER_CALLBACK_MEMBER(root_finished);
71
72   devcb2_write_line m_irq0_handler;
73   devcb2_write_line m_irq1_handler;
74   devcb2_write_line m_irq2_handler;
5775};
5876
5977#endif
trunk/src/emu/machine/am53cf96.c
r18705r18706
5050{
5151   scsi_regs[REG_IRQSTATE] = 8;   // indicate success
5252   scsi_regs[REG_STATUS] |= 0x80;   // indicate IRQ
53   irq_callback(machine());
53   m_irq_handler(1);
5454}
5555
5656WRITE8_MEMBER( am53cf96_device::write )
r18705r18706
157157   }
158158}
159159
160am53cf96_device::am53cf96_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
161    : device_t(mconfig, AM53CF96, "53CF96 SCSI", tag, owner, clock)
160am53cf96_device::am53cf96_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
161   device_t(mconfig, AM53CF96, "53CF96 SCSI", tag, owner, clock),
162   m_irq_handler(*this)
162163{
163164}
164165
165void am53cf96_device::device_config_complete()
166{
167   // inherit a copy of the static data
168   const AM53CF96interface *intf = reinterpret_cast<const AM53CF96interface *>(static_config());
169   if (intf != NULL)
170   {
171      *static_cast<AM53CF96interface *>(this) = *intf;
172   }
173}
174
175166void am53cf96_device::device_start()
176167{
168   m_irq_handler.resolve_safe();
169
177170   memset(scsi_regs, 0, sizeof(scsi_regs));
178171   memset(devices, 0, sizeof(devices));
179172
trunk/src/emu/machine/am53cf96.h
r18705r18706
88
99#include "machine/scsihle.h"
1010
11struct AM53CF96interface
12{
13   void (*irq_callback)(running_machine &machine);   /* irq callback */
14};
11#define MCFG_AM53CF96_ADD( _tag ) \
12   MCFG_DEVICE_ADD( _tag, AM53CF96, 0 )
1513
16#define MCFG_AM53CF96_ADD( _tag, _config ) \
17   MCFG_DEVICE_ADD( _tag, AM53CF96, 0 ) \
18   MCFG_DEVICE_CONFIG(_config)
14#define MCFG_AM53CF96_IRQ_HANDLER(_devcb) \
15   devcb = &am53cf96_device::set_irq_handler(*device, DEVCB2_##_devcb); \
1916
2017// 53CF96 register set
2118enum
r18705r18706
3936   REG_DATAALIGN      // data alignment (write only)
4037};
4138
42class am53cf96_device : public device_t,
43                  public AM53CF96interface
39class am53cf96_device : public device_t
4440{
4541public:
4642   // construction/destruction
4743   am53cf96_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
4844
45   // static configuration helpers
46   template<class _Object> static devcb2_base &set_irq_handler(device_t &device, _Object object) { return downcast<am53cf96_device &>(device).m_irq_handler.set_callback(object); }
47
4948   DECLARE_READ8_MEMBER(read);
5049   DECLARE_WRITE8_MEMBER(write);
5150
r18705r18706
5453
5554protected:
5655   // device-level overrides
57   virtual void device_config_complete();
5856   virtual void device_start();
5957   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
6058
r18705r18706
7068   UINT8 last_id;
7169
7270   emu_timer* m_transfer_timer;
71   devcb2_write_line m_irq_handler;
7372};
7473
7574// device type definition
trunk/src/emu/video/psx.h
r18705r18706
1212
1313#include "emu.h"
1414
15#define MCFG_PSX_GPU_VBLANK_HANDLER(_devcb) \
16   devcb = &psxgpu_device::set_vblank_handler(*device, DEVCB2_##_devcb);
17
1518#define MCFG_PSXGPU_ADD( cputag, tag, type, _vramSize, clock ) \
1619   MCFG_DEVICE_MODIFY( cputag ) \
1720   MCFG_PSX_GPU_READ_HANDLER(DEVREAD32(tag, psxgpu_device, read)) \
1821   MCFG_PSX_GPU_WRITE_HANDLER(DEVWRITE32(tag, psxgpu_device, write)) \
1922   MCFG_DEVICE_ADD( tag, type, clock ) \
2023   ((psxgpu_device *) device)->vramSize = _vramSize; \
24   MCFG_PSX_GPU_VBLANK_HANDLER(DEVWRITELINE(cputag ":irq", psxirq_device, intin0)) \
2125   MCFG_PSX_DMA_CHANNEL_READ( cputag, 2, psx_dma_write_delegate( FUNC( psxgpu_device::dma_read ), (psxgpu_device *) device ) ) \
2226   MCFG_PSX_DMA_CHANNEL_WRITE( cputag, 2, psx_dma_read_delegate( FUNC( psxgpu_device::dma_write ), (psxgpu_device *) device ) )
2327
r18705r18706
2731   MCFG_PSX_GPU_WRITE_HANDLER(DEVWRITE32(tag, psxgpu_device, write)) \
2832   MCFG_DEVICE_REPLACE( tag, type, clock ) \
2933   ((psxgpu_device *) device)->vramSize = _vramSize; \
34   MCFG_PSX_GPU_VBLANK_HANDLER(DEVWRITELINE(cputag ":irq", psxirq_device, intin0)) \
3035   MCFG_PSX_DMA_CHANNEL_READ( cputag, 2, psx_dma_write_delegate( FUNC( psxgpu_device::dma_read ), (psxgpu_device *) device ) ) \
3136   MCFG_PSX_DMA_CHANNEL_WRITE( cputag, 2, psx_dma_read_delegate( FUNC( psxgpu_device::dma_write ), (psxgpu_device *) device ) )
3237
r18705r18706
186191   psxgpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
187192   virtual machine_config_constructor device_mconfig_additions() const;
188193
194   // static configuration helpers
195   template<class _Object> static devcb2_base &set_vblank_handler(device_t &device, _Object object) { return downcast<psxgpu_device &>(device).m_vblank_handler.set_callback(object); }
196
189197   UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
190198   DECLARE_WRITE32_MEMBER( write );
191199   DECLARE_READ32_MEMBER( read );
r18705r18706
300308   UINT16 p_n_b0[ 0x10000 ];
301309   UINT16 p_n_r1[ 0x10000 ];
302310   UINT16 p_n_b1g1[ 0x10000 ];
311
312   devcb2_write_line m_vblank_handler;
303313};
304314
305315class cxd8514q_device : public psxgpu_device
trunk/src/emu/video/psx.c
r18705r18706
1919const device_type CXD8561CQ = &device_creator<cxd8561cq_device>;
2020const device_type CXD8654Q = &device_creator<cxd8654q_device>;
2121
22psxgpu_device::psxgpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
23    : device_t(mconfig, type, name, tag, owner, clock)
22psxgpu_device::psxgpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
23   device_t(mconfig, type, name, tag, owner, clock),
24   m_vblank_handler(*this)
2425{
2526}
2627
2728void psxgpu_device::device_start( void )
2829{
30   m_vblank_handler.resolve_safe();
31
2932   if( m_type == CXD8538Q )
3033   {
3134      psx_gpu_init( 1 );
r18705r18706
36613664#endif
36623665
36633666      n_gpustatus ^= ( 1L << 31 );
3664      psx_irq_set( machine(), 0x0001 );
3667      m_vblank_handler(1);
36653668   }
36663669}
36673670
trunk/src/emu/sound/spu.c
r18705r18706
954954//  spu_device - constructor
955955//-------------------------------------------------
956956
957spu_device::spu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
958   : device_t(mconfig, SPU, "SPU", tag, owner, clock),
959     device_sound_interface(mconfig, *this),
960     m_irq_cb(NULL),
961      dirty_flags(-1),
957spu_device::spu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
958   device_t(mconfig, SPU, "SPU", tag, owner, clock),
959   device_sound_interface(mconfig, *this),
960   m_irq_handler(*this),
961   dirty_flags(-1),
962962   status_enabled(false),
963963   xa_voll(0x8000),
964964   xa_volr(0x8000),
965     changed_xa_vol(0)
966
965   changed_xa_vol(0)
967966{
968967}
969968
r18705r18706
972971//  the IRQ callback
973972//-------------------------------------------------
974973
975void spu_device::static_set_irqf(device_t &device, void (*irqf)(device_t *device, UINT32 state))
976{
977   spu_device &spu = downcast<spu_device &>(device);
978   spu.m_irq_cb = irqf;
979}
980
981974void spu_device::device_start()
982975{
976   m_irq_handler.resolve_safe();
977
983978   voice=new voiceinfo [24];
984979   spu_ram=new unsigned char [spu_ram_size];
985980
r18705r18706
18581853      if (hitirq)
18591854      {
18601855         // Went past IRQ address, trigger IRQ
1861         m_irq_cb(this, 1);
1856         m_irq_handler(1);
18621857
18631858         vi->samplestoirq=spu_infinity;
18641859         vi->hitirq=true;
r18705r18706
26562651         {
26572652            if (voice[i].samplestoirq==0)
26582653            {
2659               m_irq_cb(this, 1);
2654               m_irq_handler(1);
26602655
26612656               voice[i].samplestoirq=spu_infinity;
26622657               voice[i].hitirq=true;
trunk/src/emu/sound/spu.h
r18705r18706
99//  INTERFACE CONFIGURATION MACROS
1010//**************************************************************************
1111
12#define MCFG_SPU_ADD(_tag, _clock, _irqf) \
12#define MCFG_SPU_IRQ_HANDLER(_devcb) \
13   devcb = &spu_device::set_irq_handler(*device, DEVCB2_##_devcb);
14
15#define MCFG_SPU_ADD(_tag, _clock) \
1316   MCFG_DEVICE_ADD(_tag, SPU, _clock) \
17   MCFG_SPU_IRQ_HANDLER(DEVWRITELINE("maincpu:irq", psxirq_device, intin9)) \
1418   MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 4, psx_dma_read_delegate( FUNC( spu_device::dma_read ), (spu_device *) device ) ) \
15   MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 4, psx_dma_write_delegate( FUNC( spu_device::dma_write ), (spu_device *) device ) ) \
16   MCFG_IRQ_FUNC(_irqf)
19   MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 4, psx_dma_write_delegate( FUNC( spu_device::dma_write ), (spu_device *) device ) )
1720
18#define MCFG_IRQ_FUNC(_irqf) \
19   spu_device::static_set_irqf(*device, _irqf); \
20
2121// ======================> spu_device
2222
2323const unsigned int spu_base_frequency_hz=44100;
r18705r18706
4949   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
5050
5151   // internal state
52   void (*m_irq_cb)(device_t *device, UINT32 state);
52   devcb2_write_line m_irq_handler;
5353
5454   unsigned char *spu_ram;
5555   reverb *rev;
r18705r18706
217217public:
218218   spu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
219219
220   // inline configuration helpers
221   static void static_set_irqf(device_t &device, void (*irqf)(device_t *device, UINT32 state));
220   // static configuration helpers
221   template<class _Object> static devcb2_base &set_irq_handler(device_t &device, _Object object) { return downcast<spu_device &>(device).m_irq_handler.set_callback(object); }
222222
223223   void dma_read( UINT32 n_address, INT32 n_size );
224224   void dma_write( UINT32 n_address, INT32 n_size );
trunk/src/mess/machine/psxcd.c
r18705r18706
106106   psxcd.m_devname = devname;
107107}
108108
109psxcd_device::psxcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
110   : device_t(mconfig, PSXCD, "PSXCD", tag, owner, clock)
109psxcd_device::psxcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
110   device_t(mconfig, PSXCD, "PSXCD", tag, owner, clock),
111   m_irq_handler(*this)
111112{
112113}
113114
114115void psxcd_device::device_start()
115116{
117   m_irq_handler.resolve_safe();
118
116119   unsigned int sysclk=machine().device<cpu_device>("maincpu")->clock()/2;
117120   start_read_delay=(sysclk/60);
118121   read_sector_cycles=(sysclk/75);
r18705r18706
891894
892895   if (doint)
893896   {
894      psx_irq_set(machine(), 0x0004);
897      m_irq_handler(1);
895898   }
896899
897900   add_result(res);
trunk/src/mess/machine/psxcd.h
r18705r18706
2525//**************************************************************************
2626
2727#define MCFG_PSXCD_ADD(_devname) \
28    MCFG_DEVICE_ADD(PSXCD_TAG, PSXCD, 0) \
28   MCFG_DEVICE_ADD(PSXCD_TAG, PSXCD, 0) \
2929   MCFG_PSXCD_DEVNAME(_devname)
3030
31#define MCFG_PSXCD_IRQ_HANDLER(_devcb) \
32   devcb = &psxcd_device::set_irq_handler(*device, DEVCB2_##_devcb);
33
3134#define MCFG_PSXCD_DEVNAME(_name) \
3235   psxcd_device::static_set_devname(*device, _name); \
3336
r18705r18706
4144public:
4245
4346    psxcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
44   // inline configuration helpers
47
48   // static configuration helpers
49   template<class _Object> static devcb2_base &set_irq_handler(device_t &device, _Object object) { return downcast<psxcd_device &>(device).m_irq_handler.set_callback(object); }
4550   static void static_set_devname(device_t &device, const char *devname);
4651private:
4752   struct command_result
r18705r18706
164169   bool m_timerinuse[MAX_PSXCD_TIMERS];
165170
166171   void add_system_event(event *ev);
172
173   devcb2_write_line m_irq_handler;
167174};
168175
169176
trunk/src/mess/drivers/psx.c
r18705r18706
754754   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_PLAYER(2) PORT_NAME("P2 L2")
755755INPUT_PORTS_END
756756
757static void spu_irq(device_t *device, UINT32 data)
758{
759   if (data)
760   {
761      psx_irq_set(device->machine(), 1<<9);
762   }
763}
764
765757struct cdrom_interface psx_cdrom =
766758{
767759   "psx_cdrom",
r18705r18706
780772
781773   /* sound hardware */
782774   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
783   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2, &spu_irq )
775   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 )
784776   MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 )
785777   MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 )
786778
r18705r18706
791783   MCFG_SOFTWARE_LIST_ADD("cd_list","psx")
792784
793785   MCFG_PSXCD_ADD("cdrom")
786   MCFG_PSXCD_IRQ_HANDLER(DEVWRITELINE("^maincpu:irq", psxirq_device, intin2))
794787   MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 3, psx_dma_read_delegate( FUNC( cd_dma_read ), (psxcd_device *) device ) )
795788   MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 3, psx_dma_write_delegate( FUNC( cd_dma_write ), (psxcd_device *) device ) )
796789
r18705r18706
811804
812805   /* sound hardware */
813806   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
814   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2, &spu_irq )
807   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 )
815808   MCFG_SOUND_ROUTE( 0, "lspeaker", 1.00 )
816809   MCFG_SOUND_ROUTE( 1, "rspeaker", 1.00 )
817810
r18705r18706
822815   MCFG_SOFTWARE_LIST_ADD("cd_list","psx")
823816
824817   MCFG_PSXCD_ADD("cdrom")
818   MCFG_PSXCD_IRQ_HANDLER(DEVWRITELINE("^maincpu:irq", psxirq_device, intin2))
825819   MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 3, psx_dma_read_delegate( FUNC( cd_dma_read ), (psxcd_device *) device ) )
826820   MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 3, psx_dma_write_delegate( FUNC( cd_dma_write ), (psxcd_device *) device ) )
827821
trunk/src/mame/machine/psx.c
r18705r18706
4949   return p_psx->n_com_delay;
5050}
5151
52/* IRQ */
53
54void psx_irq_set( running_machine &machine, UINT32 data )
55{
56   psxcpu_device::irq_set( *machine.device("maincpu^"), "maincpu", data );
57}
58
5952/* SIO */
6053
6154void psx_sio_install_handler( running_machine &machine, int n_port, psx_sio_handler p_f_sio_handler )
trunk/src/mame/drivers/ksys573.c
r18705r18706
479479class ksys573_state : public psx_state
480480{
481481public:
482   ksys573_state(const machine_config &mconfig, device_type type, const char *tag)
483      : psx_state(mconfig, type, tag),
484        m_cr589(*this, ":cdrom") { }
482   ksys573_state(const machine_config &mconfig, device_type type, const char *tag) :
483      psx_state(mconfig, type, tag),
484      m_psxirq(*this, ":maincpu:irq"),
485      m_cr589(*this, ":cdrom")
486   {
487   }
485488
489   required_device<psxirq_device> m_psxirq;
490
486491   int m_flash_bank;
487492   fujitsu_29f016a_device *m_flash_device[5][16];
488493   int m_security_cart_number;
r18705r18706
758763      atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO | ATAPI_INTREASON_COMMAND;
759764   }
760765
761   psx_irq_set(machine(), 0x400);
766   m_psxirq->intin10(1);
762767
763768   verboselog( machine(), 2, "atapi_xfer_end: %d %d\n", m_atapi_xferlen, m_atapi_xfermod );
764769}
r18705r18706
809814         atapi_regs[ATAPI_REG_COUNTLOW] = m_atapi_xferlen & 0xff;
810815         atapi_regs[ATAPI_REG_COUNTHIGH] = (m_atapi_xferlen>>8)&0xff;
811816
812         psx_irq_set(machine(), 0x400);
817         m_psxirq->intin10(1);
813818      }
814819
815820      if( m_atapi_data_ptr < m_atapi_data_len )
r18705r18706
826831            {
827832               atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
828833               atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO;
829               psx_irq_set(machine(), 0x400);
834               m_psxirq->intin10(1);
830835            }
831836         }
832837      }
r18705r18706
910915            m_cr589->WriteData( atapi_data, m_atapi_cdata_wait );
911916
912917            // assert IRQ
913            psx_irq_set(machine(), 0x400);
918            m_psxirq->intin10(1);
914919
915920            // not sure here, but clear DRQ at least?
916921            atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
r18705r18706
983988            }
984989
985990            // assert IRQ
986            psx_irq_set(machine(), 0x400);
991            m_psxirq->intin10(1);
987992         }
988993         else
989994         {
r18705r18706
11001105               atapi_regs[ATAPI_REG_COUNTLOW] = 0;
11011106               atapi_regs[ATAPI_REG_COUNTHIGH] = 2;
11021107
1103               psx_irq_set(machine(), 0x400);
1108               m_psxirq->intin10(1);
11041109               break;
11051110
11061111            case 0xef:   // SET FEATURES
r18705r18706
11091114               m_atapi_data_ptr = 0;
11101115               m_atapi_data_len = 0;
11111116
1112               psx_irq_set(machine(), 0x400);
1117               m_psxirq->intin10(1);
11131118               break;
11141119
11151120            default:
r18705r18706
14081413   update_mode(machine());
14091414}
14101415
1411static void spu_irq(device_t *device, UINT32 data)
1412{
1413   if (data)
1414   {
1415      psx_irq_set(device->machine(), 1<<9);
1416   }
1417}
1418
14191416void sys573_vblank(ksys573_state *state, screen_device &screen, bool vblank_state)
14201417{
14211418   UINT32 *p_n_psxram = state->m_p_n_psxram;
r18705r18706
30613058   /* sound hardware */
30623059   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
30633060
3064   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2, &spu_irq )
3061   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 )
30653062   MCFG_SOUND_ROUTE( 0, "lspeaker", 1.0 )
30663063   MCFG_SOUND_ROUTE( 1, "rspeaker", 1.0 )
30673064
trunk/src/mame/drivers/taitogn.c
r18705r18706
930930ADDRESS_MAP_END
931931
932932
933static void spu_irq(device_t *device, UINT32 data)
934{
935   if (data)
936   {
937      psx_irq_set(device->machine(), 1<<9);
938   }
939}
940
941933static const ide_config ide_intf =
942934{
943935   NULL,
r18705r18706
956948   /* sound hardware */
957949   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
958950
959   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2, &spu_irq )
951   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 )
960952   MCFG_SOUND_ROUTE(0, "lspeaker", 0.35)
961953   MCFG_SOUND_ROUTE(1, "rspeaker", 0.35)
962954
trunk/src/mame/drivers/konamigv.c
r18705r18706
292292   }
293293}
294294
295static void scsi_irq(running_machine &machine)
296{
297   psx_irq_set(machine, 0x400);
298}
299
300static const struct AM53CF96interface am53cf96_intf =
301{
302   &scsi_irq,      /* command completion IRQ */
303};
304
305295DRIVER_INIT_MEMBER(konamigv_state,konamigv)
306296{
307297   psx_driver_init(machine());
r18705r18706
309299
310300MACHINE_START_MEMBER(konamigv_state,konamigv)
311301{
312
313302   save_item(NAME(m_sector_buffer));
314303   save_item(NAME(m_flash_address));
315304   save_item(NAME(m_trackball_prev));
r18705r18706
318307   save_item(NAME(m_btc_trackball_data));
319308}
320309
321static void spu_irq(device_t *device, UINT32 data)
322{
323   if (data)
324   {
325      psx_irq_set(device->machine(), 1<<9);
326   }
327}
328
329310static MACHINE_CONFIG_START( konamigv, konamigv_state )
330311   /* basic machine hardware */
331312   MCFG_CPU_ADD( "maincpu", CXD8530BQ, XTAL_67_7376MHz )
r18705r18706
340321
341322   MCFG_SCSIBUS_ADD("scsi")
342323   MCFG_SCSIDEV_ADD("scsi:cdrom", SCSICD, SCSI_ID_4)
343   MCFG_AM53CF96_ADD("scsi:am53cf96", am53cf96_intf)
324   MCFG_AM53CF96_ADD("scsi:am53cf96")
325   MCFG_AM53CF96_IRQ_HANDLER(DEVWRITELINE("^maincpu:irq", psxirq_device, intin10))
344326
345327   /* video hardware */
346328   MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8514Q, 0x100000, XTAL_53_693175MHz )
r18705r18706
348330   /* sound hardware */
349331   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
350332
351   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2, &spu_irq )
333   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 )
352334   MCFG_SOUND_ROUTE( 0, "lspeaker", 0.75 )
353335   MCFG_SOUND_ROUTE( 1, "rspeaker", 0.75 )
354336
trunk/src/mame/drivers/konamigq.c
r18705r18706
303303{
304304}
305305
306static void scsi_irq(running_machine &machine)
307{
308   psx_irq_set(machine, 0x400);
309}
310
311static const struct AM53CF96interface am53cf96_intf =
312{
313   &scsi_irq,      /* command completion IRQ */
314};
315
316306DRIVER_INIT_MEMBER(konamigq_state,konamigq)
317307{
318
319308   psx_driver_init(machine());
320309
321310   m_p_n_pcmram = memregion( "shared" )->base() + 0x80000;
r18705r18706
323312
324313MACHINE_START_MEMBER(konamigq_state,konamigq)
325314{
326
327315   save_pointer(NAME(m_p_n_pcmram), 0x380000);
328316   save_item(NAME(m_sndto000));
329317   save_item(NAME(m_sndtor3k));
r18705r18706
353341
354342   MCFG_SCSIBUS_ADD("scsi")
355343   MCFG_SCSIDEV_ADD("scsi:disk", SCSIHD, SCSI_ID_0)
356   MCFG_AM53CF96_ADD("scsi:am53cf96", am53cf96_intf)
344   MCFG_AM53CF96_ADD("scsi:am53cf96")
345   MCFG_AM53CF96_IRQ_HANDLER(DEVWRITELINE("^maincpu:irq", psxirq_device, intin10))
357346
358347   /* video hardware */
359348   MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8538Q, 0x200000, XTAL_53_693175MHz )
trunk/src/mame/drivers/twinkle.c
r18705r18706
849849   }
850850}
851851
852static void scsi_irq(running_machine &machine)
853{
854   psx_irq_set(machine, 0x400);
855}
856
857static const struct AM53CF96interface am53cf96_intf =
858{
859   &scsi_irq,      /* command completion IRQ */
860};
861
862852DRIVER_INIT_MEMBER(twinkle_state,twinkle)
863853{
864854   psx_driver_init(machine());
r18705r18706
870860   i2cmem_wc_write( i2cmem, 0 );
871861}
872862
873static void spu_irq(device_t *device, UINT32 data)
874{
875   if (data)
876   {
877      psx_irq_set(device->machine(), 1<<9);
878   }
879}
880
881863static const i2cmem_interface i2cmem_interface =
882864{
883865   I2CMEM_SLAVE_ADDRESS, 0, 0x100
r18705r18706
912894
913895   MCFG_SCSIBUS_ADD("scsi")
914896   MCFG_SCSIDEV_ADD("scsi:cdrom", SCSICD, SCSI_ID_4)
915   MCFG_AM53CF96_ADD("scsi:am53cf96", am53cf96_intf)
897   MCFG_AM53CF96_ADD("scsi:am53cf96")
898   MCFG_AM53CF96_IRQ_HANDLER(DEVWRITELINE("^maincpu:irq", psxirq_device, intin10))
916899
917900   MCFG_IDE_CONTROLLER_ADD("ide", ide_intf, ide_devices, "hdd", NULL, true)
918901   MCFG_RTC65271_ADD("rtc", twinkle_rtc)
r18705r18706
923906   /* sound hardware */
924907   MCFG_SPEAKER_STANDARD_STEREO("speakerleft", "speakerright")
925908
926   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2, &spu_irq )
909   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 )
927910   MCFG_SOUND_ROUTE( 0, "speakerleft", 0.75 )
928911   MCFG_SOUND_ROUTE( 1, "speakerright", 0.75 )
929912
trunk/src/mame/drivers/zn.c
r18705r18706
538538   state->m_dip_timer = machine.scheduler().timer_alloc( timer_expired_delegate(FUNC(zn_state::dip_timer_fired),state), NULL );
539539}
540540
541static void psx_spu_irq(device_t *device, UINT32 data)
542{
543   if (data)
544   {
545      psx_irq_set(device->machine(), 1<<9);
546   }
547}
548
549541static void zn_machine_init( running_machine &machine )
550542{
551543   zn_state *state = machine.driver_data<zn_state>();
r18705r18706
565557   /* sound hardware */
566558   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
567559
568   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2, &psx_spu_irq )
560   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 )
569561   MCFG_SOUND_ROUTE(0, "lspeaker", 0.35)
570562   MCFG_SOUND_ROUTE(1, "rspeaker", 0.35)
571563
r18705r18706
587579   /* sound hardware */
588580   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
589581
590   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2, &psx_spu_irq )
582   MCFG_SPU_ADD( "spu", XTAL_67_7376MHz/2 )
591583   MCFG_SOUND_ROUTE(0, "lspeaker", 0.35)
592584   MCFG_SOUND_ROUTE(1, "rspeaker", 0.35)
593585
r18705r18706
14791471      *2                  - Unpopulated DIP28 socket
14801472*/
14811473
1474/* IRQ */
1475
1476void psx_irq_set( running_machine &machine, UINT32 data )
1477{
1478   psxcpu_device::irq_set( *machine.device("maincpu^"), "maincpu", data );
1479}
1480
14821481static void atpsx_interrupt(device_t *device, int state)
14831482{
14841483   if (state)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team