static int load_fx3(struct cli_state *s, char *file) { char *expanded_path; int cmd_status = 0; int lib_status; if ((expanded_path = interactive_expand_path(file)) == NULL) { cli_err(s, "Unable to expand firmware file path: \"%s\"", file); cmd_status = CMD_RET_INVPARAM; } else { printf("Flashing firmware from %s...\n", expanded_path); lib_status = bladerf_flash_firmware(s->dev, expanded_path); if (lib_status < 0) { s->last_lib_error = lib_status; cmd_status = CMD_RET_LIBBLADERF; } else { printf("Done. Cycle power on the device.\n"); } free(expanded_path); } return cmd_status; }
static int flash_fw(struct rc_config *rc, struct cli_state *state, int status) { if (!status && rc->fw_file) { if (!state->dev) { print_error_need_devarg(); status = -1; } else { printf("Flashing firmware...\n"); status = bladerf_flash_firmware(state->dev, rc->fw_file); if (status) { fprintf(stderr, "Error: failed to flash firmware: %s\n", bladerf_strerror(status)); } else { printf("Done.\n"); } bladerf_device_reset(state->dev); bladerf_close(state->dev); state->dev = NULL; } } /* TODO Do we have to fire off some sort of reset after flashing * the firmware, and before loading the FPGA? */ return status; }
static int flash_fw(struct rc_config *rc, struct cli_state *state, int status) { if (!status && rc->fw_file) { if (!state->dev) { print_error_need_devarg(); status = -1; } else { printf("Flashing firmware...\n"); status = bladerf_flash_firmware(state->dev, rc->fw_file); if (status) { fprintf(stderr, "Error: failed to flash firmware: %s\n", bladerf_strerror(status)); } else { printf("Done. " "A power cycle is required for this to take effect.\n"); } bladerf_close(state->dev); state->dev = NULL; } } return status; }