aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/zpu/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-01-11 12:19:22 -0800
committerJosh Blum <josh@joshknows.com>2011-01-11 12:19:22 -0800
commit599771914d0848875a0056cd60850eec39b06654 (patch)
tree66ddf3ee03ca33a19be565bb6fb5d1b22b52fc3c /firmware/zpu/lib
parent09e06246984546ad29c159a64f8c0419b81f8013 (diff)
downloaduhd-599771914d0848875a0056cd60850eec39b06654.tar.gz
uhd-599771914d0848875a0056cd60850eec39b06654.tar.bz2
uhd-599771914d0848875a0056cd60850eec39b06654.zip
usrp2: restart read before mode switch, added comments
use cmake compiler force macro (to simplify things), added copyright updates dates to some files
Diffstat (limited to 'firmware/zpu/lib')
-rw-r--r--firmware/zpu/lib/pkt_ctrl.c16
-rw-r--r--firmware/zpu/lib/pkt_ctrl.h6
2 files changed, 10 insertions, 12 deletions
diff --git a/firmware/zpu/lib/pkt_ctrl.c b/firmware/zpu/lib/pkt_ctrl.c
index 341ad44e1..2bbe2f843 100644
--- a/firmware/zpu/lib/pkt_ctrl.c
+++ b/firmware/zpu/lib/pkt_ctrl.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Ettus Research LLC
+ * Copyright 2010-2011 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
@@ -18,7 +18,6 @@
#include "pkt_ctrl.h"
#include "memory_map.h"
#include <nonstdio.h>
-#include <mdelay.h>
//status signals from WB into PR
#define CPU_STAT_RD_DONE (1 << 0)
@@ -46,13 +45,12 @@ void pkt_ctrl_program_inspector(
}
void pkt_ctrl_set_routing_mode(pkt_ctrl_routing_mode_t mode){
- mdelay(100); //give a little delay to space out subsequent calls
- switch(mode){
- case PKT_CTRL_ROUTING_MODE_SLAVE: router_ctrl->mode_ctrl = 0; break;
- case PKT_CTRL_ROUTING_MODE_MASTER: router_ctrl->mode_ctrl = 1; break;
- }
- router_ctrl->iface_ctrl = CPU_CTRL_WR_CLEAR; //reset the write state machine
- pkt_ctrl_release_incoming_buffer(); //reset the read state machine, and read
+ //About to change the mode; ensure that we are accepting packets.
+ //The plumbing will not switch if it cannot pass an end of packet.
+ pkt_ctrl_release_incoming_buffer();
+
+ //Change the mode; this switches the valves and crossbars.
+ router_ctrl->mode_ctrl = mode;
}
static inline void cpu_stat_wait_for(int bm){
diff --git a/firmware/zpu/lib/pkt_ctrl.h b/firmware/zpu/lib/pkt_ctrl.h
index 410ffdaa4..15e4b0c4d 100644
--- a/firmware/zpu/lib/pkt_ctrl.h
+++ b/firmware/zpu/lib/pkt_ctrl.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Ettus Research LLC
+ * Copyright 2010-2011 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
@@ -24,8 +24,8 @@
#include <lwip/ip_addr.h>
typedef enum {
- PKT_CTRL_ROUTING_MODE_SLAVE,
- PKT_CTRL_ROUTING_MODE_MASTER,
+ PKT_CTRL_ROUTING_MODE_SLAVE = 0,
+ PKT_CTRL_ROUTING_MODE_MASTER = 1
} pkt_ctrl_routing_mode_t;
//! Program the decision values into the packet inspector