aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2016-11-15 16:36:43 -0800
committerMartin Braun <martin.braun@ettus.com>2016-11-15 16:36:45 -0800
commit581672f31d57b11517e1c88948d8ad672c9975f3 (patch)
tree6214df6c3be303cf90ecba670188b34b003008d4 /host/utils
parentcc6087f452c55ffb1396f1b172d3f6c501b1f5d4 (diff)
downloaduhd-581672f31d57b11517e1c88948d8ad672c9975f3.tar.gz
uhd-581672f31d57b11517e1c88948d8ad672c9975f3.tar.bz2
uhd-581672f31d57b11517e1c88948d8ad672c9975f3.zip
fixup! Remove all boost:: namespace prefix for uint32_t, int32_t etc. (fixed-width types)
Now also removes the namespaces in the utils/ directory.
Diffstat (limited to 'host/utils')
-rw-r--r--host/utils/b2xx_fx3_utils.cpp32
-rw-r--r--host/utils/converter_benchmark.cpp34
-rw-r--r--host/utils/octoclock_firmware_burner.cpp22
-rw-r--r--host/utils/usrp_n2xx_simple_net_burner.cpp118
-rw-r--r--host/utils/usrp_x3xx_fpga_burner.cpp40
5 files changed, 123 insertions, 123 deletions
diff --git a/host/utils/b2xx_fx3_utils.cpp b/host/utils/b2xx_fx3_utils.cpp
index 89794ed84..4d30e15dd 100644
--- a/host/utils/b2xx_fx3_utils.cpp
+++ b/host/utils/b2xx_fx3_utils.cpp
@@ -45,8 +45,8 @@ namespace po = boost::program_options;
namespace fs = boost::filesystem;
struct vid_pid_t {
- boost::uint16_t vid;
- boost::uint16_t pid;
+ uint16_t vid;
+ uint16_t pid;
};
const static vid_pid_t known_vid_pids[] = {
{FX3_VID, FX3_DEFAULT_PID},
@@ -60,17 +60,17 @@ const static vid_pid_t known_vid_pids[] = {
const static std::vector<vid_pid_t> known_vid_pid_vector(known_vid_pids, known_vid_pids + (sizeof(known_vid_pids) / sizeof(known_vid_pids[0])));
static const size_t EEPROM_INIT_VALUE_VECTOR_SIZE = 8;
-static uhd::byte_vector_t construct_eeprom_init_value_vector(boost::uint16_t vid, boost::uint16_t pid)
+static uhd::byte_vector_t construct_eeprom_init_value_vector(uint16_t vid, uint16_t pid)
{
uhd::byte_vector_t init_values(EEPROM_INIT_VALUE_VECTOR_SIZE);
init_values.at(0) = 0x43;
init_values.at(1) = 0x59;
init_values.at(2) = 0x14;
init_values.at(3) = 0xB2;
- init_values.at(4) = static_cast<boost::uint8_t>(pid & 0xff);
- init_values.at(5) = static_cast<boost::uint8_t>(pid >> 8);
- init_values.at(6) = static_cast<boost::uint8_t>(vid & 0xff);
- init_values.at(7) = static_cast<boost::uint8_t>(vid >> 8);
+ init_values.at(4) = static_cast<uint8_t>(pid & 0xff);
+ init_values.at(5) = static_cast<uint8_t>(pid >> 8);
+ init_values.at(6) = static_cast<uint8_t>(vid & 0xff);
+ init_values.at(7) = static_cast<uint8_t>(vid >> 8);
return init_values;
}
@@ -85,14 +85,14 @@ template <class T> struct to_hex{
};
//!parse hex-formatted ASCII text into an int
-boost::uint16_t atoh(const std::string &string){
+uint16_t atoh(const std::string &string){
if (string.substr(0, 2) == "0x"){
std::stringstream interpreter(string);
- to_hex<boost::uint16_t> hh;
+ to_hex<uint16_t> hh;
interpreter >> hh;
return hh.value;
}
- return boost::lexical_cast<boost::uint16_t>(string);
+ return boost::lexical_cast<uint16_t>(string);
}
int reset_usb()
@@ -153,7 +153,7 @@ int reset_usb()
return 0;
}
-uhd::transport::usb_device_handle::sptr open_device(const boost::uint16_t vid, const boost::uint16_t pid, const bool user_supplied = false)
+uhd::transport::usb_device_handle::sptr open_device(const uint16_t vid, const uint16_t pid, const bool user_supplied = false)
{
std::vector<uhd::transport::usb_device_handle::sptr> handles;
uhd::transport::usb_device_handle::sptr handle;
@@ -294,8 +294,8 @@ int erase_eeprom(b200_iface::sptr& b200)
return 0;
}
-boost::int32_t main(boost::int32_t argc, char *argv[]) {
- boost::uint16_t vid, pid;
+int32_t main(int32_t argc, char *argv[]) {
+ uint16_t vid, pid;
std::string pid_str, vid_str, fw_file, fpga_file, writevid_str, writepid_str;
bool user_supplied_vid_pid = false;
@@ -540,11 +540,11 @@ boost::int32_t main(boost::int32_t argc, char *argv[]) {
return 0;
}
- boost::uint8_t data_buffer[16];
+ uint8_t data_buffer[16];
memset(data_buffer, 0x0, sizeof(data_buffer));
if (vm.count("speed")){
- boost::uint8_t speed;
+ uint8_t speed;
try {speed = b200->get_usb_speed();}
catch (uhd::exception &e) {
std::cerr << "Exception while getting USB speed: " << e.what() << std::endl;
@@ -569,7 +569,7 @@ boost::int32_t main(boost::int32_t argc, char *argv[]) {
} else if (vm.count("load-fpga")) {
std::cout << "Loading FPGA image (" << fpga_file << ")" << std::endl;
- boost::uint32_t fx3_state;
+ uint32_t fx3_state;
try {fx3_state = b200->load_fpga(fpga_file);} // returns 0 on success, or FX3 state on error
catch (uhd::exception &e) {
std::cerr << "Exception while loading FPGA: " << e.what() << std::endl;
diff --git a/host/utils/converter_benchmark.cpp b/host/utils/converter_benchmark.cpp
index ddbf50255..c0cd28440 100644
--- a/host/utils/converter_benchmark.cpp
+++ b/host/utils/converter_benchmark.cpp
@@ -131,22 +131,22 @@ void init_buffers(
if (buf_seed_mode == INC) {
for (size_t i = 0; i < buf.size(); i++) {
if (type == "sc8") {
- init_inc_vector< std::complex<boost::int8_t> >(buf[i], n_items);
+ init_inc_vector< std::complex<int8_t> >(buf[i], n_items);
} else if (type == "sc16") {
- init_inc_vector< std::complex<boost::int16_t> >(buf[i], n_items);
+ init_inc_vector< std::complex<int16_t> >(buf[i], n_items);
} else if (type == "sc32") {
- init_inc_vector< std::complex<boost::int32_t> >(buf[i], n_items);
+ init_inc_vector< std::complex<int32_t> >(buf[i], n_items);
} else if (type == "fc32") {
init_inc_vector< std::complex<float> >(buf[i], n_items);
} else if (type == "fc64") {
init_inc_vector< std::complex<double> >(buf[i], n_items);
} else if (type == "s8") {
- init_inc_vector< boost::int8_t >(buf[i], n_items);
+ init_inc_vector< int8_t >(buf[i], n_items);
} else if (type == "s16") {
- init_inc_vector< boost::int16_t >(buf[i], n_items);
+ init_inc_vector< int16_t >(buf[i], n_items);
} else if (type == "item32") {
- init_inc_vector< boost::uint32_t >(buf[i], n_items);
- init_random_vector_real_int<boost::uint32_t>(buf[i], n_items);
+ init_inc_vector< uint32_t >(buf[i], n_items);
+ init_random_vector_real_int<uint32_t>(buf[i], n_items);
} else {
throw uhd::runtime_error(str(
boost::format("Cannot handle data type: %s") % type
@@ -162,21 +162,21 @@ void init_buffers(
/// Fill with random data
for (size_t i = 0; i < buf.size(); i++) {
if (type == "sc8") {
- init_random_vector_complex_int<boost::int8_t>(buf[i], n_items);
+ init_random_vector_complex_int<int8_t>(buf[i], n_items);
} else if (type == "sc16") {
- init_random_vector_complex_int<boost::int16_t>(buf[i], n_items);
+ init_random_vector_complex_int<int16_t>(buf[i], n_items);
} else if (type == "sc32") {
- init_random_vector_complex_int<boost::int32_t>(buf[i], n_items);
+ init_random_vector_complex_int<int32_t>(buf[i], n_items);
} else if (type == "fc32") {
init_random_vector_complex_float<float>(buf[i], n_items);
} else if (type == "fc64") {
init_random_vector_complex_float<double>(buf[i], n_items);
} else if (type == "s8") {
- init_random_vector_real_int<boost::int8_t>(buf[i], n_items);
+ init_random_vector_real_int<int8_t>(buf[i], n_items);
} else if (type == "s16") {
- init_random_vector_real_int<boost::int16_t>(buf[i], n_items);
+ init_random_vector_real_int<int16_t>(buf[i], n_items);
} else if (type == "item32") {
- init_random_vector_real_int<boost::uint32_t>(buf[i], n_items);
+ init_random_vector_real_int<uint32_t>(buf[i], n_items);
} else {
throw uhd::runtime_error(str(
boost::format("Cannot handle data type: %s") % type
@@ -240,11 +240,11 @@ std::string item_to_string(
}
if (type == "sc16") {
- const std::complex<boost::int16_t> *ptr = reinterpret_cast<const std::complex<boost::int16_t> *>(v_ptr);
+ const std::complex<int16_t> *ptr = reinterpret_cast<const std::complex<int16_t> *>(v_ptr);
return boost::lexical_cast<std::string>(ptr[index]);
}
else if (type == "sc8") {
- const std::complex<boost::int8_t> *ptr = reinterpret_cast<const std::complex<boost::int8_t> *>(v_ptr);
+ const std::complex<int8_t> *ptr = reinterpret_cast<const std::complex<int8_t> *>(v_ptr);
return boost::lexical_cast<std::string>(ptr[index]);
}
else if (type == "fc32") {
@@ -252,11 +252,11 @@ std::string item_to_string(
return boost::lexical_cast<std::string>(ptr[index]);
}
else if (type == "item32") {
- const boost::uint32_t *ptr = reinterpret_cast<const boost::uint32_t *>(v_ptr);
+ const uint32_t *ptr = reinterpret_cast<const uint32_t *>(v_ptr);
return boost::lexical_cast<std::string>(ptr[index]);
}
else if (type == "s16") {
- const boost::int16_t *ptr = reinterpret_cast<const boost::int16_t *>(v_ptr);
+ const int16_t *ptr = reinterpret_cast<const int16_t *>(v_ptr);
return boost::lexical_cast<std::string>(ptr[index]);
}
else {
diff --git a/host/utils/octoclock_firmware_burner.cpp b/host/utils/octoclock_firmware_burner.cpp
index 2c44e4ff9..4ffaeb0d7 100644
--- a/host/utils/octoclock_firmware_burner.cpp
+++ b/host/utils/octoclock_firmware_burner.cpp
@@ -70,20 +70,20 @@ void sig_int_handler(int){
}
}
-boost::uint8_t firmware_image[MAX_FIRMWARE_SIZE];
+uint8_t firmware_image[MAX_FIRMWARE_SIZE];
size_t firmware_size = 0;
-boost::uint8_t octoclock_data[udp_simple::mtu];
+uint8_t octoclock_data[udp_simple::mtu];
octoclock_packet_t *pkt_in = reinterpret_cast<octoclock_packet_t *>(octoclock_data);
std::string firmware_path, actual_firmware_path;
size_t num_blocks = 0;
bool hex = true;
-static uint16_t calculate_crc(boost::uint8_t* buffer, boost::uint16_t len){
- boost::uint16_t crc = 0xFFFF;
+static uint16_t calculate_crc(uint8_t* buffer, uint16_t len){
+ uint16_t crc = 0xFFFF;
for(size_t i = 0; i < len; i++){
crc ^= buffer[i];
- for(boost::uint8_t j = 0; j < 8; ++j){
+ for(uint8_t j = 0; j < 8; ++j){
if(crc & 1) crc = (crc >> 1) ^ 0xA001;
else crc = (crc >> 1);
}
@@ -134,7 +134,7 @@ device_addrs_t bootloader_find(const std::string &ip_addr){
udp_simple::sptr udp_transport = udp_simple::make_connected(ip_addr, BOOST_STRINGIZE(OCTOCLOCK_UDP_CTRL_PORT));
octoclock_packet_t pkt_out;
- pkt_out.sequence = uhd::htonx<boost::uint32_t>(std::rand());
+ pkt_out.sequence = uhd::htonx<uint32_t>(std::rand());
pkt_out.code = OCTOCLOCK_QUERY_CMD;
pkt_out.len = 0;
size_t len = 0;
@@ -174,8 +174,8 @@ void read_firmware(){
void burn_firmware(udp_simple::sptr udp_transport){
octoclock_packet_t pkt_out;
- pkt_out.sequence = uhd::htonx<boost::uint32_t>(std::rand());
- pkt_out.len = (boost::uint16_t)firmware_size;
+ pkt_out.sequence = uhd::htonx<uint32_t>(std::rand());
+ pkt_out.len = (uint16_t)firmware_size;
pkt_out.crc = calculate_crc(firmware_image, firmware_size);
size_t len = 0, current_pos = 0;
@@ -231,7 +231,7 @@ void burn_firmware(udp_simple::sptr udp_transport){
void verify_firmware(udp_simple::sptr udp_transport){
octoclock_packet_t pkt_out;
pkt_out.proto_ver = OCTOCLOCK_FW_COMPAT_NUM;
- pkt_out.sequence = uhd::htonx<boost::uint32_t>(std::rand());
+ pkt_out.sequence = uhd::htonx<uint32_t>(std::rand());
size_t len = 0, current_pos = 0;
for(size_t i = 0; i < num_blocks; i++){
@@ -263,7 +263,7 @@ bool reset_octoclock(const std::string &ip_addr){
udp_simple::sptr udp_transport = udp_simple::make_connected(ip_addr, BOOST_STRINGIZE(OCTOCLOCK_UDP_CTRL_PORT));
octoclock_packet_t pkt_out;
- pkt_out.sequence = uhd::htonx<boost::uint32_t>(std::rand());
+ pkt_out.sequence = uhd::htonx<uint32_t>(std::rand());
size_t len;
UHD_OCTOCLOCK_SEND_AND_RECV(udp_transport, OCTOCLOCK_FW_COMPAT_NUM, RESET_CMD, pkt_out, len, octoclock_data);
@@ -280,7 +280,7 @@ bool reset_octoclock(const std::string &ip_addr){
void finalize(udp_simple::sptr udp_transport){
octoclock_packet_t pkt_out;
pkt_out.len = 0;
- pkt_out.sequence = uhd::htonx<boost::uint32_t>(std::rand());
+ pkt_out.sequence = uhd::htonx<uint32_t>(std::rand());
size_t len = 0;
UHD_OCTOCLOCK_SEND_AND_RECV(udp_transport, OCTOCLOCK_FW_COMPAT_NUM, FINALIZE_BURNING_CMD, pkt_out, len, octoclock_data);
diff --git a/host/utils/usrp_n2xx_simple_net_burner.cpp b/host/utils/usrp_n2xx_simple_net_burner.cpp
index b105e9cb6..56af3ce4a 100644
--- a/host/utils/usrp_n2xx_simple_net_burner.cpp
+++ b/host/utils/usrp_n2xx_simple_net_burner.cpp
@@ -95,26 +95,26 @@ typedef enum {
} usrp2_fw_update_id_t;
typedef struct {
- boost::uint32_t proto_ver;
- boost::uint32_t id;
- boost::uint32_t seq;
+ uint32_t proto_ver;
+ uint32_t id;
+ uint32_t seq;
union {
- boost::uint32_t ip_addr;
- boost::uint32_t hw_rev;
+ uint32_t ip_addr;
+ uint32_t hw_rev;
struct {
- boost::uint32_t flash_addr;
- boost::uint32_t length;
- boost::uint8_t data[256];
+ uint32_t flash_addr;
+ uint32_t length;
+ uint8_t data[256];
} flash_args;
struct {
- boost::uint32_t sector_size_bytes;
- boost::uint32_t memory_size_bytes;
+ uint32_t sector_size_bytes;
+ uint32_t memory_size_bytes;
} flash_info_args;
} data;
} usrp2_fw_update_data_t;
//Mapping revision numbers to filenames
-uhd::dict<boost::uint32_t, std::string> filename_map = boost::assign::map_list_of
+uhd::dict<uint32_t, std::string> filename_map = boost::assign::map_list_of
(0, "N2XX")
(0xa, "n200_r3")
(0x100a, "n200_r4")
@@ -122,9 +122,9 @@ uhd::dict<boost::uint32_t, std::string> filename_map = boost::assign::map_list_o
(0x110a, "n210_r4")
;
-boost::uint8_t usrp2_update_data_in_mem[udp_simple::mtu];
-boost::uint8_t fpga_image[FPGA_IMAGE_SIZE_BYTES];
-boost::uint8_t fw_image[FW_IMAGE_SIZE_BYTES];
+uint8_t usrp2_update_data_in_mem[udp_simple::mtu];
+uint8_t fpga_image[FPGA_IMAGE_SIZE_BYTES];
+uint8_t fw_image[FW_IMAGE_SIZE_BYTES];
/***********************************************************************
* Signal handlers
@@ -151,11 +151,11 @@ void sig_int_handler(int){
void list_usrps(){
udp_simple::sptr udp_bc_transport;
const usrp2_fw_update_data_t *update_data_in = reinterpret_cast<const usrp2_fw_update_data_t *>(usrp2_update_data_in_mem);
- boost::uint32_t hw_rev;
+ uint32_t hw_rev;
usrp2_fw_update_data_t usrp2_ack_pkt = usrp2_fw_update_data_t();
- usrp2_ack_pkt.proto_ver = htonx<boost::uint32_t>(USRP2_FW_PROTO_VERSION);
- usrp2_ack_pkt.id = htonx<boost::uint32_t>(USRP2_QUERY);
+ usrp2_ack_pkt.proto_ver = htonx<uint32_t>(USRP2_FW_PROTO_VERSION);
+ usrp2_ack_pkt.id = htonx<uint32_t>(USRP2_QUERY);
std::cout << "Available USRP N2XX devices:" << std::endl;
@@ -168,7 +168,7 @@ void list_usrps(){
size_t len = udp_bc_transport->recv(boost::asio::buffer(usrp2_update_data_in_mem), UDP_TIMEOUT);
if(len > offsetof(usrp2_fw_update_data_t, data) and ntohl(update_data_in->id) == USRP2_ACK){
- usrp2_ack_pkt.id = htonx<boost::uint32_t>(GET_HW_REV_CMD);
+ usrp2_ack_pkt.id = htonx<uint32_t>(GET_HW_REV_CMD);
udp_bc_transport->send(boost::asio::buffer(&usrp2_ack_pkt, sizeof(usrp2_ack_pkt)));
size_t len = udp_bc_transport->recv(boost::asio::buffer(usrp2_update_data_in_mem), UDP_TIMEOUT);
@@ -237,21 +237,21 @@ void print_image_loader_warning(const std::string &fw_path,
/***********************************************************************
* Find USRP N2XX with specified IP address and return type
**********************************************************************/
-boost::uint32_t find_usrp(udp_simple::sptr udp_transport, bool check_rev){
- boost::uint32_t hw_rev;
+uint32_t find_usrp(udp_simple::sptr udp_transport, bool check_rev){
+ uint32_t hw_rev;
bool found_it = false;
// If the user chooses to not care about the rev, simply check
// for the presence of a USRP N2XX.
- boost::uint32_t cmd_id = (check_rev) ? GET_HW_REV_CMD
+ uint32_t cmd_id = (check_rev) ? GET_HW_REV_CMD
: USRP2_QUERY;
- boost::uint32_t ack_id = (check_rev) ? GET_HW_REV_ACK
+ uint32_t ack_id = (check_rev) ? GET_HW_REV_ACK
: USRP2_ACK;
const usrp2_fw_update_data_t *update_data_in = reinterpret_cast<const usrp2_fw_update_data_t *>(usrp2_update_data_in_mem);
usrp2_fw_update_data_t hw_info_pkt = usrp2_fw_update_data_t();
- hw_info_pkt.proto_ver = htonx<boost::uint32_t>(USRP2_FW_PROTO_VERSION);
- hw_info_pkt.id = htonx<boost::uint32_t>(cmd_id);
+ hw_info_pkt.proto_ver = htonx<uint32_t>(USRP2_FW_PROTO_VERSION);
+ hw_info_pkt.id = htonx<uint32_t>(cmd_id);
udp_transport->send(boost::asio::buffer(&hw_info_pkt, sizeof(hw_info_pkt)));
//Loop and receive until the timeout
@@ -322,7 +322,7 @@ int read_fpga_image(std::string& fpga_path){
}
//Check sequence of bytes in image before reading
- boost::uint8_t fpga_test_bytes[63];
+ uint8_t fpga_test_bytes[63];
fpga_file.seekg(0, std::ios::beg);
fpga_file.read((char*)fpga_test_bytes,63);
bool is_good = false;
@@ -357,7 +357,7 @@ int read_fw_image(std::string& fw_path){
}
//Check sequence of bytes in image before reading
- boost::uint8_t fw_test_bytes[4];
+ uint8_t fw_test_bytes[4];
fw_file.seekg(0, std::ios::beg);
fw_file.read((char*)fw_test_bytes,4);
for(int i = 0; i < 4; i++) if(fw_test_bytes[i] != 11) throw std::runtime_error("Not a valid firmware image.");
@@ -370,15 +370,15 @@ int read_fw_image(std::string& fw_path){
return fw_image_size;
}
-boost::uint32_t* get_flash_info(std::string& ip_addr){
+uint32_t* get_flash_info(std::string& ip_addr){
- boost::uint32_t *flash_info = new boost::uint32_t[2];
+ uint32_t *flash_info = new uint32_t[2];
const usrp2_fw_update_data_t *update_data_in = reinterpret_cast<const usrp2_fw_update_data_t *>(usrp2_update_data_in_mem);
udp_simple::sptr udp_transport = udp_simple::make_connected(ip_addr, BOOST_STRINGIZE(USRP2_UDP_UPDATE_PORT));
usrp2_fw_update_data_t get_flash_info_pkt = usrp2_fw_update_data_t();
- get_flash_info_pkt.proto_ver = htonx<boost::uint32_t>(USRP2_FW_PROTO_VERSION);
- get_flash_info_pkt.id = htonx<boost::uint32_t>(GET_FLASH_INFO_CMD);
+ get_flash_info_pkt.proto_ver = htonx<uint32_t>(USRP2_FW_PROTO_VERSION);
+ get_flash_info_pkt.id = htonx<uint32_t>(GET_FLASH_INFO_CMD);
udp_transport->send(boost::asio::buffer(&get_flash_info_pkt, sizeof(get_flash_info_pkt)));
//Loop and receive until the timeout
@@ -399,13 +399,13 @@ boost::uint32_t* get_flash_info(std::string& ip_addr){
* Image burning functions
**********************************************************************/
-void erase_image(udp_simple::sptr udp_transport, bool is_fw, boost::uint32_t memory_size, bool overwrite_safe){
+void erase_image(udp_simple::sptr udp_transport, bool is_fw, uint32_t memory_size, bool overwrite_safe){
- boost::uint32_t image_location_addr = is_fw ? overwrite_safe ? SAFE_FW_IMAGE_LOCATION_ADDR
+ uint32_t image_location_addr = is_fw ? overwrite_safe ? SAFE_FW_IMAGE_LOCATION_ADDR
: PROD_FW_IMAGE_LOCATION_ADDR
: overwrite_safe ? SAFE_FPGA_IMAGE_LOCATION_ADDR
: PROD_FPGA_IMAGE_LOCATION_ADDR;
- boost::uint32_t image_size = is_fw ? FW_IMAGE_SIZE_BYTES
+ uint32_t image_size = is_fw ? FW_IMAGE_SIZE_BYTES
: FPGA_IMAGE_SIZE_BYTES;
//Making sure this won't attempt to erase past end of device
@@ -416,10 +416,10 @@ void erase_image(udp_simple::sptr udp_transport, bool is_fw, boost::uint32_t mem
//Setting up UDP packet
usrp2_fw_update_data_t erase_pkt = usrp2_fw_update_data_t();
- erase_pkt.id = htonx<boost::uint32_t>(ERASE_FLASH_CMD);
- erase_pkt.proto_ver = htonx<boost::uint32_t>(USRP2_FW_PROTO_VERSION);
- erase_pkt.data.flash_args.flash_addr = htonx<boost::uint32_t>(image_location_addr);
- erase_pkt.data.flash_args.length = htonx<boost::uint32_t>(image_size);
+ erase_pkt.id = htonx<uint32_t>(ERASE_FLASH_CMD);
+ erase_pkt.proto_ver = htonx<uint32_t>(USRP2_FW_PROTO_VERSION);
+ erase_pkt.data.flash_args.flash_addr = htonx<uint32_t>(image_location_addr);
+ erase_pkt.data.flash_args.length = htonx<uint32_t>(image_size);
//Begin erasing
udp_transport->send(boost::asio::buffer(&erase_pkt, sizeof(erase_pkt)));
@@ -434,7 +434,7 @@ void erase_image(udp_simple::sptr udp_transport, bool is_fw, boost::uint32_t mem
}
//Check for erase completion
- erase_pkt.id = htonx<boost::uint32_t>(CHECK_ERASING_DONE_CMD);
+ erase_pkt.id = htonx<uint32_t>(CHECK_ERASING_DONE_CMD);
while(true){
udp_transport->send(boost::asio::buffer(&erase_pkt, sizeof(erase_pkt)));
size_t len = udp_transport->recv(boost::asio::buffer(usrp2_update_data_in_mem), UDP_TIMEOUT);
@@ -450,14 +450,14 @@ void erase_image(udp_simple::sptr udp_transport, bool is_fw, boost::uint32_t mem
}
}
-void write_image(udp_simple::sptr udp_transport, bool is_fw, boost::uint8_t* image,
- boost::uint32_t memory_size, int image_size, bool overwrite_safe){
+void write_image(udp_simple::sptr udp_transport, bool is_fw, uint8_t* image,
+ uint32_t memory_size, int image_size, bool overwrite_safe){
- boost::uint32_t begin_addr = is_fw ? overwrite_safe ? SAFE_FW_IMAGE_LOCATION_ADDR
+ uint32_t begin_addr = is_fw ? overwrite_safe ? SAFE_FW_IMAGE_LOCATION_ADDR
: PROD_FW_IMAGE_LOCATION_ADDR
: overwrite_safe ? SAFE_FPGA_IMAGE_LOCATION_ADDR
: PROD_FPGA_IMAGE_LOCATION_ADDR;
- boost::uint32_t current_addr = begin_addr;
+ uint32_t current_addr = begin_addr;
std::string type = is_fw ? "firmware" : "FPGA";
//Making sure this won't attempt to write past end of device
@@ -468,16 +468,16 @@ void write_image(udp_simple::sptr udp_transport, bool is_fw, boost::uint8_t* ima
//Setting up UDP packet
usrp2_fw_update_data_t write_pkt = usrp2_fw_update_data_t();
- write_pkt.id = htonx<boost::uint32_t>(WRITE_FLASH_CMD);
- write_pkt.proto_ver = htonx<boost::uint32_t>(USRP2_FW_PROTO_VERSION);
- write_pkt.data.flash_args.length = htonx<boost::uint32_t>(FLASH_DATA_PACKET_SIZE);
+ write_pkt.id = htonx<uint32_t>(WRITE_FLASH_CMD);
+ write_pkt.proto_ver = htonx<uint32_t>(USRP2_FW_PROTO_VERSION);
+ write_pkt.data.flash_args.length = htonx<uint32_t>(FLASH_DATA_PACKET_SIZE);
for(int i = 0; i < ((image_size/FLASH_DATA_PACKET_SIZE)+1); i++){
//Print progress
std::cout << "\rWriting " << type << " image ("
<< int((double(current_addr-begin_addr)/double(image_size))*100) << "%)." << std::flush;
- write_pkt.data.flash_args.flash_addr = htonx<boost::uint32_t>(current_addr);
+ write_pkt.data.flash_args.flash_addr = htonx<uint32_t>(current_addr);
std::copy(image+(i*FLASH_DATA_PACKET_SIZE), image+((i+1)*FLASH_DATA_PACKET_SIZE), write_pkt.data.flash_args.data);
udp_transport->send(boost::asio::buffer(&write_pkt, sizeof(write_pkt)));
@@ -493,19 +493,19 @@ void write_image(udp_simple::sptr udp_transport, bool is_fw, boost::uint8_t* ima
std::cout << boost::format(" * Successfully wrote %d bytes.\n") % image_size;
}
-void verify_image(udp_simple::sptr udp_transport, bool is_fw, boost::uint8_t* image,
- boost::uint32_t memory_size, int image_size, bool overwrite_safe){
+void verify_image(udp_simple::sptr udp_transport, bool is_fw, uint8_t* image,
+ uint32_t memory_size, int image_size, bool overwrite_safe){
int current_index = 0;
- boost::uint32_t begin_addr = is_fw ? overwrite_safe ? SAFE_FW_IMAGE_LOCATION_ADDR
+ uint32_t begin_addr = is_fw ? overwrite_safe ? SAFE_FW_IMAGE_LOCATION_ADDR
: PROD_FW_IMAGE_LOCATION_ADDR
: overwrite_safe ? SAFE_FPGA_IMAGE_LOCATION_ADDR
: PROD_FPGA_IMAGE_LOCATION_ADDR;
- boost::uint32_t current_addr = begin_addr;
+ uint32_t current_addr = begin_addr;
std::string type = is_fw ? "firmware" : "FPGA";
//Array size needs to be known at runtime, this constant is guaranteed to be larger than any firmware or FPGA image
- boost::uint8_t from_usrp[FPGA_IMAGE_SIZE_BYTES];
+ uint8_t from_usrp[FPGA_IMAGE_SIZE_BYTES];
//Making sure this won't attempt to read past end of device
if(current_addr+image_size > memory_size) throw std::runtime_error("Cannot read past end of device.");
@@ -515,16 +515,16 @@ void verify_image(udp_simple::sptr udp_transport, bool is_fw, boost::uint8_t* im
//Setting up UDP packet
usrp2_fw_update_data_t verify_pkt = usrp2_fw_update_data_t();
- verify_pkt.id = htonx<boost::uint32_t>(READ_FLASH_CMD);
- verify_pkt.proto_ver = htonx<boost::uint32_t>(USRP2_FW_PROTO_VERSION);
- verify_pkt.data.flash_args.length = htonx<boost::uint32_t>(FLASH_DATA_PACKET_SIZE);
+ verify_pkt.id = htonx<uint32_t>(READ_FLASH_CMD);
+ verify_pkt.proto_ver = htonx<uint32_t>(USRP2_FW_PROTO_VERSION);
+ verify_pkt.data.flash_args.length = htonx<uint32_t>(FLASH_DATA_PACKET_SIZE);
for(int i = 0; i < ((image_size/FLASH_DATA_PACKET_SIZE)+1); i++){
//Print progress
std::cout << "\rVerifying " << type << " image ("
<< int((double(current_addr-begin_addr)/double(image_size))*100) << "%)." << std::flush;
- verify_pkt.data.flash_args.flash_addr = htonx<boost::uint32_t>(current_addr);
+ verify_pkt.data.flash_args.flash_addr = htonx<uint32_t>(current_addr);
udp_transport->send(boost::asio::buffer(&verify_pkt, sizeof(verify_pkt)));
size_t len = udp_transport->recv(boost::asio::buffer(usrp2_update_data_in_mem), UDP_TIMEOUT);
@@ -550,8 +550,8 @@ void reset_usrp(udp_simple::sptr udp_transport){
//Set up UDP packet
usrp2_fw_update_data_t reset_pkt = usrp2_fw_update_data_t();
- reset_pkt.id = htonx<boost::uint32_t>(RESET_USRP_CMD);
- reset_pkt.proto_ver = htonx<boost::uint32_t>(USRP2_FW_PROTO_VERSION);
+ reset_pkt.id = htonx<uint32_t>(RESET_USRP_CMD);
+ reset_pkt.proto_ver = htonx<uint32_t>(USRP2_FW_PROTO_VERSION);
//Reset USRP
udp_transport->send(boost::asio::buffer(&reset_pkt, sizeof(reset_pkt)));
@@ -645,7 +645,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//Find USRP and establish connection
std::cout << boost::format("Searching for USRP N2XX with IP address %s.\n") % ip_addr;
udp_simple::sptr udp_transport = udp_simple::make_connected(ip_addr, BOOST_STRINGIZE(USRP2_UDP_UPDATE_PORT));
- boost::uint32_t hw_rev = find_usrp(udp_transport, check_rev);
+ uint32_t hw_rev = find_usrp(udp_transport, check_rev);
//Check validity of file locations and binaries before attempting burn
std::cout << "Searching for specified images." << std::endl << std::endl;
@@ -687,7 +687,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
if(burn_fpga) std::cout << boost::format(" * FPGA: %s\n") % fpga_path;
std::cout << std::endl;
- boost::uint32_t* flash_info = get_flash_info(ip_addr);
+ uint32_t* flash_info = get_flash_info(ip_addr);
std::cout << boost::format("Querying %s for flash information.\n") % filename_map[hw_rev];
std::cout << boost::format(" * Flash size: %3.2f\n") % flash_info[1];
std::cout << boost::format(" * Sector size: %3.2f\n\n") % flash_info[0];
diff --git a/host/utils/usrp_x3xx_fpga_burner.cpp b/host/utils/usrp_x3xx_fpga_burner.cpp
index a5dcafac8..e3de8aad3 100644
--- a/host/utils/usrp_x3xx_fpga_burner.cpp
+++ b/host/utils/usrp_x3xx_fpga_burner.cpp
@@ -95,17 +95,17 @@ void sig_int_handler(int){
}
typedef struct {
- boost::uint32_t flags;
- boost::uint32_t sector;
- boost::uint32_t index;
- boost::uint32_t size;
- boost::uint16_t data[128];
+ uint32_t flags;
+ uint32_t sector;
+ uint32_t index;
+ uint32_t size;
+ uint16_t data[128];
} x300_fpga_update_data_t;
-boost::uint8_t x300_data_in_mem[udp_simple::mtu];
-boost::uint8_t intermediary_packet_data[X300_PACKET_SIZE_BYTES];
+uint8_t x300_data_in_mem[udp_simple::mtu];
+uint8_t intermediary_packet_data[X300_PACKET_SIZE_BYTES];
-boost::uint8_t bitswap(uint8_t b){
+uint8_t bitswap(uint8_t b){
b = ((b & 0xF0) >> 4) | ((b & 0x0F) << 4);
b = ((b & 0xCC) >> 2) | ((b & 0x33) << 2);
b = ((b & 0xAA) >> 1) | ((b & 0x55) << 1);
@@ -261,7 +261,7 @@ void print_image_loader_warning(const std::string &fpga_path, const po::variable
}
void ethernet_burn(udp_simple::sptr udp_transport, std::string fpga_path, bool verify){
- boost::uint32_t max_size;
+ uint32_t max_size;
std::vector<char> bitstream;
if(fs::extension(fpga_path) == ".bit") max_size = X300_FPGA_BIT_MAX_SIZE_BYTES;
@@ -293,7 +293,7 @@ void ethernet_burn(udp_simple::sptr udp_transport, std::string fpga_path, bool v
const x300_fpga_update_data_t *update_data_in = reinterpret_cast<const x300_fpga_update_data_t *>(x300_data_in_mem);
x300_fpga_update_data_t ack_packet;
- ack_packet.flags = htonx<boost::uint32_t>(X300_FPGA_PROG_FLAGS_ACK | X300_FPGA_PROG_FLAGS_INIT);
+ ack_packet.flags = htonx<uint32_t>(X300_FPGA_PROG_FLAGS_ACK | X300_FPGA_PROG_FLAGS_INIT);
ack_packet.sector = 0;
ack_packet.size = 0;
ack_packet.index = 0;
@@ -328,11 +328,11 @@ void ethernet_burn(udp_simple::sptr udp_transport, std::string fpga_path, bool v
send_packet.flags = X300_FPGA_PROG_FLAGS_ACK;
if(verify) send_packet.flags |= X300_FPGA_PROG_FLAGS_VERIFY;
if(j == i) send_packet.flags |= X300_FPGA_PROG_FLAGS_ERASE; //Erase the sector before writing
- send_packet.flags = htonx<boost::uint32_t>(send_packet.flags);
+ send_packet.flags = htonx<uint32_t>(send_packet.flags);
- send_packet.sector = htonx<boost::uint32_t>(X300_FPGA_SECTOR_START + (i/X300_FLASH_SECTOR_SIZE));
- send_packet.index = htonx<boost::uint32_t>((j % X300_FLASH_SECTOR_SIZE) / 2);
- send_packet.size = htonx<boost::uint32_t>(X300_PACKET_SIZE_BYTES / 2);
+ send_packet.sector = htonx<uint32_t>(X300_FPGA_SECTOR_START + (i/X300_FLASH_SECTOR_SIZE));
+ send_packet.index = htonx<uint32_t>((j % X300_FLASH_SECTOR_SIZE) / 2);
+ send_packet.size = htonx<uint32_t>(X300_PACKET_SIZE_BYTES / 2);
memset(intermediary_packet_data,0,X300_PACKET_SIZE_BYTES);
memset(send_packet.data,0,X300_PACKET_SIZE_BYTES);
if(!is_lvbitx) current_pos = ftell(file);
@@ -342,7 +342,7 @@ void ethernet_burn(udp_simple::sptr udp_transport, std::string fpga_path, bool v
memcpy(intermediary_packet_data, (&bitstream[current_pos]), (bitstream.size()-current_pos+1));
}
else{
- size_t len = fread(intermediary_packet_data, sizeof(boost::uint8_t), (fpga_image_size-current_pos), file);
+ size_t len = fread(intermediary_packet_data, sizeof(uint8_t), (fpga_image_size-current_pos), file);
if(len != (fpga_image_size-current_pos)){
throw std::runtime_error("Error reading from file!");
}
@@ -354,7 +354,7 @@ void ethernet_burn(udp_simple::sptr udp_transport, std::string fpga_path, bool v
current_pos += X300_PACKET_SIZE_BYTES;
}
else{
- size_t len = fread(intermediary_packet_data, sizeof(boost::uint8_t), X300_PACKET_SIZE_BYTES, file);
+ size_t len = fread(intermediary_packet_data, sizeof(uint8_t), X300_PACKET_SIZE_BYTES, file);
if(len != X300_PACKET_SIZE_BYTES){
throw std::runtime_error("Error reading from file!");
}
@@ -368,7 +368,7 @@ void ethernet_burn(udp_simple::sptr udp_transport, std::string fpga_path, bool v
memcpy(send_packet.data, intermediary_packet_data, X300_PACKET_SIZE_BYTES);
for(size_t k = 0; k < (X300_PACKET_SIZE_BYTES/2); k++){
- send_packet.data[k] = htonx<boost::uint16_t>(send_packet.data[k]);
+ send_packet.data[k] = htonx<uint16_t>(send_packet.data[k]);
}
udp_transport->send(boost::asio::buffer(&send_packet, sizeof(send_packet)));
@@ -387,7 +387,7 @@ void ethernet_burn(udp_simple::sptr udp_transport, std::string fpga_path, bool v
//Send clean-up signal
x300_fpga_update_data_t cleanup_packet;
- cleanup_packet.flags = htonx<boost::uint32_t>(X300_FPGA_PROG_FLAGS_ACK | X300_FPGA_PROG_FLAGS_CLEANUP);
+ cleanup_packet.flags = htonx<uint32_t>(X300_FPGA_PROG_FLAGS_ACK | X300_FPGA_PROG_FLAGS_CLEANUP);
cleanup_packet.sector = 0;
cleanup_packet.size = 0;
cleanup_packet.index = 0;
@@ -420,7 +420,7 @@ void pcie_burn(std::string resource, std::string rpc_port, std::string fpga_path
bool configure_fpga(udp_simple::sptr udp_transport, std::string ip_addr){
x300_fpga_update_data_t configure_packet;
- configure_packet.flags = htonx<boost::uint32_t>(X300_FPGA_PROG_CONFIGURE | X300_FPGA_PROG_FLAGS_ACK);
+ configure_packet.flags = htonx<uint32_t>(X300_FPGA_PROG_CONFIGURE | X300_FPGA_PROG_FLAGS_ACK);
configure_packet.sector = 0;
configure_packet.size = 0;
configure_packet.index = 0;
@@ -439,7 +439,7 @@ bool configure_fpga(udp_simple::sptr udp_transport, std::string ip_addr){
boost::this_thread::sleep(boost::posix_time::milliseconds(5000));
x300_fpga_update_data_t config_status_packet;
- configure_packet.flags = htonx<boost::uint32_t>(X300_FPGA_PROG_CONFIG_STATUS);
+ configure_packet.flags = htonx<uint32_t>(X300_FPGA_PROG_CONFIG_STATUS);
config_status_packet.sector = 0;
config_status_packet.size = 0;
config_status_packet.index = 0;