![]() |
libsigrok
0.3.0
sigrok hardware access and backend library
|
The public libsigrok header file to be used by frontends. More...
#include <stdio.h>
#include <sys/time.h>
#include <stdint.h>
#include <inttypes.h>
#include <glib.h>
#include "proto.h"
#include "version.h"
Go to the source code of this file.
Data Structures | |
struct | sr_datafeed_packet |
Packet in a sigrok data feed. More... | |
struct | sr_datafeed_header |
Header of a sigrok data feed. More... | |
struct | sr_datafeed_meta |
Datafeed payload for type SR_DF_META. More... | |
struct | sr_datafeed_logic |
Logic datafeed payload for type SR_DF_LOGIC. More... | |
struct | sr_datafeed_analog |
Analog datafeed payload for type SR_DF_ANALOG. More... | |
struct | sr_input |
Input (file) format struct. More... | |
struct | sr_input_format |
Input (file) format driver. More... | |
struct | sr_output |
Output (file) format struct. More... | |
struct | sr_output_format |
Output (file) format driver. More... | |
struct | sr_channel |
Information on single channel. More... | |
struct | sr_channel_group |
Structure for groups of channels that have common properties. More... | |
struct | sr_config |
Used for setting or getting value of a config item. More... | |
struct | sr_config_info |
Information about a config key. More... | |
struct | sr_dev_inst |
Device instance data. More... | |
struct | sr_dev_driver |
Device driver data. More... | |
Macros | |
#define | SR_MAX_CHANNELNAME_LEN 32 |
#define | SR_HZ(n) (n) |
#define | SR_KHZ(n) ((n) * (uint64_t)(1000ULL)) |
#define | SR_MHZ(n) ((n) * (uint64_t)(1000000ULL)) |
#define | SR_GHZ(n) ((n) * (uint64_t)(1000000000ULL)) |
#define | SR_HZ_TO_NS(n) ((uint64_t)(1000000000ULL) / (n)) |
#define | SR_API __attribute__((visibility("default"))) |
#define | SR_PRIV __attribute__((visibility("hidden"))) |
Typedefs | |
typedef int(* | sr_receive_data_callback) (int fd, int revents, void *cb_data) |
Type definition for callback function for data reception. More... | |
The public libsigrok header file to be used by frontends.
This is the only file that libsigrok users (frontends) are supposed to use and #include. There are other header files which get installed with libsigrok, but those are not meant to be used directly by frontends.
The correct way to get/use the libsigrok API functions is:
Definition in file libsigrok.h.
#define SR_API __attribute__((visibility("default"))) |
Definition at line 122 of file libsigrok.h.
#define SR_GHZ | ( | n | ) | ((n) * (uint64_t)(1000000000ULL)) |
Definition at line 90 of file libsigrok.h.
Referenced by sr_parse_sizestring(), sr_period_string(), and sr_si_string_u64().
#define SR_HZ | ( | n | ) | (n) |
Definition at line 87 of file libsigrok.h.
Referenced by sr_si_string_u64().
#define SR_HZ_TO_NS | ( | n | ) | ((uint64_t)(1000000000ULL) / (n)) |
Definition at line 92 of file libsigrok.h.
#define SR_KHZ | ( | n | ) | ((n) * (uint64_t)(1000ULL)) |
Definition at line 88 of file libsigrok.h.
Referenced by sr_parse_sizestring(), sr_period_string(), and sr_si_string_u64().
#define SR_MAX_CHANNELNAME_LEN 32 |
Definition at line 84 of file libsigrok.h.
Referenced by sr_session_load().
#define SR_MHZ | ( | n | ) | ((n) * (uint64_t)(1000000ULL)) |
Definition at line 89 of file libsigrok.h.
Referenced by sr_parse_sizestring(), sr_period_string(), and sr_si_string_u64().
#define SR_PRIV __attribute__((visibility("hidden"))) |
Definition at line 129 of file libsigrok.h.
typedef int(* sr_receive_data_callback) (int fd, int revents, void *cb_data) |
Type definition for callback function for data reception.
Definition at line 135 of file libsigrok.h.
enum sr_channeltype |
Constants for channel type.
Enumerator | |
---|---|
SR_CHANNEL_LOGIC |
Channel type is logic channel. |
SR_CHANNEL_ANALOG |
Channel type is analog channel. |
Definition at line 529 of file libsigrok.h.
enum sr_configkey |
Constants for device classes.
Enumerator | |
---|---|
SR_CONF_LOGIC_ANALYZER |
The device can act as logic analyzer. |
SR_CONF_OSCILLOSCOPE |
The device can act as an oscilloscope. |
SR_CONF_MULTIMETER |
The device can act as a multimeter. |
SR_CONF_DEMO_DEV |
The device is a demo device. |
SR_CONF_SOUNDLEVELMETER |
The device can act as a sound level meter. |
SR_CONF_THERMOMETER |
The device can measure temperature. |
SR_CONF_HYGROMETER |
The device can measure humidity. |
SR_CONF_ENERGYMETER |
The device can measure energy consumption. |
SR_CONF_DEMODULATOR |
The device can demodulate signals. |
SR_CONF_POWER_SUPPLY |
Programmable power supply. |
SR_CONF_CONN |
Specification on how to connect to a device. In combination with SR_CONF_SERIALCOMM, this is a serial port in the form which makes sense to the OS (e.g., /dev/ttyS0). Otherwise this specifies a USB device, either in the form of <bus>.<address> (decimal, e.g. 1.65) or <vendorid>.<productid> (hexadecimal, e.g. 1d6b.0001). |
SR_CONF_SERIALCOMM |
Serial communication specification, in the form: <baudrate>/<databits><parity><stopbits> Example: 9600/8n1 The string may also be followed by one or more special settings, in the form "/key=value". Supported keys and their values are: rts 0,1 set the port's RTS pin to low or high dtr 0,1 set the port's DTR pin to low or high flow 0 no flow control 1 hardware-based (RTS/CTS) flow control 2 software-based (XON/XOFF) flow control This is always an optional parameter, since a driver typically knows the speed at which the device wants to communicate. |
SR_CONF_SAMPLERATE |
The device supports setting its samplerate, in Hz. |
SR_CONF_CAPTURE_RATIO |
The device supports setting a pre/post-trigger capture ratio. |
SR_CONF_PATTERN_MODE |
The device supports setting a pattern (pattern generator mode). |
SR_CONF_RLE |
The device supports Run Length Encoding. |
SR_CONF_TRIGGER_SLOPE |
The device supports setting trigger slope. |
SR_CONF_TRIGGER_SOURCE |
Trigger source. |
SR_CONF_HORIZ_TRIGGERPOS |
Horizontal trigger position. |
SR_CONF_BUFFERSIZE |
Buffer size. |
SR_CONF_TIMEBASE |
Time base. |
SR_CONF_FILTER |
Filter. |
SR_CONF_VDIV |
Volts/div. |
SR_CONF_COUPLING |
Coupling. |
SR_CONF_TRIGGER_TYPE |
Trigger types. |
SR_CONF_SAMPLE_INTERVAL |
The device supports setting its sample interval, in ms. |
SR_CONF_NUM_TIMEBASE |
Number of timebases, as related to SR_CONF_TIMEBASE. |
SR_CONF_NUM_VDIV |
Number of vertical divisions, as related to SR_CONF_VDIV. |
SR_CONF_SPL_WEIGHT_FREQ |
Sound pressure level frequency weighting. |
SR_CONF_SPL_WEIGHT_TIME |
Sound pressure level time weighting. |
SR_CONF_SPL_MEASUREMENT_RANGE |
Sound pressure level measurement range. |
SR_CONF_HOLD_MAX |
Max hold mode. |
SR_CONF_HOLD_MIN |
Min hold mode. |
SR_CONF_VOLTAGE_THRESHOLD |
Logic low-high threshold range. |
SR_CONF_EXTERNAL_CLOCK |
The device supports using an external clock. |
SR_CONF_SWAP |
The device supports swapping channels. Typical this is between buffered and unbuffered channels. |
SR_CONF_CENTER_FREQUENCY |
Center frequency. The input signal is downmixed by this frequency before the ADC anti-aliasing filter. |
SR_CONF_NUM_LOGIC_CHANNELS |
The device supports setting the number of logic channels. |
SR_CONF_NUM_ANALOG_CHANNELS |
The device supports setting the number of analog channels. |
SR_CONF_OUTPUT_VOLTAGE |
Output voltage. |
SR_CONF_OUTPUT_VOLTAGE_MAX |
Maximum output voltage. |
SR_CONF_OUTPUT_CURRENT |
Output current. |
SR_CONF_OUTPUT_CURRENT_MAX |
Maximum output current. |
SR_CONF_OUTPUT_ENABLED |
Enabling/disabling output. |
SR_CONF_OUTPUT_CHANNEL |
Channel output configuration. |
SR_CONF_OVER_VOLTAGE_PROTECTION |
Over-voltage protection (OVP) |
SR_CONF_OVER_CURRENT_PROTECTION |
Over-current protection (OCP) |
SR_CONF_CLOCK_EDGE |
Choice of clock edge for external clock ("r" or "f"). |
SR_CONF_SCAN_OPTIONS |
Scan options supported by the driver. |
SR_CONF_DEVICE_OPTIONS |
Device options for a particular device. |
SR_CONF_SESSIONFILE |
Session filename. |
SR_CONF_CAPTUREFILE |
The device supports specifying a capturefile to inject. |
SR_CONF_CAPTURE_UNITSIZE |
The device supports specifying the capturefile unit size. |
SR_CONF_POWER_OFF |
Power off the device. |
SR_CONF_DATA_SOURCE |
Data source for acquisition. If not present, acquisition from the device is always "live", i.e. acquisition starts when the frontend asks and the results are sent out as soon as possible. If present, it indicates that either the device has no live acquisition capability (for example a pure data logger), or there is a choice. sr_config_list() returns those choices. In any case if a device has live acquisition capabilities, it is always the default. |
SR_CONF_LIMIT_MSEC |
The device supports setting a sample time limit (how long the sample acquisition should run, in ms). |
SR_CONF_LIMIT_SAMPLES |
The device supports setting a sample number limit (how many samples should be acquired). |
SR_CONF_LIMIT_FRAMES |
The device supports setting a frame limit (how many frames should be acquired). |
SR_CONF_CONTINUOUS |
The device supports continuous sampling. Neither a time limit nor a sample number limit has to be supplied, it will just acquire samples continuously, until explicitly stopped by a certain command. |
SR_CONF_DATALOG |
The device has internal storage, into which data is logged. This starts or stops the internal logging. |
SR_CONF_DEVICE_MODE |
Device mode for multi-function devices. |
SR_CONF_TEST_MODE |
Self test mode. |
Definition at line 583 of file libsigrok.h.
enum sr_datatype |
Data types used by sr_config_info().
Enumerator | |
---|---|
SR_T_UINT64 | |
SR_T_STRING | |
SR_T_BOOL | |
SR_T_FLOAT | |
SR_T_RATIONAL_PERIOD | |
SR_T_RATIONAL_VOLT | |
SR_T_KEYVALUE | |
SR_T_UINT64_RANGE | |
SR_T_DOUBLE_RANGE | |
SR_T_INT32 |
Definition at line 138 of file libsigrok.h.
enum sr_dev_inst_status |
Device instance status, struct sr_dev_inst.status.
Definition at line 877 of file libsigrok.h.
enum sr_dev_inst_type |
Types of device instance, struct sr_dev_inst.type.
Enumerator | |
---|---|
SR_INST_USB |
Device instance type for USB devices. |
SR_INST_SERIAL |
Device instance type for serial port devices. |
SR_INST_SCPI |
Device instance type for SCPI devices. |
Definition at line 867 of file libsigrok.h.
enum sr_error_code |
Status/error codes returned by libsigrok functions.
Definition at line 66 of file libsigrok.h.
enum sr_loglevel |
libsigrok loglevels.
Definition at line 95 of file libsigrok.h.
enum sr_mq |
Measured quantity, sr_datafeed_analog.mq.
Definition at line 172 of file libsigrok.h.
enum sr_mqflag |
Values for sr_datafeed_analog.flags.
Definition at line 258 of file libsigrok.h.
enum sr_packettype |
Value for sr_datafeed_packet.type.
Enumerator | |
---|---|
SR_DF_HEADER |
Payload is sr_datafeed_header. |
SR_DF_END |
End of stream (no further data). |
SR_DF_META |
Payload is struct sr_datafeed_meta. |
SR_DF_TRIGGER |
The trigger matched at this point in the data feed. No payload. |
SR_DF_LOGIC |
Payload is struct sr_datafeed_logic. |
SR_DF_ANALOG |
Payload is struct sr_datafeed_analog. |
SR_DF_FRAME_BEGIN |
Beginning of frame. No payload. |
SR_DF_FRAME_END |
End of frame. No payload. |
Definition at line 152 of file libsigrok.h.
enum sr_unit |
Unit of measured quantity, sr_datafeed_analog.unit.
Definition at line 201 of file libsigrok.h.