]> Pileus Git - ~andy/csm213a-hw/blobdiff - hw2/main_comm.c
Debug relayed initialization
[~andy/csm213a-hw] / hw2 / main_comm.c
index 380fc87f0535830935b5c5ae79a72d61179a90a2..5e261b40e07bfe2cc8a9ad2106fb8dedacdd1b31 100644 (file)
@@ -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));
        }
 }