aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-16 17:49:29 -0800
committerJosh Blum <josh@joshknows.com>2010-02-16 17:49:29 -0800
commit6d891fdfbb735f6ee31e0d4f9d786c1a6397965b (patch)
tree7c0e1fcc16789848f30e663b0cd33f4977172fa7
parentac35b51ea7e2f309625a25e41dd1bb9e1864a3f5 (diff)
downloaduhd-6d891fdfbb735f6ee31e0d4f9d786c1a6397965b.tar.gz
uhd-6d891fdfbb735f6ee31e0d4f9d786c1a6397965b.tar.bz2
uhd-6d891fdfbb735f6ee31e0d4f9d786c1a6397965b.zip
Setting the clock config over control
-rw-r--r--firmware/microblaze/apps/txrx.c38
-rw-r--r--lib/usrp/mboard/usrp2/fw_common.h7
2 files changed, 43 insertions, 2 deletions
diff --git a/firmware/microblaze/apps/txrx.c b/firmware/microblaze/apps/txrx.c
index e2500f42e..5f4c595f8 100644
--- a/firmware/microblaze/apps/txrx.c
+++ b/firmware/microblaze/apps/txrx.c
@@ -194,6 +194,44 @@ void handle_udp_ctrl_packet(
ctrl_data_out.data.dboard_ids.rx_id = read_dboard_eeprom(I2C_ADDR_RX_A);
break;
+ case USRP2_CTRL_ID_HERES_A_NEW_CLOCK_CONFIG_BRO:
+ //TODO handle MC_PROVIDE_CLK_TO_MIMO when we do MIMO setup
+ ctrl_data_out.id = USRP2_CTRL_ID_GOT_THE_NEW_CLOCK_CONFIG_DUDE;
+
+ //handle the 10 mhz ref source
+ uint32_t ref_flags = 0;
+ switch(ctrl_data_out.data.clock_config.ref_source){
+ case USRP2_REF_SOURCE_INT:
+ ref_flags = MC_WE_DONT_LOCK; break;
+ case USRP2_REF_SOURCE_SMA:
+ ref_flags = MC_WE_LOCK_TO_SMA; break;
+ case USRP2_REF_SOURCE_MIMO:
+ ref_flags = MC_WE_LOCK_TO_MIMO; break;
+ }
+ clocks_mimo_config(ref_flags & MC_REF_CLK_MASK);
+
+ //handle the pps config
+ uint32_t pps_flags = 0;
+
+ //fill in the pps polarity flags
+ switch(ctrl_data_out.data.clock_config.pps_polarity){
+ case USRP2_PPS_POLARITY_POS:
+ pps_flags |= 0x01 << 0; break;
+ case USRP2_PPS_POLARITY_NEG:
+ pps_flags |= 0x00 << 0; break;
+ }
+
+ //fill in the pps source flags
+ switch(ctrl_data_out.data.clock_config.pps_source){
+ case USRP2_PPS_SOURCE_SMA:
+ pps_flags |= 0x00 << 1; break;
+ case USRP2_PPS_SOURCE_MIMO:
+ pps_flags |= 0x01 << 1; break;
+ }
+ sr_time64->flags = pps_flags;
+
+ break;
+
default:
ctrl_data_out.id = USRP2_CTRL_ID_HUH_WHAT;
diff --git a/lib/usrp/mboard/usrp2/fw_common.h b/lib/usrp/mboard/usrp2/fw_common.h
index bfac52907..de4866d8e 100644
--- a/lib/usrp/mboard/usrp2/fw_common.h
+++ b/lib/usrp/mboard/usrp2/fw_common.h
@@ -45,11 +45,14 @@ typedef enum{
USRP2_CTRL_ID_THIS_IS_MY_MAC_ADDR_DUDE,
USRP2_CTRL_ID_HERE_IS_A_NEW_MAC_ADDR_BRO,
+ USRP2_CTRL_ID_GIVE_ME_YOUR_DBOARD_IDS_BRO,
+ USRP2_CTRL_ID_THESE_ARE_MY_DBOARD_IDS_DUDE,
+
USRP2_CTRL_ID_HERES_A_NEW_CLOCK_CONFIG_BRO,
USRP2_CTRL_ID_GOT_THE_NEW_CLOCK_CONFIG_DUDE,
- USRP2_CTRL_ID_GIVE_ME_YOUR_DBOARD_IDS_BRO,
- USRP2_CTRL_ID_THESE_ARE_MY_DBOARD_IDS_DUDE
+ USRP2_CTRL_ID_PEACE_OUT
+
} usrp2_ctrl_id_t;
typedef enum{