summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/imagedev/bitbngr.h
blob: 85124ca25368a0fea65350ef2ba3a65e5a369617 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*********************************************************************

    bitbngr.h

    TRS style "bitbanger" serial port

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

#ifndef __BITBNGR_H__
#define __BITBNGR_H__

#include "image.h"


enum
{
	BITBANGER_PRINTER			= 0,
	BITBANGER_MODEM,
   BITBANGER_MODE_MAX,

	BITBANGER_150				= 0,
	BITBANGER_300,
	BITBANGER_600,
	BITBANGER_1200,
	BITBANGER_2400,
	BITBANGER_4800,
	BITBANGER_9600,
	BITBANGER_14400,
	BITBANGER_28800,
	BITBANGER_38400,
	BITBANGER_57600,
	BITBANGER_115200,
	BITBANGER_BAUD_MAX,

	BITBANGER_NEG40PERCENT  = 0,
	BITBANGER_NEG35PERCENT,
	BITBANGER_NEG30PERCENT,
	BITBANGER_NEG25PERCENT,
	BITBANGER_NEG20PERCENT,
	BITBANGER_NEG15PERCENT,
	BITBANGER_NEG10PERCENT,
	BITBANGER_NEG5PERCENT,
	BITBANGER_0PERCENT,
	BITBANGER_POS5PERCENT,
	BITBANGER_POS10PERCENT,
	BITBANGER_POS15PERCENT,
	BITBANGER_POS20PERCENT,
	BITBANGER_POS25PERCENT,
	BITBANGER_POS30PERCENT,
	BITBANGER_POS35PERCENT,
	BITBANGER_POS40PERCENT,
	BITBANGER_TUNE_MAX
};

/***************************************************************************
    CONSTANTS
***************************************************************************/
DECLARE_LEGACY_IMAGE_DEVICE(BITBANGER, bitbanger);

#define MCFG_BITBANGER_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, BITBANGER, 0) \
	MCFG_DEVICE_CONFIG(_intrf)


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

typedef struct _bitbanger_config bitbanger_config;
struct _bitbanger_config
{
	/* callback to driver */
	void (*input_callback)(running_machine *machine, UINT8 bit);
	int default_mode;					   /* emulating a printer or modem */
	int default_baud;					   /* output bits per second */
	int default_tune;                /* fine tune adjustment to the baud */
};



/***************************************************************************
    FUNCTION PROTOTYPES
***************************************************************************/

/* outputs data to a bitbanger port */
void bitbanger_output(device_t *device, int value);

/* ui functions */
const char *bitbanger_mode_string(device_t *device);
const char *bitbanger_baud_string(device_t *device);
const char *bitbanger_tune_string(device_t *device);
bool bitbanger_inc_mode(device_t *device, bool test);
bool bitbanger_dec_mode(device_t *device, bool test);
bool bitbanger_inc_tune(device_t *device, bool test);
bool bitbanger_dec_tune(device_t *device, bool test);
bool bitbanger_inc_baud(device_t *device, bool test);
bool bitbanger_dec_baud(device_t *device, bool test);

#endif /* __BITBNGR_H__ */