diff --git a/host/libhackrf/src/hackrf.c b/host/libhackrf/src/hackrf.c index c4a21091..790c8431 100644 --- a/host/libhackrf/src/hackrf.c +++ b/host/libhackrf/src/hackrf.c @@ -642,6 +642,9 @@ int ADDCALL hackrf_spiflash_read(hackrf_device* device, const uint32_t address, int ADDCALL hackrf_cpld_write(hackrf_device* device, unsigned char* const data, const unsigned int total_length) { + const unsigned int chunk_size = 512; + unsigned int i; + int transferred = 0; int result = libusb_release_interface(device->usb_device, 0); if (result != LIBUSB_SUCCESS) { return HACKRF_ERROR_LIBUSB; @@ -657,9 +660,6 @@ int ADDCALL hackrf_cpld_write(hackrf_device* device, return HACKRF_ERROR_LIBUSB; } - const unsigned int chunk_size = 512; - unsigned int i; - int transferred = 0; for (i = 0; i < total_length; i += chunk_size) { result = libusb_bulk_transfer(