X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Flink-mso19%2Fprotocol.c;h=fbb50054ab24f8194d6989985677212eb9184377;hb=dafafb0e9429fcc9185df1c861184ce79defb7ee;hp=350cc7d148602136ebdef14fbcf0079407f9b19b;hpb=753d722f340465f5bebb175c378b579296ebbd54;p=libsigrok.git diff --git a/hardware/link-mso19/protocol.c b/hardware/link-mso19/protocol.c index 350cc7d1..fbb50054 100644 --- a/hardware/link-mso19/protocol.c +++ b/hardware/link-mso19/protocol.c @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the libsigrok project. * * Copyright (C) 2011 Daniel Ribeiro * Copyright (C) 2012 Renato Caldas @@ -20,7 +20,6 @@ */ #include "protocol.h" -#include /* serial protocol */ #define mso_trans(a, v) \ @@ -55,7 +54,7 @@ SR_PRIV int mso_send_control_message(struct sr_serial_dev_inst *serial, p += sizeof(mso_head); for (i = 0; i < n; i++) { - *(uint16_t *) p = htons(payload[i]); + *(uint16_t *) p = g_htons(payload[i]); p += 2; } memcpy(p, mso_foot, sizeof(mso_foot)); @@ -122,7 +121,7 @@ SR_PRIV int mso_configure_trigger(const struct sr_dev_inst *sdi) uint16_t ops[18]; ops[0] = mso_trans(3, threshold_value & 0xff); //The trigger_config also holds the 2 MSB bits from the threshold value - ops[1] = mso_trans(4, trigger_config | (threshold_value >> 8) & 0x03); + ops[1] = mso_trans(4, trigger_config | ((threshold_value >> 8) & 0x03)); ops[2] = mso_trans(5, devc->la_trigger); ops[3] = mso_trans(6, devc->la_trigger_mask); ops[4] = mso_trans(7, devc->trigger_holdoff[0]); @@ -216,7 +215,8 @@ SR_PRIV int mso_parse_serial(const char *iSerial, const char *iProduct, { unsigned int u1, u2, u3, u4, u5, u6; - iProduct = iProduct; + (void)iProduct; + /* FIXME: This code is in the original app, but I think its * used only for the GUI */ /* if (strstr(iProduct, "REV_02") || strstr(iProduct, "REV_03")) @@ -294,7 +294,7 @@ SR_PRIV void stop_acquisition(const struct sr_dev_inst *sdi) struct dev_context *devc; devc = sdi->priv; - sr_source_remove(devc->serial->fd); + serial_source_remove(devc->serial); /* Terminate session */ packet.type = SR_DF_END; @@ -334,7 +334,7 @@ SR_PRIV int mso_configure_rate(const struct sr_dev_inst *sdi, uint32_t rate) return ret; } -SR_PRIV int mso_check_trigger(struct sr_serial_dev_inst *serial, uint8_t * info) +SR_PRIV int mso_check_trigger(struct sr_serial_dev_inst *serial, uint8_t *info) { uint16_t ops[] = { mso_trans(REG_TRIGGER, 0) }; int ret; @@ -347,7 +347,8 @@ SR_PRIV int mso_check_trigger(struct sr_serial_dev_inst *serial, uint8_t * info) uint8_t buf = 0; if (serial_read(serial, &buf, 1) != 1) /* FIXME: Need timeout */ ret = SR_ERR; - *info = buf; + if (!info) + *info = buf; sr_dbg("Trigger state is: 0x%x.", *info); return ret; @@ -412,6 +413,7 @@ SR_PRIV int mso_receive_data(int fd, int revents, void *cb_data) /* FIXME: Need to do conversion to mV */ analog_out[i] = (devc->buffer[i * 3] & 0x3f) | ((devc->buffer[i * 3 + 1] & 0xf) << 6); + (void)analog_out; logic_out[i] = ((devc->buffer[i * 3 + 1] & 0x30) >> 4) | ((devc->buffer[i * 3 + 2] & 0x3f) << 2); }