#include "main_emit.h"
/**
- * Communcation overview:
+ * Communication overview:
*
* Initialization:
* bbb --init1--> mbed1
* Initialization:
* Each mbed is initialized by the BBB by receiving an initialization
* message. The Device ID must be non-zero, and is saved for future
- * messages. If the device is already initialized and a recevied Device ID
+ * messages. If the device is already initialized and a received Device ID
* does not match the configured Device ID, the messages is relayed to the
* second mbed.
*
*/
void comm_send_event(uint16_t event, uint64_t local)
{
- //time_printf("event received", local);
+ time_printf("event received", local);
// Convert timestamp
uint64_t world = time_to_world(local);
* Signal generation *
*********************/
-// for 50 Mhz clock 50/1000 = 1/20 (PLL/2)
+// for 50 MHz clock 50/1000 = 1/20 (PLL/2)
-// for 48 Mhz clock 48/1000 = 6/125 (FLL)
-// for 24 Mhz clock, 24/1000 = 3/125
-// for 12 Mhz clock, 12/1000 = 3/250
-// for 6 Mhz clock, 6/1000 = 3/500
-// for 3 Mhz clock, 3/1000 = 3/1000
+// for 48 MHz clock 48/1000 = 6/125 (FLL)
+// for 24 MHz clock, 24/1000 = 3/125
+// for 12 MHz clock, 12/1000 = 3/250
+// for 6 MHz clock, 6/1000 = 3/500
+// for 3 MHz clock, 3/1000 = 3/1000
#define EMIT_PS 1
TPM1->MOD = TPM_MOD_MOD(0xFFFF);
TPM1->CONTROLS[0].CnSC = TPM_CnSC_CHF_MASK // clear flag
- | TPM_CnSC_MSB_MASK // set output highon match,
+ | TPM_CnSC_MSB_MASK // set output high on match,
| TPM_CnSC_ELSB_MASK // cleared on overflow
| TPM_CnSC_ELSA_MASK; // ..
/* Initialization */
void time_init(void);
-/* Time conversino functions */
+/* Time conversion functions */
uint64_t time_to_world(uint64_t local);
uint64_t time_to_local(uint64_t world);
-/* External time syncronization */
+/* External time synchronization */
void time_ext_init(uint64_t local, uint64_t world);
void time_ext_sync(uint64_t local, uint64_t world);
uint16_t control; // Message control bits
uint16_t device; // Device ID to use
ntime_t world; // World time (since 1970)
- ntime_t start; // Transmit start time
+ ntime_t start; // Transmit start time
ntime_t period; // Transmit period
} init_msg_t;
--- /dev/null
+Primary mbed:
+ main.cpp - Primary program to control mbed
+ main_time.[ch] - Time synchronization functions
+ main_comm.[ch] - Serial communication functions
+ main_emit.[ch] - Periodic signal generation functions
+
+Testing mbed:
+ tester.cpp - Mbed 3 testing program
+
+Host control:
+ control.c - Linux program to control primary mbeds
+
+Miscellaneous:
+ examples.cpp - Device testing routines (not used)
+
+Common files:
+ messages.[ch] - Message definitions for mbed <--> {bbb,host}
+
+KL46Z Libraries:
+ serial_dma.[ch] - DMA based serial I/O (not used)
+ serial_irq.[ch] - Interrupt driven serial I/O
+ timer_dma.[ch] - Time stamping using DMA and PIT
sirq_printf("rcv - wix:%03x rix:%03x\r\n", port->rcv.wix, port->rcv.rix);\r
sirq_printf("irq - ??\r\n");\r
sirq_printf("uart - ??\r\n");\r
-\r
- // __IO uint8_t BDH; \r
- // __IO uint8_t BDL; \r
- // __IO uint8_t C1; \r
- // __IO uint8_t C2; \r
- // __IO uint8_t S1; \r
- // __IO uint8_t S2; \r
- // __IO uint8_t C3; \r
- // __IO uint8_t D; \r
- // __IO uint8_t MA1; \r
- // __IO uint8_t MA2; \r
- // __IO uint8_t C4; \r
- // __IO uint8_t C5; \r
}\r
\r
/* Write ASCII data to the output queue */\r