diff options
Diffstat (limited to 'firmware/zpu')
-rw-r--r-- | firmware/zpu/lib/udp_fw_update.h | 6 | ||||
-rw-r--r-- | firmware/zpu/usrp2p/udp_fw_update.c | 19 |
2 files changed, 24 insertions, 1 deletions
diff --git a/firmware/zpu/lib/udp_fw_update.h b/firmware/zpu/lib/udp_fw_update.h index d25525bd2..d98447aef 100644 --- a/firmware/zpu/lib/udp_fw_update.h +++ b/firmware/zpu/lib/udp_fw_update.h @@ -45,6 +45,9 @@ typedef enum { USRP2_FW_UPDATE_ID_RESET_MAH_COMPUTORZ_LOL = 's', USRP2_FW_UPDATE_ID_RESETTIN_TEH_COMPUTORZ_OMG = 'S', + USRP2_FW_UPDATE_ID_I_CAN_HAS_HW_REV_LOL = 'v', + USRP2_FW_UPDATE_ID_HERES_TEH_HW_REV_OMG = 'V', + USRP2_FW_UPDATE_ID_KTHXBAI = '~' } usrp2_fw_update_id_t; @@ -54,7 +57,8 @@ typedef struct { uint32_t id; uint32_t seq; union { - uint32_t ip_addr; + uint32_t ip_addr; + uint32_t hw_rev; struct { uint32_t flash_addr; uint32_t length; diff --git a/firmware/zpu/usrp2p/udp_fw_update.c b/firmware/zpu/usrp2p/udp_fw_update.c index ead08ad2c..f64e7653c 100644 --- a/firmware/zpu/usrp2p/udp_fw_update.c +++ b/firmware/zpu/usrp2p/udp_fw_update.c @@ -27,6 +27,13 @@ #include "ethernet.h" #include "udp_fw_update.h" #include "xilinx_s3_icap.h" +#include "i2c.h" + +uint16_t get_hw_rev(void) { + uint16_t tmp; + eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV, &tmp, sizeof(tmp)); + return tmp; +} //Firmware update packet handler void handle_udp_fw_update_packet(struct socket_address src, struct socket_address dst, @@ -59,6 +66,13 @@ void handle_udp_fw_update_packet(struct socket_address src, struct socket_addres case USRP2_FW_UPDATE_ID_OHAI_LOL: //why hello there you handsome devil update_data_out.id = USRP2_FW_UPDATE_ID_OHAI_OMG; memcpy(&update_data_out.data.ip_addr, (void *)get_ip_addr(), sizeof(struct ip_addr)); + //this is to stop streaming for the folks who think updating while streaming is a good idea + sr_rx_ctrl0->cmd = 1 << 31; //no samples now + sr_rx_ctrl0->time_secs = 0; + sr_rx_ctrl0->time_ticks = 0; //latch the command + sr_rx_ctrl1->cmd = 1 << 31; //no samples now + sr_rx_ctrl1->time_secs = 0; + sr_rx_ctrl1->time_ticks = 0; //latch the command break; case USRP2_FW_UPDATE_ID_WATS_TEH_FLASH_INFO_LOL: //query sector size, memory size so the host can mind the boundaries @@ -67,6 +81,11 @@ void handle_udp_fw_update_packet(struct socket_address src, struct socket_addres update_data_out.id = USRP2_FW_UPDATE_ID_HERES_TEH_FLASH_INFO_OMG; break; + case USRP2_FW_UPDATE_ID_I_CAN_HAS_HW_REV_LOL: //get the hardware revision of the platform for validation checking + update_data_out.data.hw_rev = (uint32_t) get_hw_rev(); + update_data_out.id = USRP2_FW_UPDATE_ID_HERES_TEH_HW_REV_OMG; + break; + case USRP2_FW_UPDATE_ID_ERASE_TEH_FLASHES_LOL: //out with the old spi_flash_async_erase_start(&spi_flash_async_state, update_data_in->data.flash_args.flash_addr, update_data_in->data.flash_args.length); update_data_out.id = USRP2_FW_UPDATE_ID_ERASING_TEH_FLASHES_OMG; |