ftdi-la: Move ftdi_la_set_samplerate() to protocol.c.
This commit is contained in:
parent
f227338297
commit
f9197887e4
|
@ -298,20 +298,6 @@ static int config_get(uint32_t key, GVariant **data,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ftdi_la_set_samplerate(struct dev_context *devc)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = ftdi_set_baudrate(devc->ftdic,
|
|
||||||
devc->cur_samplerate / devc->desc->samplerate_div);
|
|
||||||
if (ret < 0) {
|
|
||||||
sr_err("Failed to set baudrate (%d): %s.", devc->cur_samplerate,
|
|
||||||
ftdi_get_error_string(devc->ftdic));
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
return SR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int config_set(uint32_t key, GVariant *data,
|
static int config_set(uint32_t key, GVariant *data,
|
||||||
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
|
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,6 +38,20 @@ static void send_samples(struct dev_context *devc, uint64_t samples_to_send)
|
||||||
devc->bytes_received -= samples_to_send;
|
devc->bytes_received -= samples_to_send;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SR_PRIV int ftdi_la_set_samplerate(struct dev_context *devc)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = ftdi_set_baudrate(devc->ftdic,
|
||||||
|
devc->cur_samplerate / devc->desc->samplerate_div);
|
||||||
|
if (ret < 0) {
|
||||||
|
sr_err("Failed to set baudrate (%d): %s.", devc->cur_samplerate,
|
||||||
|
ftdi_get_error_string(devc->ftdic));
|
||||||
|
return SR_ERR;
|
||||||
|
}
|
||||||
|
return SR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
SR_PRIV int ftdi_la_receive_data(int fd, int revents, void *cb_data)
|
SR_PRIV int ftdi_la_receive_data(int fd, int revents, void *cb_data)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
|
|
|
@ -51,6 +51,7 @@ struct dev_context {
|
||||||
void *cb_data;
|
void *cb_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SR_PRIV int ftdi_la_set_samplerate(struct dev_context *devc);
|
||||||
SR_PRIV int ftdi_la_receive_data(int fd, int revents, void *cb_data);
|
SR_PRIV int ftdi_la_receive_data(int fd, int revents, void *cb_data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue