diff --git a/ge.c b/ge.c index 7fe343b..460b04a 100644 --- a/ge.c +++ b/ge.c @@ -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 */ @@ -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 diff --git a/ge.h b/ge.h index be1412f..3924873 100644 --- a/ge.h +++ b/ge.h @@ -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 * diff --git a/reader.c b/reader.c index 407db93..4184b6c 100644 --- a/reader.c +++ b/reader.c @@ -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) diff --git a/tests/perperi.c b/tests/perperi.c index 54409cb..307bbbc 100644 --- a/tests/perperi.c +++ b/tests/perperi.c @@ -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"); */ }