session_device_id = session_device_id;
}
-struct sr_device_plugin alsa_plugin_info = {
+SR_PRIV struct sr_device_plugin alsa_plugin_info = {
.name = "alsa",
.longname = "ALSA driver",
.api_version = 1,
sigma->state.state = SIGMA_DOWNLOAD;
}
-struct sr_device_plugin asix_sigma_plugin_info = {
+SR_PRIV struct sr_device_plugin asix_sigma_plugin_info = {
.name = "asix-sigma",
.longname = "ASIX SIGMA",
.api_version = 1,
sr_session_bus(session_data, &packet);
}
-struct sr_device_plugin chronovu_la8_plugin_info = {
+SR_PRIV struct sr_device_plugin chronovu_la8_plugin_info = {
.name = "chronovu-la8",
.longname = "ChronoVu LA8",
.api_version = 1,
};
/* FIXME: Should not be global. */
-GIOChannel *channels[2];
+static GIOChannel *channels[2];
struct databag {
int pipe_fds[2];
thread_running = 0;
}
-struct sr_device_plugin demo_plugin_info = {
+SR_PRIV struct sr_device_plugin demo_plugin_info = {
.name = "demo",
.longname = "Demo driver and pattern generator",
.api_version = 1,
sr_session_bus(session_device_id, &packet);
}
-struct sr_device_plugin link_mso19_plugin_info = {
+SR_PRIV struct sr_device_plugin link_mso19_plugin_info = {
.name = "link-mso19",
.longname = "Link Instruments MSO-19",
.api_version = 1,
};
/* FIXME: Determine corresponding voltages */
-uint16_t la_threshold_map[] = {
+static uint16_t la_threshold_map[] = {
0x8600,
0x8770,
0x88ff,
sr_session_bus(session_device_id, &packet);
}
-struct sr_device_plugin ols_plugin_info = {
+SR_PRIV struct sr_device_plugin ols_plugin_info = {
.name = "ols",
.longname = "Openbench Logic Sniffer",
.api_version = 1,
/* TODO: Need to cancel and free any queued up transfers. */
}
-struct sr_device_plugin saleae_logic_plugin_info = {
+SR_PRIV struct sr_device_plugin saleae_logic_plugin_info = {
.name = "saleae-logic",
.longname = "Saleae Logic",
.api_version = 1,
gl_reg_write(devh, FILTER_STATUS + i, g_filter_status[i]);
}
-void analyzer_reset(libusb_device_handle *devh)
+SR_PRIV void analyzer_reset(libusb_device_handle *devh)
{
analyzer_write_status(devh, 3, STATUS_FLAG_NONE); // reset device
analyzer_write_status(devh, 3, STATUS_FLAG_RESET); // reset device
}
-void analyzer_initialize(libusb_device_handle *devh)
+SR_PRIV void analyzer_initialize(libusb_device_handle *devh)
{
analyzer_write_status(devh, 1, STATUS_FLAG_NONE);
analyzer_write_status(devh, 1, STATUS_FLAG_INIT);
analyzer_write_status(devh, 1, STATUS_FLAG_NONE);
}
-void analyzer_wait(libusb_device_handle *devh, int set, int unset)
+SR_PRIV void analyzer_wait(libusb_device_handle *devh, int set, int unset)
{
int status;
while (1) {
}
}
-void analyzer_read_start(libusb_device_handle *devh)
+SR_PRIV void analyzer_read_start(libusb_device_handle *devh)
{
int i;
(void)gl_reg_read(devh, READ_RAM_STATUS);
}
-int analyzer_read_data(libusb_device_handle *devh, void *buffer,
+SR_PRIV int analyzer_read_data(libusb_device_handle *devh, void *buffer,
unsigned int size)
{
return gl_read_bulk(devh, buffer, size);
}
-void analyzer_read_stop(libusb_device_handle *devh)
+SR_PRIV void analyzer_read_stop(libusb_device_handle *devh)
{
analyzer_write_status(devh, 3, STATUS_FLAG_20);
analyzer_write_status(devh, 3, STATUS_FLAG_NONE);
}
-void analyzer_start(libusb_device_handle *devh)
+SR_PRIV void analyzer_start(libusb_device_handle *devh)
{
analyzer_write_status(devh, 1, STATUS_FLAG_NONE);
analyzer_write_status(devh, 1, STATUS_FLAG_INIT);
analyzer_write_status(devh, 1, STATUS_FLAG_GO);
}
-void analyzer_configure(libusb_device_handle *devh)
+SR_PRIV void analyzer_configure(libusb_device_handle *devh)
{
int i;
__analyzer_set_compression(devh, g_compression);
}
-void analyzer_add_trigger(int channel, int type)
+SR_PRIV void analyzer_add_trigger(int channel, int type)
{
int i;
}
}
-void analyzer_add_filter(int channel, int type)
+SR_PRIV void analyzer_add_filter(int channel, int type)
{
int i;
g_filter_enable = 1;
}
-void analyzer_set_trigger_count(int count)
+SR_PRIV void analyzer_set_trigger_count(int count)
{
g_trigger_count = count;
}
-void analyzer_set_freq(int freq, int scale)
+SR_PRIV void analyzer_set_freq(int freq, int scale)
{
g_freq_value = freq;
g_freq_scale = scale;
}
-void analyzer_set_memory_size(unsigned int size)
+SR_PRIV void analyzer_set_memory_size(unsigned int size)
{
g_memory_size = size;
}
-void analyzer_set_ramsize_trigger_address(unsigned int address)
+SR_PRIV void analyzer_set_ramsize_trigger_address(unsigned int address)
{
g_ramsize_triggerbar_addr = address;
}
-void analyzer_set_triggerbar_address(unsigned int address)
+SR_PRIV void analyzer_set_triggerbar_address(unsigned int address)
{
g_triggerbar_addr = address;
}
-unsigned int analyzer_read_id(libusb_device_handle *devh)
+SR_PRIV unsigned int analyzer_read_id(libusb_device_handle *devh)
{
return gl_reg_read(devh, DEVICE_ID1) << 8 | gl_reg_read(devh,
DEVICE_ID0);
}
-unsigned int analyzer_get_stop_address(libusb_device_handle *devh)
+SR_PRIV unsigned int analyzer_get_stop_address(libusb_device_handle *devh)
{
return gl_reg_read(devh, STOP_ADDRESS2) << 16 | gl_reg_read(devh,
STOP_ADDRESS1) << 8 | gl_reg_read(devh, STOP_ADDRESS0);
}
-unsigned int analyzer_get_now_address(libusb_device_handle *devh)
+SR_PRIV unsigned int analyzer_get_now_address(libusb_device_handle *devh)
{
return gl_reg_read(devh, NOW_ADDRESS2) << 16 | gl_reg_read(devh,
NOW_ADDRESS1) << 8 | gl_reg_read(devh, NOW_ADDRESS0);
}
-unsigned int analyzer_get_trigger_address(libusb_device_handle *devh)
+SR_PRIV unsigned int analyzer_get_trigger_address(libusb_device_handle *devh)
{
return gl_reg_read(devh, TRIGGER_ADDRESS2) << 16 | gl_reg_read(devh,
TRIGGER_ADDRESS1) << 8 | gl_reg_read(devh, TRIGGER_ADDRESS0);
}
-void analyzer_set_compression(unsigned int type)
+SR_PRIV void analyzer_set_compression(unsigned int type)
{
g_compression = type;
}
-void analyzer_wait_button(libusb_device_handle *devh)
+SR_PRIV void analyzer_wait_button(libusb_device_handle *devh)
{
analyzer_wait(devh, STATUS_BUTTON_PRESSED, 0);
}
-void analyzer_wait_data(libusb_device_handle *devh)
+SR_PRIV void analyzer_wait_data(libusb_device_handle *devh)
{
analyzer_wait(devh, STATUS_READY | 8, STATUS_BUSY);
}
-int analyzer_decompress(void *input, unsigned int input_len, void *output,
- unsigned int output_len)
+SR_PRIV int analyzer_decompress(void *input, unsigned int input_len,
+ void *output, unsigned int output_len)
{
unsigned char *in = input;
unsigned char *out = output;
#define SIGROK_ZEROPLUS_ANALYZER_H
#include <libusb.h>
+#include "sigrok.h"
#define STATUS_FLAG_NONE 0x00
#define STATUS_FLAG_RESET 0x01
TRIGGER_ANYEDGE,
};
-void analyzer_set_freq(int freq, int scale);
-void analyzer_set_ramsize_trigger_address(unsigned int address);
-void analyzer_set_triggerbar_address(unsigned int address);
-void analyzer_set_compression(unsigned int type);
-void analyzer_set_memory_size(unsigned int size);
-void analyzer_add_trigger(int channel, int type);
-void analyzer_set_trigger_count(int count);
-void analyzer_add_filter(int channel, int type);
+SR_PRIV void analyzer_set_freq(int freq, int scale);
+SR_PRIV void analyzer_set_ramsize_trigger_address(unsigned int address);
+SR_PRIV void analyzer_set_triggerbar_address(unsigned int address);
+SR_PRIV void analyzer_set_compression(unsigned int type);
+SR_PRIV void analyzer_set_memory_size(unsigned int size);
+SR_PRIV void analyzer_add_trigger(int channel, int type);
+SR_PRIV void analyzer_set_trigger_count(int count);
+SR_PRIV void analyzer_add_filter(int channel, int type);
-unsigned int analyzer_read_id(libusb_device_handle *devh);
-unsigned int analyzer_get_stop_address(libusb_device_handle *devh);
-unsigned int analyzer_get_now_address(libusb_device_handle *devh);
-unsigned int analyzer_get_trigger_address(libusb_device_handle *devh);
-int analyzer_decompress(void *input, unsigned int input_len, void *output,
- unsigned int output_len);
+SR_PRIV unsigned int analyzer_read_id(libusb_device_handle *devh);
+SR_PRIV unsigned int analyzer_get_stop_address(libusb_device_handle *devh);
+SR_PRIV unsigned int analyzer_get_now_address(libusb_device_handle *devh);
+SR_PRIV unsigned int analyzer_get_trigger_address(libusb_device_handle *devh);
+SR_PRIV int analyzer_decompress(void *input, unsigned int input_len,
+ void *output, unsigned int output_len);
-void analyzer_reset(libusb_device_handle *devh);
-void analyzer_initialize(libusb_device_handle *devh);
-void analyzer_wait(libusb_device_handle *devh, int set, int unset);
-void analyzer_read_start(libusb_device_handle *devh);
-int analyzer_read_data(libusb_device_handle *devh, void *buffer,
- unsigned int size);
-void analyzer_read_stop(libusb_device_handle *devh);
-void analyzer_start(libusb_device_handle *devh);
-void analyzer_configure(libusb_device_handle *devh);
+SR_PRIV void analyzer_reset(libusb_device_handle *devh);
+SR_PRIV void analyzer_initialize(libusb_device_handle *devh);
+SR_PRIV void analyzer_wait(libusb_device_handle *devh, int set, int unset);
+SR_PRIV void analyzer_read_start(libusb_device_handle *devh);
+SR_PRIV int analyzer_read_data(libusb_device_handle *devh, void *buffer,
+ unsigned int size);
+SR_PRIV void analyzer_read_stop(libusb_device_handle *devh);
+SR_PRIV void analyzer_start(libusb_device_handle *devh);
+SR_PRIV void analyzer_configure(libusb_device_handle *devh);
-void analyzer_wait_button(libusb_device_handle *devh);
-void analyzer_wait_data(libusb_device_handle *devh);
+SR_PRIV void analyzer_wait_button(libusb_device_handle *devh);
+SR_PRIV void analyzer_wait_data(libusb_device_handle *devh);
#endif
LIBUSB_RECIPIENT_INTERFACE)
#define CTRL_OUT (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT | \
LIBUSB_RECIPIENT_INTERFACE)
+#define EP1_BULK_IN (LIBUSB_ENDPOINT_IN | 1)
-const int PACKET_CTRL_LEN = 2;
-const int PACKET_INT_LEN = 2;
-const int PACKET_BULK_LEN = 64;
-const int INTERFACE = 0;
-const int ENDPOINT_INT_IN = 0x81; /* Endpoint 0x81 address for IN */
-const int ENDPOINT_INT_OUT = 0x01; /* Endpoint 1 address for OUT */
-const int ENDPOINT_BULK_IN = 0x81; /* Endpoint 0x81 address for IN */
-const int ENDPOINT_BULK_OUT = 0x02; /* Endpoint 1 address for OUT */
-const int TIMEOUT = 5000; /* Timeout in ms */
+#define TIMEOUT 5000 /* Timeout in ms */
enum {
REQ_READBULK = 0x82,
static struct libusb_device_handle *g_devh = NULL;
-int gl_write_address(libusb_device_handle *devh, unsigned int address)
+static int gl_write_address(libusb_device_handle *devh, unsigned int address)
{
unsigned char packet[8] = { address & 0xFF };
int ret;
return ret;
}
-int gl_write_data(libusb_device_handle *devh, unsigned int val)
+static int gl_write_data(libusb_device_handle *devh, unsigned int val)
{
unsigned char packet[8] = { val & 0xFF };
int ret;
return ret;
}
-int gl_read_data(libusb_device_handle *devh)
+static int gl_read_data(libusb_device_handle *devh)
{
unsigned char packet[8] = { 0 };
int ret;
return (ret == 1) ? packet[0] : ret;
}
-int gl_read_bulk(libusb_device_handle *devh, void *buffer, unsigned int size)
+SR_PRIV int gl_read_bulk(libusb_device_handle *devh, void *buffer,
+ unsigned int size)
{
unsigned char packet[8] =
{ 0, 0, 0, 0, size & 0xff, (size & 0xff00) >> 8,
sr_err("%s: libusb_control_transfer returned %d\n",
__func__, ret);
- ret = libusb_bulk_transfer(devh, ENDPOINT_BULK_IN, buffer, size,
+ ret = libusb_bulk_transfer(devh, EP1_BULK_IN, buffer, size,
&transferred, TIMEOUT);
if (ret < 0)
sr_err("Bulk read error %d\n", ret);
return transferred;
}
-int gl_reg_write(libusb_device_handle *devh, unsigned int reg,
+SR_PRIV int gl_reg_write(libusb_device_handle *devh, unsigned int reg,
unsigned int val)
{
int ret;
return ret;
}
-int gl_reg_read(libusb_device_handle *devh, unsigned int reg)
+SR_PRIV int gl_reg_read(libusb_device_handle *devh, unsigned int reg)
{
int ret;
#define SIGROK_ZEROPLUS_GL_H
#include <libusb.h>
+#include "sigrok.h"
-#define GL_OK 0
-#define GL_ELIBUSB -1
-#define GL_EOPEN -2
-#define GL_ESETCONFIG -3
-#define GL_ECLAIM -4
-
-int gl_write_address(libusb_device_handle *devh, unsigned int address);
-int gl_write_data(libusb_device_handle *devh, unsigned int val);
-int gl_read_data(libusb_device_handle *devh);
-int gl_read_bulk(libusb_device_handle *devh, void *buffer, unsigned int size);
-int gl_reg_write(libusb_device_handle *devh, unsigned int reg,
- unsigned int val);
-int gl_reg_read(libusb_device_handle *devh, unsigned int reg);
+SR_PRIV int gl_read_bulk(libusb_device_handle *devh, void *buffer,
+ unsigned int size);
+SR_PRIV int gl_reg_write(libusb_device_handle *devh, unsigned int reg,
+ unsigned int val);
+SR_PRIV int gl_reg_read(libusb_device_handle *devh, unsigned int reg);
#endif
/* TODO: Need to cancel and free any queued up transfers. */
}
-struct sr_device_plugin zeroplus_logic_cube_plugin_info = {
+SR_PRIV struct sr_device_plugin zeroplus_logic_cube_plugin_info = {
.name = "zeroplus-logic-cube",
.longname = "Zeroplus Logic Cube LAP-C series",
.api_version = 1,
extern struct sr_device_plugin asix_sigma_plugin_info;
#endif
#ifdef HAVE_LA_CHRONOVU_LA8
-extern struct device_plugin chronovu_la8_plugin_info;
+extern SR_PRIV struct device_plugin chronovu_la8_plugin_info;
#endif
#ifdef HAVE_LA_LINK_MSO19
extern struct sr_device_plugin link_mso19_plugin_info;