Previous 15994 Revisions Next

r7462 Thursday 25th February, 2010 at 15:01:10 UTC by Dirk Best
pit8253: Updated to use devcb calls, cleanups
[src/emu/machine]pit8253.c pit8253.h
[src/mame/drivers]calchase.c gamecstl.c mediagx.c pcat_dyn.c pcat_nit.c pcxt.c photoply.c taitowlf.c
[src/mame/machine]vertigo.c
[src/mess/drivers]apricot.c bw12.c bw2.c fk1.c fmtowns.c ip22.c mikromik.c mikrosha.c pasogo.c pc98.c qx10.c tandy2k.c victor9k.c
[src/mess/machine]amstr_pc.c at.c b2m.c bebox.c compis.c dai.c europc.c irisha.c mz700.c mz80.c pc.c pk8020.c pmd85.c pp01.c special.c tandy1t.c

src/mame/machine/vertigo.c
r7461r7462
2121 *
2222 *************************************/
2323
24static PIT8253_OUTPUT_CHANGED( v_irq4_w );
25static PIT8253_OUTPUT_CHANGED( v_irq3_w );
24static WRITE_LINE_DEVICE_HANDLER( v_irq4_w );
25static WRITE_LINE_DEVICE_HANDLER( v_irq3_w );
2626
2727
2828
r7461r7462
4949   {
5050      {
5151         240000,
52         v_irq4_w
52         DEVCB_NULL,
53         DEVCB_LINE(v_irq4_w)
5354      }, {
5455         240000,
55         v_irq3_w
56         DEVCB_NULL,
57         DEVCB_LINE(v_irq3_w)
5658      }, {
5759         240000,
58         NULL
60         DEVCB_NULL,
61         DEVCB_NULL
5962      }
6063   }
6164};
r7461r7462
8992}
9093
9194
92static PIT8253_OUTPUT_CHANGED( v_irq4_w )
95static WRITE_LINE_DEVICE_HANDLER( v_irq4_w )
9396{
9497   update_irq_encoder(device->machine, INPUT_LINE_IRQ4, state);
9598   vertigo_vproc(cputag_attotime_to_clocks(device->machine, "maincpu", attotime_sub(timer_get_time(device->machine), irq4_time)), state);
r7461r7462
97100}
98101
99102
100static PIT8253_OUTPUT_CHANGED( v_irq3_w )
103static WRITE_LINE_DEVICE_HANDLER( v_irq3_w )
101104{
102105   if (state)
103106      cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_IRQ0, ASSERT_LINE);
src/mame/drivers/mediagx.c
r7461r7462
10141014 *
10151015 *************************************************************/
10161016
1017static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
1018{
1019   pic8259_ir0_w(mediagx_devices.pic8259_1, state);
1020}
1021
1022
10231017static const struct pit8253_config mediagx_pit8254_config =
10241018{
10251019   {
10261020      {
10271021         4772720/4,            /* heartbeat IRQ */
1028         pc_timer0_w
1022         DEVCB_NULL,
1023         DEVCB_DEVICE_LINE("pic8259_master", pic8259_ir0_w)
10291024      }, {
10301025         4772720/4,            /* dram refresh */
1031         NULL
1026         DEVCB_NULL,
1027         DEVCB_NULL
10321028      }, {
10331029         4772720/4,            /* pio port c pin 4, and speaker polling enough */
1034         NULL
1030         DEVCB_NULL,
1031         DEVCB_NULL
10351032      }
10361033   }
10371034};
src/mame/drivers/pcxt.c
r7461r7462
394394Pit8253
395395*********************************/
396396
397static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
398{
399   pic8259_ir0_w(filetto_devices.pic8259_1, state);
400}
401
402397static const struct pit8253_config pc_pit8253_config =
403398{
404399   {
405400      {
406401         4772720/4,            /* heartbeat IRQ */
407         pc_timer0_w
402         DEVCB_NULL,
403         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
408404      }, {
409405         4772720/4,            /* dram refresh */
410         NULL
406         DEVCB_NULL,
407         DEVCB_NULL
411408      }, {
412409         4772720/4,            /* pio port c pin 4, and speaker polling enough */
413         NULL
410         DEVCB_NULL,
411         DEVCB_NULL
414412      }
415413   }
416414};
src/mame/drivers/photoply.c
r7461r7462
251251   return r;
252252}
253253
254static PIT8253_OUTPUT_CHANGED( at_pit8254_out0_changed )
254static WRITE_LINE_DEVICE_HANDLER( at_pit8254_out0_changed )
255255{
256256   if ( photoply_devices.pic8259_1 )
257257   {
r7461r7462
260260}
261261
262262
263static PIT8253_OUTPUT_CHANGED( at_pit8254_out2_changed )
263static WRITE_LINE_DEVICE_HANDLER( at_pit8254_out2_changed )
264264{
265265   //at_speaker_set_input( state ? 1 : 0 );
266266}
r7461r7462
271271   {
272272      {
273273         4772720/4,            /* heartbeat IRQ */
274         at_pit8254_out0_changed
274         DEVCB_NULL,
275         DEVCB_LINE(at_pit8254_out0_changed)
275276      }, {
276277         4772720/4,            /* dram refresh */
277         NULL
278         DEVCB_NULL,
279         DEVCB_NULL
278280      }, {
279281         4772720/4,            /* pio port c pin 4, and speaker polling enough */
280         at_pit8254_out2_changed
282         DEVCB_NULL,
283         DEVCB_LINE(at_pit8254_out2_changed)
281284      }
282285   }
283286};
src/mame/drivers/calchase.c
r7461r7462
595595 *
596596 *************************************************************/
597597
598static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
599{
600   pic8259_ir0_w(calchase_devices.pic8259_1, state);
601}
602
603598static const struct pit8253_config calchase_pit8254_config =
604599{
605600   {
606601      {
607602         4772720/4,            /* heartbeat IRQ */
608         pc_timer0_w
603         DEVCB_NULL,
604         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
609605      }, {
610606         4772720/4,            /* dram refresh */
611         NULL
607         DEVCB_NULL,
608         DEVCB_NULL
612609      }, {
613610         4772720/4,            /* pio port c pin 4, and speaker polling enough */
614         NULL
611         DEVCB_NULL,
612         DEVCB_NULL
615613      }
616614   }
617615};
src/mame/drivers/pcat_dyn.c
r7461r7462
257257   return r;
258258}
259259
260static PIT8253_OUTPUT_CHANGED( at_pit8254_out0_changed )
260static WRITE_LINE_DEVICE_HANDLER( at_pit8254_out0_changed )
261261{
262262   if ( pcat_dyn_devices.pic8259_1 )
263263   {
r7461r7462
266266}
267267
268268
269static PIT8253_OUTPUT_CHANGED( at_pit8254_out2_changed )
269static WRITE_LINE_DEVICE_HANDLER( at_pit8254_out2_changed )
270270{
271271   //at_speaker_set_input( state ? 1 : 0 );
272272}
r7461r7462
277277   {
278278      {
279279         4772720/4,            /* heartbeat IRQ */
280         at_pit8254_out0_changed
280         DEVCB_NULL,
281         DEVCB_LINE(at_pit8254_out0_changed)
281282      }, {
282283         4772720/4,            /* dram refresh */
283         NULL
284         DEVCB_NULL,
285         DEVCB_NULL
284286      }, {
285287         4772720/4,            /* pio port c pin 4, and speaker polling enough */
286         at_pit8254_out2_changed
288         DEVCB_NULL,
289         DEVCB_LINE(at_pit8254_out2_changed)
287290      }
288291   }
289292};
src/mame/drivers/pcat_nit.c
r7461r7462
320320   return r;
321321}
322322
323static PIT8253_OUTPUT_CHANGED( at_pit8254_out0_changed )
323static WRITE_LINE_DEVICE_HANDLER( at_pit8254_out0_changed )
324324{
325325   if ( streetg2_devices.pic8259_1 )
326326   {
r7461r7462
329329}
330330
331331
332static PIT8253_OUTPUT_CHANGED( at_pit8254_out2_changed )
332static WRITE_LINE_DEVICE_HANDLER( at_pit8254_out2_changed )
333333{
334334   //at_speaker_set_input( state ? 1 : 0 );
335335}
r7461r7462
340340   {
341341      {
342342         4772720/4,            /* heartbeat IRQ */
343         at_pit8254_out0_changed
343         DEVCB_NULL,
344         DEVCB_LINE(at_pit8254_out0_changed)
344345      }, {
345346         4772720/4,            /* dram refresh */
346         NULL
347         DEVCB_NULL,
348         DEVCB_NULL
347349      }, {
348350         4772720/4,            /* pio port c pin 4, and speaker polling enough */
349         at_pit8254_out2_changed
351         DEVCB_NULL,
352         DEVCB_LINE(at_pit8254_out2_changed)
350353      }
351354   }
352355};
src/mame/drivers/taitowlf.c
r7461r7462
578578 *
579579 *************************************************************/
580580
581static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
582{
583   pic8259_ir0_w(taitowlf_devices.pic8259_1, state);
584}
585
586581static const struct pit8253_config taitowlf_pit8254_config =
587582{
588583   {
589584      {
590585         4772720/4,            /* heartbeat IRQ */
591         pc_timer0_w
586         DEVCB_NULL,
587         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
592588      }, {
593589         4772720/4,            /* dram refresh */
594         NULL
590         DEVCB_NULL,
591         DEVCB_NULL
595592      }, {
596593         4772720/4,            /* pio port c pin 4, and speaker polling enough */
597         NULL
594         DEVCB_NULL,
595         DEVCB_NULL
598596      }
599597   }
600598};
src/mame/drivers/gamecstl.c
r7461r7462
637637 *
638638 *************************************************************/
639639
640static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
641{
642   pic8259_ir0_w(gamecstl_devices.pic8259_1, state);
643}
644
645640static const struct pit8253_config gamecstl_pit8254_config =
646641{
647642   {
648643      {
649644         4772720/4,            /* heartbeat IRQ */
650         pc_timer0_w
645         DEVCB_NULL,
646         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
651647      }, {
652648         4772720/4,            /* dram refresh */
653         NULL
649         DEVCB_NULL,
650         DEVCB_NULL
654651      }, {
655652         4772720/4,            /* pio port c pin 4, and speaker polling enough */
656         NULL
653         DEVCB_NULL,
654         DEVCB_NULL
657655      }
658656   }
659657};
src/emu/machine/pit8253.c
r7461r7462
5656   double clockin;               /* input clock frequency in Hz */
5757   int clock;                  /* clock signal when clockin is 0 */
5858
59   pit8253_output_changed_func      output_changed;   /* callback function for when output changes */
59   devcb_resolved_read_line   in_gate_func;   /* callback for gate input */
60   devcb_resolved_write_line   out_out_func;   /* callback function for when output changes */
6061
6162   attotime last_updated;         /* time when last updated */
6263
r7461r7462
119120}
120121
121122
123static int pit8253_gate(struct pit8253_timer *timer)
124{
125   if (timer->in_gate_func.read != NULL)
126      return devcb_call_read_line(&timer->in_gate_func);
127   else
128      return timer->gate;
129}
130
131
122132INLINE UINT32 decimal_from_bcd(UINT16 val)
123133{
124134   /* In BCD mode, a nybble loaded with value A-F counts down the same as in
r7461r7462
219229   if (output != timer->output)
220230   {
221231      timer->output =   output;
222      if (timer->output_changed != NULL)
223      {
224         timer->output_changed(device, output);
225      }
232      devcb_call_write_line(&timer->out_out_func, timer->output);
226233   }
227234}
228235
r7461r7462
237244   int   cycles_to_output = 0;
238245
239246   LOG2(("pit8253: simulate2(): simulating %d cycles for %d in mode %d, bcd = %d, phase = %d, gate = %d, output %d, value = 0x%04x\n",
240        (int)elapsed_cycles,timer->index,mode,bcd,timer->phase,timer->gate,timer->output,timer->value));
247        (int)elapsed_cycles,timer->index,mode,bcd,timer->phase,pit8253_gate(timer),timer->output,timer->value));
241248
242249   switch (mode) {
243250   case 0:
r7461r7462
276283            load_counter_value( device, timer );
277284         }
278285
279         if ( timer->gate == 0 )
286         if ( pit8253_gate(timer) == 0 )
280287         {
281288            cycles_to_output = CYCLES_NEVER;
282289         }
r7461r7462
387394        Rising-edge reloads count and initiates counting
388395        Gate high enables counting. */
389396
390      if (timer->gate   == 0 ||   timer->phase ==   0)
397      if (pit8253_gate(timer)   == 0 ||   timer->phase ==   0)
391398      {
392399         /* Gate low or mode control write forces output high */
393400         set_output(device, timer, 1);
r7461r7462
466473        Rising-edge reloads count and initiates counting
467474        Gate high enables counting. */
468475
469      if (timer->gate   == 0 ||   timer->phase ==   0)
476      if (pit8253_gate(timer)   == 0 ||   timer->phase ==   0)
470477      {
471478         /* Gate low or mode control write forces output high */
472479         set_output(device, timer, 1);
r7461r7462
549556        Mode 4 only: Gate level sensitive only. Low disables counting, high enables it.
550557        Mode 5 only: Gate rising-edge sensitive only. Rising edge initiates counting */
551558
552      if (timer->gate   == 0 &&   mode ==   4)
559      if (pit8253_gate(timer)   == 0 &&   mode ==   4)
553560      {
554561         cycles_to_output = CYCLES_NEVER;
555562      }
r7461r7462
611618   }
612619
613620    LOG2(("pit8253: simulate2(): simulating %d cycles for %d in mode %d, bcd = %d, phase = %d, gate = %d, output %d, value = 0x%04x, cycles_to_output = %04x\n",
614          (int)elapsed_cycles,timer->index,mode,bcd,timer->phase,timer->gate,timer->output,timer->value,cycles_to_output));
621          (int)elapsed_cycles,timer->index,mode,bcd,timer->phase,pit8253_gate(timer),timer->output,timer->value,cycles_to_output));
615622}
616623
617624
r7461r7462
974981   }
975982}
976983
977
978WRITE8_DEVICE_HANDLER( pit8253_gate_w )
984static void pit8253_gate_w(running_device *device, int gate, int state)
979985{
980986   pit8253_t   *pit8253 = get_safe_token(device);
981   struct pit8253_timer *timer   = get_timer(pit8253,offset);
982   int   mode;
983   int   gate = (data!=0   ? 1   : 0);
987   struct pit8253_timer *timer   = get_timer(pit8253, gate);
984988
985   LOG2(("pit8253_gate_w(): offset=%d gate=%d\n", offset, data));
989   LOG2(("pit8253_gate_w(): gate=%d state=%d\n", gate, state));
986990
987991   if (timer == NULL)
988992      return;
989993
990   mode = CTRL_MODE(timer->control);
991
992   if (gate !=   timer->gate)
994   if (timer->in_gate_func.read != NULL)
993995   {
994      update(device, timer);
995      timer->gate   = gate;
996      if (gate !=   0 && ( mode == 1 || mode == 2 || mode == 5 ))
996      logerror("pit8253_gate_w: write has no effect because a read handler is already defined!\n");
997   }
998   else
999   {
1000      if (state != timer->gate)
9971001      {
998         timer->phase = 1;
1002         int mode = CTRL_MODE(timer->control);
1003
1004         update(device, timer);
1005         timer->gate   = state;
1006         if (state != 0 && ( mode == 1 || mode == 2 || mode == 5 ))
1007         {
1008            timer->phase = 1;
1009         }
1010         update(device, timer);
9991011      }
1000      update(device, timer);
10011012   }
10021013}
10031014
1015WRITE_LINE_DEVICE_HANDLER( pit8253_gate0_w ) { pit8253_gate_w(device, 0, state); }
1016WRITE_LINE_DEVICE_HANDLER( pit8253_gate1_w ) { pit8253_gate_w(device, 1, state); }
1017WRITE_LINE_DEVICE_HANDLER( pit8253_gate2_w ) { pit8253_gate_w(device, 2, state); }
10041018
10051019
10061020/* ----------------------------------------------------------------------- */
r7461r7462
10321046}
10331047
10341048
1035void pit8253_set_clock_signal(running_device *device, int timerno, int state)
1049static void pit8253_set_clock_signal(running_device *device, int timerno, int state)
10361050{
10371051   pit8253_t   *pit8253 = get_safe_token(device);
10381052   struct pit8253_timer *timer = get_timer(pit8253,timerno);
r7461r7462
10481062   timer->clock = state;
10491063}
10501064
1065WRITE_LINE_DEVICE_HANDLER( pit8253_clk0_w ) { pit8253_set_clock_signal(device, 0, state); }
1066WRITE_LINE_DEVICE_HANDLER( pit8253_clk1_w ) { pit8253_set_clock_signal(device, 1, state); }
1067WRITE_LINE_DEVICE_HANDLER( pit8253_clk2_w ) { pit8253_set_clock_signal(device, 2, state); }
10511068
1069
10521070static void common_start( running_device *device, int device_type ) {
10531071   pit8253_t   *pit8253 = get_safe_token(device);
10541072   int         timerno;
r7461r7462
10591077   /* register for state saving */
10601078   for (timerno = 0; timerno < MAX_TIMER; timerno++)
10611079   {
1062      struct pit8253_timer *timer = get_timer(pit8253,timerno);
1080      struct pit8253_timer *timer = get_timer(pit8253, timerno);
10631081
1082      /* initialize timer */
10641083      timer->clockin = pit8253->config->timer[timerno].clockin;
1065      timer->output_changed = pit8253->config->timer[timerno].output_changed;
1066
10671084      timer->updatetimer = timer_alloc(device->machine, update_timer_cb, (void *)device);
10681085      timer_adjust_oneshot(timer->updatetimer, attotime_never, timerno);
10691086
1087      /* resolve callbacks */
1088      devcb_resolve_read_line(&timer->in_gate_func, &pit8253->config->timer[timerno].in_gate_func, device);
1089      devcb_resolve_write_line(&timer->out_out_func, &pit8253->config->timer[timerno].out_out_func, device);
1090
10701091      /* set up state save values */
10711092      state_save_register_device_item(device, timerno, timer->clockin);
10721093      state_save_register_device_item(device, timerno, timer->control);
r7461r7462
11161137      timer->rmsb = timer->wmsb = 0;
11171138      timer->count = timer->value = timer->latch = 0;
11181139      timer->lowcount = 0;
1119      timer->gate = 1;
1140
1141      if (timer->in_gate_func.read != NULL)
1142         timer->gate = devcb_call_read_line(&timer->in_gate_func);
1143      else
1144         timer->gate = 1;
1145
11201146      timer->output = 2;   /* output is undetermined */
11211147      timer->latched_count = 0;
11221148      timer->latched_status = 0;
src/emu/machine/pit8253.h
r7461r7462
1/*****************************************************************************
2 *
3 *  Programmable Interval Timer 8253/8254
4 *
5 *****************************************************************************/
1/***************************************************************************
62
7#ifndef __PIT8253_H_
8#define __PIT8253_H_
3    Intel 8253/8254
94
10#define PIT8253      DEVICE_GET_INFO_NAME(pit8253)
11#define PIT8254      DEVICE_GET_INFO_NAME(pit8254)
5    Programmable Interval Timer
126
7                            _____   _____
8                    D7   1 |*    \_/     | 24  VCC
9                    D6   2 |             | 23  _WR
10                    D5   3 |             | 22  _RD
11                    D4   4 |             | 21  _CS
12                    D3   5 |             | 20  A1
13                    D2   6 |             | 19  A0
14                    D1   7 |    8259A    | 18  CLK2
15                    D0   8 |             | 17  OUT2
16                  CLK0   9 |             | 16  GATE2
17                  OUT0  10 |             | 15  CLK1
18                 GATE0  11 |             | 14  GATE1
19                   GND  12 |_____________| 13  OUT1
1320
14typedef void (*pit8253_output_changed_func)(running_device *device, int state);
15#define PIT8253_OUTPUT_CHANGED(name)   void name(running_device *device, int state )
21***************************************************************************/
1622
23#ifndef __PIT8253_H__
24#define __PIT8253_H__
1725
26#include "devcb.h"
27
28
29#define PIT8253      DEVICE_GET_INFO_NAME(pit8253)
30#define PIT8254      DEVICE_GET_INFO_NAME(pit8254)
31
1832struct pit8253_config
1933{
2034   struct
2135   {
22      /* Input clock for this timer */
23      double clockin;
24
25      /* If specified, this gets called whenever the output for this timer changes */
26      pit8253_output_changed_func         output_changed;
27
36      double            clockin;      /* timer clock */
37      devcb_read_line      in_gate_func;   /* gate signal */
38      devcb_write_line   out_out_func;   /* out signal */
2839   } timer[3];
2940};
3041
r7461r7462
5061READ8_DEVICE_HANDLER( pit8253_r );
5162WRITE8_DEVICE_HANDLER( pit8253_w );
5263
53WRITE8_DEVICE_HANDLER( pit8253_gate_w );
64WRITE_LINE_DEVICE_HANDLER( pit8253_clk0_w );
65WRITE_LINE_DEVICE_HANDLER( pit8253_clk1_w );
66WRITE_LINE_DEVICE_HANDLER( pit8253_clk2_w );
5467
68WRITE_LINE_DEVICE_HANDLER( pit8253_gate0_w );
69WRITE_LINE_DEVICE_HANDLER( pit8253_gate1_w );
70WRITE_LINE_DEVICE_HANDLER( pit8253_gate2_w );
5571
5672/* In the 8253/8254 the CLKx input lines can be attached to a regular clock
5773   signal. Another option is to use the output from one timer as the input
r7461r7462
6076   The functions below should supply both functionalities. If the signal is
6177   a regular clock signal, use the pit8253_set_clockin function. If the
6278   CLKx input signal is the output of the different source, set the new_clockin
63   to 0 with pit8253_set_clockin and call pit8253_set_clock_signal to change
79   to 0 with pit8253_set_clockin and call pit8253_clkX_w to change
6480   the state of the input CLKx signal.
6581 */
6682int pit8253_get_output(running_device *device, int timer);
6783void pit8253_set_clockin(running_device *device, int timer, double new_clockin);
68void pit8253_set_clock_signal(running_device *device, int timer, int state);
6984
7085
71#endif   /* __PIT8253_H_ */
72
86#endif   /* __PIT8253_H__ */
src/mess/machine/dai.c
r7461r7462
9898   DEVCB_NULL   /* Port C write */
9999};
100100
101static PIT8253_OUTPUT_CHANGED(dai_pit_out0)
101static WRITE_LINE_DEVICE_HANDLER( dai_pit_out0 )
102102{
103103   dai_set_input(device->machine, 0, state);
104104}
105105
106106
107static PIT8253_OUTPUT_CHANGED(dai_pit_out1)
107static WRITE_LINE_DEVICE_HANDLER( dai_pit_out1 )
108108{
109109   dai_set_input(device->machine, 1, state);
110110}
111111
112112
113static PIT8253_OUTPUT_CHANGED(dai_pit_out2)
113static WRITE_LINE_DEVICE_HANDLER( dai_pit_out2 )
114114{
115115   dai_set_input(device->machine, 2, state);
116116}
r7461r7462
121121   {
122122      {
123123         2000000,
124         dai_pit_out0
124         DEVCB_NULL,
125         DEVCB_LINE(dai_pit_out0)
125126      },
126127      {
127128         2000000,
128         dai_pit_out1
129         DEVCB_NULL,
130         DEVCB_LINE(dai_pit_out1)
129131      },
130132      {
131133         2000000,
132         dai_pit_out2
134         DEVCB_NULL,
135         DEVCB_LINE(dai_pit_out2)
133136      }
134137   }
135138};
src/mess/machine/b2m.c
r7461r7462
139139   }
140140}
141141
142static PIT8253_OUTPUT_CHANGED(bm2_pit_out0)
143{
144   b2m_state *st = (b2m_state *)device->machine->driver_data;
145   pic8259_ir1_w(st->pic, state);
146}
147142
148
149static PIT8253_OUTPUT_CHANGED(bm2_pit_out1)
143static WRITE_LINE_DEVICE_HANDLER(bm2_pit_out1)
150144{
151145   b2m_state *st = (b2m_state *) device->machine->driver_data;
152146   speaker_level_w(st->speaker, state);
153
154147}
155148
156static PIT8253_OUTPUT_CHANGED(bm2_pit_out2)
157{
158   pit8253_set_clock_signal( device, 0, state );
159}
160
161
162149const struct pit8253_config b2m_pit8253_intf =
163150{
164151   {
165152      {
166153         0,
167         bm2_pit_out0
154         DEVCB_NULL,
155         DEVCB_DEVICE_LINE("pic8259", pic8259_ir1_w)
168156      },
169157      {
170158         2000000,
171         bm2_pit_out1
159         DEVCB_NULL,
160         DEVCB_LINE(bm2_pit_out1)
172161      },
173162      {
174163         2000000,
175         bm2_pit_out2
164         DEVCB_NULL,
165         DEVCB_LINE(pit8253_clk0_w)
176166      }
177167   }
178168};
src/mess/machine/pmd85.c
r7461r7462
420420const struct pit8253_config pmd85_pit8253_interface =
421421{
422422   {
423      { 0,      NULL },
424      { 2000000,   NULL },
425      { 1,      NULL }
423      { 0,      DEVCB_NULL,     DEVCB_NULL },
424      { 2000000,   DEVCB_NULL,     DEVCB_NULL },
425      { 1,      DEVCB_LINE_VCC, DEVCB_NULL }
426426   }
427427};
428428
r7461r7462
906906
907907static TIMER_CALLBACK( setup_machine_state )
908908{
909   running_device *pit8253 = devtag_get_device(machine, "pit8253");
910
911   pit8253_gate_w(pit8253, 0, 1);
912   pit8253_gate_w(pit8253, 1, 1);
913   pit8253_gate_w(pit8253, 2, 1);
914   if (pmd85_model!=MATO)
909   if (pmd85_model != MATO)
915910   {
916911      msm8251_connect(devtag_get_device(machine, "uart"), &pmd85_cassette_serial_connection);
917912   }
src/mess/machine/europc.c
r7461r7462
178178      europc_pio.port61=data;
179179//      if (data == 0x30) pc1640.port62 = (pc1640.port65 & 0x10) >> 4;
180180//      else if (data == 0x34) pc1640.port62 = pc1640.port65 & 0xf;
181      pit8253_gate_w(devtag_get_device(space->machine, "pit8253"), 2, BIT(data, 0));
181      pit8253_gate2_w(devtag_get_device(space->machine, "pit8253"), BIT(data, 0));
182182      pc_speaker_set_spkrdata(space->machine, BIT(data, 1));
183183      pc_keyb_set_clock(BIT(data, 6));
184184      break;
src/mess/machine/at.c
r7461r7462
9898 *
9999 *************************************************************/
100100
101static PIT8253_OUTPUT_CHANGED( at_pit8254_out0_changed )
101static WRITE_LINE_DEVICE_HANDLER( at_pit8254_out0_changed )
102102{
103103   at_state *st = (at_state *)device->machine->driver_data;
104104   if (st->pic8259_master)
r7461r7462
108108}
109109
110110
111static PIT8253_OUTPUT_CHANGED( at_pit8254_out2_changed )
111static WRITE_LINE_DEVICE_HANDLER( at_pit8254_out2_changed )
112112{
113113   at_speaker_set_input( device->machine, state ? 1 : 0 );
114114}
r7461r7462
119119   {
120120      {
121121         4772720/4,            /* heartbeat IRQ */
122         at_pit8254_out0_changed
122         DEVCB_NULL,
123         DEVCB_LINE(at_pit8254_out0_changed)
123124      }, {
124125         4772720/4,            /* dram refresh */
125         NULL
126         DEVCB_NULL,
127         DEVCB_NULL
126128      }, {
127129         4772720/4,            /* pio port c pin 4, and speaker polling enough */
128         at_pit8254_out2_changed
130         DEVCB_NULL,
131         DEVCB_LINE(at_pit8254_out2_changed)
129132      }
130133   }
131134};
r7461r7462
626629
627630   case 1:
628631      at_kbdc8042.speaker = data;
629      pit8253_gate_w( st->pit8254, 2, data & 1);
632      pit8253_gate2_w(st->pit8254, BIT(data, 0));
630633      at_speaker_set_spkrdata( space->machine, data & 0x02 );
631634      break;
632635
src/mess/machine/irisha.c
r7461r7462
117117   {
118118      {
119119         0,
120         NULL
120         DEVCB_NULL,
121         DEVCB_NULL
121122      },
122123      {
123124         0,
124         NULL
125         DEVCB_NULL,
126         DEVCB_NULL
125127      },
126128      {
127129         2000000,
128         NULL
130         DEVCB_NULL,
131         DEVCB_NULL
129132      }
130133   }
131134};
src/mess/machine/tandy1t.c
r7461r7462
203203   {
204204   case 1:
205205      tandy_ppi.portb = data;
206      pit8253_gate_w( devtag_get_device(space->machine, "pit8253"), 2, data & 1);
206      pit8253_gate2_w(devtag_get_device(space->machine, "pit8253"), BIT(data, 0));
207207      pc_speaker_set_spkrdata( space->machine, data & 0x02 );
208208      pc_keyb_set_clock(data&0x40);
209209      if ( data & 0x80 )
src/mess/machine/amstr_pc.c
r7461r7462
154154      pc1640.port61=data;
155155      if (data==0x30) pc1640.port62=(pc1640.port65&0x10)>>4;
156156      else if (data==0x34) pc1640.port62=pc1640.port65&0xf;
157      pit8253_gate_w( devtag_get_device(space->machine, "pit8253"), 2, data & 1);
157      pit8253_gate2_w(devtag_get_device(space->machine, "pit8253"), BIT(data, 0));
158158      pc_speaker_set_spkrdata( space->machine, data & 0x02 );
159159      pc_keyb_set_clock(data&0x40);
160160      break;
src/mess/machine/compis.c
r7461r7462
431431{
432432   {
433433      /* Timer0 */
434      {4770000/4, NULL },
434      {4770000/4, DEVCB_NULL, DEVCB_NULL },
435435      /* Timer1 */
436      {4770000/4, NULL },
436      {4770000/4, DEVCB_NULL, DEVCB_NULL },
437437      /* Timer2 */
438      {4770000/4, NULL }
438      {4770000/4, DEVCB_NULL, DEVCB_NULL }
439439   }
440440};
441441
r7461r7462
443443{
444444   {
445445      /* Timer0 */
446      {4770000/4, NULL },
446      {4770000/4, DEVCB_NULL, DEVCB_NULL },
447447      /* Timer1 */
448      {4770000/4, NULL },
448      {4770000/4, DEVCB_NULL, DEVCB_NULL },
449449      /* Timer2 */
450      {4770000/4, NULL }
450      {4770000/4, DEVCB_NULL, DEVCB_NULL }
451451   }
452452};
453453
src/mess/machine/mz700.c
r7461r7462
5252};
5353
5454
55static PIT8253_OUTPUT_CHANGED( pit_out0_changed );
56static PIT8253_OUTPUT_CHANGED( pit_out1_changed );
57static PIT8253_OUTPUT_CHANGED( pit_irq_2 );
55static WRITE_LINE_DEVICE_HANDLER( pit_out0_changed );
56static WRITE_LINE_DEVICE_HANDLER( pit_irq_2 );
5857
5958const struct pit8253_config mz700_pit8253_config =
6059{
6160   {
62      /* clockin             callback */
63      { XTAL_17_73447MHz/20, pit_out0_changed },
64      {             15611.0, pit_out1_changed },
65      {                  0, pit_irq_2        },
61      /* clockin             gate            callback */
62      { XTAL_17_73447MHz/20, DEVCB_NULL,     DEVCB_LINE(pit_out0_changed) },
63      {             15611.0, DEVCB_LINE_VCC, DEVCB_LINE(pit8253_clk2_w)   },
64      {                  0, DEVCB_LINE_VCC, DEVCB_LINE(pit_irq_2)        },
6665   }
6766};
6867
6968const struct pit8253_config mz800_pit8253_config =
7069{
7170   {
72      /* clockin             callback */
73      { XTAL_17_73447MHz/16, pit_out0_changed },
74      {             15611.0, pit_out1_changed },
75      {                  0, pit_irq_2        },
71      /* clockin             gate            callback */
72      { XTAL_17_73447MHz/16, DEVCB_NULL,     DEVCB_LINE(pit_out0_changed) },
73      {             15611.0, DEVCB_LINE_VCC, DEVCB_LINE(pit8253_clk2_w)   },
74      {                  0, DEVCB_LINE_VCC, DEVCB_LINE(pit_irq_2)        },
7675   }
7776};
7877
r7461r7462
130129
131130   data |= mz->other_timer;
132131   data |= input_port_read(space->machine, "JOY");
133   data |= video_screen_get_hblank(space->machine->primary_screen);
132   data |= video_screen_get_hblank(space->machine->primary_screen) << 7;
134133
135134   LOG(1, "mz700_e008_r", ("%02X\n", data), space->machine);
136135
137136   return data;
138137}
139138
139static WRITE8_HANDLER( mz700_e008_w )
140{
141   mz_state *mz = (mz_state *)space->machine->driver_data;
142   pit8253_gate0_w(mz->pit, BIT(data, 0));
143}
140144
145
141146/***************************************************************************
142147    BANK SWITCHING
143148***************************************************************************/
r7461r7462
283288         {
284289            memory_install_readwrite8_device_handler(spc, mz->ppi, 0xe000, 0xfff3, 0, 0x1ff0, i8255a_r, i8255a_w);
285290            memory_install_readwrite8_device_handler(spc, mz->pit, 0xe004, 0xfff7, 0, 0x1ff0, pit8253_r, pit8253_w);
286            memory_install_read8_handler(spc, 0xe008, 0xfff8, 0, 0x1ff0, mz700_e008_r);
287            memory_install_write8_device_handler(spc, mz->pit, 0xe008, 0xfff8, 0, 0x1ff0, pit8253_gate_w);
291            memory_install_readwrite8_handler(spc, 0xe008, 0xfff8, 0, 0x1ff0, mz700_e008_r, mz700_e008_w);
288292         }
289293         else
290294         {
291295            memory_install_readwrite8_device_handler(spc, mz->ppi, 0xe000, 0xe003, 0, 0, i8255a_r, i8255a_w);
292296            memory_install_readwrite8_device_handler(spc, mz->pit, 0xe004, 0xe007, 0, 0, pit8253_r, pit8253_w);
293            memory_install_read8_handler(spc, 0xe008, 0xe008, 0, 0, mz700_e008_r);
294            memory_install_write8_device_handler(spc, mz->pit, 0xe008, 0xe008, 0, 0, pit8253_gate_w);
297            memory_install_readwrite8_handler(spc, 0xe008, 0xe008, 0, 0, mz700_e008_r, mz700_e008_w);
295298         }
296299      }
297300   }
r7461r7462
417420static UINT8 speaker_level = 0;
418421static UINT8 prev_state = 0;
419422
420static PIT8253_OUTPUT_CHANGED( pit_out0_changed )
423static WRITE_LINE_DEVICE_HANDLER( pit_out0_changed )
421424{
422425   running_device *speaker = devtag_get_device(device->machine, "speaker");
423426   if((prev_state==0) && (state==1)) {
r7461r7462
427430   speaker_level_w( speaker, speaker_level);
428431}
429432
430
431/* Timer 1 is the clock for timer 2 clock input */
432static PIT8253_OUTPUT_CHANGED( pit_out1_changed )
433{
434   pit8253_set_clock_signal(device, 2, state);
435}
436
437
438433/* timer 2 is the AM/PM (12 hour) interrupt */
439static PIT8253_OUTPUT_CHANGED( pit_irq_2 )
434static WRITE_LINE_DEVICE_HANDLER( pit_irq_2 )
440435{
441436   mz_state *mz = (mz_state *)device->machine->driver_data;
442437
src/mess/machine/bebox.c
r7461r7462
778778 *
779779 *************************************/
780780
781static void bebox_timer0_w(running_device *device, int state)
781static WRITE_LINE_DEVICE_HANDLER( bebox_timer0_w )
782782{
783   if ( bebox_devices.pic8259_master ) {
783   if (bebox_devices.pic8259_master)
784784      pic8259_ir0_w(bebox_devices.pic8259_master, state);
785   }
786785}
787786
788787
r7461r7462
791790   {
792791      {
793792         4772720/4,            /* heartbeat IRQ */
794         bebox_timer0_w
793         DEVCB_NULL,
794         DEVCB_LINE(bebox_timer0_w)
795795      },
796796      {
797797         4772720/4,            /* dram refresh */
798         NULL
798         DEVCB_NULL,
799         DEVCB_NULL
799800      },
800801      {
801802         4772720/4,            /* pio port c pin 4, and speaker polling enough */
802         NULL
803         DEVCB_NULL,
804         DEVCB_NULL
803805      }
804806   }
805807};
src/mess/machine/special.c
r7461r7462
207207   specimx_set_bank(space->machine, offset, data);
208208}
209209
210static PIT8253_OUTPUT_CHANGED( specimx_pit8253_out0_changed )
210static WRITE_LINE_DEVICE_HANDLER( specimx_pit8253_out0_changed )
211211{
212212   specimx_set_input( device->machine, 0, state );
213213}
214214
215215
216216
217static PIT8253_OUTPUT_CHANGED(specimx_pit8253_out1_changed)
217static WRITE_LINE_DEVICE_HANDLER(specimx_pit8253_out1_changed)
218218{
219219   specimx_set_input( device->machine, 1, state );
220220}
221221
222222
223223
224static PIT8253_OUTPUT_CHANGED(specimx_pit8253_out2_changed)
224static WRITE_LINE_DEVICE_HANDLER(specimx_pit8253_out2_changed)
225225{
226226   specimx_set_input( device->machine, 2, state );
227227}
r7461r7462
233233   {
234234      {
235235         2000000,
236         specimx_pit8253_out0_changed
236         DEVCB_NULL,
237         DEVCB_LINE(specimx_pit8253_out0_changed)
237238      },
238239      {
239240         2000000,
240         specimx_pit8253_out1_changed
241         DEVCB_NULL,
242         DEVCB_LINE(specimx_pit8253_out1_changed)
241243      },
242244      {
243245         2000000,
244         specimx_pit8253_out2_changed
246         DEVCB_NULL,
247         DEVCB_LINE(specimx_pit8253_out2_changed)
245248      }
246249   }
247250};
r7461r7462
256259{
257260   running_device *pit8253 = devtag_get_device(machine, "pit8253");
258261
259   pit8253_gate_w(pit8253, 0, 0);
260   pit8253_gate_w(pit8253, 1, 0);
261   pit8253_gate_w(pit8253, 2, 0);
262   pit8253_gate0_w(pit8253, 0);
263   pit8253_gate1_w(pit8253, 0);
264   pit8253_gate2_w(pit8253, 0);
262265}
263266
264267MACHINE_RESET( specimx )
src/mess/machine/mz80.c
r7461r7462
7070
7171static UINT8 speaker_level = 0;
7272static UINT8 prev_state = 0;
73static PIT8253_OUTPUT_CHANGED( pit_out0_changed )
73
74static WRITE_LINE_DEVICE_HANDLER( pit_out0_changed )
7475{
7576   running_device *speaker = devtag_get_device(device->machine, "speaker");
7677   if((prev_state==0) && (state==1)) {
r7461r7462
8081   speaker_level_w( speaker, speaker_level);
8182}
8283
83
84static PIT8253_OUTPUT_CHANGED( pit_out1_changed )
84static WRITE_LINE_DEVICE_HANDLER( pit_out2_changed )
8585{
86   pit8253_set_clock_signal( device, 2, state );
87}
88
89
90static PIT8253_OUTPUT_CHANGED( pit_out2_changed )
91{
9286   cputag_set_input_line(device->machine, "maincpu", 0, HOLD_LINE);
9387}
9488
r7461r7462
10599const struct pit8253_config mz80k_pit8253_config =
106100{
107101   {
108      /* clockin    irq callback    */
109      { XTAL_8MHz/  4,  pit_out0_changed },
110      { XTAL_8MHz/256,  pit_out1_changed },
111      {            0,  pit_out2_changed },
102      /* clockin        gate        callback    */
103      { XTAL_8MHz/  4,  DEVCB_NULL, DEVCB_LINE(pit_out0_changed) },
104      { XTAL_8MHz/256,  DEVCB_NULL, DEVCB_LINE(pit8253_clk2_w)   },
105      {            0,  DEVCB_NULL, DEVCB_LINE(pit_out2_changed) },
112106   }
113107};
114108
r7461r7462
119113WRITE8_HANDLER(mz80k_strobe_w)
120114{
121115   running_device *pit = devtag_get_device(space->machine, "pit8253");
122   pit8253_gate_w(pit,0,data);
116   pit8253_gate0_w(pit, BIT(data, 0));
123117}
124
src/mess/machine/pp01.c
r7461r7462
156156}
157157
158158
159static PIT8253_OUTPUT_CHANGED(pp01_pit_out0)
159static WRITE_LINE_DEVICE_HANDLER( pp01_pit_out0 )
160160{
161161}
162162
163static PIT8253_OUTPUT_CHANGED(pp01_pit_out1)
163static WRITE_LINE_DEVICE_HANDLER( pp01_pit_out1 )
164164{
165165}
166166
167static PIT8253_OUTPUT_CHANGED(pp01_pit_out2)
168{
169   pit8253_set_clock_signal( device, 0, state );
170}
171
172
173167const struct pit8253_config pp01_pit8253_intf =
174168{
175169   {
176170      {
177171         0,
178         pp01_pit_out0
172         DEVCB_NULL,
173         DEVCB_LINE(pp01_pit_out0)
179174      },
180175      {
181176         2000000,
182         pp01_pit_out1
177         DEVCB_NULL,
178         DEVCB_LINE(pp01_pit_out1)
183179      },
184180      {
185181         2000000,
186         pp01_pit_out2
182         DEVCB_NULL,
183         DEVCB_LINE(pit8253_clk0_w)
187184      }
188185   }
189186};
src/mess/machine/pc.c
r7461r7462
269269 *
270270 *************************************************************/
271271
272static PIT8253_OUTPUT_CHANGED( ibm5150_pit8253_out0_changed )
272static WRITE_LINE_DEVICE_HANDLER( ibm5150_pit8253_out1_changed )
273273{
274274   pc_state *st = (pc_state *)device->machine->driver_data;
275   pic8259_ir0_w(st->pic8259, state);
276}
277
278
279static PIT8253_OUTPUT_CHANGED( ibm5150_pit8253_out1_changed )
280{
281   pc_state *st = (pc_state *)device->machine->driver_data;
282275   /* Trigger DMA channel #0 */
283276   if ( st->out1 == 0 && state == 1 && st->u73_q2 == 0 )
284277   {
r7461r7462
289282}
290283
291284
292static PIT8253_OUTPUT_CHANGED( ibm5150_pit8253_out2_changed )
285static WRITE_LINE_DEVICE_HANDLER( ibm5150_pit8253_out2_changed )
293286{
294287   pc_speaker_set_input( device->machine, state );
295288}
r7461r7462
300293   {
301294      {
302295         XTAL_14_31818MHz/12,            /* heartbeat IRQ */
303         ibm5150_pit8253_out0_changed
296         DEVCB_NULL,
297         DEVCB_DEVICE_LINE("pic8259", pic8259_ir0_w)
304298      }, {
305299         XTAL_14_31818MHz/12,            /* dram refresh */
306         ibm5150_pit8253_out1_changed
300         DEVCB_NULL,
301         DEVCB_LINE(ibm5150_pit8253_out1_changed)
307302      }, {
308303         XTAL_14_31818MHz/12,            /* pio port c pin 4, and speaker polling enough */
309         ibm5150_pit8253_out2_changed
304         DEVCB_NULL,
305         DEVCB_LINE(ibm5150_pit8253_out2_changed)
310306      }
311307   }
312308};
r7461r7462
323319   {
324320      {
325321         XTAL_14_31818MHz/12,              /* heartbeat IRQ */
326         ibm5150_pit8253_out0_changed
322         DEVCB_NULL,
323         DEVCB_DEVICE_LINE("pic8259", pic8259_ir0_w)
327324      }, {
328325         XTAL_14_31818MHz/12,              /* dram refresh */
329         NULL
326         DEVCB_NULL,
327         DEVCB_NULL
330328      }, {
331329         XTAL_14_31818MHz/12,              /* pio port c pin 4, and speaker polling enough */
332         ibm5150_pit8253_out2_changed
330         DEVCB_NULL,
331         DEVCB_LINE(ibm5150_pit8253_out2_changed)
333332      }
334333   }
335334};
r7461r7462
744743   st->ppi_portc_switch_high = data & 0x08;
745744   st->ppi_keyboard_clear = data & 0x80;
746745   st->ppi_keyb_clock = data & 0x40;
747   pit8253_gate_w( st->pit8253, 2, data & 1);
746   pit8253_gate2_w(st->pit8253, BIT(data, 0));
748747   pc_speaker_set_spkrdata( device->machine, data & 0x02 );
749748
750749   cassette_change_state( devtag_get_device(device->machine, "cassette"), ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
r7461r7462
902901   st->ppi_portc_switch_high = data & 0x08;
903902   st->ppi_keyboard_clear = data & 0x80;
904903   st->ppi_keyb_clock = data & 0x40;
905   pit8253_gate_w( st->pit8253, 2, data & 0x01 );
904   pit8253_gate2_w(st->pit8253, BIT(data, 0));
906905   pc_speaker_set_spkrdata( device->machine, data & 0x02 );
907906
908907   st->ppi_clock_signal = ( st->ppi_keyb_clock ) ? 1 : 0;
r7461r7462
966965   st->ppi_portc_switch_high = data & 0x08;
967966   st->ppi_keyboard_clear = data & 0x80;
968967   st->ppi_keyb_clock = data & 0x40;
969   pit8253_gate_w( st->pit8253, 2, data & 0x01 );
968   pit8253_gate2_w(st->pit8253, BIT(data, 0));
970969   pc_speaker_set_spkrdata( device->machine, data & 0x02 );
971970   pc_keyb_set_clock( st->ppi_keyb_clock );
972971
r7461r7462
992991   /* KB controller port B */
993992   st->ppi_portb = data;
994993   st->ppi_portc_switch_high = data & 0x08;
995   pit8253_gate_w( devtag_get_device(device->machine, "pit8253"), 2, data & 1);
994   pit8253_gate2_w(devtag_get_device(device->machine, "pit8253"), BIT(data, 0));
996995   pc_speaker_set_spkrdata( device->machine, data & 0x02 );
997996
998997   cassette_change_state( devtag_get_device(device->machine, "cassette"), ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
src/mess/machine/pk8020.c
r7461r7462
927927   DEVCB_NULL
928928};
929929
930static PIT8253_OUTPUT_CHANGED(pk8020_pit_out0)
930static WRITE_LINE_DEVICE_HANDLER( pk8020_pit_out0 )
931931{
932932   running_device *speaker = devtag_get_device(device->machine, "speaker");
933933
r7461r7462
937937}
938938
939939
940static PIT8253_OUTPUT_CHANGED(pk8020_pit_out1)
940static WRITE_LINE_DEVICE_HANDLER(pk8020_pit_out1)
941941{
942942}
943943
944static PIT8253_OUTPUT_CHANGED(pk8020_pit_out2)
945{
946   pic8259_ir5_w(devtag_get_device(device->machine, "pic8259"), state);
947}
948944
949
950945const struct pit8253_config pk8020_pit8253_intf =
951946{
952947   {
953948      {
954949         XTAL_20MHz / 10,
955         pk8020_pit_out0
950         DEVCB_NULL,
951         DEVCB_LINE(pk8020_pit_out0)
956952      },
957953      {
958954         XTAL_20MHz / 10,
959         pk8020_pit_out1
955         DEVCB_NULL,
956         DEVCB_LINE(pk8020_pit_out1)
960957      },
961958      {
962959         (XTAL_20MHz / 8) / 164,
963         pk8020_pit_out2
960         DEVCB_NULL,
961         DEVCB_DEVICE_LINE("pic8259", pic8259_ir5_w)
964962      }
965963   }
966964};
src/mess/drivers/ip22.c
r7461r7462
8484   {
8585      {
8686         1000000,            /* Timer 0: 1MHz */
87         NULL
87         DEVCB_NULL,
88         DEVCB_NULL
8889      }, {
8990         1000000,            /* Timer 1: 1MHz */
90         NULL
91         DEVCB_NULL,
92         DEVCB_NULL
9193      }, {
9294         1000000,            /* Timer 2: 1MHz */
93         NULL
95         DEVCB_NULL,
96         DEVCB_NULL
9497      }
9598   }
9699};
src/mess/drivers/mikromik.c
r7461r7462
479479
480480/* 8253 Interface */
481481
482static PIT8253_OUTPUT_CHANGED( itxc_w )
482static WRITE_LINE_DEVICE_HANDLER( itxc_w )
483483{
484484   mm1_state *driver_state = (mm1_state *)device->machine->driver_data;
485485
r7461r7462
489489   }
490490}
491491
492static PIT8253_OUTPUT_CHANGED( irxc_w )
492static WRITE_LINE_DEVICE_HANDLER( irxc_w )
493493{
494494   mm1_state *driver_state = (mm1_state *)device->machine->driver_data;
495495
r7461r7462
499499   }
500500}
501501
502static PIT8253_OUTPUT_CHANGED( auxc_w )
502static WRITE_LINE_DEVICE_HANDLER( auxc_w )
503503{
504504   mm1_state *driver_state = (mm1_state *)device->machine->driver_data;
505505
r7461r7462
512512   {
513513      {
514514         XTAL_6_144MHz/2/2,
515         itxc_w
515         DEVCB_NULL,
516         DEVCB_LINE(itxc_w)
516517      }, {
517518         XTAL_6_144MHz/2/2,
518         irxc_w
519         DEVCB_NULL,
520         DEVCB_LINE(irxc_w)
519521      }, {
520522         XTAL_6_144MHz/2/2,
521         auxc_w
523         DEVCB_NULL,
524         DEVCB_LINE(auxc_w)
522525      }
523526   }
524527};
src/mess/drivers/pc98.c
r7461r7462
816816   DEVCB_NULL               /* Port C write */
817817};
818818
819static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
820{
821   pic8259_ir0_w(devtag_get_device(device->machine, "pic8259_master"), state);
822}
823
824819static const struct pit8253_config pit8253_config =
825820{
826821   {
827822      {
828823         16000000/4,            /* heartbeat IRQ */
829         pc_timer0_w
824         DEVCB_NULL,
825         DEVCB_DEVICE_LINE("pic8259_master", pic8259_ir0_w)
830826      }, {
831827         16000000/4,            /* dram refresh */
832         NULL
828         DEVCB_NULL,
829         DEVCB_NULL
833830      }, {
834831         16000000/4,            /* pio port c pin 4, and speaker polling enough */
835         NULL
832         DEVCB_NULL,
833         DEVCB_NULL
836834      }
837835   }
838836};
src/mess/drivers/mikrosha.c
r7461r7462
139139};
140140
141141
142static PIT8253_OUTPUT_CHANGED(mikrosha_pit_out2)
142static WRITE_LINE_DEVICE_HANDLER(mikrosha_pit_out2)
143143{
144144
145145}
r7461r7462
149149   {
150150      {
151151         0,
152         NULL
152         DEVCB_NULL,
153         DEVCB_NULL
153154      },
154155      {
155156         0,
156         NULL
157         DEVCB_NULL,
158         DEVCB_NULL
157159      },
158160      {
159161         2000000,
160         mikrosha_pit_out2
162         DEVCB_NULL,
163         DEVCB_LINE(mikrosha_pit_out2)
161164      }
162165   }
163166};
src/mess/drivers/qx10.c
r7461r7462
327327static const struct pit8253_config qx10_pit8253_1_config =
328328{
329329   {
330      { 1200, NULL },
331      { 1200, NULL },
332      { MAIN_CLK / 8, NULL },
330      { 1200,         DEVCB_NULL,     DEVCB_NULL },
331      { 1200,         DEVCB_LINE_VCC, DEVCB_NULL },
332      { MAIN_CLK / 8, DEVCB_NULL,     DEVCB_NULL },
333333   }
334334};
335335
r7461r7462
343343static const struct pit8253_config qx10_pit8253_2_config =
344344{
345345   {
346      { MAIN_CLK / 8, NULL },
347      { MAIN_CLK / 8, NULL },
348      { MAIN_CLK / 8, NULL },
346      { MAIN_CLK / 8, DEVCB_LINE_VCC, DEVCB_NULL },
347      { MAIN_CLK / 8, DEVCB_LINE_VCC, DEVCB_NULL },
348      { MAIN_CLK / 8, DEVCB_LINE_VCC, DEVCB_NULL },
349349   }
350350};
351351
src/mess/drivers/fmtowns.c
r7461r7462
16231623//  logerror("PIC#1: set IRQ line to %i\n",interrupt);
16241624}
16251625
1626static PIT8253_OUTPUT_CHANGED( towns_pit_out0_changed )
1626static WRITE_LINE_DEVICE_HANDLER( towns_pit_out0_changed )
16271627{
16281628   running_device* dev = devtag_get_device(device->machine,"pic8259_master");
16291629
r7461r7462
16331633   }
16341634}
16351635
1636static PIT8253_OUTPUT_CHANGED( towns_pit_out1_changed )
1636static WRITE_LINE_DEVICE_HANDLER( towns_pit_out1_changed )
16371637{
16381638//  running_device* dev = devtag_get_device(device->machine,"pic8259_master");
16391639
r7461r7462
19961996   {
19971997      {
19981998         307200,
1999         towns_pit_out0_changed
1999         DEVCB_NULL,
2000         DEVCB_LINE(towns_pit_out0_changed)
20002001      },
20012002      {
20022003         307200,
2003         towns_pit_out1_changed
2004         DEVCB_NULL,
2005         DEVCB_LINE(towns_pit_out1_changed)
20042006      },
20052007      {
20062008         307200,
2007         NULL
2009         DEVCB_NULL,
2010         DEVCB_NULL
20082011      }
20092012   }
20102013};
src/mess/drivers/fk1.c
r7461r7462
196196   DEVCB_HANDLER(fk1_ppi_3_c_w)
197197};
198198
199static PIT8253_OUTPUT_CHANGED(fk1_pit_out0)
199static WRITE_LINE_DEVICE_HANDLER(fk1_pit_out0)
200200{
201201   // System time
202   logerror("PIT8253_OUTPUT_CHANGED(fk1_pit_out0)\n");
202   logerror("WRITE_LINE_DEVICE_HANDLER(fk1_pit_out0)\n");
203203}
204204
205static PIT8253_OUTPUT_CHANGED(fk1_pit_out1)
205static WRITE_LINE_DEVICE_HANDLER(fk1_pit_out1)
206206{
207207   // Timeout for disk operation
208   logerror("PIT8253_OUTPUT_CHANGED(fk1_pit_out1)\n");
208   logerror("WRITE_LINE_DEVICE_HANDLER(fk1_pit_out1)\n");
209209}
210210
211static PIT8253_OUTPUT_CHANGED(fk1_pit_out2)
211static WRITE_LINE_DEVICE_HANDLER(fk1_pit_out2)
212212{
213213   // Overflow for disk operations
214   logerror("PIT8253_OUTPUT_CHANGED(fk1_pit_out2)\n");
214   logerror("WRITE_LINE_DEVICE_HANDLER(fk1_pit_out2)\n");
215215}
216216
217217
r7461r7462
220220   {
221221      {
222222         50,
223         fk1_pit_out0
223         DEVCB_NULL,
224         DEVCB_LINE(fk1_pit_out0)
224225      },
225226      {
226227         1000000,
227         fk1_pit_out1
228         DEVCB_NULL,
229         DEVCB_LINE(fk1_pit_out1)
228230      },
229231      {
230232         0,
231         fk1_pit_out2
233         DEVCB_NULL,
234         DEVCB_LINE(fk1_pit_out2)
232235      }
233236   }
234237};
src/mess/drivers/tandy2k.c
r7461r7462
9999   state->extclk = BIT(data, 1);
100100 
101101   /* speaker gate */
102   pit8253_gate_w(state->pit, 0, BIT(data, 2));
102   pit8253_gate0_w(state->pit, BIT(data, 2));
103103 
104104   /* speaker data */
105105   state->spkrdata = BIT(data, 3);
106106   speaker_update(state);
107107 
108108   /* refresh and baud rate clocks */
109   pit8253_gate_w(state->pit, 1, BIT(data, 4));
110   pit8253_gate_w(state->pit, 2, BIT(data, 4));
109   pit8253_gate1_w(state->pit, BIT(data, 4));
110   pit8253_gate2_w(state->pit, BIT(data, 4));
111111 
112112   /* FDC reset */
113113   upd765_reset_w(state->fdc, BIT(data, 5));
r7461r7462
472472 
473473/* Intel 8253 Interface */
474474 
475static PIT8253_OUTPUT_CHANGED( outspkr_w )
475static WRITE_LINE_DEVICE_HANDLER( outspkr_w )
476476{
477477   tandy2k_state *driver_state = (tandy2k_state *)device->machine->driver_data;
478478 
r7461r7462
480480   speaker_update(driver_state);
481481}
482482 
483static PIT8253_OUTPUT_CHANGED( intbrclk_w )
483static WRITE_LINE_DEVICE_HANDLER( intbrclk_w )
484484{
485485   tandy2k_state *driver_state = (tandy2k_state *)device->machine->driver_data;
486486 
r7461r7462
491491   }
492492}
493493 
494static PIT8253_OUTPUT_CHANGED( rfrqpulse_w )
494static WRITE_LINE_DEVICE_HANDLER( rfrqpulse_w )
495495{
496496}
497497 
r7461r7462
500500   {
501501      {
502502         XTAL_16MHz/16,
503         outspkr_w
503         DEVCB_NULL,
504         DEVCB_LINE(outspkr_w)
504505      }, {
505506         XTAL_16MHz/8,
506         intbrclk_w
507         DEVCB_NULL,
508         DEVCB_LINE(intbrclk_w)
507509      }, {
508510         XTAL_16MHz/8,
509         rfrqpulse_w
511         DEVCB_NULL,
512         DEVCB_LINE(rfrqpulse_w)
510513      }
511514   }
512515};
src/mess/drivers/bw12.c
r7461r7462
583583   {
584584      {
585585         XTAL_1_8432MHz,
586         bw12_pit8253_out0_w,
586         DEVCB_NULL,
587         DEVCB_LINE(bw12_pit8253_out0_w)
587588      },
588589      {
589590         XTAL_1_8432MHz,
590         bw12_pit8253_out1_w,
591         DEVCB_NULL,
592         DEVCB_LINE(bw12_pit8253_out1_w)
591593      },
592594      {
593595         XTAL_1_8432MHz,
594         bw12_pit8253_out2_w,
596         DEVCB_NULL,
597         DEVCB_LINE(bw12_pit8253_out2_w)
595598      }
596599   }
597600};
src/mess/drivers/pasogo.c
r7461r7462
468468
469469//static const unsigned i86_address_mask = 0x000fffff;
470470
471static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
472{
473   pic8259_ir0_w(devtag_get_device(device->machine, "pic8259"), state);
474}
475
476471static const struct pit8253_config pc_pit8254_config =
477472{
478473   {
479474      {
480475         4772720/4,            /* heartbeat IRQ */
481         pc_timer0_w
476         DEVCB_NULL,
477         DEVCB_DEVICE_LINE("pic8259", pic8259_ir0_w)
482478      }, {
483479         4772720/4,            /* dram refresh */
484         NULL
480         DEVCB_NULL,
481         DEVCB_NULL
485482      }, {
486483         4772720/4,            /* pio port c pin 4, and speaker polling enough */
487         NULL
484         DEVCB_NULL,
485         DEVCB_NULL
488486      }
489487   }
490488};
src/mess/drivers/victor9k.c
r7461r7462
160160 
161161/* Intel 8253 Interface */
162162 
163static PIT8253_OUTPUT_CHANGED( mux_serial_b_w )
163static WRITE_LINE_DEVICE_HANDLER( mux_serial_b_w )
164164{
165165}
166166 
167static PIT8253_OUTPUT_CHANGED( mux_serial_a_w )
167static WRITE_LINE_DEVICE_HANDLER( mux_serial_a_w )
168168{
169169}
170170 
171static PIT8253_OUTPUT_CHANGED( timer_w )
172{
173   victor9k_state *driver_state = (victor9k_state *)device->machine->driver_data;
174 
175   pic8259_ir2_w(driver_state->pic, state);
176}
177 
178171static const struct pit8253_config pit_intf =
179172{
180173   {
181174      {
182175         2500000,
183         mux_serial_b_w
176         DEVCB_NULL,
177         DEVCB_LINE(mux_serial_b_w)
184178      }, {
185179         2500000,
186         mux_serial_a_w
180         DEVCB_NULL,
181         DEVCB_LINE(mux_serial_a_w)
187182      }, {
188183         100000,
189         timer_w
184         DEVCB_NULL,
185         DEVCB_DEVICE_LINE(I8259A_TAG, pic8259_ir2_w)
190186      }
191187   }
192188};
src/mess/drivers/bw2.c
r7461r7462
430430
431431/* PIT */
432432
433static PIT8253_OUTPUT_CHANGED( bw2_timer0_w )
433static WRITE_LINE_DEVICE_HANDLER( bw2_timer0_w )
434434{
435435   bw2_state *driver_state = (bw2_state *)device->machine->driver_data;
436436
r7461r7462
438438   msm8251_receive_clock(driver_state->msm8251);
439439}
440440
441static PIT8253_OUTPUT_CHANGED( bw2_timer1_w )
441static WRITE_LINE_DEVICE_HANDLER( bw2_timer2_w )
442442{
443   pit8253_set_clock_signal(device, 2, state);
444}
445
446static PIT8253_OUTPUT_CHANGED( bw2_timer2_w )
447{
448443   bw2_state *driver_state = (bw2_state *)device->machine->driver_data;
449444
450445   driver_state->mtron = state;
r7461r7462
462457   {
463458      {
464459         XTAL_4MHz,   /* 8251 USART TXC, RXC */
465         bw2_timer0_w
460         DEVCB_NULL,
461         DEVCB_LINE(bw2_timer0_w)
466462      },
467463      {
468464         11000,      /* LCD controller */
469         bw2_timer1_w
465         DEVCB_NULL,
466         DEVCB_LINE(pit8253_clk2_w)
470467      },
471468      {
472469         0,      /* Floppy /MTRON */
473         bw2_timer2_w
470         DEVCB_NULL,
471         DEVCB_LINE(bw2_timer2_w)
474472      }
475473   }
476474};
r7461r7462
526524   memory_configure_bank(machine, "bank1", BANK_RAM1, 1, state->work_ram, 0);
527525   memory_configure_bank(machine, "bank1", BANK_VRAM, 1, state->video_ram, 0);
528526   memory_configure_bank(machine, "bank1", BANK_ROM, 1, memory_region(machine, "ic1"), 0);
529   
527
530528   /* register for state saving */
531529   state_save_register_global(machine, state->keyboard_row);
532530   state_save_register_global_pointer(machine, state->work_ram, messram_get_size(devtag_get_device(machine, "messram")));
src/mess/drivers/apricot.c
r7461r7462
7676   DEVCB_NULL
7777};
7878
79static PIT8253_OUTPUT_CHANGED( apricot_pit8253_out0 )
79static WRITE_LINE_DEVICE_HANDLER( apricot_pit8253_out1 )
8080{
81   apricot_state *apricot = (apricot_state *)device->machine->driver_data;
82   pic8259_ir6_w(apricot->pic8259, state);
83}
84
85static PIT8253_OUTPUT_CHANGED( apricot_pit8253_out1 )
86{
8781   /* connected to the rs232c interface */
8882}
8983
90static PIT8253_OUTPUT_CHANGED( apricot_pit8253_out2 )
84static WRITE_LINE_DEVICE_HANDLER( apricot_pit8253_out2 )
9185{
9286   /* connected to the rs232c interface */
9387}
r7461r7462
9589static const struct pit8253_config apricot_pit8253_intf =
9690{
9791   {
98      { XTAL_4MHz / 16, apricot_pit8253_out0 },
99      { 0 /*XTAL_4MHz / 2*/, apricot_pit8253_out1 },
100      { 0 /*XTAL_4MHz / 2*/, apricot_pit8253_out2 }
92      { XTAL_4MHz / 16,      DEVCB_LINE_VCC, DEVCB_DEVICE_LINE("ic31", pic8259_ir6_w) },
93      { 0 /*XTAL_4MHz / 2*/, DEVCB_LINE_VCC, DEVCB_LINE(apricot_pit8253_out1) },
94      { 0 /*XTAL_4MHz / 2*/, DEVCB_LINE_VCC, DEVCB_LINE(apricot_pit8253_out2) }
10195   }
10296};
10397

Previous 15994 Revisions Next


© 1998-2018 The MESS Team