From 3ce4afc75422321ad5bce8503455a21a6a2db3a4 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Fri, 15 Jan 2016 07:26:36 -0800 Subject: n230: fixed header location --- firmware/usrp3/n230/CMakeLists.txt | 2 +- firmware/usrp3/n230/n230_eeprom.c | 2 +- firmware/usrp3/n230/n230_eeprom.h | 124 ----------------------------- firmware/usrp3/n230/n230_eth_handlers.c | 2 +- firmware/usrp3/n230/n230_init.c | 2 +- host/lib/usrp/n230/n230_eeprom.h | 124 +++++++++++++++++++++++++++++ host/lib/usrp/n230/n230_eeprom_manager.cpp | 4 +- 7 files changed, 130 insertions(+), 130 deletions(-) delete mode 100644 firmware/usrp3/n230/n230_eeprom.h create mode 100644 host/lib/usrp/n230/n230_eeprom.h diff --git a/firmware/usrp3/n230/CMakeLists.txt b/firmware/usrp3/n230/CMakeLists.txt index 327b68910..6247477f0 100644 --- a/firmware/usrp3/n230/CMakeLists.txt +++ b/firmware/usrp3/n230/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2010-2014 Ettus Research LLC +# Copyright 2010-2014,2016 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 diff --git a/firmware/usrp3/n230/n230_eeprom.c b/firmware/usrp3/n230/n230_eeprom.c index 767289efa..8f756d41f 100644 --- a/firmware/usrp3/n230/n230_eeprom.c +++ b/firmware/usrp3/n230/n230_eeprom.c @@ -15,7 +15,7 @@ // along with this program. If not, see . // -#include "n230_eeprom.h" +#include "../../../host/lib/usrp/n230/n230_eeprom.h" #include #include diff --git a/firmware/usrp3/n230/n230_eeprom.h b/firmware/usrp3/n230/n230_eeprom.h deleted file mode 100644 index b6c2a0c76..000000000 --- a/firmware/usrp3/n230/n230_eeprom.h +++ /dev/null @@ -1,124 +0,0 @@ -// -// Copyright 2014 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 -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// - -#ifndef INCLUDED_N230_EEPROM_H -#define INCLUDED_N230_EEPROM_H - -#include -#ifndef __cplusplus -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define N230_NUM_ETH_PORTS 2 -#define N230_MAX_NUM_ETH_PORTS 2 - -#if (N230_NUM_ETH_PORTS > N230_MAX_NUM_ETH_PORTS) -#error -#endif - -#define N230_EEPROM_VER_MAJOR 1 -#define N230_EEPROM_VER_MINOR 1 -#define N230_EEPROM_SERIAL_LEN 9 -#define N230_EEPROM_NAME_LEN 32 - -typedef struct -{ - uint8_t mac_addr[6]; - uint8_t _pad[2]; - uint32_t subnet; - uint32_t ip_addr; -} n230_eth_eeprom_map_t; - -typedef struct -{ - //Data format version - uint16_t data_version_major; - uint16_t data_version_minor; - - //HW identification info - uint16_t hw_revision; - uint16_t hw_product; - uint8_t serial[N230_EEPROM_SERIAL_LEN]; - uint8_t _pad_serial; - uint16_t hw_revision_compat; - uint8_t _pad0[18 - (N230_EEPROM_SERIAL_LEN + 1)]; - - //Ethernet specific - uint32_t gateway; - n230_eth_eeprom_map_t eth_info[N230_MAX_NUM_ETH_PORTS]; - - //User specific - uint8_t user_name[N230_EEPROM_NAME_LEN]; -} n230_eeprom_map_t; - -#ifdef __cplusplus -} //extern "C" -#endif - -// The following definitions are only useful in firmware. Exclude in host code. -#ifndef __cplusplus - -/*! - * Read the eeprom and update caches. - * Returns true if read was successful. - * If the read was not successful then the cache is initialized with - * default values and marked as dirty. - */ -bool read_n230_eeprom(); - -/*! - * Write the contents of the cache to the eeprom. - * Returns true if write was successful. - */ -bool write_n230_eeprom(); - -/*! - * Returns the dirty state of the cache. - */ -bool is_n230_eeprom_cache_dirty(); - -/*! - * Returns a const pointer to the EEPROM map. - */ -const n230_eeprom_map_t* get_n230_const_eeprom_map(); - -/*! - * Returns the settings for the the 'iface'th ethernet interface - */ -const n230_eth_eeprom_map_t* get_n230_ethernet_info(uint32_t iface); - -/*! - * Returns a non-const pointer to the EEPROM map. Will mark the cache as dirty. - */ -n230_eeprom_map_t* get_n230_eeprom_map(); - -/*! - * FPGA Image operations - */ -inline void read_n230_fpga_image_page(uint32_t offset, void *buf, uint32_t num_bytes); - -inline bool write_n230_fpga_image_page(uint32_t offset, const void *buf, uint32_t num_bytes); - -inline bool erase_n230_fpga_image_sector(uint32_t offset); - -#endif //ifdef __cplusplus - -#endif /* INCLUDED_N230_EEPROM_H */ diff --git a/firmware/usrp3/n230/n230_eth_handlers.c b/firmware/usrp3/n230/n230_eth_handlers.c index e5b59c212..b291bb39f 100644 --- a/firmware/usrp3/n230/n230_eth_handlers.c +++ b/firmware/usrp3/n230/n230_eth_handlers.c @@ -25,7 +25,7 @@ #include "../../../host/lib/usrp/common/fw_comm_protocol.h" #include "../../../host/lib/usrp/n230/n230_fw_defs.h" #include "../n230/n230_fw_host_iface.h" -#include "n230_eeprom.h" +#include "../../../host/lib/usrp/n230/n230_eeprom.h" static n230_host_shared_mem_t* host_shared_mem_ptr; diff --git a/firmware/usrp3/n230/n230_init.c b/firmware/usrp3/n230/n230_init.c index 0054c1bbc..14f5ebd77 100644 --- a/firmware/usrp3/n230/n230_init.c +++ b/firmware/usrp3/n230/n230_init.c @@ -24,7 +24,7 @@ #include #include #include -#include "n230_eeprom.h" +#include "../../../host/lib/usrp/n230/n230_eeprom.h" #include "n230_init.h" #include "../../../host/lib/usrp/n230/n230_fw_defs.h" diff --git a/host/lib/usrp/n230/n230_eeprom.h b/host/lib/usrp/n230/n230_eeprom.h new file mode 100644 index 000000000..b6c2a0c76 --- /dev/null +++ b/host/lib/usrp/n230/n230_eeprom.h @@ -0,0 +1,124 @@ +// +// Copyright 2014 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 +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#ifndef INCLUDED_N230_EEPROM_H +#define INCLUDED_N230_EEPROM_H + +#include +#ifndef __cplusplus +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define N230_NUM_ETH_PORTS 2 +#define N230_MAX_NUM_ETH_PORTS 2 + +#if (N230_NUM_ETH_PORTS > N230_MAX_NUM_ETH_PORTS) +#error +#endif + +#define N230_EEPROM_VER_MAJOR 1 +#define N230_EEPROM_VER_MINOR 1 +#define N230_EEPROM_SERIAL_LEN 9 +#define N230_EEPROM_NAME_LEN 32 + +typedef struct +{ + uint8_t mac_addr[6]; + uint8_t _pad[2]; + uint32_t subnet; + uint32_t ip_addr; +} n230_eth_eeprom_map_t; + +typedef struct +{ + //Data format version + uint16_t data_version_major; + uint16_t data_version_minor; + + //HW identification info + uint16_t hw_revision; + uint16_t hw_product; + uint8_t serial[N230_EEPROM_SERIAL_LEN]; + uint8_t _pad_serial; + uint16_t hw_revision_compat; + uint8_t _pad0[18 - (N230_EEPROM_SERIAL_LEN + 1)]; + + //Ethernet specific + uint32_t gateway; + n230_eth_eeprom_map_t eth_info[N230_MAX_NUM_ETH_PORTS]; + + //User specific + uint8_t user_name[N230_EEPROM_NAME_LEN]; +} n230_eeprom_map_t; + +#ifdef __cplusplus +} //extern "C" +#endif + +// The following definitions are only useful in firmware. Exclude in host code. +#ifndef __cplusplus + +/*! + * Read the eeprom and update caches. + * Returns true if read was successful. + * If the read was not successful then the cache is initialized with + * default values and marked as dirty. + */ +bool read_n230_eeprom(); + +/*! + * Write the contents of the cache to the eeprom. + * Returns true if write was successful. + */ +bool write_n230_eeprom(); + +/*! + * Returns the dirty state of the cache. + */ +bool is_n230_eeprom_cache_dirty(); + +/*! + * Returns a const pointer to the EEPROM map. + */ +const n230_eeprom_map_t* get_n230_const_eeprom_map(); + +/*! + * Returns the settings for the the 'iface'th ethernet interface + */ +const n230_eth_eeprom_map_t* get_n230_ethernet_info(uint32_t iface); + +/*! + * Returns a non-const pointer to the EEPROM map. Will mark the cache as dirty. + */ +n230_eeprom_map_t* get_n230_eeprom_map(); + +/*! + * FPGA Image operations + */ +inline void read_n230_fpga_image_page(uint32_t offset, void *buf, uint32_t num_bytes); + +inline bool write_n230_fpga_image_page(uint32_t offset, const void *buf, uint32_t num_bytes); + +inline bool erase_n230_fpga_image_sector(uint32_t offset); + +#endif //ifdef __cplusplus + +#endif /* INCLUDED_N230_EEPROM_H */ diff --git a/host/lib/usrp/n230/n230_eeprom_manager.cpp b/host/lib/usrp/n230/n230_eeprom_manager.cpp index 40f501ef9..b19deb23a 100644 --- a/host/lib/usrp/n230/n230_eeprom_manager.cpp +++ b/host/lib/usrp/n230/n230_eeprom_manager.cpp @@ -1,5 +1,5 @@ // -// Copyright 2013-2014 Ettus Research LLC +// Copyright 2013-2014,2016 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 @@ -15,7 +15,7 @@ // along with this program. If not, see . // -#include "../../../firmware/usrp3/n230/n230_eeprom.h" +#include "n230_eeprom.h" #include #include #include -- cgit v1.2.3