X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fgenericdmm%2Fgenericdmm.h;h=caf2221022fd31c973f396a0f6eb48fc67b301ec;hb=15cb43d67cee5d7381c9cbcf0a355329a5cabfd1;hp=5fa89169bbe65b98749585b5dac02bd9657cc06a;hpb=ca3d84cca1d2f7427f8c5266717cb787d2346e16;p=libsigrok.git diff --git a/hardware/genericdmm/genericdmm.h b/hardware/genericdmm/genericdmm.h index 5fa89169..caf22210 100644 --- a/hardware/genericdmm/genericdmm.h +++ b/hardware/genericdmm/genericdmm.h @@ -18,11 +18,11 @@ */ -#ifndef GENERICDMM_H_ -#define GENERICDMM_H_ +#ifndef LIBSIGROK_GENERICDMM_H +#define LIBSIGROK_GENERICDMM_H /* SR_HWCAP_CONN takes one of these: */ -#define DMM_CONN_USB_VIDPID "^([0--9a-z]{1,4}):([0--9a-z]{1,4})$" +#define DMM_CONN_USB_VIDPID "^([0-9a-z]{1,4})\\.([0-9a-z]{1,4})$" #define DMM_CONN_USB_BUSADDR "^(\\d+)\\.(\\d+)$" #define DMM_CONN_SERIALPORT "^([a-z0-9/\\-_]+)$" @@ -40,13 +40,17 @@ struct dev_profile { char *vendor; char *model; struct dmmchip *chip; - /* Only use when the VID:PID is really specific to a DMM. */ - uint16_t vid; - uint16_t pid; int transport; + struct sr_hwopt *defaults_opts; }; -struct context { +/* Private driver context. */ +struct drv_context { + GSList *instances; +}; + +/* Private, per-device-instance driver context. */ +struct dev_context { struct dev_profile *profile; uint64_t limit_samples; uint64_t limit_msec; @@ -73,10 +77,14 @@ struct context { struct dmmchip { /* Optional, called once before measurement starts. */ - int (*init) (struct context *ctx); + int (*init) (void); + + /* Scan for devices with the given options. */ + GSList *(*scan) (GSList *options); + /* Called whenever a chunk of data arrives. */ - int (*data) (struct context *ctx, unsigned char *data); + int (*data) (struct sr_dev_inst *sdi, unsigned char *data); }; -#endif /* GENERICDMM_H_ */ +#endif /* LIBSIGROK_GENERICDMM_H */