Previous 15994 Revisions Next

r4258 Friday 13th February, 2009 at 10:51:08 UTC by Dirk Best
[CENTRONICS] Fixed svn property for new files
[src/mess/machine]ctronics.c ctronics.h

src/mess/machine/ctronics.c
r4257r4258
1/***************************************************************************
2 
3    Centronics printer interface
4 
5***************************************************************************/
6 
7#include "driver.h"
8#include "ctronics.h"
9 
10 
11/***************************************************************************
12    FUNCTION PROTOTYPES
13***************************************************************************/
14 
15static TIMER_CALLBACK( ack_callback );
16static TIMER_CALLBACK( busy_callback );
17 
18 
19/***************************************************************************
20    TYPE DEFINITIONS
21***************************************************************************/
22 
23typedef struct _centronics_state centronics_state;
24struct _centronics_state
25{
26   const device_config *printer;
27 
28   devcb_resolved_write_line out_ack_func;
29   devcb_resolved_write_line out_busy_func;
30   devcb_resolved_write_line out_not_busy_func;
31 
32   int strobe;
33   int busy;
34   int ack;
35   int auto_fd;
36   int pe;
37   int fault;
38 
39   UINT8 data;
40};
41 
42 
43/*****************************************************************************
44    INLINE FUNCTIONS
45*****************************************************************************/
46 
47INLINE centronics_state *get_safe_token(const device_config *device)
48{
49   assert(device != NULL);
50   assert(device->token != NULL);
51   assert(device->type == CENTRONICS);
52 
53   return (centronics_state *)device->token;
54}
55 
56 
57/*****************************************************************************
58    GLOBAL VARIABLES
59*****************************************************************************/
60 
61const centronics_interface standard_centronics =
62{
63   FALSE,
64   DEVCB_NULL,
65   DEVCB_NULL,
66   DEVCB_NULL
67};
68 
69 
70/*****************************************************************************
71    DEVICE INTERFACE
72*****************************************************************************/
73 
74static DEVICE_START( centronics )
75{
76   centronics_state *centronics = get_safe_token(device);
77   const centronics_interface *intf = device->static_config;
78 
79   /* validate some basic stuff */
80   assert(device->static_config != NULL);
81 
82   /* get printer device */
83   centronics->printer = devtag_get_device(device->machine, PRINTER, device->tag);
84   assert(centronics->printer != NULL);
85 
86   /* make sure it's running */
87   if (!centronics->printer->started)
88   {
89      device_delay_init(device);
90      return;
91   }
92 
93   /* resolve callbacks */
94   devcb_resolve_write_line(&centronics->out_ack_func, &intf->out_ack_func, device);
95   devcb_resolve_write_line(&centronics->out_busy_func, &intf->out_busy_func, device);
96   devcb_resolve_write_line(&centronics->out_not_busy_func, &intf->out_not_busy_func, device);
97 
98   /* register for state saving */
99   state_save_register_device_item(device, 0, centronics->auto_fd);
100   state_save_register_device_item(device, 0, centronics->strobe);
101   state_save_register_device_item(device, 0, centronics->busy);
102   state_save_register_device_item(device, 0, centronics->ack);
103   state_save_register_device_item(device, 0, centronics->data);
104}
105 
106static DEVICE_RESET( centronics )
107{
108}
109 
110static DEVICE_SET_INFO( centronics )
111{
112   switch (state)
113   {
114      /* no parameters to set */
115   }
116}
117 
118DEVICE_GET_INFO( centronics )
119{
120   switch (state)
121   {
122      /* --- the following bits of info are returned as 64-bit signed integers --- */
123      case DEVINFO_INT_TOKEN_BYTES:         info->i = sizeof(centronics_state);      break;
124      case DEVINFO_INT_INLINE_CONFIG_BYTES:   info->i = 0;                     break;
125      case DEVINFO_INT_CLASS:               info->i = DEVICE_CLASS_PERIPHERAL;      break;
126 
127      /* --- the following bits of info are returned as pointers to data or functions --- */
128      case DEVINFO_FCT_SET_INFO:            info->set_info = DEVICE_SET_INFO_NAME( centronics );   break;
129      case DEVINFO_FCT_START:               info->start = DEVICE_START_NAME( centronics );         break;
130      case DEVINFO_FCT_STOP:               /* Nothing */                              break;
131      case DEVINFO_FCT_RESET:               info->reset = DEVICE_RESET_NAME( centronics );         break;
132 
133      /* --- the following bits of info are returned as NULL-terminated strings --- */
134      case DEVINFO_STR_NAME:               strcpy(info->s, "Centronics");         break;
135      case DEVINFO_STR_FAMILY:            strcpy(info->s, "Centronics");         break;
136      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");               break;
137      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
138      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright MESS Team");   break;
139   }
140}
141 
142 
143/***************************************************************************
144    IMPLEMENTATION
145***************************************************************************/
146 
147/*-------------------------------------------------
148    centronics_printer_online - callback that
149    sets us busy when the printer goes offline
150-------------------------------------------------*/
151 
152void centronics_printer_online(const device_config *device, int state)
153{
154   const device_config *c = devtag_get_device(device->machine, CENTRONICS, device->tag);
155   centronics_state *centronics = get_safe_token(c);
156 
157   /* when going online, set PE and FAULT high and BUSY low */
158   centronics->pe = state;
159   centronics->fault = state;
160   centronics->busy = !state;
161}
162 
163 
164static TIMER_CALLBACK( ack_callback )
165{
166   centronics_state *centronics = (centronics_state *)ptr;
167 
168   /* signal change */
169   devcb_call_write_line(&centronics->out_ack_func, param);
170   centronics->ack = param;
171 
172   if (param == FALSE)
173   {
174      /* data is now ready, output it */
175      printer_output(centronics->printer, centronics->data);
176 
177      /* timer to return BUSY to low, 5us max */
178      timer_set(machine, ATTOTIME_IN_USEC(4), ptr, FALSE, busy_callback);
179   }
180}
181 
182 
183static TIMER_CALLBACK( busy_callback )
184{
185   centronics_state *centronics = (centronics_state *)ptr;
186 
187   /* signal change */
188   devcb_call_write_line(&centronics->out_busy_func, param);
189   devcb_call_write_line(&centronics->out_not_busy_func, !param);
190   centronics->busy = param;
191 
192   if (param == TRUE)
193   {
194      /* timer to turn ACK low to receive data */
195      timer_set(machine, ATTOTIME_IN_NSEC(250), ptr, FALSE, ack_callback);
196   }
197   else
198   {
199      /* timer to return ACK to high state, 5us max */
200      timer_set(machine, ATTOTIME_IN_USEC(4), ptr, TRUE, ack_callback);
201   }
202}
203 
204 
205/*-------------------------------------------------
206    centronics_data_w - write print data
207-------------------------------------------------*/
208 
209WRITE8_DEVICE_HANDLER( centronics_data_w )
210{
211   centronics_state *centronics = get_safe_token(device);
212   centronics->data = data;
213}
214 
215 
216/*-------------------------------------------------
217    set_line - helper to set individual bits
218-------------------------------------------------*/
219 
220static void set_line(const device_config *device, int line, int state)
221{
222   centronics_state *centronics = get_safe_token(device);
223 
224   if (state)
225      centronics->data |= 1 << line;
226   else
227      centronics->data &= ~(1 << line);
228}
229 
230 
231/*-------------------------------------------------
232    centronics_dx_w - write line dx print data
233-------------------------------------------------*/
234 
235WRITE_LINE_DEVICE_HANDLER( centronics_d0_w ) { set_line(device, 0, state); }
236WRITE_LINE_DEVICE_HANDLER( centronics_d1_w ) { set_line(device, 1, state); }
237WRITE_LINE_DEVICE_HANDLER( centronics_d2_w ) { set_line(device, 2, state); }
238WRITE_LINE_DEVICE_HANDLER( centronics_d3_w ) { set_line(device, 3, state); }
239WRITE_LINE_DEVICE_HANDLER( centronics_d4_w ) { set_line(device, 4, state); }
240WRITE_LINE_DEVICE_HANDLER( centronics_d5_w ) { set_line(device, 5, state); }
241WRITE_LINE_DEVICE_HANDLER( centronics_d6_w ) { set_line(device, 6, state); }
242WRITE_LINE_DEVICE_HANDLER( centronics_d7_w ) { set_line(device, 7, state); }
243 
244 
245/*-------------------------------------------------
246    centronics_strobe_w - signal that data is
247    ready
248-------------------------------------------------*/
249 
250WRITE_LINE_DEVICE_HANDLER( centronics_strobe_w )
251{
252   centronics_state *centronics = get_safe_token(device);
253 
254   /* look for a high -> low transition */
255   if (centronics->strobe == TRUE && state == FALSE && centronics->busy == FALSE)
256   {
257      /* STROBE has gone low, data is ready */
258      timer_set(device->machine, ATTOTIME_IN_NSEC(250), centronics, TRUE, busy_callback);
259   }
260 
261   centronics->strobe = state;
262}
263 
264 
265/*-------------------------------------------------
266    centronics_prime_w - initialize and reset
267    printer (centronics mode)
268-------------------------------------------------*/
269 
270WRITE_LINE_DEVICE_HANDLER( centronics_prime_w )
271{
272   assert(((const centronics_interface *)device->static_config)->is_ibmpc == FALSE);
273 
274   /* reset printer if line is low */
275   if (state == FALSE)
276      device_reset_centronics(device);
277}
278 
279 
280/*-------------------------------------------------
281    centronics_init_w - initialize and reset
282    printer (ibm mode)
283-------------------------------------------------*/
284 
285WRITE_LINE_DEVICE_HANDLER( centronics_init_w )
286{
287   assert(((const centronics_interface *)device->static_config)->is_ibmpc == TRUE);
288 
289   /* reset printer if line is low */
290   if (state == FALSE)
291      device_reset_centronics(device);
292}
293 
294 
295/*-------------------------------------------------
296    centronics_autofeed_w - auto line feed
297-------------------------------------------------*/
298 
299WRITE_LINE_DEVICE_HANDLER( centronics_autofeed_w )
300{
301   centronics_state *centronics = get_safe_token(device);
302   assert(((const centronics_interface *)device->static_config)->is_ibmpc == TRUE);
303 
304   centronics->auto_fd = state;
305}
306 
307 
308/*-------------------------------------------------
309    centronics_ack_r - return the state of the
310    ack line
311-------------------------------------------------*/
312 
313READ_LINE_DEVICE_HANDLER( centronics_ack_r )
314{
315   centronics_state *centronics = get_safe_token(device);
316   return centronics->ack;
317}
318 
319 
320/*-------------------------------------------------
321    centronics_busy_r - return the state of the
322    busy line
323-------------------------------------------------*/
324 
325READ_LINE_DEVICE_HANDLER( centronics_busy_r )
326{
327   centronics_state *centronics = get_safe_token(device);
328   return centronics->busy;
329}
330 
331 
332/*-------------------------------------------------
333    centronics_pe_r - return the state of the
334    pe line
335-------------------------------------------------*/
336 
337READ_LINE_DEVICE_HANDLER( centronics_pe_r )
338{
339   centronics_state *centronics = get_safe_token(device);
340   return centronics->pe;
341}
342 
343 
344/*-------------------------------------------------
345    centronics_not_busy_r - return the state of the
346    not busy line
347-------------------------------------------------*/
348 
349READ_LINE_DEVICE_HANDLER( centronics_not_busy_r )
350{
351   centronics_state *centronics = get_safe_token(device);
352   return !centronics->busy;
353}
354 
355 
356/*-------------------------------------------------
357    centronics_not_busy_r - return the state of the
358    vcc line
359-------------------------------------------------*/
360 
361READ_LINE_DEVICE_HANDLER( centronics_vcc_r )
362{
363   /* always return high */
364   return TRUE;
365}
366 
367 
368/*-------------------------------------------------
369    centronics_fault_r - return the state of the
370    fault line
371-------------------------------------------------*/
372 
373READ_LINE_DEVICE_HANDLER( centronics_fault_r )
374{
375   centronics_state *centronics = get_safe_token(device);
376   return centronics->fault;
377}
1/***************************************************************************
2
3    Centronics printer interface
4
5***************************************************************************/
6
7#include "driver.h"
8#include "ctronics.h"
9
10
11/***************************************************************************
12    FUNCTION PROTOTYPES
13***************************************************************************/
14
15static TIMER_CALLBACK( ack_callback );
16static TIMER_CALLBACK( busy_callback );
17
18
19/***************************************************************************
20    TYPE DEFINITIONS
21***************************************************************************/
22
23typedef struct _centronics_state centronics_state;
24struct _centronics_state
25{
26   const device_config *printer;
27
28   devcb_resolved_write_line out_ack_func;
29   devcb_resolved_write_line out_busy_func;
30   devcb_resolved_write_line out_not_busy_func;
31
32   int strobe;
33   int busy;
34   int ack;
35   int auto_fd;
36   int pe;
37   int fault;
38
39   UINT8 data;
40};
41
42
43/*****************************************************************************
44    INLINE FUNCTIONS
45*****************************************************************************/
46
47INLINE centronics_state *get_safe_token(const device_config *device)
48{
49   assert(device != NULL);
50   assert(device->token != NULL);
51   assert(device->type == CENTRONICS);
52
53   return (centronics_state *)device->token;
54}
55
56
57/*****************************************************************************
58    GLOBAL VARIABLES
59*****************************************************************************/
60
61const centronics_interface standard_centronics =
62{
63   FALSE,
64   DEVCB_NULL,
65   DEVCB_NULL,
66   DEVCB_NULL
67};
68
69
70/*****************************************************************************
71    DEVICE INTERFACE
72*****************************************************************************/
73
74static DEVICE_START( centronics )
75{
76   centronics_state *centronics = get_safe_token(device);
77   const centronics_interface *intf = device->static_config;
78
79   /* validate some basic stuff */
80   assert(device->static_config != NULL);
81
82   /* get printer device */
83   centronics->printer = devtag_get_device(device->machine, PRINTER, device->tag);
84   assert(centronics->printer != NULL);
85
86   /* make sure it's running */
87   if (!centronics->printer->started)
88   {
89      device_delay_init(device);
90      return;
91   }
92
93   /* resolve callbacks */
94   devcb_resolve_write_line(&centronics->out_ack_func, &intf->out_ack_func, device);
95   devcb_resolve_write_line(&centronics->out_busy_func, &intf->out_busy_func, device);
96   devcb_resolve_write_line(&centronics->out_not_busy_func, &intf->out_not_busy_func, device);
97
98   /* register for state saving */
99   state_save_register_device_item(device, 0, centronics->auto_fd);
100   state_save_register_device_item(device, 0, centronics->strobe);
101   state_save_register_device_item(device, 0, centronics->busy);
102   state_save_register_device_item(device, 0, centronics->ack);
103   state_save_register_device_item(device, 0, centronics->data);
104}
105
106static DEVICE_RESET( centronics )
107{
108}
109
110static DEVICE_SET_INFO( centronics )
111{
112   switch (state)
113   {
114      /* no parameters to set */
115   }
116}
117
118DEVICE_GET_INFO( centronics )
119{
120   switch (state)
121   {
122      /* --- the following bits of info are returned as 64-bit signed integers --- */
123      case DEVINFO_INT_TOKEN_BYTES:         info->i = sizeof(centronics_state);      break;
124      case DEVINFO_INT_INLINE_CONFIG_BYTES:   info->i = 0;                     break;
125      case DEVINFO_INT_CLASS:               info->i = DEVICE_CLASS_PERIPHERAL;      break;
126
127      /* --- the following bits of info are returned as pointers to data or functions --- */
128      case DEVINFO_FCT_SET_INFO:            info->set_info = DEVICE_SET_INFO_NAME( centronics );   break;
129      case DEVINFO_FCT_START:               info->start = DEVICE_START_NAME( centronics );         break;
130      case DEVINFO_FCT_STOP:               /* Nothing */                              break;
131      case DEVINFO_FCT_RESET:               info->reset = DEVICE_RESET_NAME( centronics );         break;
132
133      /* --- the following bits of info are returned as NULL-terminated strings --- */
134      case DEVINFO_STR_NAME:               strcpy(info->s, "Centronics");         break;
135      case DEVINFO_STR_FAMILY:            strcpy(info->s, "Centronics");         break;
136      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");               break;
137      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
138      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright MESS Team");   break;
139   }
140}
141
142
143/***************************************************************************
144    IMPLEMENTATION
145***************************************************************************/
146
147/*-------------------------------------------------
148    centronics_printer_online - callback that
149    sets us busy when the printer goes offline
150-------------------------------------------------*/
151
152void centronics_printer_online(const device_config *device, int state)
153{
154   const device_config *c = devtag_get_device(device->machine, CENTRONICS, device->tag);
155   centronics_state *centronics = get_safe_token(c);
156
157   /* when going online, set PE and FAULT high and BUSY low */
158   centronics->pe = state;
159   centronics->fault = state;
160   centronics->busy = !state;
161}
162
163
164static TIMER_CALLBACK( ack_callback )
165{
166   centronics_state *centronics = (centronics_state *)ptr;
167
168   /* signal change */
169   devcb_call_write_line(&centronics->out_ack_func, param);
170   centronics->ack = param;
171
172   if (param == FALSE)
173   {
174      /* data is now ready, output it */
175      printer_output(centronics->printer, centronics->data);
176
177      /* timer to return BUSY to low, 5us max */
178      timer_set(machine, ATTOTIME_IN_USEC(4), ptr, FALSE, busy_callback);
179   }
180}
181
182
183static TIMER_CALLBACK( busy_callback )
184{
185   centronics_state *centronics = (centronics_state *)ptr;
186
187   /* signal change */
188   devcb_call_write_line(&centronics->out_busy_func, param);
189   devcb_call_write_line(&centronics->out_not_busy_func, !param);
190   centronics->busy = param;
191
192   if (param == TRUE)
193   {
194      /* timer to turn ACK low to receive data */
195      timer_set(machine, ATTOTIME_IN_NSEC(250), ptr, FALSE, ack_callback);
196   }
197   else
198   {
199      /* timer to return ACK to high state, 5us max */
200      timer_set(machine, ATTOTIME_IN_USEC(4), ptr, TRUE, ack_callback);
201   }
202}
203
204
205/*-------------------------------------------------
206    centronics_data_w - write print data
207-------------------------------------------------*/
208
209WRITE8_DEVICE_HANDLER( centronics_data_w )
210{
211   centronics_state *centronics = get_safe_token(device);
212   centronics->data = data;
213}
214
215
216/*-------------------------------------------------
217    set_line - helper to set individual bits
218-------------------------------------------------*/
219
220static void set_line(const device_config *device, int line, int state)
221{
222   centronics_state *centronics = get_safe_token(device);
223
224   if (state)
225      centronics->data |= 1 << line;
226   else
227      centronics->data &= ~(1 << line);
228}
229
230
231/*-------------------------------------------------
232    centronics_dx_w - write line dx print data
233-------------------------------------------------*/
234
235WRITE_LINE_DEVICE_HANDLER( centronics_d0_w ) { set_line(device, 0, state); }
236WRITE_LINE_DEVICE_HANDLER( centronics_d1_w ) { set_line(device, 1, state); }
237WRITE_LINE_DEVICE_HANDLER( centronics_d2_w ) { set_line(device, 2, state); }
238WRITE_LINE_DEVICE_HANDLER( centronics_d3_w ) { set_line(device, 3, state); }
239WRITE_LINE_DEVICE_HANDLER( centronics_d4_w ) { set_line(device, 4, state); }
240WRITE_LINE_DEVICE_HANDLER( centronics_d5_w ) { set_line(device, 5, state); }
241WRITE_LINE_DEVICE_HANDLER( centronics_d6_w ) { set_line(device, 6, state); }
242WRITE_LINE_DEVICE_HANDLER( centronics_d7_w ) { set_line(device, 7, state); }
243
244
245/*-------------------------------------------------
246    centronics_strobe_w - signal that data is
247    ready
248-------------------------------------------------*/
249
250WRITE_LINE_DEVICE_HANDLER( centronics_strobe_w )
251{
252   centronics_state *centronics = get_safe_token(device);
253
254   /* look for a high -> low transition */
255   if (centronics->strobe == TRUE && state == FALSE && centronics->busy == FALSE)
256   {
257      /* STROBE has gone low, data is ready */
258      timer_set(device->machine, ATTOTIME_IN_NSEC(250), centronics, TRUE, busy_callback);
259   }
260
261   centronics->strobe = state;
262}
263
264
265/*-------------------------------------------------
266    centronics_prime_w - initialize and reset
267    printer (centronics mode)
268-------------------------------------------------*/
269
270WRITE_LINE_DEVICE_HANDLER( centronics_prime_w )
271{
272   assert(((const centronics_interface *)device->static_config)->is_ibmpc == FALSE);
273
274   /* reset printer if line is low */
275   if (state == FALSE)
276      device_reset_centronics(device);
277}
278
279
280/*-------------------------------------------------
281    centronics_init_w - initialize and reset
282    printer (ibm mode)
283-------------------------------------------------*/
284
285WRITE_LINE_DEVICE_HANDLER( centronics_init_w )
286{
287   assert(((const centronics_interface *)device->static_config)->is_ibmpc == TRUE);
288
289   /* reset printer if line is low */
290   if (state == FALSE)
291      device_reset_centronics(device);
292}
293
294
295/*-------------------------------------------------
296    centronics_autofeed_w - auto line feed
297-------------------------------------------------*/
298
299WRITE_LINE_DEVICE_HANDLER( centronics_autofeed_w )
300{
301   centronics_state *centronics = get_safe_token(device);
302   assert(((const centronics_interface *)device->static_config)->is_ibmpc == TRUE);
303
304   centronics->auto_fd = state;
305}
306
307
308/*-------------------------------------------------
309    centronics_ack_r - return the state of the
310    ack line
311-------------------------------------------------*/
312
313READ_LINE_DEVICE_HANDLER( centronics_ack_r )
314{
315   centronics_state *centronics = get_safe_token(device);
316   return centronics->ack;
317}
318
319
320/*-------------------------------------------------
321    centronics_busy_r - return the state of the
322    busy line
323-------------------------------------------------*/
324
325READ_LINE_DEVICE_HANDLER( centronics_busy_r )
326{
327   centronics_state *centronics = get_safe_token(device);
328   return centronics->busy;
329}
330
331
332/*-------------------------------------------------
333    centronics_pe_r - return the state of the
334    pe line
335-------------------------------------------------*/
336
337READ_LINE_DEVICE_HANDLER( centronics_pe_r )
338{
339   centronics_state *centronics = get_safe_token(device);
340   return centronics->pe;
341}
342
343
344/*-------------------------------------------------
345    centronics_not_busy_r - return the state of the
346    not busy line
347-------------------------------------------------*/
348
349READ_LINE_DEVICE_HANDLER( centronics_not_busy_r )
350{
351   centronics_state *centronics = get_safe_token(device);
352   return !centronics->busy;
353}
354
355
356/*-------------------------------------------------
357    centronics_not_busy_r - return the state of the
358    vcc line
359-------------------------------------------------*/
360
361READ_LINE_DEVICE_HANDLER( centronics_vcc_r )
362{
363   /* always return high */
364   return TRUE;
365}
366
367
368/*-------------------------------------------------
369    centronics_fault_r - return the state of the
370    fault line
371-------------------------------------------------*/
372
373READ_LINE_DEVICE_HANDLER( centronics_fault_r )
374{
375   centronics_state *centronics = get_safe_token(device);
376   return centronics->fault;
377}
src/mess/machine/ctronics.h
r4257r4258
1/***************************************************************************
2 
3    Centronics printer interface
4 
5***************************************************************************/
6 
7#ifndef __CTRONICS_H__
8#define __CTRONICS_H__
9 
10#include "devcb.h"
11#include "devices/printer.h"
12 
13 
14/***************************************************************************
15    TYPE DEFINITIONS
16***************************************************************************/
17 
18typedef struct _centronics_interface centronics_interface;
19struct _centronics_interface
20{
21   int is_ibmpc;
22 
23   devcb_write_line out_ack_func;
24   devcb_write_line out_busy_func;
25   devcb_write_line out_not_busy_func;
26};
27 
28 
29/***************************************************************************
30    FUNCTION PROTOTYPES
31***************************************************************************/
32 
33DEVICE_GET_INFO( centronics );
34 
35WRITE8_DEVICE_HANDLER( centronics_data_w );
36 
37/* access to the individual bits */
38WRITE_LINE_DEVICE_HANDLER( centronics_d0_w );
39WRITE_LINE_DEVICE_HANDLER( centronics_d1_w );
40WRITE_LINE_DEVICE_HANDLER( centronics_d2_w );
41WRITE_LINE_DEVICE_HANDLER( centronics_d3_w );
42WRITE_LINE_DEVICE_HANDLER( centronics_d4_w );
43WRITE_LINE_DEVICE_HANDLER( centronics_d5_w );
44WRITE_LINE_DEVICE_HANDLER( centronics_d6_w );
45WRITE_LINE_DEVICE_HANDLER( centronics_d7_w );
46 
47WRITE_LINE_DEVICE_HANDLER( centronics_strobe_w );
48WRITE_LINE_DEVICE_HANDLER( centronics_prime_w );
49WRITE_LINE_DEVICE_HANDLER( centronics_init_w );
50WRITE_LINE_DEVICE_HANDLER( centronics_autofeed_w );
51 
52READ_LINE_DEVICE_HANDLER( centronics_ack_r );
53READ_LINE_DEVICE_HANDLER( centronics_busy_r );
54READ_LINE_DEVICE_HANDLER( centronics_pe_r );
55READ_LINE_DEVICE_HANDLER( centronics_not_busy_r );
56READ_LINE_DEVICE_HANDLER( centronics_vcc_r );
57READ_LINE_DEVICE_HANDLER( centronics_fault_r );
58 
59/* callback for the printer device */
60void centronics_printer_online(const device_config *device, int state);
61 
62 
63/***************************************************************************
64    DEVICE CONFIGURATION MACROS
65***************************************************************************/
66 
67#define CENTRONICS DEVICE_GET_INFO_NAME(centronics)
68 
69#define MDRV_CENTRONICS_ADD(_tag, _intf) \
70   MDRV_PRINTER_ADD(_tag) \
71   MDRV_PRINTER_ONLINE(centronics_printer_online) \
72   MDRV_DEVICE_ADD(_tag, CENTRONICS, 0) \
73   MDRV_DEVICE_CONFIG(_intf)
74 
75#define MDRV_CENTRONICS_REMOVE(_tag) \
76   MDRV_PRINTER_REMOVE(_tag) \
77   MDRV_DEVICE_REMOVE(_tag, CENTRONICS)
78 
79 
80/***************************************************************************
81    DEFAULT INTERFACES
82***************************************************************************/
83 
84extern const centronics_interface standard_centronics;
85 
86 
87#endif /* __CTRONICS_H__ */
1/***************************************************************************
2
3    Centronics printer interface
4
5***************************************************************************/
6
7#ifndef __CTRONICS_H__
8#define __CTRONICS_H__
9
10#include "devcb.h"
11#include "devices/printer.h"
12
13
14/***************************************************************************
15    TYPE DEFINITIONS
16***************************************************************************/
17
18typedef struct _centronics_interface centronics_interface;
19struct _centronics_interface
20{
21   int is_ibmpc;
22
23   devcb_write_line out_ack_func;
24   devcb_write_line out_busy_func;
25   devcb_write_line out_not_busy_func;
26};
27
28
29/***************************************************************************
30    FUNCTION PROTOTYPES
31***************************************************************************/
32
33DEVICE_GET_INFO( centronics );
34
35WRITE8_DEVICE_HANDLER( centronics_data_w );
36
37/* access to the individual bits */
38WRITE_LINE_DEVICE_HANDLER( centronics_d0_w );
39WRITE_LINE_DEVICE_HANDLER( centronics_d1_w );
40WRITE_LINE_DEVICE_HANDLER( centronics_d2_w );
41WRITE_LINE_DEVICE_HANDLER( centronics_d3_w );
42WRITE_LINE_DEVICE_HANDLER( centronics_d4_w );
43WRITE_LINE_DEVICE_HANDLER( centronics_d5_w );
44WRITE_LINE_DEVICE_HANDLER( centronics_d6_w );
45WRITE_LINE_DEVICE_HANDLER( centronics_d7_w );
46
47WRITE_LINE_DEVICE_HANDLER( centronics_strobe_w );
48WRITE_LINE_DEVICE_HANDLER( centronics_prime_w );
49WRITE_LINE_DEVICE_HANDLER( centronics_init_w );
50WRITE_LINE_DEVICE_HANDLER( centronics_autofeed_w );
51
52READ_LINE_DEVICE_HANDLER( centronics_ack_r );
53READ_LINE_DEVICE_HANDLER( centronics_busy_r );
54READ_LINE_DEVICE_HANDLER( centronics_pe_r );
55READ_LINE_DEVICE_HANDLER( centronics_not_busy_r );
56READ_LINE_DEVICE_HANDLER( centronics_vcc_r );
57READ_LINE_DEVICE_HANDLER( centronics_fault_r );
58
59/* callback for the printer device */
60void centronics_printer_online(const device_config *device, int state);
61
62
63/***************************************************************************
64    DEVICE CONFIGURATION MACROS
65***************************************************************************/
66
67#define CENTRONICS DEVICE_GET_INFO_NAME(centronics)
68
69#define MDRV_CENTRONICS_ADD(_tag, _intf) \
70   MDRV_PRINTER_ADD(_tag) \
71   MDRV_PRINTER_ONLINE(centronics_printer_online) \
72   MDRV_DEVICE_ADD(_tag, CENTRONICS, 0) \
73   MDRV_DEVICE_CONFIG(_intf)
74
75#define MDRV_CENTRONICS_REMOVE(_tag) \
76   MDRV_PRINTER_REMOVE(_tag) \
77   MDRV_DEVICE_REMOVE(_tag, CENTRONICS)
78
79
80/***************************************************************************
81    DEFAULT INTERFACES
82***************************************************************************/
83
84extern const centronics_interface standard_centronics;
85
86
87#endif /* __CTRONICS_H__ */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team