Skip to content

Commit

Permalink
ge: initial support for connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
biappi committed May 9, 2024
1 parent 905e0e7 commit 9665c3b
Show file tree
Hide file tree
Showing 7 changed files with 348 additions and 42 deletions.
9 changes: 4 additions & 5 deletions ge.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ void ge_init(struct ge *ge)
ge->halted = 1;
ge->powered = 1;
ge->register_selector = RS_NORM;

ge->ST3.name = "ST3";
ge->ST4.name = "ST4";
}

void ge_clear(struct ge *ge)
Expand Down Expand Up @@ -236,12 +239,8 @@ int ge_deinit(struct ge *ge)

void connectors_first_clock(struct ge *ge)
{
ge_log(LOG_READER, " RA101 = %d\n", RA101(ge));
ge_log(LOG_READER, " RF101 = %d\n", RF101(ge));
ge_log(LOG_READER, " RB111 = %d\n", RB111(ge));
ge_log(LOG_READER, " Signaling incoming data\n");

if (RA101(ge)) {
ge_log(LOG_READER, "RA101: signaling incoming data\n");
ge->RC01 = 1;
}
}
Expand Down
13 changes: 12 additions & 1 deletion ge.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ struct ge {
uint8_t RAVI:1;

uint8_t RT121:1;
uint8_t RT131:1;

/**
* Future state
Expand Down Expand Up @@ -529,10 +530,20 @@ struct ge {
struct ge_counting_network counting_network;

/**
* The I/O interface for the integrated reader
* The I/O interface for the integrated reader (RI)
*/
struct ge_integrated_reader integrated_reader;

/**
* The I/O interface for the ST3 connector
*/
struct ge_connector ST3;

/**
* The I/O interface for the ST4 connector
*/
struct ge_connector ST4;

struct ge_peri *peri;

/**
Expand Down
26 changes: 23 additions & 3 deletions msl-commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static void CE01(struct ge* ge) {
static void CE02(struct ge* ge) {
/* admits AEBE: */
/* UNIV 1.2µs --> RATE1 nand PC131 --> AEBE */
/* AEBE is a control signal sent to ST3 */
/* AEBE is a control signal sent to ST3 and ST4 */

/* Unconditionally set by command CE02 (cpu fo. 235) */
ge->PIC1 = 1;
Expand Down Expand Up @@ -304,7 +304,14 @@ static void CE09(struct ge *ge) {
/* emits TU101: */
/* UNIV 1.2µs --> RT111 */

reader_send_tu10(ge);
uint8_t RT111 = 1;

/* intermediate fo 14 D3 */
uint8_t TU03A = !(RT111 && PC121(ge));
uint8_t TU03 = !TU03A;

if (TU03)
reader_send_tu10(ge);
}

static void CE10(struct ge *ge) {
Expand All @@ -319,7 +326,20 @@ static void CE10(struct ge *ge) {
}

static void CE11(struct ge* ge) {
ge_log(LOG_PERI, "TODO: emit TU301.. should not be used by RI but only ST3 and ST4\n");
ge->RT131 = 1;

/* UNIV seems a delay line to synchronise the hardware, let's
* ignore the exact timings. */

/* ad hoc logic, this should be conditioned by TU30C and TU30D
* (intermediate fo 14, B4 B5) to send the command only to the
* specified units, but the signals don't fully work here */

if (PC131(ge))
connector_send_tu00(ge, &ge->ST3);

if (PC141(ge))
connector_send_tu00(ge, &ge->ST4);
}

static void CE18(struct ge *ge) {
Expand Down
75 changes: 75 additions & 0 deletions reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,78 @@ uint8_t reader_get_FINI1(struct ge *ge)
ge_log(LOG_READER, "**** reading FINI1 %d\n", ge->integrated_reader.fini);
return ge->integrated_reader.fini;
}

uint8_t connector_get_MARE(struct ge_connector *conn)
{
ge_log(LOG_READER, "%s -- connector_get_MARE\n", conn->name);
return conn->mare;
}

uint8_t connector_get_TE10(struct ge_connector *conn)
{
ge_log(LOG_READER, "%s -- connector_get_TE10\n", conn->name);
return conn->te10;
}

uint8_t connector_get_TE20(struct ge_connector *conn)
{
ge_log(LOG_READER, "%s -- connector_get_TE20\n", conn->name);
return conn->te20;
}

uint8_t connector_get_TE30(struct ge_connector *conn)
{
ge_log(LOG_READER, "%s -- connector_get_TE30\n", conn->name);
return conn->te30;
}

uint8_t connector_get_FINE(struct ge_connector *conn)
{
ge_log(LOG_READER, "%s -- connector_get_FINE\n", conn->name);
return conn->fine;
}

void connector_setup_to_send(struct ge *ge, struct ge_connector *conn, uint8_t data, uint8_t end)
{
/* equivalent of lu08, but not sure if it's TE10 or TE20, seems or-red together
* (intermediate fo. 11, D1, D2) */

conn->te10 = 1;
conn->te20 = 1;
conn->data = data;
conn->fine = end;

/* signal end character */
/* todo: should use RF101 here? is "if (end)" correct? */
if (end)
ge->RIG1 = 1;

/* todo: should be conditioned by PIM11, but it's false at this point
* without this, we don't get to state ea after waiting state b8 when
* reading */
if (end)
ge->PEC1 = 1;

if (RB111(ge)) {
ge_log(LOG_READER, "XXX\n");
}
}

void connector_clear_sending(struct ge_connector *conn)
{
conn->te10 = 0;
conn->te20 = 0;
conn->data = 0;
}

void connector_send_tu00(struct ge *ge, struct ge_connector *conn)
{
uint8_t command = ge->rRE;

switch (command) {
#define X(cmd, namex, desc) case cmd: ge_log(LOG_READER, " connector %s got: %02x - %s\n", conn->name, cmd, desc ); break;
ENUMERATE_READER_COMMANDS
#undef X
}

}
22 changes: 22 additions & 0 deletions reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,27 @@ uint8_t reader_get_LU08(struct ge *);
uint8_t reader_get_LUPO1(struct ge *);
uint8_t reader_get_FINI1(struct ge *);

struct ge_connector {
const char *name;

uint8_t data;

uint8_t mare:1;
uint8_t te10:1;
uint8_t te20:1;
uint8_t te30:1;
uint8_t fine:1;
};

void connector_setup_to_send(struct ge *, struct ge_connector *, uint8_t, uint8_t);
void connector_send_tu00(struct ge *, struct ge_connector *);
void connector_clear_sending(struct ge_connector *);

uint8_t connector_get_MARE(struct ge_connector *);
uint8_t connector_get_TE10(struct ge_connector *);
uint8_t connector_get_TE20(struct ge_connector *);
uint8_t connector_get_TE30(struct ge_connector *);
uint8_t connector_get_FINE(struct ge_connector *);

#endif

Loading

0 comments on commit 9665c3b

Please sign in to comment.