X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fserial-dmm%2Fprotocol.h;h=fb5a2a336d99e88fc11c8d618dfb144b3acfb0b5;hb=6dcb97230eac000a4033aef0d5ec1099e5f8143d;hp=e313492fca0fe7842579f84a98ad29e9ecef9bcf;hpb=2710cb53fd4e56eb0ffe0b76657a67cce932c734;p=libsigrok.git diff --git a/hardware/serial-dmm/protocol.h b/hardware/serial-dmm/protocol.h index e313492f..fb5a2a33 100644 --- a/hardware/serial-dmm/protocol.h +++ b/hardware/serial-dmm/protocol.h @@ -22,7 +22,6 @@ #define LOG_PREFIX "serial-dmm" -/* Note: When adding entries here, don't forget to update DMM_COUNT. */ enum { BBCGM_M2110, DIGITEK_DT4000ZC, @@ -40,8 +39,10 @@ enum { RADIOSHACK_22_805, RADIOSHACK_22_812, TECPEL_DMM_8061_SER, + VOLTCRAFT_M3650CR, VOLTCRAFT_M3650D, VOLTCRAFT_M4650CR, + VOLTCRAFT_ME42, VOLTCRAFT_VC820_SER, VOLTCRAFT_VC830_SER, VOLTCRAFT_VC840_SER, @@ -57,8 +58,6 @@ enum { TENMA_72_7750_SER, }; -#define DMM_COUNT 31 - struct dmm_info { /** Manufacturer/brand. */ char *vendor; @@ -70,6 +69,12 @@ struct dmm_info { uint32_t baudrate; /** Packet size in bytes. */ int packet_size; + /** Request timeout [ms] before request is considered lost and a new + * one is sent. Used only if device needs polling. */ + int64_t req_timeout_ms; + /** Delay between reception of packet and next request. Some DMMs + * need this. Used only if device needs polling. */ + int64_t req_delay_ms; /** Packet request function. */ int (*packet_request)(struct sr_serial_dev_inst *); /** Packet validation function. */ @@ -85,7 +90,7 @@ struct dmm_info { int (*receive_data)(int, int, void *); }; -extern SR_PRIV struct dmm_info dmms[DMM_COUNT]; +extern SR_PRIV struct dmm_info dmms[]; #define DMM_BUFSIZE 256 @@ -103,13 +108,20 @@ struct dev_context { /** The current number of already received samples. */ uint64_t num_samples; + /** The starting time of current sampling run. */ int64_t starttime; uint8_t buf[DMM_BUFSIZE]; int bufoffset; int buflen; + + /** The timestamp [µs] to send the next request. + * Used only if device needs polling. */ + int64_t req_next_at; }; +SR_PRIV int req_packet(struct sr_dev_inst *sdi, int dmm); + SR_PRIV int receive_data_BBCGM_M2110(int fd, int revents, void *cb_data); 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); @@ -126,8 +138,10 @@ SR_PRIV int receive_data_RADIOSHACK_22_168(int fd, int revents, void *cb_data); SR_PRIV int receive_data_RADIOSHACK_22_805(int fd, int revents, void *cb_data); SR_PRIV int receive_data_RADIOSHACK_22_812(int fd, int revents, void *cb_data); SR_PRIV int receive_data_TECPEL_DMM_8061_SER(int fd, int revents, void *cb_data); +SR_PRIV int receive_data_VOLTCRAFT_M3650CR(int fd, int revents, void *cb_data); SR_PRIV int receive_data_VOLTCRAFT_M3650D(int fd, int revents, void *cb_data); SR_PRIV int receive_data_VOLTCRAFT_M4650CR(int fd, int revents, void *cb_data); +SR_PRIV int receive_data_VOLTCRAFT_ME42(int fd, int revents, void *cb_data); SR_PRIV int receive_data_VOLTCRAFT_VC820_SER(int fd, int revents, void *cb_data); SR_PRIV int receive_data_VOLTCRAFT_VC830_SER(int fd, int revents, void *cb_data); SR_PRIV int receive_data_VOLTCRAFT_VC840_SER(int fd, int revents, void *cb_data);