aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp_clock/octoclock
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2015-06-30 13:36:15 -0700
committerMartin Braun <martin.braun@ettus.com>2015-07-09 09:13:41 -0700
commitd9656de88f7af77b39bfe9985f0ac7c623932d71 (patch)
treeed83e5b72fa8c2afd25410ce6e1bece5621896cd /host/lib/usrp_clock/octoclock
parent1449687bb41e9cd39cc3d94413c993a1ec553251 (diff)
downloaduhd-d9656de88f7af77b39bfe9985f0ac7c623932d71.tar.gz
uhd-d9656de88f7af77b39bfe9985f0ac7c623932d71.tar.bz2
uhd-d9656de88f7af77b39bfe9985f0ac7c623932d71.zip
OctoClock bugfixes
* Bumped compatibility version to 3 * firmware: Ethernet, clkdist bugfixes * lib: fixed invalid rev detection
Diffstat (limited to 'host/lib/usrp_clock/octoclock')
-rw-r--r--host/lib/usrp_clock/octoclock/common.h35
-rw-r--r--host/lib/usrp_clock/octoclock/octoclock_impl.cpp8
2 files changed, 28 insertions, 15 deletions
diff --git a/host/lib/usrp_clock/octoclock/common.h b/host/lib/usrp_clock/octoclock/common.h
index 96acbb30f..5861bc4b1 100644
--- a/host/lib/usrp_clock/octoclock/common.h
+++ b/host/lib/usrp_clock/octoclock/common.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Ettus Research LLC
+ * Copyright 2014-2015 Ettus Research LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -42,11 +42,11 @@ extern "C" {
* only valid C code should go in this section.
*/
-//These values are placed in the octoclock_packet_t.proto_ver field
+// These values are placed in the octoclock_packet_t.proto_ver field
#define OCTOCLOCK_BOOTLOADER_PROTO_VER 1234
-#define OCTOCLOCK_FW_COMPAT_NUM 2
+#define OCTOCLOCK_FW_COMPAT_NUM 3
-//UDP ports assigned for different tasks
+// UDP ports assigned for different tasks
#define OCTOCLOCK_UDP_CTRL_PORT 50000
#define OCTOCLOCK_UDP_GPSDO_PORT 50001
#define OCTOCLOCK_UDP_FW_PORT 50002
@@ -98,11 +98,21 @@ typedef enum {
} ref_t;
typedef enum {
- UP,
- DOWN
+ PREFER_INTERNAL,
+ PREFER_EXTERNAL
} switch_pos_t;
+/*
+ * Some versions of AVR-GCC ignore #pragma pack, so
+ * if AVR-GCC is being used, use __attribute__
+ * instead.
+ */
+#ifdef AVR
+#define __AVR_ALIGNED__ __attribute__((aligned(1)))
+#else
+#define __AVR_ALIGNED__
#pragma pack(push,1)
+#endif
// Structure of values in EEPROM, starting in location 0
typedef struct {
@@ -113,34 +123,37 @@ typedef struct {
uint8_t serial[10];
uint8_t name[10];
uint8_t revision;
-} octoclock_fw_eeprom_t;
+} octoclock_fw_eeprom_t __AVR_ALIGNED__;
typedef struct {
uint8_t external_detected;
uint8_t gps_detected;
uint8_t which_ref;
uint8_t switch_pos;
-} octoclock_state_t;
+} octoclock_state_t __AVR_ALIGNED__;
typedef struct {
uint8_t num_wraps;
uint8_t pos;
-} gpsdo_cache_state_t;
+} gpsdo_cache_state_t __AVR_ALIGNED__;
typedef struct {
uint32_t proto_ver;
uint32_t sequence;
uint8_t code;
union {
- uint16_t len;
+ uint16_t crc;
gpsdo_cache_state_t state;
uint16_t poolsize;
uint16_t addr;
};
uint8_t data[256];
-} octoclock_packet_t;
+ uint16_t len;
+} octoclock_packet_t __AVR_ALIGNED__;
+#ifndef AVR
#pragma pack(pop)
+#endif
#ifdef __cplusplus
}
diff --git a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp
index b98d95725..ef1bc8ca0 100644
--- a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp
+++ b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp
@@ -357,14 +357,14 @@ void octoclock_impl::_get_state(const std::string &oc){
}
uhd::dict<ref_t, std::string> _ref_strings = boost::assign::map_list_of
- (NO_REF, "none")
+ (NO_REF, "none")
(INTERNAL, "internal")
(EXTERNAL, "external")
;
uhd::dict<switch_pos_t, std::string> _switch_pos_strings = boost::assign::map_list_of
- (UP, "Prefer internal")
- (DOWN, "Prefer external")
+ (PREFER_INTERNAL, "Prefer internal")
+ (PREFER_EXTERNAL, "Prefer external")
;
sensor_value_t octoclock_impl::_ext_ref_detected(const std::string &oc){
@@ -410,7 +410,7 @@ boost::uint32_t octoclock_impl::_get_time(const std::string &oc){
}
std::string octoclock_impl::_get_images_help_message(const std::string &addr){
- const std::string image_name = "octoclock_r4_fw.bin";
+ const std::string image_name = "octoclock_r4_fw.hex";
//Check to see if image is in default location
std::string image_location;