X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fkorad-kaxxxxp%2Fprotocol.h;h=362c73f2773039970d5ae630d53956306854d8aa;hb=27a9b6639e1bd6530bf8f4304677dc127e343001;hp=307424a0200f1e27605aba18b9dbd221e94c5738;hpb=695dc859c15ba4190f5c1aa2e1a6e2dc6a6e5845;p=libsigrok.git diff --git a/src/hardware/korad-kaxxxxp/protocol.h b/src/hardware/korad-kaxxxxp/protocol.h index 307424a0..362c73f2 100644 --- a/src/hardware/korad-kaxxxxp/protocol.h +++ b/src/hardware/korad-kaxxxxp/protocol.h @@ -2,6 +2,7 @@ * This file is part of the libsigrok project. * * Copyright (C) 2015 Hannu Vuolasaho + * Copyright (C) 2018 Frank Stettner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,12 +18,6 @@ * along with this program. If not, see . */ -/** - * @file - * Korad KAxxxxP power supply driver - * @internal - */ - #ifndef LIBSIGROK_HARDWARE_KORAD_KAXXXXP_PROTOCOL_H #define LIBSIGROK_HARDWARE_KORAD_KAXXXXP_PROTOCOL_H @@ -41,6 +36,12 @@ enum { VELLEMAN_LABPS3005D, KORAD_KA3005P, KORAD_KA3005P_0X01, + KORAD_KD3005P, + KORAD_KD3005P_V20_NOSP, + RND_320K30PV, + TENMA_72_2540_V20, + TENMA_72_2540_V21, + STAMOS_SLS31_V20, /* Support for future devices with this protocol. */ }; @@ -70,20 +71,13 @@ enum { KAXXXXP_RECALL, }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ const struct korad_kaxxxxp_model *model; /**< Model information. */ - /* Acquisition settings */ - uint64_t limit_samples; - uint64_t limit_msec; - uint64_t num_samples; - int64_t starttime; + struct sr_sw_limits limits; int64_t req_sent_at; - gboolean reply_pending; + GMutex rw_mutex; - /* Operational state */ float current; /**< Last current value [A] read from device. */ float current_max; /**< Output current set. */ float voltage; /**< Last voltage value [V] read from device. */ @@ -95,10 +89,8 @@ struct dev_context { gboolean ocp_enabled; /**< Output current protection enabled. */ gboolean ovp_enabled; /**< Output voltage protection enabled. */ - /* Temporary state across callbacks */ - int target; /**< What reply to expect. */ + int acquisition_target; /**< What reply to expect. */ int program; /**< Program to store or recall. */ - char reply[6]; }; SR_PRIV int korad_kaxxxxp_send_cmd(struct sr_serial_dev_inst *serial, @@ -106,11 +98,9 @@ SR_PRIV int korad_kaxxxxp_send_cmd(struct sr_serial_dev_inst *serial, SR_PRIV int korad_kaxxxxp_read_chars(struct sr_serial_dev_inst *serial, int count, char *buf); SR_PRIV int korad_kaxxxxp_set_value(struct sr_serial_dev_inst *serial, - struct dev_context *devc); -SR_PRIV int korad_kaxxxxp_query_value(struct sr_serial_dev_inst *serial, - struct dev_context *devc); -SR_PRIV int korad_kaxxxxp_get_reply(struct sr_serial_dev_inst *serial, - struct dev_context *devc); + int target, struct dev_context *devc); +SR_PRIV int korad_kaxxxxp_get_value(struct sr_serial_dev_inst *serial, + int target, struct dev_context *devc); SR_PRIV int korad_kaxxxxp_get_all_values(struct sr_serial_dev_inst *serial, struct dev_context *devc); SR_PRIV int korad_kaxxxxp_receive_data(int fd, int revents, void *cb_data);