sr: Make more symbols private via static/SR_PRIV.
Additional zeroplus fixes: - Remove unneeded function prototypes from .h files. - Remove unused variables and/or use standard libusb #defines instead. - Remove unused GL_* error code #defines.
This commit is contained in:
parent
185ae2c5c9
commit
ca070ed9a0
|
@ -386,7 +386,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
|
|||
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,
|
||||
|
|
|
@ -1399,7 +1399,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
|
|||
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,
|
||||
|
|
|
@ -1127,7 +1127,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
|
|||
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,
|
||||
|
|
|
@ -64,7 +64,7 @@ enum {
|
|||
};
|
||||
|
||||
/* FIXME: Should not be global. */
|
||||
GIOChannel *channels[2];
|
||||
static GIOChannel *channels[2];
|
||||
|
||||
struct databag {
|
||||
int pipe_fds[2];
|
||||
|
@ -487,7 +487,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
|
|||
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,
|
||||
|
|
|
@ -826,7 +826,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
|
|||
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,
|
||||
|
|
|
@ -150,7 +150,7 @@ static struct rate_map rate_map[] = {
|
|||
};
|
||||
|
||||
/* FIXME: Determine corresponding voltages */
|
||||
uint16_t la_threshold_map[] = {
|
||||
static uint16_t la_threshold_map[] = {
|
||||
0x8600,
|
||||
0x8770,
|
||||
0x88ff,
|
||||
|
|
|
@ -1022,7 +1022,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
|
|||
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,
|
||||
|
|
|
@ -815,7 +815,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
|
|||
/* 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,
|
||||
|
|
|
@ -302,20 +302,20 @@ static void analyzer_set_filter(libusb_device_handle *devh)
|
|||
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) {
|
||||
|
@ -325,7 +325,7 @@ void analyzer_wait(libusb_device_handle *devh, int set, int unset)
|
|||
}
|
||||
}
|
||||
|
||||
void analyzer_read_start(libusb_device_handle *devh)
|
||||
SR_PRIV void analyzer_read_start(libusb_device_handle *devh)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -335,19 +335,19 @@ void analyzer_read_start(libusb_device_handle *devh)
|
|||
(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);
|
||||
|
@ -355,7 +355,7 @@ void analyzer_start(libusb_device_handle *devh)
|
|||
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;
|
||||
|
||||
|
@ -405,7 +405,7 @@ void analyzer_configure(libusb_device_handle *devh)
|
|||
__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;
|
||||
|
||||
|
@ -448,7 +448,7 @@ void analyzer_add_trigger(int channel, int type)
|
|||
}
|
||||
}
|
||||
|
||||
void analyzer_add_filter(int channel, int type)
|
||||
SR_PRIV void analyzer_add_filter(int channel, int type)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -479,73 +479,73 @@ void analyzer_add_filter(int channel, int type)
|
|||
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;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#define SIGROK_ZEROPLUS_ANALYZER_H
|
||||
|
||||
#include <libusb.h>
|
||||
#include "sigrok.h"
|
||||
|
||||
#define STATUS_FLAG_NONE 0x00
|
||||
#define STATUS_FLAG_RESET 0x01
|
||||
|
@ -75,33 +76,33 @@ enum {
|
|||
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,
|
||||
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);
|
||||
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_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
|
||||
|
|
|
@ -39,16 +39,9 @@
|
|||
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,
|
||||
|
@ -59,7 +52,7 @@ enum {
|
|||
|
||||
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;
|
||||
|
@ -72,7 +65,7 @@ int gl_write_address(libusb_device_handle *devh, unsigned int address)
|
|||
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;
|
||||
|
@ -85,7 +78,7 @@ int gl_write_data(libusb_device_handle *devh, unsigned int val)
|
|||
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;
|
||||
|
@ -98,7 +91,8 @@ int gl_read_data(libusb_device_handle *devh)
|
|||
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,
|
||||
|
@ -111,14 +105,14 @@ int gl_read_bulk(libusb_device_handle *devh, void *buffer, unsigned int size)
|
|||
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;
|
||||
|
@ -130,7 +124,7 @@ int gl_reg_write(libusb_device_handle *devh, unsigned int reg,
|
|||
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;
|
||||
|
||||
|
|
|
@ -33,19 +33,12 @@
|
|||
#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,
|
||||
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);
|
||||
int gl_reg_read(libusb_device_handle *devh, unsigned int reg);
|
||||
SR_PRIV int gl_reg_read(libusb_device_handle *devh, unsigned int reg);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -722,7 +722,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
|
|||
/* 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,
|
||||
|
|
|
@ -58,7 +58,7 @@ extern struct sr_device_plugin zeroplus_logic_cube_plugin_info;
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue