-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathchannel.c
More file actions
39 lines (34 loc) · 1.2 KB
/
channel.c
File metadata and controls
39 lines (34 loc) · 1.2 KB
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
/*
* channel.c - generic CPU<->peripheral line bundle (see channel.h).
*
* Pure line-level state: these ops only set/read the lines of a ge_channel.
* The CPU microcode reads the lines (request -> RC0x, data -> NE_knot, fini ->
* RIG1) and drives output via channel_accept_output -> the peripheral sink. No
* CPU flip-flops are forced here; the machine's own sequencer moves the data.
*/
#include "channel.h"
void channel_offer_input(struct ge *ge, struct ge_channel *ch,
uint8_t data, uint8_t end)
{
(void)ge;
ch->data = data;
ch->data_valid = 1;
ch->fini = end ? 1 : 0;
ch->req = 1; /* raise the cycle request (OR-source for RC02) */
}
void channel_clear_input(struct ge *ge, struct ge_channel *ch)
{
(void)ge;
ch->data = 0;
ch->data_valid = 0;
ch->fini = 0;
ch->req = 0;
}
void channel_accept_output(struct ge *ge, struct ge_channel *ch, uint8_t c)
{
if (ch->sink)
ch->sink(ge, ch, c);
}
uint8_t channel_get_req(struct ge_channel *ch) { return ch->req; }
uint8_t channel_get_data(struct ge_channel *ch) { return ch->data; }
uint8_t channel_get_fini(struct ge_channel *ch) { return ch->fini; }