link-mso19: Fix a bunch of compiler warnings.
This commit is contained in:
parent
00b44ccb8b
commit
753d722f34
|
@ -22,6 +22,14 @@
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
/* serial protocol */
|
||||||
|
#define mso_trans(a, v) \
|
||||||
|
(((v) & 0x3f) | (((v) & 0xc0) << 6) | (((a) & 0xf) << 8) | \
|
||||||
|
((~(v) & 0x20) << 1) | ((~(v) & 0x80) << 7))
|
||||||
|
|
||||||
|
static const char mso_head[] = { 0x40, 0x4c, 0x44, 0x53, 0x7e };
|
||||||
|
static const char mso_foot[] = { 0x7e };
|
||||||
|
|
||||||
extern SR_PRIV struct sr_dev_driver link_mso19_driver_info;
|
extern SR_PRIV struct sr_dev_driver link_mso19_driver_info;
|
||||||
static struct sr_dev_driver *di = &link_mso19_driver_info;
|
static struct sr_dev_driver *di = &link_mso19_driver_info;
|
||||||
|
|
||||||
|
@ -68,7 +76,7 @@ ret:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int mso_configure_trigger(struct sr_dev_inst *sdi)
|
SR_PRIV int mso_configure_trigger(const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
uint16_t threshold_value = mso_calc_raw_from_mv(devc);
|
uint16_t threshold_value = mso_calc_raw_from_mv(devc);
|
||||||
|
@ -142,7 +150,7 @@ SR_PRIV int mso_configure_trigger(struct sr_dev_inst *sdi)
|
||||||
return mso_send_control_message(devc->serial, ARRAY_AND_SIZE(ops));
|
return mso_send_control_message(devc->serial, ARRAY_AND_SIZE(ops));
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int mso_configure_threshold_level(struct sr_dev_inst *sdi)
|
SR_PRIV int mso_configure_threshold_level(const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
|
|
||||||
|
@ -158,7 +166,7 @@ SR_PRIV int mso_read_buffer(struct sr_dev_inst *sdi)
|
||||||
return mso_send_control_message(devc->serial, ARRAY_AND_SIZE(ops));
|
return mso_send_control_message(devc->serial, ARRAY_AND_SIZE(ops));
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int mso_arm(struct sr_dev_inst *sdi)
|
SR_PRIV int mso_arm(const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
uint16_t ops[] = {
|
uint16_t ops[] = {
|
||||||
|
@ -183,7 +191,7 @@ SR_PRIV int mso_force_capture(struct sr_dev_inst *sdi)
|
||||||
return mso_send_control_message(devc->serial, ARRAY_AND_SIZE(ops));
|
return mso_send_control_message(devc->serial, ARRAY_AND_SIZE(ops));
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int mso_dac_out(struct sr_dev_inst *sdi, uint16_t val)
|
SR_PRIV int mso_dac_out(const struct sr_dev_inst *sdi, uint16_t val)
|
||||||
{
|
{
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
uint16_t ops[] = {
|
uint16_t ops[] = {
|
||||||
|
@ -304,7 +312,7 @@ SR_PRIV int mso_clkrate_out(struct sr_serial_dev_inst *serial, uint16_t val)
|
||||||
return mso_send_control_message(serial, ARRAY_AND_SIZE(ops));
|
return mso_send_control_message(serial, ARRAY_AND_SIZE(ops));
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int mso_configure_rate(struct sr_dev_inst *sdi, uint32_t rate)
|
SR_PRIV int mso_configure_rate(const struct sr_dev_inst *sdi, uint32_t rate)
|
||||||
{
|
{
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -417,15 +425,6 @@ SR_PRIV int mso_receive_data(int fd, int revents, void *cb_data)
|
||||||
|
|
||||||
devc->num_samples += 1024;
|
devc->num_samples += 1024;
|
||||||
|
|
||||||
// Dont bother fixing this yet, keep it "old style"
|
|
||||||
/*
|
|
||||||
packet.type = SR_DF_ANALOG;
|
|
||||||
packet.length = 1024;
|
|
||||||
packet.unitsize = sizeof(double);
|
|
||||||
packet.payload = analog_out;
|
|
||||||
sr_session_send(ctx->session_dev_id, &packet);
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (devc->limit_samples && devc->num_samples >= devc->limit_samples) {
|
if (devc->limit_samples && devc->num_samples >= devc->limit_samples) {
|
||||||
sr_info("Requested number of samples reached.");
|
sr_info("Requested number of samples reached.");
|
||||||
sdi->driver->dev_acquisition_stop(sdi, cb_data);
|
sdi->driver->dev_acquisition_stop(sdi, cb_data);
|
||||||
|
@ -439,7 +438,6 @@ SR_PRIV int mso_configure_probes(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
int probe_bit, stage, i;
|
|
||||||
char *tc;
|
char *tc;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <libudev.h>
|
||||||
#include "libsigrok.h"
|
#include "libsigrok.h"
|
||||||
#include "libsigrok-internal.h"
|
#include "libsigrok-internal.h"
|
||||||
|
|
||||||
|
@ -133,14 +134,14 @@ SR_PRIV int mso_check_trigger(struct sr_serial_dev_inst *serial,
|
||||||
uint8_t * info);
|
uint8_t * info);
|
||||||
SR_PRIV int mso_reset_adc(struct sr_dev_inst *sdi);
|
SR_PRIV int mso_reset_adc(struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int mso_clkrate_out(struct sr_serial_dev_inst *serial, uint16_t val);
|
SR_PRIV int mso_clkrate_out(struct sr_serial_dev_inst *serial, uint16_t val);
|
||||||
SR_PRIV int mso_configure_rate(struct sr_dev_inst *sdi, uint32_t rate);
|
SR_PRIV int mso_configure_rate(const struct sr_dev_inst *sdi, uint32_t rate);
|
||||||
SR_PRIV int mso_receive_data(int fd, int revents, void *cb_data);
|
SR_PRIV int mso_receive_data(int fd, int revents, void *cb_data);
|
||||||
SR_PRIV int mso_configure_trigger(struct sr_dev_inst *sdi);
|
SR_PRIV int mso_configure_trigger(const struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int mso_configure_threshold_level(struct sr_dev_inst *sdi);
|
SR_PRIV int mso_configure_threshold_level(const struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int mso_read_buffer(struct sr_dev_inst *sdi);
|
SR_PRIV int mso_read_buffer(struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int mso_arm(struct sr_dev_inst *sdi);
|
SR_PRIV int mso_arm(const struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int mso_force_capture(struct sr_dev_inst *sdi);
|
SR_PRIV int mso_force_capture(struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int mso_dac_out(struct sr_dev_inst *sdi, uint16_t val);
|
SR_PRIV int mso_dac_out(const struct sr_dev_inst *sdi, uint16_t val);
|
||||||
SR_PRIV inline uint16_t mso_calc_raw_from_mv(struct dev_context *devc);
|
SR_PRIV inline uint16_t mso_calc_raw_from_mv(struct dev_context *devc);
|
||||||
SR_PRIV int mso_reset_fsm(struct sr_dev_inst *sdi);
|
SR_PRIV int mso_reset_fsm(struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int mso_toggle_led(struct sr_dev_inst *sdi, int state);
|
SR_PRIV int mso_toggle_led(struct sr_dev_inst *sdi, int state);
|
||||||
|
@ -148,14 +149,6 @@ SR_PRIV int mso_toggle_led(struct sr_dev_inst *sdi, int state);
|
||||||
SR_PRIV int mso_configure_probes(const struct sr_dev_inst *sdi);
|
SR_PRIV int mso_configure_probes(const struct sr_dev_inst *sdi);
|
||||||
SR_PRIV void stop_acquisition(const struct sr_dev_inst *sdi);
|
SR_PRIV void stop_acquisition(const struct sr_dev_inst *sdi);
|
||||||
|
|
||||||
/* serial protocol */
|
|
||||||
#define mso_trans(a, v) \
|
|
||||||
(((v) & 0x3f) | (((v) & 0xc0) << 6) | (((a) & 0xf) << 8) | \
|
|
||||||
((~(v) & 0x20) << 1) | ((~(v) & 0x80) << 7))
|
|
||||||
|
|
||||||
SR_PRIV static const char mso_head[] = { 0x40, 0x4c, 0x44, 0x53, 0x7e };
|
|
||||||
SR_PRIV static const char mso_foot[] = { 0x7e };
|
|
||||||
|
|
||||||
/* bank agnostic registers */
|
/* bank agnostic registers */
|
||||||
#define REG_CTL2 15
|
#define REG_CTL2 15
|
||||||
|
|
||||||
|
@ -191,7 +184,7 @@ struct rate_map {
|
||||||
uint8_t slowmode;
|
uint8_t slowmode;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct rate_map rate_map[] = {
|
static const struct rate_map rate_map[] = {
|
||||||
{ SR_MHZ(200), 0x0205, 0 },
|
{ SR_MHZ(200), 0x0205, 0 },
|
||||||
{ SR_MHZ(100), 0x0105, 0 },
|
{ SR_MHZ(100), 0x0105, 0 },
|
||||||
{ SR_MHZ(50), 0x0005, 0 },
|
{ SR_MHZ(50), 0x0005, 0 },
|
||||||
|
@ -215,7 +208,7 @@ static struct rate_map rate_map[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* FIXME: Determine corresponding voltages */
|
/* FIXME: Determine corresponding voltages */
|
||||||
static uint16_t la_threshold_map[] = {
|
static const uint16_t la_threshold_map[] = {
|
||||||
0x8600,
|
0x8600,
|
||||||
0x8770,
|
0x8770,
|
||||||
0x88ff,
|
0x88ff,
|
||||||
|
|
Loading…
Reference in New Issue