1 // 2 // Copyright 2015 Ettus Research LLC 3 // Copyright 2018 Ettus Research, a National Instruments Company 4 // 5 // SPDX-License-Identifier: GPL-3.0-or-later 6 // 7 8 #pragma once 9 10 #include <uhd/config.h> 11 #include <uhd/error.h> 12 13 #ifdef __cplusplus 14 #include <uhd/usrp/mboard_eeprom.hpp> 15 #include <string> 16 17 struct uhd_mboard_eeprom_t { 18 uhd::usrp::mboard_eeprom_t mboard_eeprom_cpp; 19 std::string last_error; 20 }; 21 22 extern "C" { 23 #else 24 struct uhd_mboard_eeprom_t; 25 #endif 26 27 //! A C-level interface for interacting with a USRP motherboard's EEPROM 28 /*! 29 * See uhd::usrp::mboard_eeprom_t for more details. 30 * 31 * NOTE: Using a handle before passing it into uhd_mboard_eeprom_make() will 32 * result in undefined behavior. 33 */ 34 typedef struct uhd_mboard_eeprom_t* uhd_mboard_eeprom_handle; 35 36 //! Create a handle for working with a USRP motherboard EEPROM 37 UHD_API uhd_error uhd_mboard_eeprom_make( 38 uhd_mboard_eeprom_handle* h 39 ); 40 41 //! Free a USRP motherboard EEPROM handle 42 /*! 43 * NOTE: Using a handle after passing it into this function will result in 44 * a segmentation fault. 45 */ 46 UHD_API uhd_error uhd_mboard_eeprom_free( 47 uhd_mboard_eeprom_handle* h 48 ); 49 50 //! Get the value associated with the given EEPROM key 51 UHD_API uhd_error uhd_mboard_eeprom_get_value( 52 uhd_mboard_eeprom_handle h, 53 const char* key, 54 char* value_out, 55 size_t strbuffer_len 56 ); 57 58 //! Set the value for the given EEPROM key 59 UHD_API uhd_error uhd_mboard_eeprom_set_value( 60 uhd_mboard_eeprom_handle h, 61 const char* key, 62 const char* value 63 ); 64 65 //! Get the last error recorded by the handle 66 UHD_API uhd_error uhd_mboard_eeprom_last_error( 67 uhd_mboard_eeprom_handle h, 68 char* error_out, 69 size_t strbuffer_len 70 ); 71 72 #ifdef __cplusplus 73 } 74 #endif 75