20 #ifndef LIBSIGROK_LIBSIGROK_H
21 #define LIBSIGROK_LIBSIGROK_H
84 #define SR_MAX_CHANNELNAME_LEN 32
88 #define SR_KHZ(n) ((n) * (uint64_t)(1000ULL))
89 #define SR_MHZ(n) ((n) * (uint64_t)(1000000ULL))
90 #define SR_GHZ(n) ((n) * (uint64_t)(1000000000ULL))
92 #define SR_HZ_TO_NS(n) ((uint64_t)(1000000000ULL) / (n))
122 #define SR_API __attribute__((visibility("default")))
129 #define SR_PRIV __attribute__((visibility("hidden")))
910 GSList *(*scan) (GSList *options);
915 GSList *(*dev_list) (void);
Generic/unspecified error.
char * description
A short description of the input format, which can (for example) be displayed to the user by frontend...
sr_dev_inst_type
Types of device instance, struct sr_dev_inst.type.
Time is duration (as opposed to epoch, ...).
Sound pressure level is not weighted in the frequency domain, albeit without standards-defined low an...
char * version
Device version.
char * vendor
Device vendor.
sr_mqflag
Values for sr_datafeed_analog.flags.
int(* format_match)(const char *filename)
Check if this input module can load and parse the specified file.
sr_channeltype
Constants for channel type.
Sound pressure level is A-weighted in the frequency domain, according to IEC 61672:2003.
The device can measure temperature.
int(* cleanup)(void)
Called before driver is unloaded.
The device supports setting the number of logic channels.
Packet in a sigrok data feed.
The device supports setting the number of analog channels.
The device supports setting a sample number limit (how many samples should be acquired).
The device supports Run Length Encoding.
int unit
Unit in which the MQ is measured.
The device can act as an oscilloscope.
GVariant * data
Key-specific data.
Degrees Fahrenheit (temperature).
This is a true RMS measurement.
Payload is struct sr_datafeed_meta.
const struct sr_dev_inst * sdi
The device for which this output module is creating output.
Output (file) format struct.
Normalized (0 to 1) concentration of a substance or compound with 0 representing a concentration of 0...
Scan options supported by the driver.
Output no messages at all.
Sound pressure level measurement is S-weighted (1s) in the time domain.
The device supports continuous sampling.
int(* dev_acquisition_stop)(struct sr_dev_inst *sdi, void *cb_data)
End data acquisition on the specified device.
Used for setting or getting value of a config item.
Number of vertical divisions, as related to SR_CONF_VDIV.
Payload is struct sr_datafeed_analog.
Payload is struct sr_datafeed_logic.
Unit of conductance, the inverse of resistance.
int datatype
Data type like SR_T_STRING, etc.
Channel output configuration.
Output very noisy debug messages.
Sound pressure level measurement is F-weighted (125ms) in the time domain.
Information on single channel.
Enabling/disabling output.
Channel type is logic channel.
void * conn
Device instance connection data (used?)
char * longname
Long name.
Degrees Celsius (temperature).
gboolean enabled
Is this channel enabled?
Number of timebases, as related to SR_CONF_TIMEBASE.
int(* loadfile)(struct sr_input *in, const char *filename)
Load a file, parsing the input according to the file's format.
void * priv
Device instance private data (used?)
The device supports setting a sample time limit (how long the sample acquisition should run...
Data source for acquisition.
int(* dev_acquisition_start)(const struct sr_dev_inst *sdi, void *cb_data)
Begin data acquisition on the specified device.
Logic low-high threshold range.
An absolute measurement of power, in decibels, referenced to 1 milliwatt (dBu).
Sound pressure level is time-averaged (LAT), also known as Equivalent Continuous A-weighted Sound Lev...
char * description
A short description of the output format.
Device is in autoranging mode.
Output informational messages.
Sound pressure level is C-weighted in the frequency domain, according to IEC 61672:2003.
struct sr_output_format * format
A pointer to this output's format.
The device is a demo device.
End of stream (no further data).
Device is in "min" mode, only updating upon a new min value.
sr_mq
Measured quantity, sr_datafeed_analog.mq.
int(* sr_receive_data_callback)(int fd, int revents, void *cb_data)
Type definition for callback function for data reception.
GSList * channels
List of sr_channel structs of the channels belonging to this group.
int key
Config key like SR_CONF_CONN, etc.
Electrical power, usually in W, or dBm.
int(* dev_clear)(void)
Clear list of devices the driver knows about.
Sound pressure level represented as a percentage of measurements that were over a preset alarm level...
Device instance type for SCPI devices.
char * trigger
Trigger string, format like used by sigrok-cli.
GSList * channels
List of channels.
The device supports specifying a capturefile to inject.
Voltage measurement is alternating current (AC).
The device supports setting a pre/post-trigger capture ratio.
Horizontal trigger position.
Analog datafeed payload for type SR_DF_ANALOG.
The device supports specifying the capturefile unit size.
int status
Device instance status.
int api_version
API version (currently 1).
Device options for a particular device.
int(* init)(struct sr_output *o)
This function is called once, at the beginning of an output stream.
The trigger matched at this point in the data feed.
Specification on how to connect to a device.
The device can measure energy consumption.
int num_samples
Number of samples in data.
The device supports setting its sample interval, in ms.
Channel type is analog channel.
int(* receive)(struct sr_output *o, const struct sr_datafeed_packet *packet, GString **out)
This function is passed a copy of every packed in the data feed.
Device is in "hold" mode (repeating the last measurement).
The device has internal storage, into which data is logged.
char * name
Name of the channel group.
Datafeed payload for type SR_DF_META.
sr_error_code
Status/error codes returned by libsigrok functions.
struct sr_input_format * format
A pointer to this input format's 'struct sr_input_format'.
A channel group must be specified.
GSList * channels
The channels for which data is included in this packet.
Header file containing API function prototypes.
int(* config_set)(int id, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
Set value of a configuration key in driver or a given device instance.
The device instance is actively in use in a session.
Input (file) format driver.
sr_unit
Unit of measured quantity, sr_datafeed_analog.unit.
Over-voltage protection (OVP)
int(* dev_close)(struct sr_dev_inst *sdi)
Close device.
The device can measure humidity.
GSList * channel_groups
List of sr_channel_group structs.
The device can act as a multimeter.
The device supports using an external clock.
Opaque data structure representing a libsigrok session.
Hertz (frequency, 1/s, [Hz]).
The device supports setting its samplerate, in Hz.
Opaque structure representing a libsigrok context.
The device instance was found, but is still booting.
The device can act as logic analyzer.
The device can demodulate signals.
Device instance type for serial port devices.
Malloc/calloc/realloc error.
int inst_type
Device instance type.
int(* dev_open)(struct sr_dev_inst *sdi)
Open device.
Device is closed, but must be open.
The device supports swapping channels.
int mq
Measured quantity (voltage, current, temperature, and so on).
int(* config_list)(int info_id, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
List all possible values for a configuration key in a device instance.
char * id
The unique ID for this input format.
int type
Channel type (SR_CHANNEL_LOGIC, ...)
Device is in "avg" mode, averaging upon each new value.
The device is winding down its session.
Sound pressure level time weighting.
Device mode for multi-function devices.
Voltage measurement is direct current (DC).
Over-current protection (OCP)
The device can act as a sound level meter.
int key
Config key like SR_CONF_CONN, etc.
The device supports setting trigger slope.
int(* config_commit)(const struct sr_dev_inst *sdi)
Apply configuration settings to the device hardware.
Serial communication specification, in the form:
Input (file) format struct.
char * model
Device model.
char * description
Verbose description (unused currently).
sr_datatype
Data types used by sr_config_info().
sr_packettype
Value for sr_datafeed_packet.type.
Payload is sr_datafeed_header.
void * priv
Device driver private data.
The device supports setting a pattern (pattern generator mode).
void * priv
Private data for driver use.
Gain (a transistor's gain, or hFE, for example).
The device instance was not found.
Voltage in decibel, referenced to 1 volt (dBV).
Logic datafeed payload for type SR_DF_LOGIC.
int index
Index of device in driver.
Version number definitions and macros.
char * name
Name of channel.
sr_dev_inst_status
Device instance status, struct sr_dev_inst.status.
Programmable power supply.
Sound pressure level is Z-weighted (i.e.
Device instance type for USB devices.
sr_loglevel
libsigrok loglevels.
uint64_t mqflags
Bitmap with extra information about the MQ.
int(* cleanup)(struct sr_output *o)
This function is called after the caller is finished using the output module, and can be used to free...
int(* config_channel_set)(const struct sr_dev_inst *sdi, struct sr_channel *ch, unsigned int changes)
Channel status change.
struct sr_dev_driver * driver
Device driver.
int(* init)(struct sr_context *sr_ctx)
Called when driver is loaded, e.g.
int(* init)(struct sr_input *in, const char *filename)
Initialize the input module.
Value is voltage drop across a diode, or NAN.
int(* config_get)(int id, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
Query value of a configuration key in driver or given device instance.
Output (file) format driver.
Sound pressure level relative so 20 micropascals.
Sound pressure level measurement range.
Device is in "max" mode, only updating upon a new max value.
The device instance is live, but not in use.
Information about a config key.
Device is in relative mode.
The device supports setting a frame limit (how many frames should be acquired).
Logarithmic representation of sound pressure relative to a reference value.
Structure for groups of channels that have common properties.
Sound pressure level frequency weighting.
Errors hinting at internal bugs.
int index
Number of channels, starting at 0.
sr_configkey
Constants for device classes.
GHashTable * params
An optional parameter which the frontend can pass in to the output module.
char * id
A unique ID for this output format.
float * data
The analog value(s).
Measurements that intrinsically do not have units attached, such as ratios, gains, etc.
Header of a sigrok data feed.
Choice of clock edge for external clock ("r" or "f").