make radio_upload not use static device

This commit is contained in:
Greg Shuflin 2021-02-28 02:40:00 -08:00
parent 863f14b0c2
commit 05b7842053
3 changed files with 7 additions and 7 deletions

View File

@ -158,10 +158,10 @@ void radio_download(radio_device_t* dev)
// //
// Write firmware image to the device. // Write firmware image to the device.
// //
void radio_upload(int cont_flag) void radio_upload(radio_device_t* dev, int cont_flag)
{ {
// Check for compatibility. // Check for compatibility.
if (! device->is_compatible(device)) { if (! dev->is_compatible(dev)) {
fprintf(stderr, "Incompatible image - cannot upload.\n"); fprintf(stderr, "Incompatible image - cannot upload.\n");
exit(-1); exit(-1);
} }
@ -170,7 +170,7 @@ void radio_upload(int cont_flag)
fprintf(stderr, "Write device: "); fprintf(stderr, "Write device: ");
fflush(stderr); fflush(stderr);
} }
device->upload(device, cont_flag); dev->upload(dev, cont_flag);
if (! trace_flag) if (! trace_flag)
fprintf(stderr, " done.\n"); fprintf(stderr, " done.\n");

View File

@ -45,7 +45,7 @@ void radio_disconnect(void);
// //
// Write firmware image to the device. // Write firmware image to the device.
// //
void radio_upload(int cont_flag); //void radio_upload(int cont_flag);
// //
// Print a generic information about the device. // Print a generic information about the device.

View File

@ -9,7 +9,7 @@ extern {
fn radio_connect() -> *const RadioDeviceT; fn radio_connect() -> *const RadioDeviceT;
fn radio_disconnect(); fn radio_disconnect();
fn radio_download(device: *const RadioDeviceT); fn radio_download(device: *const RadioDeviceT);
fn radio_upload(cont_flag: c_int); fn radio_upload(device: *const RadioDeviceT, cont_flag: c_int);
fn radio_list_c(); fn radio_list_c();
fn radio_verify_config(); fn radio_verify_config();
fn radio_print_version(device: *const RadioDeviceT, stdout: *const libc::FILE); fn radio_print_version(device: *const RadioDeviceT, stdout: *const libc::FILE);
@ -38,9 +38,9 @@ pub fn download(device: *const RadioDeviceT) {
} }
} }
pub fn upload(_device: *const RadioDeviceT, cont_flag: c_int) { pub fn upload(device: *const RadioDeviceT, cont_flag: c_int) {
unsafe { unsafe {
radio_upload(cont_flag) radio_upload(device, cont_flag)
} }
} }