]> Pileus Git - ~andy/csm213a-hw/commitdiff
Debug relayed initialization
authorAndy Spencer <andy753421@gmail.com>
Sat, 15 Mar 2014 06:39:41 +0000 (06:39 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sat, 15 Mar 2014 06:39:41 +0000 (06:39 +0000)
hw2/main.cpp
hw2/main_comm.c
hw2/makefile

index e794213546f0ff4a9d5d23e5b338614ebc778913..d03b3f312cc3aa843290485b338f7f333bf65859 100644 (file)
@@ -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_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);
 
        msg_register(&parser_mbed, MSG_ID_SYNC,  (handler_t)comm_handle_sync);
        msg_register(&parser_mbed, MSG_ID_EVENT, (handler_t)comm_handle_event);
 
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) {
 {
        // 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;
        }
 
                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) {
 {
        // 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));
        }
 }
        }
 }
index 54e987246accffe2a32c74d17a2d972e60f49192..d6dd6ec30339e3df3774e3eaaf44dabd72ca56d6 100644 (file)
@@ -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
 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
 
 # Testing mbed (mbed3)
 tester.elf: tester.o serial_irq.o timer_dma.o messages.o