int rxtx_cmd_start_check(struct cli_state *s, struct rxtx_data *rxtx, const char *argv0) { int status = CLI_RET_UNKNOWN; bool have_file; if (rxtx_get_state(rxtx) != RXTX_STATE_IDLE) { return CLI_RET_STATE; } else { MUTEX_LOCK(&rxtx->file_mgmt.file_meta_lock); have_file = (rxtx->file_mgmt.path != NULL); MUTEX_UNLOCK(&rxtx->file_mgmt.file_meta_lock); if (!have_file) { cli_err(s, argv0, "File not configured\n"); status = CLI_RET_INVPARAM; } else { status = validate_stream_params(s, rxtx, argv0); } if (status == 0) { check_samplerate(s, rxtx); } } return status; }
int cubeb_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_name, cubeb_devid input_device, cubeb_stream_params * input_stream_params, cubeb_devid output_device, cubeb_stream_params * output_stream_params, unsigned int latency, cubeb_data_callback data_callback, cubeb_state_callback state_callback, void * user_ptr) { int r; if (!context || !stream) { return CUBEB_ERROR_INVALID_PARAMETER; } if ((r = validate_stream_params(input_stream_params, output_stream_params)) != CUBEB_OK || (r = validate_latency(latency)) != CUBEB_OK) { return r; } return context->ops->stream_init(context, stream, stream_name, input_device, input_stream_params, output_device, output_stream_params, latency, data_callback, state_callback, user_ptr); }
int rxtx_cmd_start_check(struct cli_state *s, struct rxtx_data *rxtx, const char *argv0) { int status = CMD_RET_UNKNOWN; int fpga_status; bool have_file; if (!cli_device_is_opened(s)) { return CMD_RET_NODEV; } else if (rxtx_get_state(rxtx) != RXTX_STATE_IDLE) { return CMD_RET_STATE; } else { fpga_status = bladerf_is_fpga_configured(s->dev); if (fpga_status < 0) { s->last_lib_error = fpga_status; status = CMD_RET_LIBBLADERF; } else if (fpga_status != 1) { status = CMD_RET_NOFPGA; } else { pthread_mutex_lock(&rxtx->file_mgmt.file_meta_lock); have_file = (rxtx->file_mgmt.path != NULL); pthread_mutex_unlock(&rxtx->file_mgmt.file_meta_lock); if (!have_file) { cli_err(s, argv0, "File not configured"); status = CMD_RET_INVPARAM; } else { status = validate_stream_params(s, rxtx, argv0); } if (status == 0) { check_samplerate(s, rxtx); } } } return status; }