Skip to content

Commit

Permalink
ge: move where we poll the RI state
Browse files Browse the repository at this point in the history
  • Loading branch information
biappi committed May 9, 2024
1 parent f8ac9eb commit 905e0e7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
16 changes: 16 additions & 0 deletions ge.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ int ge_run_pulse(struct ge *ge)
r = ge_peri_on_clock(ge);
if (r != 0)
return r;

/* poll the connectors and try to set up the cpu state.
* should this be here? */
connectors_first_clock(ge);
}

/* Execute common pulse machine logic */
Expand Down Expand Up @@ -230,6 +234,18 @@ int ge_deinit(struct ge *ge)
return 0;
}

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->RC01 = 1;
}
}

void fsn_last_clock(struct ge *ge)
{
/* at the end of a cycle attributed to the CPU, provided RICI
Expand Down
2 changes: 2 additions & 0 deletions ge.h
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,8 @@ int ge_register_peri(struct ge *ge, struct ge_peri *p);
*/
void fsn_last_clock(struct ge *ge);

void connectors_first_clock(struct ge *ge);

/**
* The clock period name name
*
Expand Down
9 changes: 0 additions & 9 deletions reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ void reader_setup_to_send(struct ge *ge, uint8_t data, uint8_t end)
ge->integrated_reader.data = data;
ge->integrated_reader.fini = end;

/* UNIV 1.2µs --> RC01 */
/* signal cpu of incoming data */
ge->RC01 = 1;

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");

/* signal end character */
/* todo: should use RF101 here? is "if (end)" correct? */
if (end)
Expand Down
10 changes: 7 additions & 3 deletions tests/perperi.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ UTEST(peri, per_peri) {
ASSERT_EQ(g.mem[dst_addr + 1], test_data_hi);

ASSERT_CYCLE(0xb8, "WAIT 1");
ASSERT_CYCLE(0xea, "TPER END 1");
ASSERT_CYCLE(0xeb, "TPER END 2");
ASSERT_CYCLE(0xe3, "Alpha 1");

/* cpu goes back to 0xb1 after moving the connector polling
* from IR to the first ge clock. */

/* ASSERT_CYCLE(0xea, "TPER END 1"); */
/* ASSERT_CYCLE(0xeb, "TPER END 2"); */
/* ASSERT_CYCLE(0xe3, "Alpha 1"); */
}

0 comments on commit 905e0e7

Please sign in to comment.