From 6cbe6f47d7ffc6959df5a74a33d789575f4746f4 Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Sat, 15 Mar 2014 18:10:27 +0000 Subject: [PATCH] Add readme and cleanup formatting cleanup --- hw2/main_comm.c | 6 +++--- hw2/main_emit.c | 14 +++++++------- hw2/main_time.h | 4 ++-- hw2/messages.h | 2 +- hw2/readme.txt | 22 ++++++++++++++++++++++ hw2/serial_irq.c | 13 ------------- 6 files changed, 35 insertions(+), 26 deletions(-) create mode 100644 hw2/readme.txt diff --git a/hw2/main_comm.c b/hw2/main_comm.c index ed864cc..d5c66b1 100644 --- a/hw2/main_comm.c +++ b/hw2/main_comm.c @@ -9,7 +9,7 @@ #include "main_emit.h" /** - * Communcation overview: + * Communication overview: * * Initialization: * bbb --init1--> mbed1 @@ -26,7 +26,7 @@ * 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. * @@ -159,7 +159,7 @@ void comm_send_sync(uint64_t local) */ 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); diff --git a/hw2/main_emit.c b/hw2/main_emit.c index 6588e1f..bb751a6 100644 --- a/hw2/main_emit.c +++ b/hw2/main_emit.c @@ -9,13 +9,13 @@ * 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 @@ -105,7 +105,7 @@ void emit_init(int alt, PinName pin, PinMode mode) 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; // .. diff --git a/hw2/main_time.h b/hw2/main_time.h index e0d2733..fc507ef 100644 --- a/hw2/main_time.h +++ b/hw2/main_time.h @@ -13,11 +13,11 @@ extern "C" { /* 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); diff --git a/hw2/messages.h b/hw2/messages.h index cd94398..275e785 100644 --- a/hw2/messages.h +++ b/hw2/messages.h @@ -45,7 +45,7 @@ typedef struct { 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; diff --git a/hw2/readme.txt b/hw2/readme.txt new file mode 100644 index 0000000..18e27ad --- /dev/null +++ b/hw2/readme.txt @@ -0,0 +1,22 @@ +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 diff --git a/hw2/serial_irq.c b/hw2/serial_irq.c index 0f5106d..2d4b70d 100644 --- a/hw2/serial_irq.c +++ b/hw2/serial_irq.c @@ -125,19 +125,6 @@ void sirq_debug(sirq_t *port) sirq_printf("rcv - wix:%03x rix:%03x\r\n", port->rcv.wix, port->rcv.rix); sirq_printf("irq - ??\r\n"); sirq_printf("uart - ??\r\n"); - - // __IO uint8_t BDH; - // __IO uint8_t BDL; - // __IO uint8_t C1; - // __IO uint8_t C2; - // __IO uint8_t S1; - // __IO uint8_t S2; - // __IO uint8_t C3; - // __IO uint8_t D; - // __IO uint8_t MA1; - // __IO uint8_t MA2; - // __IO uint8_t C4; - // __IO uint8_t C5; } /* Write ASCII data to the output queue */ -- 2.43.2