Previous 15994 Revisions Next

r14340 Saturday 4th February, 2012 at 10:31:17 UTC by Miodrag Milanović
Some speedup on ISA DMA, no more list search, direct hook now (no whatsnew)
[src/mess/machine]3c503.c 3c503.h isa.c isa.h isa_fdc.c isa_fdc.h isa_hdc.c isa_hdc.h isa_sblaster.c isa_sblaster.h isa_wdxt_gen.c isa_wdxt_gen.h

src/mess/machine/isa_fdc.c
r14339r14340
9292{
9393   set_isa_device();
9494   m_isa->install_device(this, 0x03f0, 0x03f7, 0, 0, FUNC(pc_fdc_r), FUNC(pc_fdc_w) );
95   m_isa->set_dma_channel(2, this, TRUE);
9596}
9697
9798//-------------------------------------------------
r14339r14340
429430   pc_fdc_set_tc_state( this, state);
430431}
431432
432bool isa8_fdc_device::have_dack(int line)
433{
434   if (line==2) return TRUE;
435   return FALSE;
436}
src/mess/machine/isa_fdc.h
r14339r14340
3838      virtual UINT8 dack_r(int line);
3939      virtual void dack_w(int line,UINT8 data);
4040      virtual void eop_w(int state);
41      virtual bool have_dack(int line);
4241
4342      int status_register_a;
4443      int status_register_b;
src/mess/machine/isa_wdxt_gen.c
r14339r14340
230230   set_isa_device();
231231   m_isa->install_rom(this, 0xc8000, 0xc9fff, 0, 0, "hdc", "hdc");
232232   m_isa->install_device(0x0320, 0x0323, 0, 0, read8_delegate(FUNC(wd11c00_17_device::io_r), (wd11c00_17_device*)m_host), write8_delegate(FUNC(wd11c00_17_device::io_w), (wd11c00_17_device*)m_host));
233   m_isa->set_dma_channel(3, this, FALSE);
233234}
234235
235236
r14339r14340
263264   m_host->dack_w(data);
264265}
265266
266
267267//-------------------------------------------------
268//  have_dack -
269//-------------------------------------------------
270
271bool wdxt_gen_device::have_dack(int line)
272{
273   return (line == 3) ? TRUE : FALSE;
274}
275
276
277//-------------------------------------------------
278268//  wd1015_t0_r -
279269//-------------------------------------------------
280270
src/mess/machine/isa_wdxt_gen.h
r14339r14340
7070   // device_isa8_card_interface
7171   virtual UINT8 dack_r(int line);
7272   virtual void dack_w(int line, UINT8 data);
73   virtual bool have_dack(int line);
7473
7574private:
7675   required_device<cpu_device> m_maincpu;
src/mess/machine/3c503.c
r14339r14340
3838   set_isa_device();
3939   m_isa->install_device(0x0300, 0x030f, 0, 0, read8_delegate(FUNC(el2_3c503_device::el2_3c503_loport_r), this), write8_delegate(FUNC(el2_3c503_device::el2_3c503_loport_w), this));
4040   m_isa->install_device(0x0700, 0x070f, 0, 0, read8_delegate(FUNC(el2_3c503_device::el2_3c503_hiport_r), this), write8_delegate(FUNC(el2_3c503_device::el2_3c503_hiport_w), this));
41   
42   int chan = 0, idcfr = m_regs.idcfr & 0x0f;
43   if((m_regs.streg | 0x08)) {
44      while(idcfr) {
45         chan++;
46         idcfr >>= 1;
47      }
48      m_isa->set_dma_channel(chan, this, FALSE);
49   }
4150}
4251
4352void el2_3c503_device::device_reset() {
r14339r14340
9099   }
91100}
92101
93bool el2_3c503_device::have_dack(int line) {
94   int chan = 0, idcfr = m_regs.idcfr & 0x0f;
95   if(!(m_regs.streg | 0x08)) return FALSE;
96   while(idcfr) {
97      chan++;
98      idcfr >>= 1;
99   }
100   if(chan && (chan == line)) return TRUE;
101   return FALSE;
102}
103
104102UINT8 el2_3c503_device::dack_r(int line) {
105103   set_drq(CLEAR_LINE);
106104   return el2_3c503_mem_read(m_regs.da++);
src/mess/machine/3c503.h
r14339r14340
2424   void eop_w(int state);
2525   UINT8 dack_r(int line);
2626   void dack_w(int line, UINT8 data);
27   bool have_dack(int line);
2827protected:
2928   virtual void device_start();
3029   virtual void device_reset();
src/mess/machine/isa_hdc.c
r14339r14340
172172   set_isa_device();
173173   m_isa->install_rom(this, 0xc8000, 0xc9fff, 0, 0, "hdc", "hdc");
174174   m_isa->install_device(this, 0x0320, 0x0323, 0, 0, FUNC(pc_HDC_r), FUNC(pc_HDC_w) );
175   m_isa->set_dma_channel(3, this, FALSE);
175176   buffer = auto_alloc_array(machine(), UINT8, 17*4*512);
176177   timer = machine().scheduler().timer_alloc(FUNC(pc_hdc_command), this);
177178}
r14339r14340
824825{
825826   pc_hdc_dack_w(data);
826827}
827bool isa8_hdc_device::have_dack(int line)
828{
829   if (line==3) return TRUE;
830   return FALSE;
831}
src/mess/machine/isa_hdc.h
r14339r14340
7171public:
7272      virtual UINT8 dack_r(int line);
7373      virtual void dack_w(int line,UINT8 data);
74      virtual bool have_dack(int line);
7574protected:
7675      hard_disk_file *pc_hdc_file(int id);
7776      void pc_hdc_result(int set_error_info);
src/mess/machine/isa_sblaster.c
r14339r14340
491491    // 1.0 always has the SAA1099s for CMS back-compatibility
492492   m_isa->install_device(subdevice("saa1099.1"), 0x0220, 0x0221, 0, 0, FUNC(saa1099_16_r), FUNC(saa1099_16_w) );
493493   m_isa->install_device(subdevice("saa1099.2"), 0x0222, 0x0223, 0, 0, FUNC(saa1099_16_r), FUNC(saa1099_16_w) );
494   m_isa->set_dma_channel(1, this, FALSE);
494495   m_dsp.version = 0x0105;
495496    sb8_device::device_start();
496497}
r14339r14340
516517    m_dsp.fifo_r_ptr = 0;
517518}
518519
519bool sb8_device::have_dack(int line)
520{
521   if (line==1) return TRUE;
522   return FALSE;
523}
524
525520UINT8 sb8_device::dack_r(int line)
526521{
527522//    printf("dack_r: line %x out = %02x\n", line, m_dack_out);
src/mess/machine/isa_sblaster.h
r14339r14340
5858        // device-level overrides
5959        virtual void device_start();
6060        virtual void device_reset();
61        virtual bool have_dack(int line);
6261        virtual UINT8 dack_r(int line);
6362        virtual void dack_w(int line, UINT8 data);
6463        virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
src/mess/machine/isa.c
r14339r14340
145145isa8_device::isa8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
146146        device_t(mconfig, ISA8, "ISA8", tag, owner, clock)
147147{
148   for(int i=0;i<8;i++)
149   {
150      m_dma_device[i] = NULL;
151      m_dma_eop[i] = false;
152   }
148153}
149154
150155isa8_device::isa8_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
151156        device_t(mconfig, type, name, tag, owner, clock)
152157{
158   for(int i=0;i<8;i++)
159   {
160      m_dma_device[i] = NULL;
161      m_dma_eop[i] = false;
162   }
153163}
164
165void isa8_device::set_dma_channel(UINT8 channel, device_isa8_card_interface *dev, bool do_eop)
166{
167   m_dma_device[channel] = dev;
168   m_dma_eop[channel] = do_eop;
169}
170
154171//-------------------------------------------------
155172//  device_start - device-specific startup
156173//-------------------------------------------------
r14339r14340
177194{
178195}
179196
180void isa8_device::add_isa_card(device_isa8_card_interface *card)
181{
182   m_device_list.append(*card);
183}
184
185197void isa8_device::install_memory(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_space_func rhandler, const char* rhandler_name, write8_space_func whandler, const char *whandler_name)
186198{
187199   int buswidth = m_maincpu->memory().space_config(AS_PROGRAM)->m_databus_width;
r14339r14340
347359
348360UINT8 isa8_device::dack_r(int line)
349361{
350   UINT8 retVal = 0xff;
351   device_isa8_card_interface *entry = m_device_list.first();
352   while(entry) {
353      if (entry->have_dack(line)) {
354         retVal = entry->dack_r(line);
355         break;
356      }
357      entry = entry->next();
358   }
359   return retVal;
362   if (m_dma_device[line])
363      return m_dma_device[line]->dack_r(line);   
364   return 0xff;
360365}
361366
362367void isa8_device::dack_w(int line,UINT8 data)
363368{
364   device_isa8_card_interface *entry = m_device_list.first();
365   while(entry) {
366      if (entry->have_dack(line)) {
367         entry->dack_w(line,data);
368      }
369      entry = entry->next();
370   }
369   if (m_dma_device[line])
370      return m_dma_device[line]->dack_w(line,data);
371371}
372372
373373void isa8_device::eop_w(int state)
374374{
375   device_isa8_card_interface *entry = m_device_list.first();
376   while(entry) {
377      entry->eop_w(state);
378      entry = entry->next();
375   for (int i=0;i<8;i++) {
376      if (m_dma_eop[i]==TRUE && m_dma_device[i])
377         m_dma_device[i]->eop_w(state);
379378   }
380379}
381380
r14339r14340
420419{
421420}
422421
423bool device_isa8_card_interface::have_dack(int line)
424{
425   return FALSE;
426}
427
428422void device_isa8_card_interface::static_set_isabus_tag(device_t &device, const char *tag)
429423{
430424   device_isa8_card_interface &isa_card = dynamic_cast<device_isa8_card_interface &>(device);
r14339r14340
434428void device_isa8_card_interface::set_isa_device()
435429{
436430   m_isa = dynamic_cast<isa8_device *>(device().machine().device(m_isa_tag));
437   m_isa->add_isa_card(this);
438431}
439432
440433
r14339r14340
590583void device_isa16_card_interface::set_isa_device()
591584{
592585   m_isa = dynamic_cast<isa16_device *>(device().machine().device(m_isa_tag));
593   m_isa->add_isa_card(this);
594586}
src/mess/machine/isa.h
r14339r14340
151151   // inline configuration
152152   static void static_set_cputag(device_t &device, const char *tag);
153153
154   void add_isa_card(device_isa8_card_interface *card);
155154   void install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_device_func rhandler, const char* rhandler_name, write8_device_func whandler, const char *whandler_name);
156155   void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler);
157156   void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_space_func rhandler, const char* rhandler_name, write8_space_func whandler, const char *whandler_name);
r14339r14340
176175   UINT8 dack_r(int line);
177176   void dack_w(int line,UINT8 data);
178177   void eop_w(int state);
179
178   
179   void set_dma_channel(UINT8 channel, device_isa8_card_interface *dev, bool do_eop);
180180protected:
181181   // device-level overrides
182182   virtual void device_start();
r14339r14340
197197   devcb_resolved_write_line   m_out_drq2_func;
198198   devcb_resolved_write_line   m_out_drq3_func;
199199
200   simple_list<device_isa8_card_interface> m_device_list;
200   device_isa8_card_interface *m_dma_device[8];
201   bool                  m_dma_eop[8];
201202   const char *m_cputag;
202203};
203204
r14339r14340
223224   virtual UINT8 dack_r(int line);
224225   virtual void dack_w(int line,UINT8 data);
225226   virtual void eop_w(int state);
226   virtual bool have_dack(int line);
227227
228228    // inline configuration
229229    static void static_set_isabus_tag(device_t &device, const char *tag);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team