sr: move SR_HWOPT into its own enum, and create struct sr_hwopt
SR_HWOPT_* entries are driver options, not device instance parameters, so they will never be mixed together. Also, driver options are always passed in a GSList, where the data field is a struct sr_hwopt.
This commit is contained in:
parent
633b2fac75
commit
b159add3d9
|
@ -32,6 +32,11 @@
|
|||
*/
|
||||
/* TODO: This shouldn't be a global. */
|
||||
SR_API struct sr_hwcap_option sr_hwcap_options[] = {
|
||||
/* Driver scanning options. */
|
||||
{SR_HWOPT_MODEL, SR_T_KEYVALUE, "Model", "model"},
|
||||
{SR_HWOPT_CONN, SR_T_CHAR, "Connection", "conn"},
|
||||
{SR_HWOPT_SERIALCOMM, SR_T_CHAR, "Serial communication", "serialcomm"},
|
||||
/* Device instance options. */
|
||||
{SR_HWCAP_SAMPLERATE, SR_T_UINT64, "Sample rate", "samplerate"},
|
||||
{SR_HWCAP_CAPTURE_RATIO, SR_T_UINT64, "Pre-trigger capture ratio", "captureratio"},
|
||||
{SR_HWCAP_PATTERN_MODE, SR_T_CHAR, "Pattern generator mode", "pattern"},
|
||||
|
@ -45,9 +50,6 @@ SR_API struct sr_hwcap_option sr_hwcap_options[] = {
|
|||
{SR_HWCAP_FILTER, SR_T_CHAR, "Filter targets", "filter"},
|
||||
{SR_HWCAP_VDIV, SR_T_RATIONAL_VOLT, "Volts/div", "vdiv"},
|
||||
{SR_HWCAP_COUPLING, SR_T_CHAR, "Coupling", "coupling"},
|
||||
{SR_HWCAP_MODEL, SR_T_KEYVALUE, "Model", "model"},
|
||||
{SR_HWCAP_CONN, SR_T_CHAR, "Connection", "connect"},
|
||||
{SR_HWCAP_SERIALCOMM, SR_T_CHAR, "Serial communication", "serialcomm"},
|
||||
{0, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
|
|
30
libsigrok.h
30
libsigrok.h
|
@ -261,7 +261,24 @@ struct sr_probe {
|
|||
char *trigger;
|
||||
};
|
||||
|
||||
/* Hardware driver capabilities */
|
||||
struct sr_hwopt {
|
||||
int hwopt;
|
||||
const void *value;
|
||||
};
|
||||
|
||||
/* Hardware driver options */
|
||||
enum {
|
||||
/** Some drivers cannot detect the exact model they're talking to. */
|
||||
SR_HWOPT_MODEL,
|
||||
|
||||
/** Specification on how to connect to a device */
|
||||
SR_HWOPT_CONN,
|
||||
|
||||
/** Serial communication spec: <data bits><parity><stop bit> e.g. 8n1 */
|
||||
SR_HWOPT_SERIALCOMM,
|
||||
};
|
||||
|
||||
/* Hardware device capabilities */
|
||||
enum {
|
||||
SR_HWCAP_DUMMY = 0, /* Used to terminate lists. Must be 0! */
|
||||
|
||||
|
@ -280,17 +297,6 @@ enum {
|
|||
SR_HWCAP_DEMO_DEV,
|
||||
|
||||
|
||||
/*--- Device communication ------------------------------------------*/
|
||||
/** Some drivers cannot detect the exact model they're talking to. */
|
||||
SR_HWCAP_MODEL,
|
||||
|
||||
/** Specification on how to connect to a device */
|
||||
SR_HWCAP_CONN,
|
||||
|
||||
/** Serial communication spec: <data bits><parity><stop bit> e.g. 8n1 */
|
||||
SR_HWCAP_SERIALCOMM,
|
||||
|
||||
|
||||
/*--- Device configuration ------------------------------------------*/
|
||||
|
||||
/** The device supports setting/changing its samplerate. */
|
||||
|
|
Loading…
Reference in New Issue