2012-10-21 01:39:37 +00:00
|
|
|
/*
|
2013-04-23 20:24:30 +00:00
|
|
|
* This file is part of the libsigrok project.
|
2012-10-21 01:39:37 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2012-12-01 18:35:19 +00:00
|
|
|
#ifndef LIBSIGROK_HARDWARE_SERIAL_DMM_PROTOCOL_H
|
|
|
|
#define LIBSIGROK_HARDWARE_SERIAL_DMM_PROTOCOL_H
|
2012-10-21 01:39:37 +00:00
|
|
|
|
2013-12-23 03:38:35 +00:00
|
|
|
#define LOG_PREFIX "serial-dmm"
|
2012-10-21 01:39:37 +00:00
|
|
|
|
2012-12-01 18:28:36 +00:00
|
|
|
enum {
|
2013-12-18 22:37:42 +00:00
|
|
|
BBCGM_M2110,
|
2012-12-01 18:53:05 +00:00
|
|
|
DIGITEK_DT4000ZC,
|
2012-12-01 18:28:36 +00:00
|
|
|
TEKPOWER_TP4000ZC,
|
2012-12-02 13:22:15 +00:00
|
|
|
METEX_ME31,
|
2012-12-01 21:45:45 +00:00
|
|
|
PEAKTECH_3410,
|
2012-12-01 22:04:00 +00:00
|
|
|
MASTECH_MAS345,
|
2012-12-01 22:32:39 +00:00
|
|
|
VA_VA18B,
|
2014-01-02 00:34:21 +00:00
|
|
|
VA_VA40B,
|
2012-12-01 23:40:15 +00:00
|
|
|
METEX_M3640D,
|
2013-10-29 19:31:24 +00:00
|
|
|
METEX_M4650CR,
|
2012-12-02 00:02:16 +00:00
|
|
|
PEAKTECH_4370,
|
2012-12-02 00:32:57 +00:00
|
|
|
PCE_PCE_DM32,
|
2012-12-02 15:17:46 +00:00
|
|
|
RADIOSHACK_22_168,
|
2013-03-21 01:36:56 +00:00
|
|
|
RADIOSHACK_22_805,
|
2012-12-02 19:15:21 +00:00
|
|
|
RADIOSHACK_22_812,
|
2013-05-01 01:13:15 +00:00
|
|
|
TECPEL_DMM_8061_SER,
|
2013-06-11 18:35:57 +00:00
|
|
|
VOLTCRAFT_M3650D,
|
2013-10-29 17:10:10 +00:00
|
|
|
VOLTCRAFT_M4650CR,
|
2012-12-19 21:50:07 +00:00
|
|
|
VOLTCRAFT_VC820_SER,
|
2013-06-22 14:48:00 +00:00
|
|
|
VOLTCRAFT_VC830_SER,
|
2012-12-19 21:50:07 +00:00
|
|
|
VOLTCRAFT_VC840_SER,
|
2013-07-05 12:02:50 +00:00
|
|
|
UNI_T_UT60A_SER,
|
|
|
|
UNI_T_UT60E_SER,
|
2014-01-03 21:32:16 +00:00
|
|
|
UNI_T_UT60G_SER,
|
2014-01-01 14:25:39 +00:00
|
|
|
UNI_T_UT61B_SER,
|
2013-12-29 16:35:51 +00:00
|
|
|
UNI_T_UT61C_SER,
|
2013-04-29 18:15:02 +00:00
|
|
|
UNI_T_UT61D_SER,
|
2012-12-26 00:53:50 +00:00
|
|
|
UNI_T_UT61E_SER,
|
2013-10-10 23:36:52 +00:00
|
|
|
ISO_TECH_IDM103N,
|
2014-01-06 17:08:55 +00:00
|
|
|
TENMA_72_7745_SER,
|
2014-01-06 16:20:35 +00:00
|
|
|
TENMA_72_7750_SER,
|
2012-12-01 18:28:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct dmm_info {
|
2013-12-18 23:31:26 +00:00
|
|
|
/** Manufacturer/brand. */
|
2012-12-01 18:28:36 +00:00
|
|
|
char *vendor;
|
2013-12-18 23:31:26 +00:00
|
|
|
/** Model. */
|
2012-12-01 18:28:36 +00:00
|
|
|
char *device;
|
2013-12-18 23:31:26 +00:00
|
|
|
/** serialconn string. */
|
2012-12-01 18:28:36 +00:00
|
|
|
char *conn;
|
2013-12-18 23:31:26 +00:00
|
|
|
/** Baud rate. */
|
2012-12-01 18:28:36 +00:00
|
|
|
uint32_t baudrate;
|
2013-12-18 23:31:26 +00:00
|
|
|
/** Packet size in bytes. */
|
2012-12-01 18:28:36 +00:00
|
|
|
int packet_size;
|
2013-12-18 22:33:45 +00:00
|
|
|
/** Packet request function. */
|
2012-12-02 13:22:15 +00:00
|
|
|
int (*packet_request)(struct sr_serial_dev_inst *);
|
2013-12-18 22:33:45 +00:00
|
|
|
/** Packet validation function. */
|
2012-12-01 18:28:36 +00:00
|
|
|
gboolean (*packet_valid)(const uint8_t *);
|
2013-12-18 22:33:45 +00:00
|
|
|
/** Packet parsing function. */
|
2012-12-01 18:28:36 +00:00
|
|
|
int (*packet_parse)(const uint8_t *, float *,
|
|
|
|
struct sr_datafeed_analog *, void *);
|
2013-12-18 22:33:45 +00:00
|
|
|
/** */
|
2012-12-01 18:28:36 +00:00
|
|
|
void (*dmm_details)(struct sr_datafeed_analog *, void *);
|
2013-12-18 22:33:45 +00:00
|
|
|
/** libsigrok driver info struct. */
|
2012-12-11 16:06:04 +00:00
|
|
|
struct sr_dev_driver *di;
|
2013-12-18 22:33:45 +00:00
|
|
|
/** Data reception function. */
|
2012-12-11 16:06:04 +00:00
|
|
|
int (*receive_data)(int, int, void *);
|
2012-12-01 18:28:36 +00:00
|
|
|
};
|
|
|
|
|
2014-01-06 19:53:12 +00:00
|
|
|
extern SR_PRIV struct dmm_info dmms[];
|
2012-12-01 18:28:36 +00:00
|
|
|
|
|
|
|
#define DMM_BUFSIZE 256
|
2012-10-21 01:39:37 +00:00
|
|
|
|
2012-10-27 19:03:02 +00:00
|
|
|
/** Private, per-device-instance driver context. */
|
2012-10-21 01:39:37 +00:00
|
|
|
struct dev_context {
|
2012-10-27 19:03:02 +00:00
|
|
|
/** The current sampling limit (in number of samples). */
|
2012-10-21 01:39:37 +00:00
|
|
|
uint64_t limit_samples;
|
|
|
|
|
2012-12-23 18:48:48 +00:00
|
|
|
/** The time limit (in milliseconds). */
|
|
|
|
uint64_t limit_msec;
|
|
|
|
|
2012-10-27 19:03:02 +00:00
|
|
|
/** Opaque pointer passed in by the frontend. */
|
2012-10-21 01:39:37 +00:00
|
|
|
void *cb_data;
|
|
|
|
|
2012-10-27 19:03:02 +00:00
|
|
|
/** The current number of already received samples. */
|
2012-10-21 01:39:37 +00:00
|
|
|
uint64_t num_samples;
|
2012-10-27 19:03:02 +00:00
|
|
|
|
2012-12-23 18:48:48 +00:00
|
|
|
int64_t starttime;
|
|
|
|
|
2012-10-21 01:39:37 +00:00
|
|
|
uint8_t buf[DMM_BUFSIZE];
|
2012-10-27 19:03:02 +00:00
|
|
|
int bufoffset;
|
|
|
|
int buflen;
|
2012-10-21 01:39:37 +00:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:37:42 +00:00
|
|
|
SR_PRIV int receive_data_BBCGM_M2110(int fd, int revents, void *cb_data);
|
2012-12-13 00:19:17 +00:00
|
|
|
SR_PRIV int receive_data_DIGITEK_DT4000ZC(int fd, int revents, void *cb_data);
|
|
|
|
SR_PRIV int receive_data_TEKPOWER_TP4000ZC(int fd, int revents, void *cb_data);
|
|
|
|
SR_PRIV int receive_data_METEX_ME31(int fd, int revents, void *cb_data);
|
|
|
|
SR_PRIV int receive_data_PEAKTECH_3410(int fd, int revents, void *cb_data);
|
|
|
|
SR_PRIV int receive_data_MASTECH_MAS345(int fd, int revents, void *cb_data);
|
|
|
|
SR_PRIV int receive_data_VA_VA18B(int fd, int revents, void *cb_data);
|
2014-01-02 00:34:21 +00:00
|
|
|
SR_PRIV int receive_data_VA_VA40B(int fd, int revents, void *cb_data);
|
2012-12-13 00:19:17 +00:00
|
|
|
SR_PRIV int receive_data_METEX_M3640D(int fd, int revents, void *cb_data);
|
2013-10-29 19:31:24 +00:00
|
|
|
SR_PRIV int receive_data_METEX_M4650CR(int fd, int revents, void *cb_data);
|
2012-12-13 00:19:17 +00:00
|
|
|
SR_PRIV int receive_data_PEAKTECH_4370(int fd, int revents, void *cb_data);
|
|
|
|
SR_PRIV int receive_data_PCE_PCE_DM32(int fd, int revents, void *cb_data);
|
|
|
|
SR_PRIV int receive_data_RADIOSHACK_22_168(int fd, int revents, void *cb_data);
|
2013-03-21 01:36:56 +00:00
|
|
|
SR_PRIV int receive_data_RADIOSHACK_22_805(int fd, int revents, void *cb_data);
|
2012-12-13 00:19:17 +00:00
|
|
|
SR_PRIV int receive_data_RADIOSHACK_22_812(int fd, int revents, void *cb_data);
|
2013-05-01 01:13:15 +00:00
|
|
|
SR_PRIV int receive_data_TECPEL_DMM_8061_SER(int fd, int revents, void *cb_data);
|
2013-06-11 18:35:57 +00:00
|
|
|
SR_PRIV int receive_data_VOLTCRAFT_M3650D(int fd, int revents, void *cb_data);
|
2013-10-29 17:10:10 +00:00
|
|
|
SR_PRIV int receive_data_VOLTCRAFT_M4650CR(int fd, int revents, void *cb_data);
|
2012-12-19 21:50:07 +00:00
|
|
|
SR_PRIV int receive_data_VOLTCRAFT_VC820_SER(int fd, int revents, void *cb_data);
|
2013-06-22 14:48:00 +00:00
|
|
|
SR_PRIV int receive_data_VOLTCRAFT_VC830_SER(int fd, int revents, void *cb_data);
|
2012-12-19 21:50:07 +00:00
|
|
|
SR_PRIV int receive_data_VOLTCRAFT_VC840_SER(int fd, int revents, void *cb_data);
|
2013-07-05 12:02:50 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT60A_SER(int fd, int revents, void *cb_data);
|
|
|
|
SR_PRIV int receive_data_UNI_T_UT60E_SER(int fd, int revents, void *cb_data);
|
2014-01-03 21:32:16 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT60G_SER(int fd, int revents, void *cb_data);
|
2014-01-01 14:25:39 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT61B_SER(int fd, int revents, void *cb_data);
|
2013-12-29 16:35:51 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT61C_SER(int fd, int revents, void *cb_data);
|
2013-04-29 18:15:02 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT61D_SER(int fd, int revents, void *cb_data);
|
2012-12-26 00:53:50 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT61E_SER(int fd, int revents, void *cb_data);
|
2013-10-10 23:36:52 +00:00
|
|
|
SR_PRIV int receive_data_ISO_TECH_IDM103N(int fd, int revents, void *cb_data);
|
2014-01-06 17:08:55 +00:00
|
|
|
SR_PRIV int receive_data_TENMA_72_7745_SER(int fd, int revents, void *cb_data);
|
2014-01-06 16:20:35 +00:00
|
|
|
SR_PRIV int receive_data_TENMA_72_7750_SER(int fd, int revents, void *cb_data);
|
2012-12-01 18:53:05 +00:00
|
|
|
|
2012-10-27 19:03:02 +00:00
|
|
|
#endif
|