summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/6840ptm.h
blob: c22bfea9b223a0e6ebe44d979126e2ff03964beb (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
/***************************************************************************

    Motorola 6840 (PTM)

    Programmable Timer Module

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

#ifndef __6840PTM_H__
#define __6840PTM_H__

#include "devcb.h"

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

#define PTM6840		DEVICE_GET_INFO_NAME(ptm6840)

#define MDRV_PTM6840_ADD(_tag, _config) \
	MDRV_DEVICE_ADD(_tag, PTM6840, 0) \
	MDRV_DEVICE_CONFIG(_config)

#define MDRV_PTM6840_REMOVE(_tag) \
	MDRV_DEVICE_REMOVE(_tag)

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


typedef struct _ptm6840_interface ptm6840_interface;
struct _ptm6840_interface
{
	int internal_clock;
	int external_clock[3];

	devcb_write8 out_func[3];	// function to call when output[idx] changes
	devcb_write_line irq_func;	// function called if IRQ line changes
};


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

/* device interface */
DEVICE_GET_INFO( ptm6840 );

int ptm6840_get_status( const device_config *device, int clock );	// get whether timer is enabled
int ptm6840_get_irq( const device_config *device );					// get IRQ state
UINT16 ptm6840_get_count( const device_config *device, int counter );// get counter value
void ptm6840_set_ext_clock( const device_config *device, int counter, int clock ); // set clock frequency
int ptm6840_get_ext_clock( const device_config *device, int counter );// get clock frequency

WRITE8_DEVICE_HANDLER( ptm6840_set_g1 );	// set gate1 state
WRITE8_DEVICE_HANDLER( ptm6840_set_g2 );	// set gate2 state
WRITE8_DEVICE_HANDLER( ptm6840_set_g3 );	// set gate3 state
WRITE8_DEVICE_HANDLER( ptm6840_set_c1 );	// set clock1 state
WRITE8_DEVICE_HANDLER( ptm6840_set_c2 );	// set clock2 state
WRITE8_DEVICE_HANDLER( ptm6840_set_c3 );	// set clock3 state

WRITE8_DEVICE_HANDLER( ptm6840_write );
READ8_DEVICE_HANDLER( ptm6840_read );

#endif /* __6840PTM_H__ */