aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fpga/usrp2/fifo/fifo_2clock.v44
-rw-r--r--fpga/usrp2/gpif/packet_reframer.v5
-rw-r--r--fpga/usrp2/gpif/slave_fifo.v126
-rw-r--r--fpga/usrp2/top/B100/u1plus_core.v2
-rw-r--r--host/cmake/Modules/UHDVersion.cmake50
-rw-r--r--host/lib/usrp/common/fx2_ctrl.cpp39
-rw-r--r--host/lib/usrp/dboard/db_dbsrx.cpp9
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp20
8 files changed, 169 insertions, 126 deletions
diff --git a/fpga/usrp2/fifo/fifo_2clock.v b/fpga/usrp2/fifo/fifo_2clock.v
index 756ad508f..98aab18a5 100644
--- a/fpga/usrp2/fifo/fifo_2clock.v
+++ b/fpga/usrp2/fifo/fifo_2clock.v
@@ -1,5 +1,5 @@
//
-// Copyright 2011 Ettus Research LLC
+// Copyright 2011-2012 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
@@ -31,42 +31,44 @@ module fifo_2clock
assign src_rdy_o = ~empty;
assign write = src_rdy_i & dst_rdy_o;
assign read = src_rdy_o & dst_rdy_i;
- wire dummy;
-
+
generate
- if(WIDTH==36)
+ if((WIDTH <= 36) && (WIDTH > 19)) begin
+ wire [35:0] data_in_wide, data_out_wide;
+ assign data_in_wide[WIDTH-1:0] = datain;
+ assign dataout = data_out_wide[WIDTH-1:0];
if(SIZE==9)
fifo_xlnx_512x36_2clk fifo_xlnx_512x36_2clk
(.rst(arst),
- .wr_clk(wclk),.din(datain),.full(full),.wr_en(write),.wr_data_count(level_wclk),
- .rd_clk(rclk),.dout(dataout),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) );
+ .wr_clk(wclk),.din(data_in_wide),.full(full),.wr_en(write),.wr_data_count(level_wclk),
+ .rd_clk(rclk),.dout(data_out_wide),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) );
else if(SIZE==11)
fifo_xlnx_2Kx36_2clk fifo_xlnx_2Kx36_2clk
(.rst(arst),
- .wr_clk(wclk),.din(datain),.full(full),.wr_en(write),.wr_data_count(level_wclk),
- .rd_clk(rclk),.dout(dataout),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) );
+ .wr_clk(wclk),.din(data_in_wide),.full(full),.wr_en(write),.wr_data_count(level_wclk),
+ .rd_clk(rclk),.dout(data_out_wide),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) );
else if(SIZE==6)
fifo_xlnx_64x36_2clk fifo_xlnx_64x36_2clk
(.rst(arst),
- .wr_clk(wclk),.din(datain),.full(full),.wr_en(write),.wr_data_count(level_wclk),
- .rd_clk(rclk),.dout(dataout),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) );
+ .wr_clk(wclk),.din(data_in_wide),.full(full),.wr_en(write),.wr_data_count(level_wclk),
+ .rd_clk(rclk),.dout(data_out_wide),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) );
else
fifo_xlnx_512x36_2clk fifo_xlnx_512x36_2clk
(.rst(arst),
- .wr_clk(wclk),.din(datain),.full(full),.wr_en(write),.wr_data_count(level_wclk),
- .rd_clk(rclk),.dout(dataout),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) );
- else if((WIDTH==19) & (SIZE==4))
- fifo_xlnx_16x19_2clk fifo_xlnx_16x19_2clk
- (.rst(arst),
- .wr_clk(wclk),.din(datain),.full(full),.wr_en(write),.wr_data_count(level_wclk),
- .rd_clk(rclk),.dout(dataout),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) );
- else if((WIDTH==18) & (SIZE==4))
+ .wr_clk(wclk),.din(data_in_wide),.full(full),.wr_en(write),.wr_data_count(level_wclk),
+ .rd_clk(rclk),.dout(data_out_wide),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) );
+ end
+ else if((WIDTH <= 19) && (SIZE <= 4)) begin
+ wire [18:0] data_in_wide, data_out_wide;
+ assign data_in_wide[WIDTH-1:0] = datain;
+ assign dataout = data_out_wide[WIDTH-1:0];
fifo_xlnx_16x19_2clk fifo_xlnx_16x19_2clk
(.rst(arst),
- .wr_clk(wclk),.din({1'b0,datain}),.full(full),.wr_en(write),.wr_data_count(level_wclk),
- .rd_clk(rclk),.dout({dummy,dataout}),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) );
+ .wr_clk(wclk),.din(data_in_wide),.full(full),.wr_en(write),.wr_data_count(level_wclk),
+ .rd_clk(rclk),.dout(data_out_wide),.empty(empty),.rd_en(read),.rd_data_count(level_rclk) );
+ end
endgenerate
-
+
assign occupied = {{(16-SIZE-1){1'b0}},level_rclk};
assign space = ((1<<SIZE)+1)-level_wclk;
diff --git a/fpga/usrp2/gpif/packet_reframer.v b/fpga/usrp2/gpif/packet_reframer.v
index 8bb8a3678..e0ce9e174 100644
--- a/fpga/usrp2/gpif/packet_reframer.v
+++ b/fpga/usrp2/gpif/packet_reframer.v
@@ -20,7 +20,7 @@
module packet_reframer
(input clk, input reset, input clear,
- input [18:0] data_i,
+ input [15:0] data_i,
input src_rdy_i,
output dst_rdy_o,
output [18:0] data_o,
@@ -60,8 +60,7 @@ module packet_reframer
wire occ_out = 0;
assign eof_out = (state == RF_PKT) & (length == 2);
wire sof_out = (state == RF_IDLE);
- wire [15:0] data_out = data_i[15:0];
- assign data_o = {occ_out, eof_out, sof_out, data_out};
+ assign data_o = {occ_out, eof_out, sof_out, data_i[15:0]};
endmodule // packet_reframer
diff --git a/fpga/usrp2/gpif/slave_fifo.v b/fpga/usrp2/gpif/slave_fifo.v
index 10740942b..b1d642fca 100644
--- a/fpga/usrp2/gpif/slave_fifo.v
+++ b/fpga/usrp2/gpif/slave_fifo.v
@@ -46,11 +46,15 @@ module slave_fifo
output [31:0] debug0, output [31:0] debug1
);
+ reg FX2_DE, FX2_CE, FX2_DF, FX2_CF;
+
// inputs to FPGA (all active low)
- wire FX2_DE = ~gpif_ctl[0]; //EP2 FX2 FIFO empty (FLAGA)
- wire FX2_CE = ~gpif_ctl[1]; //EP4 FX2 FIFO empty (FLAGB)
- wire FX2_DF = ~gpif_ctl[2]; //EP6 FX2 FIFO full (FLAGC)
- wire FX2_CF = ~gpif_ctl[3]; //EP8 FX2 FIFO full (FLAGD)
+ always @(posedge gpif_clk) begin
+ FX2_DE <= ~gpif_ctl[0]; //EP2 FX2 FIFO empty (FLAGA)
+ FX2_CE <= ~gpif_ctl[1]; //EP4 FX2 FIFO empty (FLAGB)
+ FX2_DF <= ~gpif_ctl[2]; //EP6 FX2 FIFO full (FLAGC)
+ FX2_CF <= ~gpif_ctl[3]; //EP8 FX2 FIFO full (FLAGD)
+ end
wire [17:0] gpif_d_out_ctrl, gpif_d_out_data, gpif_d_out;
@@ -68,7 +72,7 @@ module slave_fifo
//tx
wire ctrl_tx_dst_rdy; //sm input, ctrl tx path has space
wire ctrl_tx_src_rdy; //sm output, ctrl tx path enable
- reg data_tx_dst_rdy; //sm input, data tx path has space
+ wire data_tx_dst_rdy; //sm input, data tx path has space
wire data_tx_src_rdy; //sm output, data tx path enable
//rx
@@ -77,9 +81,9 @@ module slave_fifo
wire data_rx_dst_rdy; //sm output, data rx path enable
wire data_rx_src_rdy; //sm input, data rx path has space
- reg [9:0] transfer_count; //number of lines (a line is 16 bits) in active transfer
+ reg tx_data_enough_space;
- wire sop, eop; //SOP/EOP markers for TX data packets
+ reg [9:0] transfer_count; //number of lines (a line is 16 bits) in active transfer
reg pktend_latch;
@@ -93,6 +97,7 @@ module slave_fifo
localparam STATE_CTRL_TX_SLOE = 8;
localparam STATE_DATA_RX_ADR = 1;
localparam STATE_CTRL_RX_ADR = 4;
+ localparam STATE_PKTEND_ADR = 10;
localparam STATE_PKTEND = 7;
//logs the last bus user for xfer fairness
@@ -118,16 +123,16 @@ module slave_fifo
state <= STATE_CTRL_TX_SLOE;
else if(ctrl_rx_src_rdy & ~FX2_CF) //if the ctrl fifo has data and the FX2 isn't full
state <= STATE_CTRL_RX_ADR;
- else if(data_tx_dst_rdy & ~FX2_DE & last_data_bus_hog == BUS_HOG_RX) //if there's room in the data fifo and the FX2 has data
+ else if(data_tx_dst_rdy & ~FX2_DE & last_data_bus_hog == BUS_HOG_RX & tx_data_enough_space) //if there's room in the data fifo and the FX2 has data
state <= STATE_DATA_TX_SLOE;
else if(data_rx_src_rdy & ~FX2_DF & last_data_bus_hog == BUS_HOG_TX) //if the data fifo has data and the FX2 isn't full
state <= STATE_DATA_RX_ADR;
- else if(data_tx_dst_rdy & ~FX2_DE)
+ else if(data_tx_dst_rdy & ~FX2_DE & tx_data_enough_space)
state <= STATE_DATA_TX_SLOE;
else if(data_rx_src_rdy & ~FX2_DF)
state <= STATE_DATA_RX_ADR;
else if(~data_rx_src_rdy & ~dsp_rx_run & pktend_latch & ~FX2_DF)
- state <= STATE_PKTEND;
+ state <= STATE_PKTEND_ADR;
if(data_rx_src_rdy)
pktend_latch <= 1;
@@ -145,13 +150,18 @@ module slave_fifo
STATE_DATA_RX:
begin
- if((transfer_count == data_transfer_size) | FX2_DF | (~data_rx_src_rdy))
- state <= STATE_IDLE;
-
- transfer_count <= transfer_count + 1;
- last_data_bus_hog <= BUS_HOG_RX;
+ if(data_rx_src_rdy && data_rx_dst_rdy && (transfer_count != data_transfer_size))
+ transfer_count <= transfer_count + 1;
+ else
+ state <= STATE_IDLE;
+ last_data_bus_hog <= BUS_HOG_RX;
end
+ STATE_PKTEND_ADR:
+ begin
+ state <= STATE_PKTEND;
+ end
+
STATE_PKTEND:
begin
state <= STATE_IDLE;
@@ -160,22 +170,25 @@ module slave_fifo
STATE_DATA_TX:
begin
- if((transfer_count == data_transfer_size) | FX2_DE )/*| (~data_tx_dst_rdy))*/
- state <= STATE_IDLE;
- transfer_count <= transfer_count + 1;
- last_data_bus_hog <= BUS_HOG_TX;
+ if(data_tx_dst_rdy && data_tx_src_rdy && (transfer_count != data_transfer_size))
+ transfer_count <= transfer_count + 1;
+ else
+ state <= STATE_IDLE;
+ last_data_bus_hog <= BUS_HOG_TX;
end
STATE_CTRL_RX:
begin
- if(FX2_CF | (~ctrl_rx_src_rdy))
- state <= STATE_IDLE;
- transfer_count <= transfer_count + 1;
+ if(ctrl_rx_src_rdy && ctrl_rx_dst_rdy)
+ transfer_count <= transfer_count + 1;
+ else
+ state <= STATE_IDLE;
end
STATE_CTRL_TX:
begin
- if(FX2_CE | (~ctrl_tx_dst_rdy))
- state <= STATE_IDLE;
- transfer_count <= transfer_count + 1;
+ if(ctrl_tx_dst_rdy && ctrl_tx_src_rdy)
+ transfer_count <= transfer_count + 1;
+ else
+ state <= STATE_IDLE;
end
endcase
end
@@ -184,18 +197,15 @@ module slave_fifo
// fifo signal assignments and enables
//enable fifos
- assign data_rx_dst_rdy = (state == STATE_DATA_RX);
- assign data_tx_src_rdy = (state == STATE_DATA_TX);
- assign ctrl_rx_dst_rdy = (state == STATE_CTRL_RX);
- assign ctrl_tx_src_rdy = (state == STATE_CTRL_TX);
-
- //tx framing (this is super suspect)
- //eop should be used only to set the EOP bit going into FIFOs
- wire eop_data, eop_ctrl;
- assign sop = (transfer_count == 0);
- assign eop_data = (transfer_count == (data_transfer_size-1));
+ assign data_rx_dst_rdy = (state == STATE_DATA_RX) && ~FX2_DF;
+ assign data_tx_src_rdy = (state == STATE_DATA_TX) && ~FX2_DE;
+ assign ctrl_rx_dst_rdy = (state == STATE_CTRL_RX) && ~FX2_CF;
+ assign ctrl_tx_src_rdy = (state == STATE_CTRL_TX) && ~FX2_CE;
+
+ //framing for TX ctrl packets
+ wire sop_ctrl, eop_ctrl;
+ assign sop_ctrl = (transfer_count == 0);
assign eop_ctrl = (transfer_count == (ctrl_transfer_size-1));
- assign eop = (state == STATE_DATA_TX) ? eop_data : eop_ctrl;
// ////////////////////////////////////////////////////////////////////
// set GPIF pins
@@ -205,15 +215,15 @@ module slave_fifo
// {0,1}: EP4, ctrl TX from host
// {1,0}: EP6, data RX to host
// {1,1}: EP8, ctrl RX to host
- assign fifoadr = {(state == STATE_DATA_RX) | (state == STATE_CTRL_RX) | (state == STATE_DATA_RX_ADR) | (state == STATE_CTRL_RX_ADR) | (state == STATE_PKTEND),
+ assign fifoadr = {(state == STATE_DATA_RX) | (state == STATE_CTRL_RX) | (state == STATE_DATA_RX_ADR) | (state == STATE_CTRL_RX_ADR) | (state == STATE_PKTEND) | (state == STATE_PKTEND_ADR),
(state == STATE_CTRL_RX) | (state == STATE_CTRL_RX_ADR) | (state == STATE_CTRL_TX) | (state == STATE_CTRL_TX_SLOE)};
//set sloe, slwr, slrd (all active low)
//SLOE gets asserted when we want data from the FX2; i.e., TX mode
assign sloe = ~{(state == STATE_DATA_TX) | (state == STATE_CTRL_TX) | (state == STATE_DATA_TX_SLOE) | (state == STATE_CTRL_TX_SLOE)};
//"read" and "write" here are from the master's point of view;
//so "read" means "transmit" and "write" means "receive"
- assign slwr = ~{(state == STATE_DATA_RX) | (state == STATE_CTRL_RX)};
- assign slrd = ~{(state == STATE_DATA_TX) | (state == STATE_CTRL_TX)};
+ assign slwr = ~{(data_rx_src_rdy && data_rx_dst_rdy) || (ctrl_rx_src_rdy && ctrl_rx_dst_rdy)};
+ assign slrd = ~{(data_tx_src_rdy && data_tx_dst_rdy) || (ctrl_tx_src_rdy && ctrl_tx_dst_rdy)};
wire pktend_ctrl, pktend_data;
assign pktend_ctrl = ((~ctrl_rx_src_rdy | gpif_d_out_ctrl[17]) & (state == STATE_CTRL_RX));
@@ -228,43 +238,39 @@ module slave_fifo
// ////////////////////////////////////////////////////////////////////
// TX Data Path
- wire [18:0] tx19_data;
- wire tx19_src_rdy, tx19_dst_rdy;
+ wire [15:0] txfifo_data;
+ wire txfifo_src_rdy, txfifo_dst_rdy;
wire [35:0] tx36_data;
wire tx36_src_rdy, tx36_dst_rdy;
- wire [17:0] data_tx_int;
- wire tx_src_rdy_int, tx_dst_rdy_int;
+ wire [15:0] data_tx_2clk;
+ wire tx_src_rdy_2clk, tx_dst_rdy_2clk;
wire [15:0] wr_fifo_space;
-
+
always @(posedge gpif_clk)
- if(gpif_rst)
- data_tx_dst_rdy <= 0;
- else
- data_tx_dst_rdy <= wr_fifo_space >= 256;
+ tx_data_enough_space <= (wr_fifo_space >= data_transfer_size);
- fifo_cascade #(.WIDTH(18), .SIZE(12)) wr_fifo
+ fifo_cascade #(.WIDTH(16), .SIZE(12)) wr_fifo
(.clk(gpif_clk), .reset(gpif_rst), .clear(clear_tx),
- .datain({eop,sop,gpif_d}), .src_rdy_i(data_tx_src_rdy), .dst_rdy_o(/*data_tx_dst_rdy*/), .space(wr_fifo_space),
- .dataout(data_tx_int), .src_rdy_o(tx_src_rdy_int), .dst_rdy_i(tx_dst_rdy_int), .occupied());
+ .datain(gpif_d), .src_rdy_i(data_tx_src_rdy), .dst_rdy_o(data_tx_dst_rdy), .space(wr_fifo_space),
+ .dataout(txfifo_data), .src_rdy_o(txfifo_src_rdy), .dst_rdy_i(txfifo_dst_rdy), .occupied());
- fifo_2clock_cascade #(.WIDTH(18), .SIZE(4)) wr_fifo_2clk
- (.wclk(gpif_clk), .datain(data_tx_int), .src_rdy_i(tx_src_rdy_int), .dst_rdy_o(tx_dst_rdy_int), .space(),
- .rclk(fifo_clk), .dataout(tx19_data[17:0]), .src_rdy_o(tx19_src_rdy), .dst_rdy_i(tx19_dst_rdy), .occupied(),
+ fifo_2clock_cascade #(.WIDTH(16), .SIZE(4)) wr_fifo_2clk
+ (.wclk(gpif_clk), .datain(txfifo_data), .src_rdy_i(txfifo_src_rdy), .dst_rdy_o(txfifo_dst_rdy), .space(),
+ .rclk(fifo_clk), .dataout(data_tx_2clk), .src_rdy_o(tx_src_rdy_2clk), .dst_rdy_i(tx_dst_rdy_2clk), .occupied(),
.arst(fifo_rst));
-
- assign tx19_data[18] = 1'b0;
- // join vita packets which are longer than one frame, drop frame padding
+ // join vita packets which are longer than one frame, add SOP/EOP/OCC
wire [18:0] refr_data;
wire refr_src_rdy, refr_dst_rdy;
+ //below 3 signals for debug only
wire refr_state;
wire refr_eof;
wire [15:0] refr_len;
packet_reframer tx_packet_reframer
(.clk(fifo_clk), .reset(fifo_rst), .clear(clear_tx),
- .data_i(tx19_data), .src_rdy_i(tx19_src_rdy), .dst_rdy_o(tx19_dst_rdy),
+ .data_i(data_tx_2clk), .src_rdy_i(tx_src_rdy_2clk), .dst_rdy_o(tx_dst_rdy_2clk),
.data_o(refr_data), .src_rdy_o(refr_src_rdy), .dst_rdy_i(refr_dst_rdy),
.state(refr_state), .eof_out(refr_eof), .length(refr_len));
@@ -308,7 +314,7 @@ module slave_fifo
.arst(fifo_rst));
//rd_fifo buffers writes to the 2clock fifo above
- fifo_cascade #(.WIDTH(19), .SIZE(RXFIFOSIZE)) rd_fifo
+ fifo_cascade #(.WIDTH(16), .SIZE(RXFIFOSIZE)) rd_fifo
(.clk(~gpif_clk), .reset(gpif_rst), .clear(clear_rx),
.datain(data_rx_int), .src_rdy_i(rx_src_rdy_int), .dst_rdy_o(rx_dst_rdy_int), .space(rxfifospace),
.dataout(gpif_d_out_data), .src_rdy_o(data_rx_src_rdy), .dst_rdy_i(data_rx_dst_rdy), .occupied());
@@ -341,7 +347,7 @@ module slave_fifo
//how does this use fifo_clk instead of wb_clk
//answer: on b100 fifo clk IS wb clk
fifo_2clock_cascade #(.WIDTH(19), .SIZE(4)) ctrl_fifo_2clk
- (.wclk(gpif_clk), .datain({1'b0,eop,sop,gpif_d}),
+ (.wclk(gpif_clk), .datain({1'b0,eop_ctrl,sop_ctrl,gpif_d}),
.src_rdy_i(ctrl_tx_src_rdy), .dst_rdy_o(ctrl_tx_dst_rdy), .space(),
.rclk(fifo_clk), .dataout(ctrl_data),
.src_rdy_o(ctrl_src_rdy), .dst_rdy_i(ctrl_dst_rdy), .occupied(),
diff --git a/fpga/usrp2/top/B100/u1plus_core.v b/fpga/usrp2/top/B100/u1plus_core.v
index e335fb8bb..26714b669 100644
--- a/fpga/usrp2/top/B100/u1plus_core.v
+++ b/fpga/usrp2/top/B100/u1plus_core.v
@@ -413,7 +413,7 @@ module u1plus_core
// Readback mux 32 -- Slave #7
//compatibility number -> increment when the fpga has been sufficiently altered
- localparam compat_num = {16'd9, 16'd0}; //major, minor
+ localparam compat_num = {16'd9, 16'd1}; //major, minor
wire [31:0] reg_test32;
diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake
index 8f77188ee..b9ddddae3 100644
--- a/host/cmake/Modules/UHDVersion.cmake
+++ b/host/cmake/Modules/UHDVersion.cmake
@@ -32,34 +32,40 @@ SET(UHD_VERSION_PATCH 000)
########################################################################
# Version information discovery through git log
########################################################################
-IF(UHD_RELEASE_MODE)
- SET(UHD_BUILD_INFO_DISCOVERY FALSE)
- SET(UHD_BUILD_INFO "release")
-ELSE()
- SET(UHD_BUILD_INFO_DISCOVERY GIT_FOUND)
- SET(UHD_BUILD_INFO "unknown")
-ENDIF()
-IF(UHD_BUILD_INFO_DISCOVERY)
+#grab the git ref id for the current head
+EXECUTE_PROCESS(
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8 --long
+ OUTPUT_VARIABLE _git_describe OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE _git_describe_result
+)
- #grab the git ref id for the current head
+#only set the build info on success
+IF(_git_describe_result EQUAL 0)
+ EXECUTE_PROCESS(
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND ${PYTHON_EXECUTABLE} -c "print '${_git_describe}'.split('-')[1]"
+ OUTPUT_VARIABLE UHD_GIT_COUNT OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8 --long
- OUTPUT_VARIABLE _git_describe OUTPUT_STRIP_TRAILING_WHITESPACE
- RESULT_VARIABLE _git_describe_result
+ COMMAND ${PYTHON_EXECUTABLE} -c "print '${_git_describe}'.split('-')[2]"
+ OUTPUT_VARIABLE UHD_GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE
)
+ENDIF()
- #only set the build info on success
- IF(_git_describe_result EQUAL 0)
- EXECUTE_PROCESS(
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- COMMAND ${PYTHON_EXECUTABLE} -c "print '${_git_describe}'.split('-',1)[1]"
- OUTPUT_VARIABLE UHD_BUILD_INFO OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- ENDIF()
+IF(NOT UHD_GIT_COUNT)
+ SET(UHD_GIT_COUNT "0")
+ENDIF()
+
+IF(NOT UHD_GIT_HASH)
+ SET(UHD_GIT_HASH "unknown")
+ENDIF()
-ENDIF(UHD_BUILD_INFO_DISCOVERY)
+IF(UHD_RELEASE_MODE)
+ SET(UHD_GIT_HASH ${UHD_RELEASE_MODE})
+ENDIF()
########################################################################
-SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}-${UHD_BUILD_INFO}")
+SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}-${UHD_GIT_COUNT}-${UHD_GIT_HASH}")
diff --git a/host/lib/usrp/common/fx2_ctrl.cpp b/host/lib/usrp/common/fx2_ctrl.cpp
index 7b8920eb1..5cc701eb0 100644
--- a/host/lib/usrp/common/fx2_ctrl.cpp
+++ b/host/lib/usrp/common/fx2_ctrl.cpp
@@ -411,6 +411,26 @@ public:
return usrp_control_write(request, value, index, 0, 0);
}
+ void write_eeprom(
+ boost::uint8_t addr,
+ boost::uint8_t offset,
+ const byte_vector_t &bytes
+ ){
+ byte_vector_t bytes_with_cmd(bytes.size() + 1);
+ bytes_with_cmd[0] = offset;
+ std::copy(bytes.begin(), bytes.end(), &bytes_with_cmd[1]);
+ this->write_i2c(addr, bytes_with_cmd);
+ }
+
+ byte_vector_t read_eeprom(
+ boost::uint8_t addr,
+ boost::uint8_t offset,
+ size_t num_bytes
+ ){
+ this->write_i2c(addr, byte_vector_t(1, offset));
+ return this->read_i2c(addr, num_bytes);
+ }
+
int usrp_i2c_write(boost::uint16_t i2c_addr, unsigned char *buf, boost::uint16_t len)
{
return usrp_control_write(VRQ_I2C_WRITE, i2c_addr, 0, buf, len);
@@ -428,12 +448,7 @@ public:
{
UHD_ASSERT_THROW(bytes.size() < max_i2c_data_bytes);
- unsigned char buff[max_i2c_data_bytes] = {};
- std::copy(bytes.begin(), bytes.end(), buff);
-
- int ret = this->usrp_i2c_write(addr & 0xff,
- buff,
- bytes.size());
+ int ret = this->usrp_i2c_write(addr, (unsigned char *)&bytes.front(), bytes.size());
if (iface_debug && (ret < 0))
uhd::runtime_error("USRP: failed i2c write");
@@ -443,19 +458,13 @@ public:
{
UHD_ASSERT_THROW(num_bytes < max_i2c_data_bytes);
- unsigned char buff[max_i2c_data_bytes] = {};
- int ret = this->usrp_i2c_read(addr & 0xff,
- buff,
- num_bytes);
+ byte_vector_t bytes(num_bytes);
+ int ret = this->usrp_i2c_read(addr, (unsigned char *)&bytes.front(), num_bytes);
if (iface_debug && ((ret < 0) || (unsigned)ret < (num_bytes)))
uhd::runtime_error("USRP: failed i2c read");
- byte_vector_t out_bytes;
- for (size_t i = 0; i < num_bytes; i++)
- out_bytes.push_back(buff[i]);
-
- return out_bytes;
+ return bytes;
}
diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp
index 846597f06..95c5c5d4d 100644
--- a/host/lib/usrp/dboard/db_dbsrx.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010-2011 Ettus Research LLC
+// Copyright 2010-2012 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
@@ -58,6 +58,8 @@ static const uhd::dict<std::string, gain_range_t> dbsrx_gain_ranges = map_list_o
("GC2", gain_range_t(0, 24, 1))
;
+static const double usrp1_gpio_clock_rate_limit = 4e6;
+
/***********************************************************************
* The DBSRX dboard class
**********************************************************************/
@@ -265,6 +267,11 @@ double dbsrx::set_lo_freq(double target_freq){
std::vector<double> clock_rates = this->get_iface()->get_clock_rates(dboard_iface::UNIT_RX);
const double max_clock_rate = uhd::sorted(clock_rates).back();
BOOST_FOREACH(ref_clock, uhd::reversed(uhd::sorted(clock_rates))){
+ //USRP1 feeds the DBSRX clock from a FPGA GPIO line.
+ //make sure that this clock does not exceed rate limit.
+ if (this->get_iface()->get_special_props().soft_clock_divider){
+ if (ref_clock > usrp1_gpio_clock_rate_limit) continue;
+ }
if (ref_clock > 27.0e6) continue;
if (size_t(max_clock_rate/ref_clock)%2 == 1) continue; //reject asymmetric clocks (odd divisors)
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 2e3d1e479..55c5e7dac 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -121,12 +121,26 @@ static device_addrs_t usrp2_find(const device_addr_t &hint_){
//new_addr["addr"] = ip_addr.to_string();
new_addr["addr"] = udp_transport->get_recv_addr();
+ //Attempt a simple 2-way communication with a connected socket.
+ //Reason: Although the USRP will respond the broadcast above,
+ //we may not be able to communicate directly (non-broadcast).
+ udp_simple::sptr ctrl_xport = udp_simple::make_connected(
+ new_addr["addr"], BOOST_STRINGIZE(USRP2_UDP_CTRL_PORT)
+ );
+ ctrl_xport->send(boost::asio::buffer(&ctrl_data_out, sizeof(ctrl_data_out)));
+ size_t len = ctrl_xport->recv(asio::buffer(usrp2_ctrl_data_in_mem));
+ if (len > offsetof(usrp2_ctrl_data_t, data) and ntohl(ctrl_data_in->id) == USRP2_CTRL_ID_WAZZUP_DUDE){
+ //found the device, open up for communication!
+ }
+ else{
+ //otherwise we don't find it...
+ continue;
+ }
+
//Attempt to read the name from the EEPROM and perform filtering.
//This operation can throw due to compatibility mismatch.
try{
- usrp2_iface::sptr iface = usrp2_iface::make(udp_simple::make_connected(
- new_addr["addr"], BOOST_STRINGIZE(USRP2_UDP_CTRL_PORT)
- ));
+ usrp2_iface::sptr iface = usrp2_iface::make(ctrl_xport);
if (iface->is_device_locked()) continue; //ignore locked devices
mboard_eeprom_t mb_eeprom = iface->mb_eeprom;
new_addr["name"] = mb_eeprom["name"];