From 83b574a16cf66deda0fa95b6bc43a4b293162593 Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Sat, 15 Mar 2014 06:39:41 +0000 Subject: [PATCH] Debug relayed initialization --- hw2/main.cpp | 1 + hw2/main_comm.c | 16 ++++++++++++---- hw2/makefile | 3 ++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/hw2/main.cpp b/hw2/main.cpp index e794213..d03b3f3 100644 --- a/hw2/main.cpp +++ b/hw2/main.cpp @@ -200,6 +200,7 @@ int main(int argc, char **argv) msg_register(&parser_bbb, MSG_ID_INIT, (handler_t)comm_handle_init); + msg_register(&parser_mbed, MSG_ID_INIT, (handler_t)comm_handle_init); msg_register(&parser_mbed, MSG_ID_SYNC, (handler_t)comm_handle_sync); msg_register(&parser_mbed, MSG_ID_EVENT, (handler_t)comm_handle_event); diff --git a/hw2/main_comm.c b/hw2/main_comm.c index 380fc87..5e261b4 100644 --- a/hw2/main_comm.c +++ b/hw2/main_comm.c @@ -199,8 +199,16 @@ void comm_handle_init(header_t *head, init_msg_t *body) { // Relay initialization from bbb to mbed if (comm_device_id && body->device != comm_device_id) { - sirq_write(comm_sirq_bbb, &head, sizeof(head)); - sirq_write(comm_sirq_bbb, &body, sizeof(body)); + //sirq_printf("relaying init\r\n"); + + sirq_write(comm_sirq_mbed, head, sizeof(*head)); + sirq_write(comm_sirq_mbed, body, sizeof(*body)); + + // Normally we transmit during the time sync but + // if we haven't started syncing yet, we need to + // push out the message now. + if (!comm_sync_due) + sirq_transmit(comm_sirq_mbed); return; } @@ -271,7 +279,7 @@ void comm_handle_event(header_t *head, event_msg_t *body) { // Relay event from mbed to bbb if (comm_device_id == 1) { - sirq_write(comm_sirq_bbb, &head, sizeof(head)); - sirq_write(comm_sirq_bbb, &body, sizeof(body)); + sirq_write(comm_sirq_bbb, head, sizeof(*head)); + sirq_write(comm_sirq_bbb, body, sizeof(*body)); } } diff --git a/hw2/makefile b/hw2/makefile index 54e9872..d6dd6ec 100644 --- a/hw2/makefile +++ b/hw2/makefile @@ -25,7 +25,8 @@ mbed.elf: main.o main_time.o main_emit.o main_comm.o \ mbed-run: mbed.bin control install.sh @./install.sh $< @./control $(UART0) 1 - @./control $(UART1) 2 sync + @./control $(UART0) 2 + @./control $(UART0) 1 sync # Testing mbed (mbed3) tester.elf: tester.o serial_irq.o timer_dma.o messages.o -- 2.43.2