From ef5b907295bbfc86e183d8f6249ac7d88d42870b Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 27 Mar 2019 12:16:39 -0700 Subject: [PATCH] CPLD: Remove checksum function from libhackrf and hackrf_info. The checksum calculation process was causing the CPLD configuration to reload from flash. With the new SRAM loading mechanism, flash contents may not be up to date, so the CPLD bitstream may regress to the point of not working or not working correctly. This commit is a short-term fix for mossmann/hackrf issue #609. --- host/hackrf-tools/src/hackrf_info.c | 4 +++- host/libhackrf/src/hackrf.c | 2 ++ host/libhackrf/src/hackrf.h | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/host/hackrf-tools/src/hackrf_info.c b/host/hackrf-tools/src/hackrf_info.c index 9c10ad5f..e962f086 100644 --- a/host/hackrf-tools/src/hackrf_info.c +++ b/host/hackrf-tools/src/hackrf_info.c @@ -125,7 +125,8 @@ int main(void) printf("Operacake found, address: 0x%02x\n", operacakes[j]); } } - + +#ifdef HACKRF_ISSUE_609_IS_FIXED uint32_t cpld_crc = 0; result = hackrf_cpld_checksum(device, &cpld_crc); if ((result != HACKRF_SUCCESS) && (result != HACKRF_ERROR_USB_API_VERSION)) { @@ -136,6 +137,7 @@ int main(void) if(result == HACKRF_SUCCESS) { printf("CPLD checksum: 0x%08x\n", cpld_crc); } +#endif /* HACKRF_ISSUE_609_IS_FIXED */ result = hackrf_close(device); if (result != HACKRF_SUCCESS) { diff --git a/host/libhackrf/src/hackrf.c b/host/libhackrf/src/hackrf.c index db1cf862..76f74895 100644 --- a/host/libhackrf/src/hackrf.c +++ b/host/libhackrf/src/hackrf.c @@ -2105,6 +2105,7 @@ int ADDCALL hackrf_operacake_gpio_test(hackrf_device* device, const uint8_t addr } } +#ifdef HACKRF_ISSUE_609_IS_FIXED int ADDCALL hackrf_cpld_checksum(hackrf_device* device, uint32_t* crc) { @@ -2133,6 +2134,7 @@ int ADDCALL hackrf_cpld_checksum(hackrf_device* device, return HACKRF_SUCCESS; } } +#endif /* HACKRF_ISSUE_609_IS_FIXED */ #ifdef __cplusplus } // __cplusplus defined. diff --git a/host/libhackrf/src/hackrf.h b/host/libhackrf/src/hackrf.h index 2dfdb8d4..7e5d2425 100644 --- a/host/libhackrf/src/hackrf.h +++ b/host/libhackrf/src/hackrf.h @@ -254,9 +254,10 @@ extern ADDAPI int ADDCALL hackrf_set_clkout_enable(hackrf_device* device, const extern ADDAPI int ADDCALL hackrf_operacake_gpio_test(hackrf_device* device, uint8_t address, uint16_t* test_result); - +#ifdef HACKRF_ISSUE_609_IS_FIXED extern ADDAPI int ADDCALL hackrf_cpld_checksum(hackrf_device* device, uint32_t* crc); +#endif /* HACKRF_ISSUE_609_IS_FIXED */ #ifdef __cplusplus } // __cplusplus defined.