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);
{
// 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;
}
{
// 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));
}
}
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