25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_dc7085.c,v 1.55 2006/03/04 12:38:47 debug Exp $ |
* $Id: dev_dc7085.c,v 1.58 2006/09/06 04:55:35 debug Exp $ |
29 |
* |
* |
30 |
* DC7085 serial controller, used in some DECstation models. |
* DC7085 serial controller, used in some DECstation models. |
31 |
*/ |
*/ |
46 |
|
|
47 |
#define DC_TICK_SHIFT 14 |
#define DC_TICK_SHIFT 14 |
48 |
|
|
49 |
#define MAX_QUEUE_LEN 4096 |
#define MAX_QUEUE_LEN 32768 |
50 |
|
|
51 |
struct dc_data { |
struct dc_data { |
52 |
struct dc7085regs regs; |
struct dc7085regs regs; |
78 |
struct dc_data *d = (struct dc_data *) e; |
struct dc_data *d = (struct dc_data *) e; |
79 |
int entries_in_use = d->cur_rx_queue_pos_write - |
int entries_in_use = d->cur_rx_queue_pos_write - |
80 |
d->cur_rx_queue_pos_read; |
d->cur_rx_queue_pos_read; |
81 |
|
|
82 |
while (entries_in_use < 0) |
while (entries_in_use < 0) |
83 |
entries_in_use += MAX_QUEUE_LEN; |
entries_in_use += MAX_QUEUE_LEN; |
84 |
|
|
97 |
} |
} |
98 |
|
|
99 |
|
|
100 |
/* |
DEVICE_TICK(dc7085) |
|
* dev_dc7085_tick(): |
|
|
* |
|
|
* This function is called "every now and then". |
|
|
* If a key is available from the keyboard, add it to the rx queue. |
|
|
* If other bits are set, an interrupt might need to be caused. |
|
|
*/ |
|
|
void dev_dc7085_tick(struct cpu *cpu, void *extra) |
|
101 |
{ |
{ |
102 |
|
/* |
103 |
|
* If a key is available from the keyboard, add it to the rx queue. |
104 |
|
* If other bits are set, an interrupt might need to be caused. |
105 |
|
*/ |
106 |
struct dc_data *d = extra; |
struct dc_data *d = extra; |
107 |
int avail; |
int avail; |
108 |
|
|
147 |
return; |
return; |
148 |
} |
} |
149 |
|
|
150 |
lk201_tick(&d->lk201); |
lk201_tick(cpu->machine, &d->lk201); |
151 |
|
|
152 |
avail = d->cur_rx_queue_pos_write != d->cur_rx_queue_pos_read; |
avail = d->cur_rx_queue_pos_write != d->cur_rx_queue_pos_read; |
153 |
|
|
159 |
} |
} |
160 |
|
|
161 |
|
|
|
/* |
|
|
* dev_dc7085_access(): |
|
|
*/ |
|
162 |
DEVICE_ACCESS(dc7085) |
DEVICE_ACCESS(dc7085) |
163 |
{ |
{ |
164 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |