diff options
Diffstat (limited to 'libsigrok4DSLogic/libsigrok.h')
-rw-r--r-- | libsigrok4DSLogic/libsigrok.h | 120 |
1 files changed, 81 insertions, 39 deletions
diff --git a/libsigrok4DSLogic/libsigrok.h b/libsigrok4DSLogic/libsigrok.h index 523aabc..da82e05 100644 --- a/libsigrok4DSLogic/libsigrok.h +++ b/libsigrok4DSLogic/libsigrok.h @@ -26,7 +26,7 @@ #include <inttypes.h> #include <glib.h> -#ifdef WIN32 +#ifdef _WIN32 #define WINVER 0x0500 #define _WIN32_WINNT WINVER #include <Winsock2.h> @@ -89,6 +89,7 @@ enum { #define SR_MAX_PROBENAME_LEN 32 #define DS_MAX_ANALOG_PROBES_NUM 8 +#define DS_MAX_DSO_PROBES_NUM 2 #define TriggerStages 16 #define TriggerProbes 16 #define TriggerCountBits 16 @@ -101,6 +102,11 @@ enum { #define SR_HZ_TO_NS(n) ((uint64_t)(1000000000ULL) / (n)) +#define SR_B(n) (n) +#define SR_KB(n) ((n) * (uint64_t)(1024ULL)) +#define SR_MB(n) ((n) * (uint64_t)(1048576ULL)) +#define SR_GB(n) ((n) * (uint64_t)(1073741824ULL)) + /** libsigrok loglevels. */ enum { SR_LOG_NONE = 0, /**< Output no messages at all. */ @@ -161,6 +167,7 @@ enum { SR_DF_META, SR_DF_TRIGGER, SR_DF_LOGIC, + SR_DF_DSO, SR_DF_ANALOG, SR_DF_FRAME_BEGIN, SR_DF_FRAME_END, @@ -300,6 +307,21 @@ struct sr_datafeed_trigger { }; +struct sr_datafeed_dso { + /** The probes for which data is included in this packet. */ + GSList *probes; + int num_samples; + /** Measured quantity (voltage, current, temperature, and so on). */ + int mq; + /** Unit in which the MQ is measured. */ + int unit; + /** Bitmap with extra information about the MQ. */ + uint64_t mqflags; + /** The analog value(s). The data is interleaved according to + * the probes list. */ + float *data; +}; + struct sr_datafeed_analog { /** The probes for which data is included in this packet. */ GSList *probes; @@ -547,17 +569,20 @@ struct sr_output_format { enum { SR_PROBE_LOGIC = 10000, + SR_PROBE_DSO, SR_PROBE_ANALOG, }; enum { LOGIC = 0, - ANALOG = 1, + DSO = 1, + ANALOG = 2, }; static const char *mode_strings[] = { "Logic Analyzer", "Oscilloscope", + "Data Acquisition", }; struct sr_probe { @@ -664,6 +689,9 @@ enum { /** Trigger source. */ SR_CONF_TRIGGER_SOURCE, + /** Trigger Value. */ + SR_CONF_TRIGGER_VALUE, + /** Horizontal trigger position. */ SR_CONF_HORIZ_TRIGGERPOS, @@ -676,11 +704,23 @@ enum { /** Filter. */ SR_CONF_FILTER, + /** DSO configure sync */ + SR_CONF_DSO_SYNC, + + /** Zero */ + SR_CONF_ZERO, + /** Volts/div. */ - SR_CONF_VDIV, + SR_CONF_VDIV0, + SR_CONF_VDIV1, /** Coupling. */ - SR_CONF_COUPLING, + SR_CONF_COUPLING0, + SR_CONF_COUPLING1, + + /** Channel enable*/ + SR_CONF_EN_CH0, + SR_CONF_EN_CH1, /** Trigger types. */ SR_CONF_TRIGGER_TYPE, @@ -697,6 +737,9 @@ enum { /** clock type (internal/external) */ SR_CONF_CLOCK_TYPE, + /** Device operation mode */ + SR_CONF_OPERATION_MODE, + /*--- Special stuff -------------------------------------------------*/ /** Scan options supported by the driver. */ @@ -786,6 +829,27 @@ enum { SR_ST_STOPPING, }; +/** Device operation modes. */ +enum { + /** Normal */ + SR_OP_NORMAL = 0, + /** Internal pattern test mode */ + SR_OP_INTERNAL_TEST = 1, + /** External pattern test mode */ + SR_OP_EXTERNAL_TEST = 2, + /** SDRAM loopback test mode */ + SR_OP_LOOPBACK_TEST = 3, +}; + +static const char *opmodes[] = { + "Normal", + "Internal Test", + "External Test", + "DRAM Loopback Test", +}; + +extern char config_path[256]; + struct sr_dev_driver { /* Driver-specific */ char *name; @@ -822,6 +886,7 @@ struct sr_session { /** List of struct datafeed_callback pointers. */ GSList *datafeed_callbacks; GTimeVal starttime; + gboolean running; unsigned int num_sources; @@ -849,6 +914,18 @@ enum { ADV_TRIGGER, }; +enum { + DSO_TRIGGER_AUTO = 0, + DSO_TRIGGER_CH0, + DSO_TRIGGER_CH1, + DSO_TRIGGER_CH0A1, + DSO_TRIGGER_CH0O1, +}; +enum { + DSO_TRIGGER_RISING = 0, + DSO_TRIGGER_FALLING, +}; + struct ds_trigger { uint16_t trigger_en; uint16_t trigger_mode; @@ -869,41 +946,6 @@ struct ds_trigger_pos { unsigned char first_block[504]; }; -//struct libusbhp_t; -typedef void (*libusbhp_hotplug_cb_fn)(struct libusbhp_device_t *device, - void *user_data); -#ifdef __linux__ -#include <libudev.h> - -struct dev_list_t { - char *path; - unsigned short vid; - unsigned short pid; - struct dev_list_t *next; -}; -#endif/*__linux__*/ - -struct libusbhp_t { -#ifdef __linux__ - struct udev* hotplug; - struct udev_monitor* hotplug_monitor; - struct dev_list_t *devlist; -#endif/*__linux__*/ -#ifdef _WIN32 - HWND hwnd; - HDEVNOTIFY hDeviceNotify; - WNDCLASSEX wcex; -#endif/*_WIN32*/ - libusbhp_hotplug_cb_fn attach; - libusbhp_hotplug_cb_fn detach; - void *user_data; -}; - -struct libusbhp_device_t { - unsigned short idVendor; - unsigned short idProduct; -}; - #include "proto.h" #include "version.h" |