summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/cdp1852.h
blob: 7073ee77b3fc9d8c9ea2eaef9b3e7a5e6f3ba9b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**********************************************************************

    RCA CDP1852 Byte-Wide Input/Output Port emulation

    Copyright MESS Team.
    Visit http://mamedev.org for licensing and usage restrictions.

**********************************************************************
                            _____   _____
              CSI/_CSI   1 |*    \_/     | 24  Vdd
                  MODE   2 |             | 23  _SR/SR
                   DI0   3 |             | 22  DI7
                   DO0   4 |             | 21  DO7
                   DI1   5 |             | 20  DI6
                   DO1   6 |   CDP1852   | 19  DO6
                   DI2   7 |             | 18  DI5
                   DO2   8 |             | 17  DO5
                   DI3   9 |             | 16  DI4
                   DO3  10 |             | 15  DO4
                 CLOCK  11 |             | 14  _CLEAR
                   Vss  12 |_____________| 13  CS2

**********************************************************************/

#ifndef __CDP1852__
#define __CDP1852__

#include "devlegcy.h"


/***************************************************************************
    MACROS / CONSTANTS
***************************************************************************/

#define CDP1852_CLOCK_HIGH	0

DECLARE_LEGACY_DEVICE(CDP1852, cdp1852);

#define MDRV_CDP1852_ADD(_tag, _clock, _config) \
	MDRV_DEVICE_ADD(_tag, CDP1852, _clock) \
	MDRV_DEVICE_CONFIG(_config)

#define CDP1852_INTERFACE(_name) \
	const cdp1852_interface (_name)=

/***************************************************************************
    TYPE DEFINITIONS
***************************************************************************/

enum _cdp1852_mode {
	CDP1852_MODE_INPUT = 0,
	CDP1852_MODE_OUTPUT
};
typedef enum _cdp1852_mode cdp1852_mode;

typedef struct _cdp1852_interface cdp1852_interface;
struct _cdp1852_interface
{
	int mode;				/* operation mode */

	/* this gets called for every external data read */
	devcb_read8				in_data_func;

	/* this gets called for every external data write */
	devcb_write8			out_data_func;

	/* this gets called for every change of the SR pin (pin 23) */
	devcb_write_line		out_sr_func;
};

/***************************************************************************
    PROTOTYPES
***************************************************************************/

/* data access */
READ8_DEVICE_HANDLER( cdp1852_data_r );
WRITE8_DEVICE_HANDLER( cdp1852_data_w );

#endif