summaryrefslogtreecommitdiff
path: root/src/hw/hw_eeprom.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2016-05-08 16:02:01 +0100
committerFreeArtMan <dos21h@gmail.com>2016-05-08 16:02:01 +0100
commite42911405c4bc2f8c097f47d4598baf8522ef3da (patch)
tree9eb767c5e6a4443e8773b18ea76cf4216f6c8758 /src/hw/hw_eeprom.c
parent9b95088bddcf1f83e3a8f73f08f49b38ecb0f500 (diff)
downloadradiola-e42911405c4bc2f8c097f47d4598baf8522ef3da.tar.gz
radiola-e42911405c4bc2f8c097f47d4598baf8522ef3da.zip
Moved source to src directoryHEADmaster
Diffstat (limited to 'src/hw/hw_eeprom.c')
-rw-r--r--src/hw/hw_eeprom.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/hw/hw_eeprom.c b/src/hw/hw_eeprom.c
new file mode 100644
index 0000000..10ae817
--- /dev/null
+++ b/src/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;
+}
+
+