20 #ifndef LIBSIGROK_LIBSIGROK_H
21 #define LIBSIGROK_LIBSIGROK_H
83 #define SR_MAX_CHANNELNAME_LEN 32
87 #define SR_KHZ(n) ((n) * (uint64_t)(1000ULL))
88 #define SR_MHZ(n) ((n) * (uint64_t)(1000000ULL))
89 #define SR_GHZ(n) ((n) * (uint64_t)(1000000000ULL))
91 #define SR_HZ_TO_NS(n) ((uint64_t)(1000000000ULL) / (n))
121 #define SR_API __attribute__((visibility("default")))
128 #define SR_PRIV __attribute__((visibility("hidden")))
586 struct sr_input_module;
588 struct sr_output_module;
590 struct sr_transform_module;
1121 const struct sr_dev_inst *sdi,
1126 const struct sr_dev_inst *sdi,
1131 struct sr_channel *ch,
unsigned int changes);
1139 const struct sr_dev_inst *sdi,
Sound pressure level is Z-weighted (i.e.
The representation of a trigger, consisting of one or more stages containing one or more matches on a...
Device instance type for USB devices.
char * name
The OS dependent name of the serial port.
Over-temperature protection (OTP)
Logic low-high threshold range.
int(* config_commit)(const struct sr_dev_inst *sdi)
Apply configuration settings to the device hardware.
An absolute measurement of power, in decibels, referenced to 1 milliwatt (dBu).
char * name
Name of the channel group.
Over-voltage protection (OVP) feature.
Difference from reference value.
Device is in autoranging mode.
Analog datafeed payload for type SR_DF_ANALOG_OLD.
sr_datatype
Data types used by sr_config_info().
struct sr_analog_encoding * encoding
Pieces (number of items).
Over-temperature protection (OTP) active.
Value is voltage drop across a diode, or NAN.
Mass in tael (variants: Hong Kong, Singapore/Malaysia, Taiwan)
Mass in pennyweight [dwt].
Sound pressure level measurement range.
sr_unit
Unit of measured quantity, sr_analog_meaning.unit.
End of stream (no further data).
Electrical power, usually in W, or dBm.
Logarithmic representation of sound pressure relative to a reference value.
Device instance type for SCPI devices.
The device supports specifying a capturefile to inject.
Sound pressure level frequency weighting.
Errors hinting at internal bugs.
Wind speed in meters per second.
Voltage measurement is alternating current (AC).
The device supports setting a pre/post-trigger capture ratio.
Horizontal trigger position.
The device supports specifying the capturefile unit size.
Number of horizontal divisions, as related to SR_CONF_TIMEBASE.
The device can measure energy consumption.
Over-current protection (OCP) active.
Choice of clock edge for external clock ("r" or "f").
Unstable value (hasn't settled yet).
uint64_t mqflags
Bitmap with extra information about the MQ.
The device supports setting its sample interval, in ms.
Generic/unspecified error.
Output frequency target in Hz.
int(* config_channel_set)(const struct sr_dev_inst *sdi, struct sr_channel *ch, unsigned int changes)
Channel status change.
Device is in "hold" mode (repeating the last measurement).
Time is duration (as opposed to epoch, ...).
The device has internal storage, into which data is logged.
void * priv
Private data for driver use.
int(* dev_acquisition_stop)(struct sr_dev_inst *sdi, void *cb_data)
End data acquisition on the specified device.
sr_resource_type
Resource type.
Opaque structure representing a libsigrok session.
Sound pressure level is A-weighted in the frequency domain, according to IEC 61672:2003.
A channel group must be specified.
The device supports setting the number of logic channels.
Parallel inductance (LCR meter model).
The device supports setting the number of analog channels.
sr_configcap
Configuration capabilities.
The device supports setting a sample number limit (how many samples should be acquired).
The device supports run-length encoding (RLE).
const char * id
Short, lowercase ID string, e.g.
int api_version
API version (currently 1).
gboolean enabled
Is this channel enabled?
int match
The trigger match to use.
Degrees Fahrenheit (temperature).
This is a true RMS measurement.
Device instance type for Modbus devices.
The device can act as an LCR meter.
If set, this output module writes the output itself.
Equivalent circuit model.
Channel regulation get: "CV", "CC" or "UR", denoting constant voltage, constant current or unregulate...
The device supports continuous sampling.
int(* dev_acquisition_start)(const struct sr_dev_inst *sdi, void *cb_data)
Begin data acquisition on the specified device.
char * description
An end user friendly description for the serial port.
const char * name
Full capitalized name, e.g.
Number of vertical divisions, as related to SR_CONF_VDIV.
Unit of conductance, the inverse of resistance.
uint32_t key
Config key like SR_CONF_CONN, MQ value like SR_MQ_VOLTAGE, etc.
The device can act as a multimeter.
Sound pressure level measurement is F-weighted (125ms) in the time domain.
The device supports using an external clock.
Structure for groups of channels that have common properties.
int mq
Measured quantity (voltage, current, temperature, and so on).
sr_packettype
Value for sr_datafeed_packet.type.
Hertz (frequency, 1/s, [Hz]).
The device can act as logic analyzer.
Degrees Celsius (temperature).
The device can act as a signal demodulator.
sr_dev_inst_type
Types of device instance, struct sr_dev_inst.type.
int(* config_get)(uint32_t key, 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.
float * data
The analog value(s).
Amplitude of a source without strictly-defined MQ.
The device can act as a scale.
struct sr_rational offset
Malloc/calloc/realloc error.
sr_mqflag
Values for sr_analog_meaning.mqflags.
sr_channeltype
Constants for channel type.
The device supports setting a sample time limit (how long the sample acquisition should run...
Over-voltage protection (OVP) active.
Data source for acquisition.
The device supports averaging.
Modbus slave address specification.
gboolean is_digits_decimal
Device is closed, but must be open.
Over-current protection (OCP) threshold.
Analog datafeed payload for type SR_DF_ANALOG.
Sound pressure level is time-averaged (LAT), also known as Equivalent Continuous A-weighted Sound Lev...
The device supports swapping channels.
char * name
Name of channel.
sr_dev_inst_status
Device instance status, struct sr_dev_inst.status.
Output informational messages.
Sound pressure level is C-weighted in the frequency domain, according to IEC 61672:2003.
GSList * channels
The channels for which data is included in this packet.
const char * name
Driver name.
GVariant * data
Key-specific data.
sr_loglevel
libsigrok loglevels.
Packet in a sigrok data feed.
int type
Resource type (SR_RESOURCE_FIRMWARE, ...)
Sound pressure level time weighting.
Voltage measurement is direct current (DC).
The device can act as a sound level meter.
struct sr_analog_meaning * meaning
The device supports setting trigger slope.
Logic datafeed payload for type SR_DF_LOGIC.
The device is a demo device.
Device is in "min" mode, only updating upon a new min value.
Sound pressure level represented as a percentage of measurements that were over a preset alarm level...
float value
If the trigger match is one of SR_TRIGGER_OVER or SR_TRIGGER_UNDER, this contains the value to compar...
uint64_t q
Denominator of the rational number.
const char * longname
Long name.
Version number definitions and macros.
Payload is sr_datafeed_header.
Generic option struct used by various subsystems.
char * name
A name for this trigger.
int type
Channel type (SR_CHANNEL_LOGIC, ...)
The trigger matched at this point in the data feed.
Specification on how to connect to a device.
The device supports setting a pattern (pattern generator mode).
Information on single channel.
Channel type is analog channel.
int64_t p
Numerator of the rational number.
Voltage in decibel, referenced to 1 volt (dBV).
The device supports setting a probe factor.
sr_configkey
Configuration keys.
The device can act as a programmable power supply.
Enabling/disabling channel.
Over-voltage protection (OVP) threshold.
sr_output_flag
Output module flags.
struct sr_analog_spec * spec
Possible values can be enumerated.
Relative humidity assuming air temperature of 293 Kelvin (rF).
int unit
Unit in which the MQ is measured.
Device-instance type for user-created "devices".
The device instance is actively in use in a session.
A channel to match and what to match it on.
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.
void * priv
Private data for driver use.
Datafeed payload for type SR_DF_META.
Parallel resistance (LCR meter model).
Series resistance (LCR meter model).
int(* cleanup)(const struct sr_dev_driver *driver)
Called before driver is unloaded.
Header of a sigrok data feed.
Sound pressure level, in decibels, relative to 20 micropascals.
Parallel capacitance (LCR meter model).
The device can measure humidity.
Device is in "max" mode, only updating upon a new max value.
The device instance is live, but not in use.
Device is in relative mode.
The device supports setting a frame limit (how many frames should be acquired).
The device can act as an electronic load.
The device supports setting its samplerate, in Hz.
The device instance was found, but is still booting.
Device instance type for serial port devices.
int(* config_set)(uint32_t key, 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.
Opaque structure representing a libsigrok context.
sr_error_code
Status/error codes returned by libsigrok functions.
int(* init)(struct sr_dev_driver *driver, struct sr_context *sr_ctx)
Called when driver is loaded, e.g.
GSList * stages
List of pointers to struct sr_trigger_stage.
Measurements that intrinsically do not have units attached, such as ratios, gains, etc.
void * handle
File handle or equivalent; set by resource open callback.
Sound pressure level is not weighted in the frequency domain, albeit without standards-defined low an...
Device is in "avg" mode, averaging upon each new value.
The device is winding down its session.
struct sr_dev_inst * sdi
The device this channel is attached to.
Device mode for multi-function devices.
uint64_t size
Size of resource in bytes; set by resource open callback.
int datatype
Data type like SR_T_STRING, etc if applicable.
The device can measure temperature.
void * context
Device driver context, considered private.
Serial communication specification, in the form:
int index
The index of this channel, starting at 0.
Header file containing API function prototypes.
int(* dev_close)(struct sr_dev_inst *sdi)
Close device.
uint32_t key
Config key like SR_CONF_CONN, etc.
The device can act as an oscilloscope.
Series inductance (LCR meter model).
int(* config_list)(uint32_t key, 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.
Mass in troy ounce [oz t].
Payload is struct sr_datafeed_meta.
Series capacitance (LCR meter model).
Normalized (0 to 1) concentration of a substance or compound with 0 representing a concentration of 0...
Plane angle in 1/360th of a full circle.
Output no messages at all.
struct sr_channel * channel
The channel to trigger on.
Sound pressure level measurement is S-weighted (1s) in the time domain.
sr_mq
Measured quantity, sr_analog_meaning.mq.
int(* dev_clear)(const struct sr_dev_driver *driver)
Clear list of devices the driver knows about.
DEPRECATED! Use SR_DF_ANALOG instead.
Payload is struct sr_datafeed_analog.
Payload is struct sr_datafeed_logic.
int num_samples
Number of samples in data.
Output very noisy debug messages.
Gain (a transistor's gain, or hFE, for example).
int(* dev_open)(struct sr_dev_inst *sdi)
Open device.
The device supports setting number of samples to be averaged over.
The device instance was not found.
Over-current protection (OCP) feature.
Channel type is logic channel.
const char * description
Verbose description (unused currently).
GSList * matches
List of pointers to struct sr_trigger_match.
Used for setting or getting value of a config item.