From: Uwe Hermann Date: Sun, 3 Apr 2016 15:22:05 +0000 (+0200) Subject: ftdi-la: Move ftdi_la_set_samplerate() to protocol.c. X-Git-Tag: libsigrok-0.5.0~527 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f9197887e447bb7536e25f3cb24d175d97cd20bb;p=libsigrok.git ftdi-la: Move ftdi_la_set_samplerate() to protocol.c. --- diff --git a/src/hardware/ftdi-la/api.c b/src/hardware/ftdi-la/api.c index a4309774..cd70bb7f 100644 --- a/src/hardware/ftdi-la/api.c +++ b/src/hardware/ftdi-la/api.c @@ -298,20 +298,6 @@ static int config_get(uint32_t key, GVariant **data, 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, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { diff --git a/src/hardware/ftdi-la/protocol.c b/src/hardware/ftdi-la/protocol.c index 0d71bcb3..273d79e7 100644 --- a/src/hardware/ftdi-la/protocol.c +++ b/src/hardware/ftdi-la/protocol.c @@ -38,6 +38,20 @@ static void send_samples(struct dev_context *devc, uint64_t 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) { struct sr_dev_inst *sdi; diff --git a/src/hardware/ftdi-la/protocol.h b/src/hardware/ftdi-la/protocol.h index 4c440eaa..54c19ee3 100644 --- a/src/hardware/ftdi-la/protocol.h +++ b/src/hardware/ftdi-la/protocol.h @@ -51,6 +51,7 @@ struct dev_context { 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); #endif