summaryrefslogtreecommitdiff
path: root/usrp2/firmware
diff options
context:
space:
mode:
authorjcorgan2009-02-10 16:35:17 +0000
committerjcorgan2009-02-10 16:35:17 +0000
commit776f05255fbed9d7beecf03759215641c74188c5 (patch)
treefb86fce24ebb455217c165239006c5f8fcc9da32 /usrp2/firmware
parent9f6bc9d5da0e504008b7d692fd6c9cbe55753d90 (diff)
downloadgnuradio-776f05255fbed9d7beecf03759215641c74188c5.tar.gz
gnuradio-776f05255fbed9d7beecf03759215641c74188c5.tar.bz2
gnuradio-776f05255fbed9d7beecf03759215641c74188c5.zip
Merged r10418:10423 from jcorgan/pps into trunk. Adds usrp2::sync_every_pps
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10424 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'usrp2/firmware')
-rw-r--r--usrp2/firmware/apps/app_common_v2.c17
-rw-r--r--usrp2/firmware/include/usrp2_eth_packet.h2
-rw-r--r--usrp2/firmware/lib/memory_map.h19
3 files changed, 38 insertions, 0 deletions
diff --git a/usrp2/firmware/apps/app_common_v2.c b/usrp2/firmware/apps/app_common_v2.c
index c277d12f0..df943a4ee 100644
--- a/usrp2/firmware/apps/app_common_v2.c
+++ b/usrp2/firmware/apps/app_common_v2.c
@@ -55,6 +55,18 @@ sync_to_pps(const op_generic_t *p)
}
static bool
+sync_every_pps(const op_generic_t *p)
+{
+ // FIXME use bit fields or defined masks
+ if (p->ok)
+ timesync_regs->tick_control |= 16;
+ else
+ timesync_regs->tick_control &= ~16;
+
+ return true;
+}
+
+static bool
config_mimo_cmd(const op_config_mimo_t *p)
{
clocks_mimo_config(p->flags);
@@ -505,6 +517,11 @@ handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len)
subpktlen = generic_reply(gp, reply_payload, reply_payload_space, true);
break;
+ case OP_SYNC_EVERY_PPS:
+ subpktlen = generic_reply(gp, reply_payload, reply_payload_space,
+ sync_every_pps((op_generic_t *) payload));
+ break;
+
default:
printf("app_common_v2: unhandled opcode = %d\n", gp->opcode);
break;
diff --git a/usrp2/firmware/include/usrp2_eth_packet.h b/usrp2/firmware/include/usrp2_eth_packet.h
index 77de02dbb..98e2123ed 100644
--- a/usrp2/firmware/include/usrp2_eth_packet.h
+++ b/usrp2/firmware/include/usrp2_eth_packet.h
@@ -195,6 +195,8 @@ typedef struct {
#define OP_SET_RX_LO_OFFSET_REPLY (OP_SET_RX_LO_OFFSET | OP_REPLY_BIT)
#define OP_RESET_DB 15
#define OP_RESET_DB_REPLY (OP_RESET_DB | OP_REPLY_BIT)
+#define OP_SYNC_EVERY_PPS 16
+#define OP_SYNC_EVERY_PPS_REPLY (OP_SYNC_EVERY_PPS | OP_REPLY_BIT)
/*
* All subpackets are a multiple of 4 bytes long.
diff --git a/usrp2/firmware/lib/memory_map.h b/usrp2/firmware/lib/memory_map.h
index 0519282bb..f4bf42010 100644
--- a/usrp2/firmware/lib/memory_map.h
+++ b/usrp2/firmware/lib/memory_map.h
@@ -629,6 +629,25 @@ typedef struct {
#define TIMESYNC_BASE 0xE800
typedef struct {
+ /*!
+ * \brief Time sync configuration.
+ *
+ * <pre>
+ *
+ * 3 2 1
+ * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+ * +-----------------------------------------------------+-+-+-+-+-+
+ * | |T|G|X|I|S|
+ * +-----------------------------------------------------+-+-+-+-+-+
+ *
+ * S - Tick source (0 = free run, 1 = pps, default=0)
+ * I - Tick interrupt enable (not implemented)
+ * X - Use external sync source (default=1)
+ * G - PPS edge selection (0=negedge, 1=posedge, default=0)
+ * T - Trigger sync every pps edge (default=0)
+ *
+ * </pre>
+ */
volatile uint32_t tick_control;
volatile uint32_t tick_interval;
volatile uint32_t delta_time;