Previous 199869 Revisions Next

r30678 Monday 26th May, 2014 at 17:21:39 UTC by Carl
microtch: remove non-serial device (nw)
[src/emu/machine]microtch.c microtch.h
[src/mame/drivers]adp.c cubo.c magtouch.c meritm.c pcat_nit.c tmaster.c vlc.c

trunk/src/mame/drivers/cubo.c
r30677r30678
355355   virtual void potgo_w(UINT16 data);
356356
357357private:
358   required_device<microtouch_serial_device> m_microtouch;
358   required_device<microtouch_device> m_microtouch;
359359   required_device<cdda_device> m_cdda;
360360
361361   typedef void (cubo_state::*input_hack_func)();
r30677r30678
10731073   MCFG_DEVICE_ADD("cia_1", MOS8520, amiga_state::CLK_E_PAL)
10741074   MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_1_irq))
10751075
1076   MCFG_MICROTOUCH_SERIAL_ADD("microtouch", 9600, WRITELINE(cubo_state, rs232_rx_w))
1076   MCFG_MICROTOUCH_ADD("microtouch", 9600, WRITELINE(cubo_state, rs232_rx_w))
10771077
10781078   MCFG_CDROM_ADD("cd32_cdrom")
10791079   MCFG_CDROM_INTERFACE("cd32_cdrom")
trunk/src/mame/drivers/vlc.c
r30677r30678
166166   required_device<mc68681_device> m_duart40_68681;
167167
168168   required_device<cpu_device> m_maincpu;
169   optional_device<microtouch_serial_device> m_microtouch;
169   optional_device<microtouch_device> m_microtouch;
170170   required_device<nvram_device> m_nvram;
171171
172172   required_shared_ptr<UINT16> m_ram62256;
r30677r30678
632632
633633   MCFG_MC68681_ADD( "duart40_68681", XTAL_3_6864MHz )  // UARTA = Touch , UARTB = Bill Acceptor
634634   MCFG_MC68681_IRQ_CALLBACK(WRITELINE(nevada_state, duart40_irq_handler))
635   MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("microtouch", microtouch_serial_device, rx))
635   MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("microtouch", microtouch_device, rx))
636636   MCFG_MC68681_INPORT_CALLBACK(IOPORT("DSW3"))
637637
638   MCFG_MICROTOUCH_SERIAL_ADD( "microtouch", 9600, DEVWRITELINE("duart40_68681", mc68681_device, rx_a_w) )
638   MCFG_MICROTOUCH_ADD( "microtouch", 9600, DEVWRITELINE("duart40_68681", mc68681_device, rx_a_w) )
639639
640640   /* devices */
641641   MCFG_DEVICE_ADD("rtc", MSM6242, XTAL_32_768kHz)
trunk/src/mame/drivers/meritm.c
r30677r30678
208208   required_device<ds1204_device> m_ds1204;
209209   required_device<v9938_device> m_v9938_0;
210210   required_device<v9938_device> m_v9938_1;
211   optional_device<microtouch_serial_device> m_microtouch;
211   optional_device<microtouch_device> m_microtouch;
212212   optional_device<ns16550_device> m_uart;
213213   DECLARE_WRITE8_MEMBER(meritm_crt250_bank_w);
214214   DECLARE_WRITE8_MEMBER(meritm_psd_a15_w);
r30677r30678
11051105   MCFG_MACHINE_START_OVERRIDE(meritm_state,meritm_crt250_crt252_crt258)
11061106
11071107   MCFG_DEVICE_ADD("ns16550", NS16550, UART_CLK)
1108   MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("microtouch", microtouch_serial_device, rx))
1109   MCFG_MICROTOUCH_SERIAL_ADD("microtouch", 9600, DEVWRITELINE("ns16550", ins8250_uart_device, rx_w))
1108   MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("microtouch", microtouch_device, rx))
1109   MCFG_MICROTOUCH_ADD("microtouch", 9600, DEVWRITELINE("ns16550", ins8250_uart_device, rx_w))
11101110   MCFG_MICROTOUCH_TOUCH_CB(meritm_state, meritm_touch_coord_transform)
11111111MACHINE_CONFIG_END
11121112
r30677r30678
11231123   MCFG_MACHINE_START_OVERRIDE(meritm_state,meritm_crt260)
11241124
11251125   MCFG_DEVICE_ADD("ns16550", NS16550, UART_CLK)
1126   MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("microtouch", microtouch_serial_device, rx))
1127   MCFG_MICROTOUCH_SERIAL_ADD("microtouch", 9600, DEVWRITELINE("ns16550", ins8250_uart_device, rx_w))
1126   MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("microtouch", microtouch_device, rx))
1127   MCFG_MICROTOUCH_ADD("microtouch", 9600, DEVWRITELINE("ns16550", ins8250_uart_device, rx_w))
11281128   MCFG_MICROTOUCH_TOUCH_CB(meritm_state, meritm_touch_coord_transform)
11291129MACHINE_CONFIG_END
11301130
trunk/src/mame/drivers/tmaster.c
r30677r30678
133133      m_palette(*this, "palette") { }
134134
135135   required_device<cpu_device> m_maincpu;
136   optional_device<microtouch_serial_device> m_microtouch;
136   optional_device<microtouch_device> m_microtouch;
137137   required_shared_ptr<UINT16> m_regs;
138138   optional_shared_ptr<UINT16> m_galgames_ram;
139139   required_device<okim6295_device> m_oki;
r30677r30678
921921
922922   MCFG_MC68681_ADD( "duart68681", XTAL_8_664MHz / 2 /*??*/)
923923   MCFG_MC68681_IRQ_CALLBACK(WRITELINE(tmaster_state, duart_irq_handler))
924   MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("microtouch", microtouch_serial_device, rx))
924   MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("microtouch", microtouch_device, rx))
925925
926   MCFG_MICROTOUCH_SERIAL_ADD( "microtouch", 9600, DEVWRITELINE("duart68681", mc68681_device, rx_a_w) )
926   MCFG_MICROTOUCH_ADD( "microtouch", 9600, DEVWRITELINE("duart68681", mc68681_device, rx_a_w) )
927927
928928   MCFG_NVRAM_ADD_0FILL("nvram")
929929
trunk/src/mame/drivers/adp.c
r30677r30678
173173      { }
174174
175175   required_device<h63484_device> m_h63484;
176   required_device<microtouch_serial_device> m_microtouch;
176   required_device<microtouch_device> m_microtouch;
177177   required_device<cpu_device> m_maincpu;
178178   required_device<mc68681_device> m_duart;
179179   required_device<screen_device> m_screen;
r30677r30678
649649
650650   MCFG_MC68681_ADD( "duart68681", XTAL_8_664MHz / 2 )
651651   MCFG_MC68681_IRQ_CALLBACK(WRITELINE(adp_state, duart_irq_handler))
652   MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("microtouch", microtouch_serial_device, rx))
652   MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("microtouch", microtouch_device, rx))
653653   MCFG_MC68681_INPORT_CALLBACK(IOPORT("DSW1"))
654654
655   MCFG_MICROTOUCH_SERIAL_ADD( "microtouch", 9600, DEVWRITELINE("duart68681", mc68681_device, rx_a_w) )
655   MCFG_MICROTOUCH_ADD( "microtouch", 9600, DEVWRITELINE("duart68681", mc68681_device, rx_a_w) )
656656
657657   MCFG_SCREEN_ADD("screen", RASTER)
658658   MCFG_SCREEN_REFRESH_RATE(60)
trunk/src/mame/drivers/pcat_nit.c
r30677r30678
101101
102102   UINT8 *m_banked_nvram;
103103   required_device<ns16450_device> m_uart;
104   required_device<microtouch_serial_device> m_microtouch;
104   required_device<microtouch_device> m_microtouch;
105105
106106   DECLARE_WRITE8_MEMBER(pcat_nit_rombank_w);
107107   DECLARE_READ8_MEMBER(pcat_nit_io_r);
r30677r30678
229229
230230   MCFG_FRAGMENT_ADD( pcat_common )
231231   MCFG_DEVICE_ADD( "ns16450_0", NS16450, XTAL_1_8432MHz )
232   MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("microtouch", microtouch_serial_device, rx))
232   MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("microtouch", microtouch_device, rx))
233233   MCFG_INS8250_OUT_INT_CB(DEVWRITELINE("pic8259_1", pic8259_device, ir4_w))
234   MCFG_MICROTOUCH_SERIAL_ADD( "microtouch", 9600, DEVWRITELINE("ns16450_0", ins8250_uart_device, rx_w) ) // rate?
234   MCFG_MICROTOUCH_ADD( "microtouch", 9600, DEVWRITELINE("ns16450_0", ins8250_uart_device, rx_w) ) // rate?
235235
236236   MCFG_NVRAM_ADD_0FILL("nvram")
237237MACHINE_CONFIG_END
r30677r30678
248248
249249   MCFG_FRAGMENT_ADD( pcat_common )
250250   MCFG_DEVICE_ADD( "ns16450_0", NS16450, XTAL_1_8432MHz )
251   MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("microtouch", microtouch_serial_device, rx))
251   MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("microtouch", microtouch_device, rx))
252252   MCFG_INS8250_OUT_INT_CB(DEVWRITELINE("pic8259_1", pic8259_device, ir4_w))
253   MCFG_MICROTOUCH_SERIAL_ADD( "microtouch", 9600, DEVWRITELINE("ns16450_0", ins8250_uart_device, rx_w) ) // rate?
253   MCFG_MICROTOUCH_ADD( "microtouch", 9600, DEVWRITELINE("ns16450_0", ins8250_uart_device, rx_w) ) // rate?
254254
255255   MCFG_NVRAM_ADD_0FILL("nvram")
256256MACHINE_CONFIG_END
trunk/src/mame/drivers/magtouch.c
r30677r30678
9090         m_microtouch(*this, "microtouch"){ }
9191
9292   required_device<ns16450_device> m_uart;
93   required_device<microtouch_serial_device> m_microtouch;
93   required_device<microtouch_device> m_microtouch;
9494
9595   DECLARE_READ8_MEMBER(magtouch_io_r);
9696   DECLARE_WRITE8_MEMBER(magtouch_io_w);
r30677r30678
175175
176176   MCFG_FRAGMENT_ADD( pcat_common )
177177   MCFG_DEVICE_ADD( "ns16450_0", NS16450, XTAL_1_8432MHz )
178   MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("microtouch", microtouch_serial_device, rx))
178   MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("microtouch", microtouch_device, rx))
179179   MCFG_INS8250_OUT_INT_CB(DEVWRITELINE("pic8259_1", pic8259_device, ir4_w))
180   MCFG_MICROTOUCH_SERIAL_ADD( "microtouch", 9600, DEVWRITELINE("ns16450_0", ins8250_uart_device, rx_w) ) // rate?
180   MCFG_MICROTOUCH_ADD( "microtouch", 9600, DEVWRITELINE("ns16450_0", ins8250_uart_device, rx_w) ) // rate?
181181MACHINE_CONFIG_END
182182
183183
trunk/src/emu/machine/microtch.c
r30677r30678
1515
1616const device_type MICROTOUCH = &device_creator<microtouch_device>;
1717
18microtouch_device::microtouch_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
19   : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
20   m_out_tx_func(*this),
18microtouch_device::microtouch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
19   device_t(mconfig, MICROTOUCH, "Microtouch Touchscreen", tag, owner, clock, "microtouch", __FILE__),
20   device_serial_interface(mconfig, *this),
21   m_out_stx_func(*this),
2122   m_touch(*this, "TOUCH"),
2223   m_touchx(*this, "TOUCH_X"),
2324   m_touchy(*this, "TOUCH_Y")
2425{
2526}
2627
27microtouch_device::microtouch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
28   : device_t(mconfig, MICROTOUCH, "Microtouch Touchscreen", tag, owner, clock, "microtouch", __FILE__),
29   m_out_tx_func(*this),
30   m_touch(*this, "TOUCH"),
31   m_touchx(*this, "TOUCH_X"),
32   m_touchy(*this, "TOUCH_Y")
33{
34}
35
3628int microtouch_device::check_command( const char* commandtocheck, int command_len, UINT8* command_data )
3729{
3830   if ( (command_len == (strlen(commandtocheck) + 2)) &&
r30677r30678
117109
118110void microtouch_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
119111{
112   if(id)
113   {
114      device_serial_interface::device_timer(timer, id, param, ptr);
115      return;
116   }
117
120118   if ( m_tx_buffer_ptr < m_tx_buffer_num )
121119   {
122      tx( m_tx_buffer[m_tx_buffer_ptr++] );
120      m_output = m_tx_buffer[m_tx_buffer_ptr++];
121      m_output_valid = true;
122      if(is_transmit_register_empty())
123         tra_complete();
124
123125      if ( m_tx_buffer_ptr == m_tx_buffer_num )
124126      {
125127         m_tx_buffer_ptr = m_tx_buffer_num = 0;
r30677r30678
190192   save_item(NAME(m_tx_buffer_ptr));
191193   save_item(NAME(m_format));
192194   save_item(NAME(m_mode));
193   m_out_tx_func.resolve_safe();
195   set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); //8N1?
196   set_tra_rate(clock());
197   set_rcv_rate(clock());
198   m_out_stx_func.resolve_safe();
199   m_output_valid = false;
200
201   save_item(NAME(m_output_valid));
202   save_item(NAME(m_output));
194203}
195204
196205
197WRITE8_MEMBER(microtouch_device::rx)
206void microtouch_device::rcv_complete()
198207{
199   m_rx_buffer[m_rx_buffer_ptr] = data;
208   receive_register_extract();
209   m_rx_buffer[m_rx_buffer_ptr] = get_received_char();
200210   m_rx_buffer_ptr++;
201211   if(m_rx_buffer_ptr == 16)
202212      return;
r30677r30678
280290   return INPUT_PORTS_NAME(microtouch);
281291}
282292
283const device_type MICROTOUCH_SERIAL = &device_creator<microtouch_serial_device>;
284
285microtouch_serial_device::microtouch_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
286   : microtouch_device(mconfig, MICROTOUCH_SERIAL, "Microtouch Serial Touchscreen", tag, owner, clock, "microtouch_serial", __FILE__),
287   device_serial_interface(mconfig, *this),
288   m_out_stx_func(*this)
293void microtouch_device::tra_callback()
289294{
290}
291
292void microtouch_serial_device::device_start()
293{
294   microtouch_device::device_start();
295   set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); //8N1?
296   set_tra_rate(clock());
297   set_rcv_rate(clock());
298   m_out_stx_func.resolve_safe();
299   m_output_valid = false;
300
301   save_item(NAME(m_output_valid));
302   save_item(NAME(m_output));
303}
304
305void microtouch_serial_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
306{
307   if(id)
308      device_serial_interface::device_timer(timer, id, param, ptr);
309   else
310      microtouch_device::device_timer(timer, id, param, ptr);
311}
312
313void microtouch_serial_device::tx(UINT8 data)
314{
315   m_output = data;
316   m_output_valid = true;
317   if(is_transmit_register_empty())
318      tra_complete();
319}
320
321void microtouch_serial_device::tra_callback()
322{
323295   m_out_stx_func(transmit_register_get_data_bit());
324296}
325297
326void microtouch_serial_device::tra_complete()
298void microtouch_device::tra_complete()
327299{
328300   if(m_output_valid)
329301   {
r30677r30678
331303      m_output_valid = false;
332304   }
333305}
334
335void microtouch_serial_device::rcv_complete()
336{
337   receive_register_extract();
338   microtouch_device::rx(machine().driver_data()->generic_space(), 0, get_received_char());
339}
trunk/src/emu/machine/microtch.h
r30677r30678
55
66
77class microtouch_device :
8      public device_t
8      public device_t,
9      public device_serial_interface
910{
1011public:
1112   microtouch_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
1213   microtouch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
13   template<class _Object> static devcb_base &static_set_tx_callback(device_t &device, _Object object) { return downcast<microtouch_device &>(device).m_out_tx_func.set_callback(object); }
14   template<class _Object> static devcb_base &static_set_stx_callback(device_t &device, _Object object) { return downcast<microtouch_device &>(device).m_out_stx_func.set_callback(object); }
1415
1516   virtual ioport_constructor device_input_ports() const;
16   DECLARE_WRITE8_MEMBER(rx);
17   DECLARE_WRITE_LINE_MEMBER(rx) { device_serial_interface::rx_w(state); }
1718   DECLARE_INPUT_CHANGED_MEMBER(touch);
1819
1920   typedef delegate<int (int *, int *)> touch_cb;
r30677r30678
2122protected:
2223   virtual void device_start();
2324   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
24   virtual void tx(UINT8 data) { m_out_tx_func(data); }
25   emu_timer*  m_timer;
25   virtual void tra_callback();
26   virtual void tra_complete();
27   virtual void rcv_complete();
2628private:
2729   int check_command( const char* commandtocheck, int command_len, UINT8* command_data );
2830   void send_format_table_packet(UINT8 flag, int x, int y);
r30677r30678
5254   int         m_last_touch_state;
5355   int         m_last_x;
5456   int         m_last_y;
55   devcb_write8 m_out_tx_func;
5657   touch_cb m_out_touch_cb;
58   devcb_write_line m_out_stx_func;
5759   required_ioport m_touch;
5860   required_ioport m_touchx;
5961   required_ioport m_touchy;
60};
61
62extern const device_type MICROTOUCH;
63
64#define MCFG_MICROTOUCH_ADD(_tag, _devcb) \
65   MCFG_DEVICE_ADD(_tag, MICROTOUCH, 0) \
66   devcb = &microtouch_serial_device::static_set_tx_callback(*device, DEVCB_##_devcb);
67
68
69class microtouch_serial_device
70   : public microtouch_device,
71      public device_serial_interface
72{
73public:
74   microtouch_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
75   template<class _Object> static devcb_base &static_set_stx_callback(device_t &device, _Object object) { return downcast<microtouch_serial_device &>(device).m_out_stx_func.set_callback(object); }
76
77   DECLARE_WRITE_LINE_MEMBER(rx) { device_serial_interface::rx_w(state); }
78protected:
79   virtual void device_start();
80   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
81   virtual void tx(UINT8 data);
82   virtual void tra_callback();
83   virtual void tra_complete();
84   virtual void rcv_complete();
85private:
62   emu_timer*  m_timer;
8663   bool m_output_valid;
8764   UINT8 m_output;
88   devcb_write_line m_out_stx_func;
8965};
9066
91extern const device_type MICROTOUCH_SERIAL;
67extern const device_type MICROTOUCH;
9268
93#define MCFG_MICROTOUCH_SERIAL_ADD(_tag, _clock, _devcb) \
94   MCFG_DEVICE_ADD(_tag, MICROTOUCH_SERIAL, _clock) \
95   devcb = &microtouch_serial_device::static_set_stx_callback(*device, DEVCB_##_devcb);
69#define MCFG_MICROTOUCH_ADD(_tag, _clock, _devcb) \
70   MCFG_DEVICE_ADD(_tag, MICROTOUCH, _clock) \
71   devcb = &microtouch_device::static_set_stx_callback(*device, DEVCB_##_devcb);
9672
9773#define MCFG_MICROTOUCH_TOUCH_CB(_class, _touch_cb) \
9874   microtouch_device::static_set_touch_callback(*device, microtouch_device::touch_cb(FUNC(_class::_touch_cb), (_class *)owner));

Previous 199869 Revisions Next


© 1997-2024 The MAME Team