diff options
author | FreeArtMan <dos21h@gmail.com> | 2015-12-31 13:43:51 +0000 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2015-12-31 13:43:51 +0000 |
commit | 891ba007a455590ac544bbebd270ebe8d3417f2c (patch) | |
tree | e848f2c880d2bddc3b62c6090d88c966ab2b3d13 /hw/hw_eeprom.c | |
parent | 2d6d67e07233cc6b085fd9eebdd6795602c75a0b (diff) | |
download | radiola-891ba007a455590ac544bbebd270ebe8d3417f2c.tar.gz radiola-891ba007a455590ac544bbebd270ebe8d3417f2c.zip |
Add eeprom dump test
Diffstat (limited to 'hw/hw_eeprom.c')
-rw-r--r-- | hw/hw_eeprom.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/hw/hw_eeprom.c b/hw/hw_eeprom.c index e69de29..10ae817 100644 --- a/hw/hw_eeprom.c +++ b/hw/hw_eeprom.c @@ -0,0 +1,47 @@ +#include "hw_eeprom.h" + + + +int dump_eeprom( rtlsdr_dev_t *dev, uint8_t *data, uint16_t len ) +{ + int fret = 0; + + if ( len != EEPROM_SIZE ) + { + printf("EEPROM sump size expected to be %d\n", EEPROM_SIZE); + return -1; + } + + fret = hw_read_eeprom( dev, data, 0, len ); + if ( fret != 0 ) + { + printf("Cannot read eeprom rtlsdr err (%d)\n", fret); + return -1; + } + + return 0; +} + + +int restore_eeprom( rtlsdr_dev_t *dev, uint8_t *data, uint16_t len ) +{ + int fret = 0; + + if ( len != EEPROM_SIZE ) + { + printf("EEPROM sump size expected to be %d\n", EEPROM_SIZE); + return -1; + } + + fret = hw_write_eeprom( dev, data, 0, len ); + if ( fret != 0 ) + { + printf("Cannot write eeprom rtlsdr err(%d)\n", fret); + return -1; + } + + + return 0; +} + + |