X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=sigrok.h;h=89be429bf978c959eba3827f5e7e32f1c28628e3;hb=c8f2c9dda4027fe723aabccb4265629c374afcd9;hp=bb16a63dfcfe3525b567e78fc16f2ffe2378fbfe;hpb=3010f21c9170e9f235d49bc7b333d17677c70e5c;p=libsigrok.git diff --git a/sigrok.h b/sigrok.h index bb16a63d..89be429b 100644 --- a/sigrok.h +++ b/sigrok.h @@ -66,12 +66,12 @@ extern "C" { #define SR_HZ_TO_NS(n) (1000000000 / (n)) /* libsigrok loglevels. */ -#define SR_LOG_NONE 0 /**< Output no messages at all. */ +#define SR_LOG_NONE 0 /**< Output no messages at all. */ #define SR_LOG_ERR 1 /**< Output error messages. */ -#define SR_LOG_WARN 2 /**< Output warnings. */ -#define SR_LOG_INFO 3 /**< Output informational messages. */ +#define SR_LOG_WARN 2 /**< Output warnings. */ +#define SR_LOG_INFO 3 /**< Output informational messages. */ #define SR_LOG_DBG 4 /**< Output debug messages. */ -#define SR_LOG_SPEW 5 /**< Output very noisy debug messages. */ +#define SR_LOG_SPEW 5 /**< Output very noisy debug messages. */ /* * Use SR_API to mark public API symbols, and SR_PRIV for private symbols. @@ -92,9 +92,9 @@ extern "C" { /* Marks private, non-public libsigrok symbols (not part of the API). */ #define SR_PRIV __attribute__((visibility("hidden"))) -typedef int (*sr_receive_data_callback) (int fd, int revents, void *user_data); +typedef int (*sr_receive_data_callback_t)(int fd, int revents, void *cb_data); -/* Data types used by hardware plugins for set_configuration() */ +/* Data types used by hardware drivers for dev_config_set() */ enum { SR_T_UINT64, SR_T_CHAR, @@ -131,7 +131,7 @@ struct sr_datafeed_logic { struct sr_input { struct sr_input_format *format; char *param; - struct sr_device *vdevice; + struct sr_dev *vdev; }; struct sr_input_format { @@ -144,7 +144,7 @@ struct sr_input_format { struct sr_output { struct sr_output_format *format; - struct sr_device *device; + struct sr_dev *dev; char *param; void *internal; }; @@ -169,15 +169,15 @@ struct sr_datastore { /* * This represents a generic device connected to the system. - * For device-specific information, ask the plugin. The plugin_index refers - * to the device index within that plugin; it may be handling more than one - * device. All relevant plugin calls take a device_index parameter for this. + * For device-specific information, ask the driver. The driver_index refers + * to the device index within that driver; it may be handling more than one + * device. All relevant driver calls take a dev_index parameter for this. */ -struct sr_device { - /* Which plugin handles this device */ - struct sr_device_plugin *plugin; - /* A plugin may handle multiple devices of the same type */ - int plugin_index; +struct sr_dev { + /* Which driver handles this device */ + struct sr_dev_driver *driver; + /* A driver may handle multiple devices of the same type */ + int driver_index; /* List of struct sr_probe* */ GSList *probes; /* Data acquired by this device, if any */ @@ -196,7 +196,7 @@ struct sr_probe { char *trigger; }; -/* Hardware plugin capabilities */ +/* Hardware driver capabilities */ enum { SR_HWCAP_DUMMY = 0, /* Used to terminate lists. Must be 0! */ @@ -210,7 +210,7 @@ enum { /*--- Device types --------------------------------------------------*/ /** The device is demo device. */ - SR_HWCAP_DEMO_DEVICE, + SR_HWCAP_DEMO_DEV, /*--- Device options ------------------------------------------------*/ @@ -270,26 +270,26 @@ enum { }; struct sr_hwcap_option { - int capability; + int hwcap; int type; char *description; char *shortname; }; -struct sr_device_instance { +struct sr_dev_inst { int index; int status; - int instance_type; + int inst_type; char *vendor; char *model; char *version; void *priv; }; -/* sr_device_instance types */ +/* sr_dev_inst types */ enum { - SR_USB_INSTANCE, - SR_SERIAL_INSTANCE, + SR_USB_INST, + SR_SERIAL_INST, }; /* Device instance status */ @@ -310,8 +310,8 @@ enum { /* Device info IDs */ enum { - /* struct sr_device_instance for this specific device */ - SR_DI_INSTANCE, + /* struct sr_dev_inst for this specific device */ + SR_DI_INST, /* The number of probes connected to this device */ SR_DI_NUM_PROBES, /* The probe names on this device */ @@ -338,29 +338,29 @@ struct sr_samplerates { uint64_t *list; }; -struct sr_device_plugin { - /* Plugin-specific */ +struct sr_dev_driver { + /* Driver-specific */ char *name; char *longname; int api_version; - int (*init) (const char *deviceinfo); - void (*cleanup) (void); + int (*init) (const char *devinfo); + int (*cleanup) (void); /* Device-specific */ - int (*opendev) (int device_index); - int (*closedev) (int device_index); - void *(*get_device_info) (int device_index, int device_info_id); - int (*get_status) (int device_index); - int *(*get_capabilities) (void); - int (*set_configuration) (int device_index, int capability, void *value); - int (*start_acquisition) (int device_index, gpointer session_device_id); - int (*stop_acquisition) (int device_index, gpointer session_device_id); + int (*dev_open) (int dev_index); + int (*dev_close) (int dev_index); + void *(*dev_info_get) (int dev_index, int dev_info_id); + int (*dev_status_get) (int dev_index); + int *(*hwcap_get_all) (void); + int (*dev_config_set) (int dev_index, int hwcap, void *value); + int (*dev_acquisition_start) (int dev_index, void *session_dev_id); + int (*dev_acquisition_stop) (int dev_index, void *session_dev_id); }; struct sr_session { - /* List of struct sr_device* */ - GSList *devices; - /* list of sr_receive_data_callback */ + /* List of struct sr_dev* */ + GSList *devs; + /* list of sr_receive_data_callback_t */ GSList *datafeed_callbacks; GTimeVal starttime; gboolean running;