sr: Mark API functions with SR_API/SR_PRIV.
Use SR_API to mark public API symbols, and SR_PRIV for private symbols. Variables and functions marked 'static' are private already and don't need SR_PRIV. However, functions which are not static (because they need to be used in other libsigrok-internal files) but are also not meant to be part of the public libsigrok API, must use SR_PRIV. This uses the 'visibility' feature of gcc (requires gcc >= 4.0). Details: http://gcc.gnu.org/wiki/Visibility
This commit is contained in:
parent
0146970797
commit
1a081ca67d
2
README
2
README
|
@ -25,7 +25,7 @@ Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
- git
|
- git
|
||||||
- gcc
|
- gcc (>= 4.0)
|
||||||
- make
|
- make
|
||||||
- autoconf >= 2.63
|
- autoconf >= 2.63
|
||||||
- automake >= 1.11
|
- automake >= 1.11
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, a (negative) error code otherwise.
|
* @return SR_OK upon success, a (negative) error code otherwise.
|
||||||
*/
|
*/
|
||||||
int sr_init(void)
|
SR_API int sr_init(void)
|
||||||
{
|
{
|
||||||
return load_hwplugins();
|
return load_hwplugins();
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ int sr_init(void)
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, a (negative) error code otherwise.
|
* @return SR_OK upon success, a (negative) error code otherwise.
|
||||||
*/
|
*/
|
||||||
int sr_exit(void)
|
SR_API int sr_exit(void)
|
||||||
{
|
{
|
||||||
sr_cleanup_hwplugins();
|
sr_cleanup_hwplugins();
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,9 @@ AH_TOP([#ifndef LIBSIGROK_CONFIG_H
|
||||||
#define LIBSIGROK_CONFIG_H /* To stop multiple inclusions. */])
|
#define LIBSIGROK_CONFIG_H /* To stop multiple inclusions. */])
|
||||||
AH_BOTTOM([#endif /* LIBSIGROK_CONFIG_H */])
|
AH_BOTTOM([#endif /* LIBSIGROK_CONFIG_H */])
|
||||||
|
|
||||||
CFLAGS="-g -Wall -Wextra"
|
# Enable more compiler warnings via -Wall and -Wextra. Add -fvisibility=hidden
|
||||||
|
# and enforce use of SR_API to explicitly mark all public API functions.
|
||||||
|
CFLAGS="-g -Wall -Wextra -fvisibility=hidden"
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
|
|
|
@ -48,7 +48,7 @@ static gpointer new_chunk(struct sr_datastore **ds);
|
||||||
* or SR_ERR_ARG upon invalid arguments. If something other than SR_OK
|
* or SR_ERR_ARG upon invalid arguments. If something other than SR_OK
|
||||||
* is returned, the value of 'ds' is undefined.
|
* is returned, the value of 'ds' is undefined.
|
||||||
*/
|
*/
|
||||||
int sr_datastore_new(int unitsize, struct sr_datastore **ds)
|
SR_API int sr_datastore_new(int unitsize, struct sr_datastore **ds)
|
||||||
{
|
{
|
||||||
if (!ds) {
|
if (!ds) {
|
||||||
sr_err("ds: %s: ds was NULL", __func__);
|
sr_err("ds: %s: ds was NULL", __func__);
|
||||||
|
@ -83,7 +83,7 @@ int sr_datastore_new(int unitsize, struct sr_datastore **ds)
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
|
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
|
||||||
*/
|
*/
|
||||||
int sr_datastore_destroy(struct sr_datastore *ds)
|
SR_API int sr_datastore_destroy(struct sr_datastore *ds)
|
||||||
{
|
{
|
||||||
GSList *chunk;
|
GSList *chunk;
|
||||||
|
|
||||||
|
@ -129,8 +129,8 @@ int sr_datastore_destroy(struct sr_datastore *ds)
|
||||||
* or SR_ERR_ARG upon invalid arguments. If something other than SR_OK
|
* or SR_ERR_ARG upon invalid arguments. If something other than SR_OK
|
||||||
* is returned, the value/state of 'ds' is undefined.
|
* is returned, the value/state of 'ds' is undefined.
|
||||||
*/
|
*/
|
||||||
int sr_datastore_put(struct sr_datastore *ds, void *data, unsigned int length,
|
SR_API int sr_datastore_put(struct sr_datastore *ds, void *data,
|
||||||
int in_unitsize, int *probelist)
|
unsigned int length, int in_unitsize, int *probelist)
|
||||||
{
|
{
|
||||||
unsigned int stored;
|
unsigned int stored;
|
||||||
int capacity, size, num_chunks, chunk_bytes_free, chunk_offset;
|
int capacity, size, num_chunks, chunk_bytes_free, chunk_offset;
|
||||||
|
|
22
device.c
22
device.c
|
@ -57,7 +57,7 @@ static GSList *devices = NULL;
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, SR_ERR upon errors.
|
* @return SR_OK upon success, SR_ERR upon errors.
|
||||||
*/
|
*/
|
||||||
int sr_device_scan(void)
|
SR_API int sr_device_scan(void)
|
||||||
{
|
{
|
||||||
GSList *plugins, *l;
|
GSList *plugins, *l;
|
||||||
struct sr_device_plugin *plugin;
|
struct sr_device_plugin *plugin;
|
||||||
|
@ -91,7 +91,7 @@ int sr_device_scan(void)
|
||||||
*
|
*
|
||||||
* @return The list (GSList) of detected devices, or NULL if none were found.
|
* @return The list (GSList) of detected devices, or NULL if none were found.
|
||||||
*/
|
*/
|
||||||
GSList *sr_device_list(void)
|
SR_API GSList *sr_device_list(void)
|
||||||
{
|
{
|
||||||
if (!devices)
|
if (!devices)
|
||||||
sr_device_scan();
|
sr_device_scan();
|
||||||
|
@ -119,7 +119,7 @@ GSList *sr_device_list(void)
|
||||||
*
|
*
|
||||||
* @return Pointer to the newly allocated device, or NULL upon errors.
|
* @return Pointer to the newly allocated device, or NULL upon errors.
|
||||||
*/
|
*/
|
||||||
struct sr_device *sr_device_new(const struct sr_device_plugin *plugin,
|
SR_API struct sr_device *sr_device_new(const struct sr_device_plugin *plugin,
|
||||||
int plugin_index)
|
int plugin_index)
|
||||||
{
|
{
|
||||||
struct sr_device *device;
|
struct sr_device *device;
|
||||||
|
@ -156,7 +156,7 @@ struct sr_device *sr_device_new(const struct sr_device_plugin *plugin,
|
||||||
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
|
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
|
||||||
* If something other than SR_OK is returned, 'device' is unchanged.
|
* If something other than SR_OK is returned, 'device' is unchanged.
|
||||||
*/
|
*/
|
||||||
int sr_device_clear(struct sr_device *device)
|
SR_API int sr_device_clear(struct sr_device *device)
|
||||||
{
|
{
|
||||||
unsigned int pnum;
|
unsigned int pnum;
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ int sr_device_clear(struct sr_device *device)
|
||||||
* upon other errors.
|
* upon other errors.
|
||||||
* If something other than SR_OK is returned, 'device' is unchanged.
|
* If something other than SR_OK is returned, 'device' is unchanged.
|
||||||
*/
|
*/
|
||||||
int sr_device_probe_clear(struct sr_device *device, int probenum)
|
SR_API int sr_device_probe_clear(struct sr_device *device, int probenum)
|
||||||
{
|
{
|
||||||
struct sr_probe *p;
|
struct sr_probe *p;
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ int sr_device_probe_clear(struct sr_device *device, int probenum)
|
||||||
* or SR_ERR_ARG upon invalid arguments.
|
* or SR_ERR_ARG upon invalid arguments.
|
||||||
* If something other than SR_OK is returned, 'device' is unchanged.
|
* If something other than SR_OK is returned, 'device' is unchanged.
|
||||||
*/
|
*/
|
||||||
int sr_device_probe_add(struct sr_device *device, const char *name)
|
SR_API int sr_device_probe_add(struct sr_device *device, const char *name)
|
||||||
{
|
{
|
||||||
struct sr_probe *p;
|
struct sr_probe *p;
|
||||||
int probenum;
|
int probenum;
|
||||||
|
@ -285,7 +285,7 @@ int sr_device_probe_add(struct sr_device *device, const char *name)
|
||||||
* @return A pointer to the requested probe's 'struct sr_probe', or NULL
|
* @return A pointer to the requested probe's 'struct sr_probe', or NULL
|
||||||
* if the probe could not be found.
|
* if the probe could not be found.
|
||||||
*/
|
*/
|
||||||
struct sr_probe *sr_device_probe_find(const struct sr_device *device,
|
SR_API struct sr_probe *sr_device_probe_find(const struct sr_device *device,
|
||||||
int probenum)
|
int probenum)
|
||||||
{
|
{
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
@ -328,7 +328,7 @@ struct sr_probe *sr_device_probe_find(const struct sr_device *device,
|
||||||
* upon other errors.
|
* upon other errors.
|
||||||
* If something other than SR_OK is returned, 'device' is unchanged.
|
* If something other than SR_OK is returned, 'device' is unchanged.
|
||||||
*/
|
*/
|
||||||
int sr_device_probe_name(struct sr_device *device, int probenum,
|
SR_API int sr_device_probe_name(struct sr_device *device, int probenum,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
struct sr_probe *p;
|
struct sr_probe *p;
|
||||||
|
@ -364,7 +364,7 @@ int sr_device_probe_name(struct sr_device *device, int probenum,
|
||||||
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
|
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
|
||||||
* If something other than SR_OK is returned, 'device' is unchanged.
|
* If something other than SR_OK is returned, 'device' is unchanged.
|
||||||
*/
|
*/
|
||||||
int sr_device_trigger_clear(struct sr_device *device)
|
SR_API int sr_device_trigger_clear(struct sr_device *device)
|
||||||
{
|
{
|
||||||
struct sr_probe *p;
|
struct sr_probe *p;
|
||||||
unsigned int pnum; /* TODO: uint16_t? */
|
unsigned int pnum; /* TODO: uint16_t? */
|
||||||
|
@ -407,7 +407,7 @@ int sr_device_trigger_clear(struct sr_device *device)
|
||||||
* upon other errors.
|
* upon other errors.
|
||||||
* If something other than SR_OK is returned, 'device' is unchanged.
|
* If something other than SR_OK is returned, 'device' is unchanged.
|
||||||
*/
|
*/
|
||||||
int sr_device_trigger_set(struct sr_device *device, int probenum,
|
SR_API int sr_device_trigger_set(struct sr_device *device, int probenum,
|
||||||
const char *trigger)
|
const char *trigger)
|
||||||
{
|
{
|
||||||
struct sr_probe *p;
|
struct sr_probe *p;
|
||||||
|
@ -449,7 +449,7 @@ int sr_device_trigger_set(struct sr_device *device, int probenum,
|
||||||
* FALSE is also returned upon invalid input parameters or other
|
* FALSE is also returned upon invalid input parameters or other
|
||||||
* error conditions.
|
* error conditions.
|
||||||
*/
|
*/
|
||||||
gboolean sr_device_has_hwcap(const struct sr_device *device, int hwcap)
|
SR_API gboolean sr_device_has_hwcap(const struct sr_device *device, int hwcap)
|
||||||
{
|
{
|
||||||
int *capabilities, i;
|
int *capabilities, i;
|
||||||
|
|
||||||
|
|
7
filter.c
7
filter.c
|
@ -73,9 +73,10 @@
|
||||||
* If something other than SR_OK is returned, the values of
|
* If something other than SR_OK is returned, the values of
|
||||||
* out_unitsize, data_out, and length_out are undefined.
|
* out_unitsize, data_out, and length_out are undefined.
|
||||||
*/
|
*/
|
||||||
int sr_filter_probes(int in_unitsize, int out_unitsize, const int *probelist,
|
SR_API int sr_filter_probes(int in_unitsize, int out_unitsize,
|
||||||
const unsigned char *data_in, uint64_t length_in,
|
const int *probelist, const unsigned char *data_in,
|
||||||
char **data_out, uint64_t *length_out)
|
uint64_t length_in, char **data_out,
|
||||||
|
uint64_t *length_out)
|
||||||
{
|
{
|
||||||
unsigned int in_offset, out_offset;
|
unsigned int in_offset, out_offset;
|
||||||
int num_enabled_probes, out_bit, i;
|
int num_enabled_probes, out_bit, i;
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
/* Note: This driver doesn't compile, analog support in sigrok is WIP. */
|
/* Note: This driver doesn't compile, analog support in sigrok is WIP. */
|
||||||
|
|
||||||
#include "config.h" /* Must come before sigrok.h */
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
* ASIX SIGMA Logic Analyzer Driver
|
* ASIX SIGMA Logic Analyzer Driver
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
#include <ftdi.h>
|
#include <ftdi.h>
|
||||||
|
|
|
@ -27,11 +27,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "config.h"
|
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
|
|
||||||
int ezusb_reset(struct libusb_device_handle *hdl, int set_clear)
|
SR_PRIV int ezusb_reset(struct libusb_device_handle *hdl, int set_clear)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
unsigned char buf[1];
|
unsigned char buf[1];
|
||||||
|
@ -46,7 +45,8 @@ int ezusb_reset(struct libusb_device_handle *hdl, int set_clear)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ezusb_install_firmware(libusb_device_handle *hdl, const char *filename)
|
SR_PRIV int ezusb_install_firmware(libusb_device_handle *hdl,
|
||||||
|
const char *filename)
|
||||||
{
|
{
|
||||||
FILE *fw;
|
FILE *fw;
|
||||||
int offset, chunksize, err, result;
|
int offset, chunksize, err, result;
|
||||||
|
@ -82,7 +82,7 @@ int ezusb_install_firmware(libusb_device_handle *hdl, const char *filename)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ezusb_upload_firmware(libusb_device *dev, int configuration,
|
SR_PRIV int ezusb_upload_firmware(libusb_device *dev, int configuration,
|
||||||
const char *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
struct libusb_device_handle *hdl;
|
struct libusb_device_handle *hdl;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
static HANDLE hdl;
|
static HANDLE hdl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *serial_port_glob[] = {
|
static const char *serial_port_glob[] = {
|
||||||
/* Linux */
|
/* Linux */
|
||||||
"/dev/ttyS*",
|
"/dev/ttyS*",
|
||||||
"/dev/ttyUSB*",
|
"/dev/ttyUSB*",
|
||||||
|
@ -50,7 +50,7 @@ const char *serial_port_glob[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
GSList *list_serial_ports(void)
|
SR_PRIV GSList *list_serial_ports(void)
|
||||||
{
|
{
|
||||||
GSList *ports;
|
GSList *ports;
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ GSList *list_serial_ports(void)
|
||||||
return ports;
|
return ports;
|
||||||
}
|
}
|
||||||
|
|
||||||
int serial_open(const char *pathname, int flags)
|
SR_PRIV int serial_open(const char *pathname, int flags)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* FIXME: Don't hardcode COM1. */
|
/* FIXME: Don't hardcode COM1. */
|
||||||
|
@ -94,7 +94,7 @@ int serial_open(const char *pathname, int flags)
|
||||||
* Close the serial port.
|
* Close the serial port.
|
||||||
* Returns 0 upon success, -1 upon failure.
|
* Returns 0 upon success, -1 upon failure.
|
||||||
*/
|
*/
|
||||||
int serial_close(int fd)
|
SR_PRIV int serial_close(int fd)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* Returns non-zero upon success, 0 upon failure. */
|
/* Returns non-zero upon success, 0 upon failure. */
|
||||||
|
@ -109,7 +109,7 @@ int serial_close(int fd)
|
||||||
* Flush serial port buffers (if any).
|
* Flush serial port buffers (if any).
|
||||||
* Returns 0 upon success, -1 upon failure.
|
* Returns 0 upon success, -1 upon failure.
|
||||||
*/
|
*/
|
||||||
int serial_flush(int fd)
|
SR_PRIV int serial_flush(int fd)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* Returns non-zero upon success, 0 upon failure. */
|
/* Returns non-zero upon success, 0 upon failure. */
|
||||||
|
@ -124,7 +124,7 @@ int serial_flush(int fd)
|
||||||
* Write a number of bytes to the specified serial port.
|
* Write a number of bytes to the specified serial port.
|
||||||
* Returns the number of bytes written, or -1 upon failure.
|
* Returns the number of bytes written, or -1 upon failure.
|
||||||
*/
|
*/
|
||||||
int serial_write(int fd, const void *buf, size_t count)
|
SR_PRIV int serial_write(int fd, const void *buf, size_t count)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD tmp = 0;
|
DWORD tmp = 0;
|
||||||
|
@ -142,7 +142,7 @@ int serial_write(int fd, const void *buf, size_t count)
|
||||||
* Read a number of bytes from the specified serial port.
|
* Read a number of bytes from the specified serial port.
|
||||||
* Returns the number of bytes read, or -1 upon failure.
|
* Returns the number of bytes read, or -1 upon failure.
|
||||||
*/
|
*/
|
||||||
int serial_read(int fd, void *buf, size_t count)
|
SR_PRIV int serial_read(int fd, void *buf, size_t count)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD tmp = 0;
|
DWORD tmp = 0;
|
||||||
|
@ -156,7 +156,7 @@ int serial_read(int fd, void *buf, size_t count)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void *serial_backup_params(int fd)
|
SR_PRIV void *serial_backup_params(int fd)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
@ -175,7 +175,7 @@ void *serial_backup_params(int fd)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void serial_restore_params(int fd, void *backup)
|
SR_PRIV void serial_restore_params(int fd, void *backup)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
@ -190,8 +190,8 @@ void serial_restore_params(int fd, void *backup)
|
||||||
* flowcontrol: 1 = rts/cts, 2 = xon/xoff
|
* flowcontrol: 1 = rts/cts, 2 = xon/xoff
|
||||||
* parity: 0 = none, 1 = even, 2 = odd
|
* parity: 0 = none, 1 = even, 2 = odd
|
||||||
*/
|
*/
|
||||||
int serial_set_params(int fd, int speed, int bits, int parity, int stopbits,
|
SR_PRIV int serial_set_params(int fd, int speed, int bits, int parity,
|
||||||
int flowcontrol)
|
int stopbits, int flowcontrol)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DCB dcb;
|
DCB dcb;
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#define pipe(fds) _pipe(fds, 4096, _O_BINARY)
|
#define pipe(fds) _pipe(fds, 4096, _O_BINARY)
|
||||||
#endif
|
#endif
|
||||||
#include "config.h"
|
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
#include "config.h"
|
|
||||||
#include "link-mso19.h"
|
#include "link-mso19.h"
|
||||||
|
|
||||||
#define USB_VENDOR "3195"
|
#define USB_VENDOR "3195"
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
|
#include "config.h"
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
#include "saleae-logic.h"
|
#include "saleae-logic.h"
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
#include "gl_usb.h"
|
#include "gl_usb.h"
|
||||||
|
|
||||||
|
|
32
hwplugin.c
32
hwplugin.c
|
@ -17,7 +17,6 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -35,7 +34,7 @@ static GSList *plugins;
|
||||||
* options.
|
* options.
|
||||||
*/
|
*/
|
||||||
/* TODO: This shouldn't be a global. */
|
/* TODO: This shouldn't be a global. */
|
||||||
struct sr_hwcap_option sr_hwcap_options[] = {
|
SR_API struct sr_hwcap_option sr_hwcap_options[] = {
|
||||||
{SR_HWCAP_SAMPLERATE, SR_T_UINT64, "Sample rate", "samplerate"},
|
{SR_HWCAP_SAMPLERATE, SR_T_UINT64, "Sample rate", "samplerate"},
|
||||||
{SR_HWCAP_CAPTURE_RATIO, SR_T_UINT64, "Pre-trigger capture ratio", "captureratio"},
|
{SR_HWCAP_CAPTURE_RATIO, SR_T_UINT64, "Pre-trigger capture ratio", "captureratio"},
|
||||||
{SR_HWCAP_PATTERN_MODE, SR_T_CHAR, "Pattern generator mode", "patternmode"},
|
{SR_HWCAP_PATTERN_MODE, SR_T_CHAR, "Pattern generator mode", "patternmode"},
|
||||||
|
@ -69,7 +68,7 @@ extern struct sr_device_plugin alsa_plugin_info;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TODO: No linked list needed, this can be a simple array. */
|
/* TODO: No linked list needed, this can be a simple array. */
|
||||||
int load_hwplugins(void)
|
SR_PRIV int load_hwplugins(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LA_DEMO
|
#ifdef HAVE_LA_DEMO
|
||||||
plugins = g_slist_append(plugins, (gpointer *)&demo_plugin_info);
|
plugins = g_slist_append(plugins, (gpointer *)&demo_plugin_info);
|
||||||
|
@ -101,12 +100,12 @@ int load_hwplugins(void)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
GSList *sr_list_hwplugins(void)
|
SR_API GSList *sr_list_hwplugins(void)
|
||||||
{
|
{
|
||||||
return plugins;
|
return plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sr_init_hwplugins(struct sr_device_plugin *plugin)
|
SR_API int sr_init_hwplugins(struct sr_device_plugin *plugin)
|
||||||
{
|
{
|
||||||
int num_devices, num_probes, i, j;
|
int num_devices, num_probes, i, j;
|
||||||
int num_initialized_devices = 0;
|
int num_initialized_devices = 0;
|
||||||
|
@ -136,7 +135,7 @@ int sr_init_hwplugins(struct sr_device_plugin *plugin)
|
||||||
return num_initialized_devices;
|
return num_initialized_devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sr_cleanup_hwplugins(void)
|
SR_API void sr_cleanup_hwplugins(void)
|
||||||
{
|
{
|
||||||
struct sr_device_plugin *plugin;
|
struct sr_device_plugin *plugin;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
@ -148,7 +147,7 @@ void sr_cleanup_hwplugins(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sr_device_instance *sr_device_instance_new(int index, int status,
|
SR_API struct sr_device_instance *sr_device_instance_new(int index, int status,
|
||||||
const char *vendor, const char *model, const char *version)
|
const char *vendor, const char *model, const char *version)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
|
@ -167,8 +166,8 @@ struct sr_device_instance *sr_device_instance_new(int index, int status,
|
||||||
return sdi;
|
return sdi;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sr_device_instance *sr_get_device_instance(GSList *device_instances,
|
SR_API struct sr_device_instance *sr_get_device_instance(
|
||||||
int device_index)
|
GSList *device_instances, int device_index)
|
||||||
{
|
{
|
||||||
struct sr_device_instance *sdi;
|
struct sr_device_instance *sdi;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
@ -183,7 +182,7 @@ struct sr_device_instance *sr_get_device_instance(GSList *device_instances,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sr_device_instance_free(struct sr_device_instance *sdi)
|
SR_API void sr_device_instance_free(struct sr_device_instance *sdi)
|
||||||
{
|
{
|
||||||
g_free(sdi->priv);
|
g_free(sdi->priv);
|
||||||
g_free(sdi->vendor);
|
g_free(sdi->vendor);
|
||||||
|
@ -194,7 +193,7 @@ void sr_device_instance_free(struct sr_device_instance *sdi)
|
||||||
|
|
||||||
#ifdef HAVE_LIBUSB_1_0
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
|
|
||||||
struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
|
SR_PRIV struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
|
||||||
uint8_t address, struct libusb_device_handle *hdl)
|
uint8_t address, struct libusb_device_handle *hdl)
|
||||||
{
|
{
|
||||||
struct sr_usb_device_instance *udi;
|
struct sr_usb_device_instance *udi;
|
||||||
|
@ -209,7 +208,7 @@ struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
|
||||||
return udi;
|
return udi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sr_usb_device_instance_free(struct sr_usb_device_instance *usb)
|
SR_PRIV void sr_usb_device_instance_free(struct sr_usb_device_instance *usb)
|
||||||
{
|
{
|
||||||
/* Avoid compiler warnings. */
|
/* Avoid compiler warnings. */
|
||||||
(void)usb;
|
(void)usb;
|
||||||
|
@ -219,7 +218,7 @@ void sr_usb_device_instance_free(struct sr_usb_device_instance *usb)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct sr_serial_device_instance *sr_serial_device_instance_new(
|
SR_PRIV struct sr_serial_device_instance *sr_serial_device_instance_new(
|
||||||
const char *port, int fd)
|
const char *port, int fd)
|
||||||
{
|
{
|
||||||
struct sr_serial_device_instance *serial;
|
struct sr_serial_device_instance *serial;
|
||||||
|
@ -233,12 +232,13 @@ struct sr_serial_device_instance *sr_serial_device_instance_new(
|
||||||
return serial;
|
return serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sr_serial_device_instance_free(struct sr_serial_device_instance *serial)
|
SR_PRIV void sr_serial_device_instance_free(
|
||||||
|
struct sr_serial_device_instance *serial)
|
||||||
{
|
{
|
||||||
free(serial->port);
|
free(serial->port);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sr_find_hwcap(int *capabilities, int hwcap)
|
SR_API int sr_find_hwcap(int *capabilities, int hwcap)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ int sr_find_hwcap(int *capabilities, int hwcap)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sr_hwcap_option *sr_find_hwcap_option(int hwcap)
|
SR_API struct sr_hwcap_option *sr_find_hwcap_option(int hwcap)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
|
#include "sigrok-internal.h"
|
||||||
|
|
||||||
extern struct sr_input_format input_chronovu_la8;
|
extern struct sr_input_format input_chronovu_la8;
|
||||||
extern struct sr_input_format input_binary;
|
extern struct sr_input_format input_binary;
|
||||||
|
@ -29,7 +30,7 @@ static struct sr_input_format *input_module_list[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sr_input_format **sr_input_list(void)
|
SR_API struct sr_input_format **sr_input_list(void)
|
||||||
{
|
{
|
||||||
return input_module_list;
|
return input_module_list;
|
||||||
}
|
}
|
||||||
|
|
16
log.c
16
log.c
|
@ -35,7 +35,7 @@ static int sr_loglevel = SR_LOG_WARN; /* Show errors+warnings per default. */
|
||||||
* SR_LOG_INFO, SR_LOG_DBG, or SR_LOG_SPEW).
|
* SR_LOG_INFO, SR_LOG_DBG, or SR_LOG_SPEW).
|
||||||
* @return SR_OK upon success, SR_ERR_ARG upon invalid loglevel.
|
* @return SR_OK upon success, SR_ERR_ARG upon invalid loglevel.
|
||||||
*/
|
*/
|
||||||
int sr_set_loglevel(int loglevel)
|
SR_API int sr_set_loglevel(int loglevel)
|
||||||
{
|
{
|
||||||
if (loglevel < SR_LOG_NONE || loglevel > SR_LOG_SPEW) {
|
if (loglevel < SR_LOG_NONE || loglevel > SR_LOG_SPEW) {
|
||||||
sr_err("log: %s: invalid loglevel %d", __func__, loglevel);
|
sr_err("log: %s: invalid loglevel %d", __func__, loglevel);
|
||||||
|
@ -54,7 +54,7 @@ int sr_set_loglevel(int loglevel)
|
||||||
*
|
*
|
||||||
* @return The currently configured libsigrok loglevel.
|
* @return The currently configured libsigrok loglevel.
|
||||||
*/
|
*/
|
||||||
int sr_get_loglevel(void)
|
SR_API int sr_get_loglevel(void)
|
||||||
{
|
{
|
||||||
return sr_loglevel;
|
return sr_loglevel;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ static int sr_logv(int loglevel, const char *format, va_list args)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sr_log(int loglevel, const char *format, ...)
|
SR_PRIV int sr_log(int loglevel, const char *format, ...)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
@ -85,7 +85,7 @@ int sr_log(int loglevel, const char *format, ...)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sr_spew(const char *format, ...)
|
SR_PRIV int sr_spew(const char *format, ...)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
@ -97,7 +97,7 @@ int sr_spew(const char *format, ...)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sr_dbg(const char *format, ...)
|
SR_PRIV int sr_dbg(const char *format, ...)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
@ -109,7 +109,7 @@ int sr_dbg(const char *format, ...)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sr_info(const char *format, ...)
|
SR_PRIV int sr_info(const char *format, ...)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
@ -121,7 +121,7 @@ int sr_info(const char *format, ...)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sr_warn(const char *format, ...)
|
SR_PRIV int sr_warn(const char *format, ...)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
@ -133,7 +133,7 @@ int sr_warn(const char *format, ...)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sr_err(const char *format, ...)
|
SR_PRIV int sr_err(const char *format, ...)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#define DEFAULT_BPL_BITS 64
|
#define DEFAULT_BPL_BITS 64
|
||||||
#define DEFAULT_BPL_HEX 192
|
#define DEFAULT_BPL_HEX 192
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
||||||
char **data_out, uint64_t *length_out)
|
char **data_out, uint64_t *length_out)
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include "config.h"
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
struct context {
|
struct context {
|
||||||
unsigned int num_enabled_probes;
|
unsigned int num_enabled_probes;
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include "config.h"
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
struct context {
|
struct context {
|
||||||
unsigned int num_enabled_probes;
|
unsigned int num_enabled_probes;
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
struct context {
|
struct context {
|
||||||
GString *header;
|
GString *header;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
|
#include "sigrok-internal.h"
|
||||||
|
|
||||||
extern struct sr_output_format output_text_bits;
|
extern struct sr_output_format output_text_bits;
|
||||||
extern struct sr_output_format output_text_hex;
|
extern struct sr_output_format output_text_hex;
|
||||||
|
@ -46,7 +47,7 @@ static struct sr_output_format *output_module_list[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sr_output_format **sr_output_list(void)
|
SR_API struct sr_output_format **sr_output_list(void)
|
||||||
{
|
{
|
||||||
return output_module_list;
|
return output_module_list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include "sigrok.h"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "sigrok.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
|
||||||
void flush_linebufs(struct context *ctx, char *outbuf)
|
void flush_linebufs(struct context *ctx, char *outbuf)
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include "config.h"
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
struct context {
|
struct context {
|
||||||
int num_enabled_probes;
|
int num_enabled_probes;
|
||||||
|
|
28
session.c
28
session.c
|
@ -17,7 +17,6 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -56,7 +55,7 @@ static int source_timeout = -1;
|
||||||
*
|
*
|
||||||
* @return A pointer to the newly allocated session, or NULL upon errors.
|
* @return A pointer to the newly allocated session, or NULL upon errors.
|
||||||
*/
|
*/
|
||||||
struct sr_session *sr_session_new(void)
|
SR_API struct sr_session *sr_session_new(void)
|
||||||
{
|
{
|
||||||
if (!(session = calloc(1, sizeof(struct sr_session)))) {
|
if (!(session = calloc(1, sizeof(struct sr_session)))) {
|
||||||
sr_err("session: %s: session malloc failed", __func__);
|
sr_err("session: %s: session malloc failed", __func__);
|
||||||
|
@ -73,7 +72,7 @@ struct sr_session *sr_session_new(void)
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
||||||
*/
|
*/
|
||||||
int sr_session_destroy(void)
|
SR_API int sr_session_destroy(void)
|
||||||
{
|
{
|
||||||
if (!session) {
|
if (!session) {
|
||||||
sr_warn("session: %s: session was NULL", __func__);
|
sr_warn("session: %s: session was NULL", __func__);
|
||||||
|
@ -101,7 +100,7 @@ int sr_session_destroy(void)
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
||||||
*/
|
*/
|
||||||
int sr_session_device_clear(void)
|
SR_API int sr_session_device_clear(void)
|
||||||
{
|
{
|
||||||
if (!session) {
|
if (!session) {
|
||||||
sr_warn("session: %s: session was NULL", __func__);
|
sr_warn("session: %s: session was NULL", __func__);
|
||||||
|
@ -123,7 +122,7 @@ int sr_session_device_clear(void)
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
|
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
|
||||||
*/
|
*/
|
||||||
int sr_session_device_add(struct sr_device *device)
|
SR_API int sr_session_device_add(struct sr_device *device)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -165,7 +164,7 @@ int sr_session_device_add(struct sr_device *device)
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
||||||
*/
|
*/
|
||||||
int sr_session_datafeed_callback_clear(void)
|
SR_API int sr_session_datafeed_callback_clear(void)
|
||||||
{
|
{
|
||||||
if (!session) {
|
if (!session) {
|
||||||
sr_err("session: %s: session was NULL", __func__);
|
sr_err("session: %s: session was NULL", __func__);
|
||||||
|
@ -184,7 +183,7 @@ int sr_session_datafeed_callback_clear(void)
|
||||||
* @param callback TODO.
|
* @param callback TODO.
|
||||||
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
||||||
*/
|
*/
|
||||||
int sr_session_datafeed_callback_add(sr_datafeed_callback callback)
|
SR_API int sr_session_datafeed_callback_add(sr_datafeed_callback callback)
|
||||||
{
|
{
|
||||||
if (!session) {
|
if (!session) {
|
||||||
sr_err("session: %s: session was NULL", __func__);
|
sr_err("session: %s: session was NULL", __func__);
|
||||||
|
@ -258,7 +257,7 @@ static int sr_session_run_poll(void)
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, SR_ERR upon errors.
|
* @return SR_OK upon success, SR_ERR upon errors.
|
||||||
*/
|
*/
|
||||||
int sr_session_start(void)
|
SR_API int sr_session_start(void)
|
||||||
{
|
{
|
||||||
struct sr_device *device;
|
struct sr_device *device;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
@ -304,7 +303,7 @@ int sr_session_start(void)
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, SR_ERR_BUG upon errors.
|
* @return SR_OK upon success, SR_ERR_BUG upon errors.
|
||||||
*/
|
*/
|
||||||
int sr_session_run(void)
|
SR_API int sr_session_run(void)
|
||||||
{
|
{
|
||||||
if (!session) {
|
if (!session) {
|
||||||
sr_err("session: %s: session was NULL; a session must be "
|
sr_err("session: %s: session was NULL; a session must be "
|
||||||
|
@ -342,7 +341,7 @@ int sr_session_run(void)
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
||||||
*/
|
*/
|
||||||
int sr_session_halt(void)
|
SR_API int sr_session_halt(void)
|
||||||
{
|
{
|
||||||
if (!session) {
|
if (!session) {
|
||||||
sr_err("session: %s: session was NULL", __func__);
|
sr_err("session: %s: session was NULL", __func__);
|
||||||
|
@ -362,7 +361,7 @@ int sr_session_halt(void)
|
||||||
*
|
*
|
||||||
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
|
||||||
*/
|
*/
|
||||||
int sr_session_stop(void)
|
SR_API int sr_session_stop(void)
|
||||||
{
|
{
|
||||||
struct sr_device *device;
|
struct sr_device *device;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
@ -439,7 +438,8 @@ static int datafeed_dump(struct sr_datafeed_packet *packet)
|
||||||
* @param packet TODO.
|
* @param packet TODO.
|
||||||
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
|
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
|
||||||
*/
|
*/
|
||||||
int sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
|
SR_API int sr_session_bus(struct sr_device *device,
|
||||||
|
struct sr_datafeed_packet *packet)
|
||||||
{
|
{
|
||||||
GSList *l;
|
GSList *l;
|
||||||
sr_datafeed_callback cb;
|
sr_datafeed_callback cb;
|
||||||
|
@ -487,7 +487,7 @@ int sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
|
||||||
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or
|
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or
|
||||||
* SR_ERR_MALLOC upon memory allocation errors.
|
* SR_ERR_MALLOC upon memory allocation errors.
|
||||||
*/
|
*/
|
||||||
int sr_session_source_add(int fd, int events, int timeout,
|
SR_API int sr_session_source_add(int fd, int events, int timeout,
|
||||||
sr_receive_data_callback callback, void *user_data)
|
sr_receive_data_callback callback, void *user_data)
|
||||||
{
|
{
|
||||||
struct source *new_sources, *s;
|
struct source *new_sources, *s;
|
||||||
|
@ -537,7 +537,7 @@ int sr_session_source_add(int fd, int events, int timeout,
|
||||||
* SR_ERR_MALLOC upon memory allocation errors, SR_ERR_BUG upon
|
* SR_ERR_MALLOC upon memory allocation errors, SR_ERR_BUG upon
|
||||||
* internal errors.
|
* internal errors.
|
||||||
*/
|
*/
|
||||||
int sr_session_source_remove(int fd)
|
SR_API int sr_session_source_remove(int fd)
|
||||||
{
|
{
|
||||||
struct source *new_sources;
|
struct source *new_sources;
|
||||||
int old, new;
|
int old, new;
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <zip.h>
|
#include <zip.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
|
#include "config.h"
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ extern struct sr_device_plugin session_driver;
|
||||||
* SR_ERR_MALLOC upon memory allocation errors, or SR_ERR upon
|
* SR_ERR_MALLOC upon memory allocation errors, or SR_ERR upon
|
||||||
* other errors.
|
* other errors.
|
||||||
*/
|
*/
|
||||||
int sr_session_load(const char *filename)
|
SR_API int sr_session_load(const char *filename)
|
||||||
{
|
{
|
||||||
GKeyFile *kf;
|
GKeyFile *kf;
|
||||||
GPtrArray *capturefiles;
|
GPtrArray *capturefiles;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */
|
||||||
#ifdef HAVE_LIBUSB_1_0
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,7 +42,7 @@
|
||||||
|
|
||||||
/*--- hwplugin.c ------------------------------------------------------------*/
|
/*--- hwplugin.c ------------------------------------------------------------*/
|
||||||
|
|
||||||
int load_hwplugins(void);
|
SR_PRIV int load_hwplugins(void);
|
||||||
|
|
||||||
#ifdef HAVE_LIBUSB_1_0
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
struct sr_usb_device_instance {
|
struct sr_usb_device_instance {
|
||||||
|
@ -58,54 +59,56 @@ struct sr_serial_device_instance {
|
||||||
|
|
||||||
#ifdef HAVE_LIBUSB_1_0
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
/* USB-specific instances */
|
/* USB-specific instances */
|
||||||
struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
|
SR_PRIV struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
|
||||||
uint8_t address, struct libusb_device_handle *hdl);
|
uint8_t address, struct libusb_device_handle *hdl);
|
||||||
void sr_usb_device_instance_free(struct sr_usb_device_instance *usb);
|
SR_PRIV void sr_usb_device_instance_free(struct sr_usb_device_instance *usb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Serial-specific instances */
|
/* Serial-specific instances */
|
||||||
struct sr_serial_device_instance *sr_serial_device_instance_new(
|
SR_PRIV struct sr_serial_device_instance *sr_serial_device_instance_new(
|
||||||
const char *port, int fd);
|
const char *port, int fd);
|
||||||
void sr_serial_device_instance_free(struct sr_serial_device_instance *serial);
|
SR_PRIV void sr_serial_device_instance_free(
|
||||||
|
struct sr_serial_device_instance *serial);
|
||||||
|
|
||||||
/*--- log.c -----------------------------------------------------------------*/
|
/*--- log.c -----------------------------------------------------------------*/
|
||||||
|
|
||||||
int sr_log(int loglevel, const char *format, ...);
|
SR_PRIV int sr_log(int loglevel, const char *format, ...);
|
||||||
int sr_spew(const char *format, ...);
|
SR_PRIV int sr_spew(const char *format, ...);
|
||||||
int sr_dbg(const char *format, ...);
|
SR_PRIV int sr_dbg(const char *format, ...);
|
||||||
int sr_info(const char *format, ...);
|
SR_PRIV int sr_info(const char *format, ...);
|
||||||
int sr_warn(const char *format, ...);
|
SR_PRIV int sr_warn(const char *format, ...);
|
||||||
int sr_err(const char *format, ...);
|
SR_PRIV int sr_err(const char *format, ...);
|
||||||
|
|
||||||
/*--- hardware/common/serial.c ----------------------------------------------*/
|
/*--- hardware/common/serial.c ----------------------------------------------*/
|
||||||
|
|
||||||
GSList *list_serial_ports(void);
|
SR_PRIV GSList *list_serial_ports(void);
|
||||||
int serial_open(const char *pathname, int flags);
|
SR_PRIV int serial_open(const char *pathname, int flags);
|
||||||
int serial_close(int fd);
|
SR_PRIV int serial_close(int fd);
|
||||||
int serial_flush(int fd);
|
SR_PRIV int serial_flush(int fd);
|
||||||
int serial_write(int fd, const void *buf, size_t count);
|
SR_PRIV int serial_write(int fd, const void *buf, size_t count);
|
||||||
int serial_read(int fd, void *buf, size_t count);
|
SR_PRIV int serial_read(int fd, void *buf, size_t count);
|
||||||
void *serial_backup_params(int fd);
|
SR_PRIV void *serial_backup_params(int fd);
|
||||||
void serial_restore_params(int fd, void *backup);
|
SR_PRIV void serial_restore_params(int fd, void *backup);
|
||||||
int serial_set_params(int fd, int speed, int bits, int parity, int stopbits,
|
SR_PRIV int serial_set_params(int fd, int speed, int bits, int parity,
|
||||||
int flowcontrol);
|
int stopbits, int flowcontrol);
|
||||||
|
|
||||||
/*--- hardware/common/ezusb.c -----------------------------------------------*/
|
/*--- hardware/common/ezusb.c -----------------------------------------------*/
|
||||||
|
|
||||||
#ifdef HAVE_LIBUSB_1_0
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
int ezusb_reset(struct libusb_device_handle *hdl, int set_clear);
|
SR_PRIV int ezusb_reset(struct libusb_device_handle *hdl, int set_clear);
|
||||||
int ezusb_install_firmware(libusb_device_handle *hdl, const char *filename);
|
SR_PRIV int ezusb_install_firmware(libusb_device_handle *hdl,
|
||||||
int ezusb_upload_firmware(libusb_device *dev, int configuration,
|
const char *filename);
|
||||||
|
SR_PRIV int ezusb_upload_firmware(libusb_device *dev, int configuration,
|
||||||
const char *filename);
|
const char *filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--- hardware/common/misc.c ------------------------------------------------*/
|
/*--- hardware/common/misc.c ------------------------------------------------*/
|
||||||
|
|
||||||
#ifdef HAVE_LIBUSB_1_0
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
int opendev2(int device_index, struct sr_device_instance **sdi,
|
SR_PRIV int opendev2(int device_index, struct sr_device_instance **sdi,
|
||||||
libusb_device *dev, struct libusb_device_descriptor *des,
|
libusb_device *dev, struct libusb_device_descriptor *des,
|
||||||
int *skip, uint16_t vid, uint16_t pid, int interface);
|
int *skip, uint16_t vid, uint16_t pid, int interface);
|
||||||
int opendev3(struct sr_device_instance **sdi, libusb_device *dev,
|
SR_PRIV int opendev3(struct sr_device_instance **sdi, libusb_device *dev,
|
||||||
struct libusb_device_descriptor *des,
|
struct libusb_device_descriptor *des,
|
||||||
uint16_t vid, uint16_t pid, int interface);
|
uint16_t vid, uint16_t pid, int interface);
|
||||||
#endif
|
#endif
|
||||||
|
|
117
sigrok-proto.h
117
sigrok-proto.h
|
@ -22,64 +22,66 @@
|
||||||
|
|
||||||
/*--- backend.c -------------------------------------------------------------*/
|
/*--- backend.c -------------------------------------------------------------*/
|
||||||
|
|
||||||
int sr_init(void);
|
SR_API int sr_init(void);
|
||||||
int sr_exit(void);
|
SR_API int sr_exit(void);
|
||||||
|
|
||||||
/*--- log.c -----------------------------------------------------------------*/
|
/*--- log.c -----------------------------------------------------------------*/
|
||||||
|
|
||||||
int sr_set_loglevel(int loglevel);
|
SR_API int sr_set_loglevel(int loglevel);
|
||||||
int sr_get_loglevel(void);
|
SR_API int sr_get_loglevel(void);
|
||||||
|
|
||||||
/*--- datastore.c -----------------------------------------------------------*/
|
/*--- datastore.c -----------------------------------------------------------*/
|
||||||
|
|
||||||
int sr_datastore_new(int unitsize, struct sr_datastore **ds);
|
SR_API int sr_datastore_new(int unitsize, struct sr_datastore **ds);
|
||||||
int sr_datastore_destroy(struct sr_datastore *ds);
|
SR_API int sr_datastore_destroy(struct sr_datastore *ds);
|
||||||
int sr_datastore_put(struct sr_datastore *ds, void *data, unsigned int length,
|
SR_API int sr_datastore_put(struct sr_datastore *ds, void *data,
|
||||||
int in_unitsize, int *probelist);
|
unsigned int length, int in_unitsize,
|
||||||
|
int *probelist);
|
||||||
|
|
||||||
/*--- device.c --------------------------------------------------------------*/
|
/*--- device.c --------------------------------------------------------------*/
|
||||||
|
|
||||||
int sr_device_scan(void);
|
SR_API int sr_device_scan(void);
|
||||||
GSList *sr_device_list(void);
|
SR_API GSList *sr_device_list(void);
|
||||||
struct sr_device *sr_device_new(const struct sr_device_plugin *plugin,
|
SR_API struct sr_device *sr_device_new(const struct sr_device_plugin *plugin,
|
||||||
int plugin_index);
|
int plugin_index);
|
||||||
int sr_device_clear(struct sr_device *device);
|
SR_API int sr_device_clear(struct sr_device *device);
|
||||||
int sr_device_probe_clear(struct sr_device *device, int probenum);
|
SR_API int sr_device_probe_clear(struct sr_device *device, int probenum);
|
||||||
int sr_device_probe_add(struct sr_device *device, const char *name);
|
SR_API int sr_device_probe_add(struct sr_device *device, const char *name);
|
||||||
struct sr_probe *sr_device_probe_find(const struct sr_device *device,
|
SR_API struct sr_probe *sr_device_probe_find(const struct sr_device *device,
|
||||||
int probenum);
|
int probenum);
|
||||||
int sr_device_probe_name(struct sr_device *device, int probenum,
|
SR_API int sr_device_probe_name(struct sr_device *device, int probenum,
|
||||||
const char *name);
|
const char *name);
|
||||||
int sr_device_trigger_clear(struct sr_device *device);
|
SR_API int sr_device_trigger_clear(struct sr_device *device);
|
||||||
int sr_device_trigger_set(struct sr_device *device, int probenum,
|
SR_API int sr_device_trigger_set(struct sr_device *device, int probenum,
|
||||||
const char *trigger);
|
const char *trigger);
|
||||||
gboolean sr_device_has_hwcap(const struct sr_device *device, int hwcap);
|
SR_API gboolean sr_device_has_hwcap(const struct sr_device *device, int hwcap);
|
||||||
int sr_device_get_info(const struct sr_device *device, int id,
|
SR_API int sr_device_get_info(const struct sr_device *device, int id,
|
||||||
const void **data);
|
const void **data);
|
||||||
|
|
||||||
/*--- filter.c --------------------------------------------------------------*/
|
/*--- filter.c --------------------------------------------------------------*/
|
||||||
|
|
||||||
int sr_filter_probes(int in_unitsize, int out_unitsize, const int *probelist,
|
SR_API int sr_filter_probes(int in_unitsize, int out_unitsize,
|
||||||
const unsigned char *data_in, uint64_t length_in,
|
const int *probelist, const unsigned char *data_in,
|
||||||
char **data_out, uint64_t *length_out);
|
uint64_t length_in, char **data_out,
|
||||||
|
uint64_t *length_out);
|
||||||
|
|
||||||
/*--- hwplugin.c ------------------------------------------------------------*/
|
/*--- hwplugin.c ------------------------------------------------------------*/
|
||||||
|
|
||||||
GSList *sr_list_hwplugins(void);
|
SR_API GSList *sr_list_hwplugins(void);
|
||||||
int sr_init_hwplugins(struct sr_device_plugin *plugin);
|
SR_API int sr_init_hwplugins(struct sr_device_plugin *plugin);
|
||||||
void sr_cleanup_hwplugins(void);
|
SR_API void sr_cleanup_hwplugins(void);
|
||||||
|
|
||||||
/* Generic device instances */
|
/* Generic device instances */
|
||||||
struct sr_device_instance *sr_device_instance_new(int index,
|
SR_API struct sr_device_instance *sr_device_instance_new(int index,
|
||||||
int status, const char *vendor, const char *model, const char *version);
|
int status, const char *vendor, const char *model, const char *version);
|
||||||
struct sr_device_instance *sr_get_device_instance(GSList *device_instances,
|
SR_API struct sr_device_instance *sr_get_device_instance(
|
||||||
int device_index);
|
GSList *device_instances, int device_index);
|
||||||
void sr_device_instance_free(struct sr_device_instance *sdi);
|
SR_API void sr_device_instance_free(struct sr_device_instance *sdi);
|
||||||
|
|
||||||
int sr_find_hwcap(int *capabilities, int hwcap);
|
SR_API int sr_find_hwcap(int *capabilities, int hwcap);
|
||||||
struct sr_hwcap_option *sr_find_hwcap_option(int hwcap);
|
SR_API struct sr_hwcap_option *sr_find_hwcap_option(int hwcap);
|
||||||
void sr_source_remove(int fd);
|
SR_API void sr_source_remove(int fd);
|
||||||
void sr_source_add(int fd, int events, int timeout,
|
SR_API void sr_source_add(int fd, int events, int timeout,
|
||||||
sr_receive_data_callback rcv_cb, void *user_data);
|
sr_receive_data_callback rcv_cb, void *user_data);
|
||||||
|
|
||||||
/*--- session.c -------------------------------------------------------------*/
|
/*--- session.c -------------------------------------------------------------*/
|
||||||
|
@ -88,43 +90,44 @@ typedef void (*sr_datafeed_callback) (struct sr_device *device,
|
||||||
struct sr_datafeed_packet *packet);
|
struct sr_datafeed_packet *packet);
|
||||||
|
|
||||||
/* Session setup */
|
/* Session setup */
|
||||||
int sr_session_load(const char *filename);
|
SR_API int sr_session_load(const char *filename);
|
||||||
struct sr_session *sr_session_new(void);
|
SR_API struct sr_session *sr_session_new(void);
|
||||||
int sr_session_destroy(void);
|
SR_API int sr_session_destroy(void);
|
||||||
int sr_session_device_clear(void);
|
SR_API int sr_session_device_clear(void);
|
||||||
int sr_session_device_add(struct sr_device *device);
|
SR_API int sr_session_device_add(struct sr_device *device);
|
||||||
|
|
||||||
/* Datafeed setup */
|
/* Datafeed setup */
|
||||||
int sr_session_datafeed_callback_clear(void);
|
SR_API int sr_session_datafeed_callback_clear(void);
|
||||||
int sr_session_datafeed_callback_add(sr_datafeed_callback callback);
|
SR_API int sr_session_datafeed_callback_add(sr_datafeed_callback callback);
|
||||||
|
|
||||||
/* Session control */
|
/* Session control */
|
||||||
int sr_session_start(void);
|
SR_API int sr_session_start(void);
|
||||||
int sr_session_run(void);
|
SR_API int sr_session_run(void);
|
||||||
int sr_session_halt(void);
|
SR_API int sr_session_halt(void);
|
||||||
int sr_session_stop(void);
|
SR_API int sr_session_stop(void);
|
||||||
int sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet);
|
SR_API int sr_session_bus(struct sr_device *device,
|
||||||
int sr_session_save(const char *filename);
|
struct sr_datafeed_packet *packet);
|
||||||
int sr_session_source_add(int fd, int events, int timeout,
|
SR_API int sr_session_save(const char *filename);
|
||||||
|
SR_API int sr_session_source_add(int fd, int events, int timeout,
|
||||||
sr_receive_data_callback callback, void *user_data);
|
sr_receive_data_callback callback, void *user_data);
|
||||||
int sr_session_source_remove(int fd);
|
SR_API int sr_session_source_remove(int fd);
|
||||||
|
|
||||||
/*--- input/input.c ---------------------------------------------------------*/
|
/*--- input/input.c ---------------------------------------------------------*/
|
||||||
|
|
||||||
struct sr_input_format **sr_input_list(void);
|
SR_API struct sr_input_format **sr_input_list(void);
|
||||||
|
|
||||||
/*--- output/output.c -------------------------------------------------------*/
|
/*--- output/output.c -------------------------------------------------------*/
|
||||||
|
|
||||||
struct sr_output_format **sr_output_list(void);
|
SR_API struct sr_output_format **sr_output_list(void);
|
||||||
|
|
||||||
/*--- output/common.c -------------------------------------------------------*/
|
/*--- output/common.c -------------------------------------------------------*/
|
||||||
|
|
||||||
char *sr_samplerate_string(uint64_t samplerate);
|
SR_API char *sr_samplerate_string(uint64_t samplerate);
|
||||||
char *sr_period_string(uint64_t frequency);
|
SR_API char *sr_period_string(uint64_t frequency);
|
||||||
char **sr_parse_triggerstring(struct sr_device *device,
|
SR_API char **sr_parse_triggerstring(struct sr_device *device,
|
||||||
const char *triggerstring);
|
const char *triggerstring);
|
||||||
int sr_parse_sizestring(const char *sizestring, uint64_t *size);
|
SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size);
|
||||||
uint64_t sr_parse_timestring(const char *timestring);
|
SR_API uint64_t sr_parse_timestring(const char *timestring);
|
||||||
gboolean sr_parse_boolstring(const char *boolstring);
|
SR_API gboolean sr_parse_boolstring(const char *boolstring);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
19
sigrok.h.in
19
sigrok.h.in
|
@ -73,6 +73,25 @@ extern "C" {
|
||||||
#define SR_LOG_DBG 4
|
#define SR_LOG_DBG 4
|
||||||
#define SR_LOG_SPEW 5
|
#define SR_LOG_SPEW 5
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use SR_API to mark public API symbols, and SR_PRIV for private symbols.
|
||||||
|
*
|
||||||
|
* Variables and functions marked 'static' are private already and don't
|
||||||
|
* need SR_PRIV. However, functions which are not static (because they need
|
||||||
|
* to be used in other libsigrok-internal files) but are also not meant to
|
||||||
|
* be part of the public libsigrok API, must use SR_PRIV.
|
||||||
|
*
|
||||||
|
* This uses the 'visibility' feature of gcc (requires gcc >= 4.0).
|
||||||
|
*
|
||||||
|
* Details: http://gcc.gnu.org/wiki/Visibility
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Marks public libsigrok API symbols. */
|
||||||
|
#define SR_API __attribute__((visibility("default")))
|
||||||
|
|
||||||
|
/* Marks private, non-public libsigrok symbols (not part of the API). */
|
||||||
|
#define SR_PRIV __attribute__((visibility("hidden")))
|
||||||
|
|
||||||
typedef int (*sr_receive_data_callback) (int fd, int revents, void *user_data);
|
typedef int (*sr_receive_data_callback) (int fd, int revents, void *user_data);
|
||||||
|
|
||||||
/* Data types used by hardware plugins for set_configuration() */
|
/* Data types used by hardware plugins for set_configuration() */
|
||||||
|
|
12
strutil.c
12
strutil.c
|
@ -33,7 +33,7 @@
|
||||||
* @return A malloc()ed string representation of the samplerate value,
|
* @return A malloc()ed string representation of the samplerate value,
|
||||||
* or NULL upon errors. The caller is responsible to free() the memory.
|
* or NULL upon errors. The caller is responsible to free() the memory.
|
||||||
*/
|
*/
|
||||||
char *sr_samplerate_string(uint64_t samplerate)
|
SR_API char *sr_samplerate_string(uint64_t samplerate)
|
||||||
{
|
{
|
||||||
char *o;
|
char *o;
|
||||||
int r;
|
int r;
|
||||||
|
@ -70,7 +70,7 @@ char *sr_samplerate_string(uint64_t samplerate)
|
||||||
* @return A malloc()ed string representation of the frequency value,
|
* @return A malloc()ed string representation of the frequency value,
|
||||||
* or NULL upon errors. The caller is responsible to free() the memory.
|
* or NULL upon errors. The caller is responsible to free() the memory.
|
||||||
*/
|
*/
|
||||||
char *sr_period_string(uint64_t frequency)
|
SR_API char *sr_period_string(uint64_t frequency)
|
||||||
{
|
{
|
||||||
char *o;
|
char *o;
|
||||||
int r;
|
int r;
|
||||||
|
@ -104,7 +104,7 @@ char *sr_period_string(uint64_t frequency)
|
||||||
* @param triggerstring TODO
|
* @param triggerstring TODO
|
||||||
* @return TODO
|
* @return TODO
|
||||||
*/
|
*/
|
||||||
char **sr_parse_triggerstring(struct sr_device *device,
|
SR_API char **sr_parse_triggerstring(struct sr_device *device,
|
||||||
const char *triggerstring)
|
const char *triggerstring)
|
||||||
{
|
{
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
@ -189,7 +189,7 @@ char **sr_parse_triggerstring(struct sr_device *device,
|
||||||
* @return SR_OK or error code
|
* @return SR_OK or error code
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int sr_parse_sizestring(const char *sizestring, uint64_t *size)
|
SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size)
|
||||||
{
|
{
|
||||||
int multiplier, done;
|
int multiplier, done;
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -247,7 +247,7 @@ int sr_parse_sizestring(const char *sizestring, uint64_t *size)
|
||||||
* TODO: picoseconds?
|
* TODO: picoseconds?
|
||||||
* TODO: Allow both lower-case and upper-case.
|
* TODO: Allow both lower-case and upper-case.
|
||||||
*/
|
*/
|
||||||
uint64_t sr_parse_timestring(const char *timestring)
|
SR_API uint64_t sr_parse_timestring(const char *timestring)
|
||||||
{
|
{
|
||||||
uint64_t time_msec;
|
uint64_t time_msec;
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -270,7 +270,7 @@ uint64_t sr_parse_timestring(const char *timestring)
|
||||||
return time_msec;
|
return time_msec;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean sr_parse_boolstring(const char *boolstr)
|
SR_API gboolean sr_parse_boolstring(const char *boolstr)
|
||||||
{
|
{
|
||||||
if (!boolstr)
|
if (!boolstr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in New Issue