libsigrok
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions | Variables
hwdriver.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <glib.h>
#include "sigrok.h"
#include "sigrok-internal.h"
Include dependency graph for hwdriver.c:

Go to the source code of this file.

Functions

SR_API struct sr_dev_driver ** sr_driver_list (void)
 Return the list of supported hardware drivers. More...
 
SR_API int sr_driver_init (struct sr_dev_driver *driver)
 Initialize a hardware driver. More...
 
SR_PRIV void sr_hw_cleanup_all (void)
 
SR_PRIV struct sr_dev_instsr_dev_inst_new (int index, int status, const char *vendor, const char *model, const char *version)
 
SR_PRIV struct sr_dev_instsr_dev_inst_get (GSList *dev_insts, int dev_index)
 
SR_PRIV void sr_dev_inst_free (struct sr_dev_inst *sdi)
 
SR_PRIV struct sr_usb_dev_inst * sr_usb_dev_inst_new (uint8_t bus, uint8_t address, struct libusb_device_handle *hdl)
 
SR_PRIV void sr_usb_dev_inst_free (struct sr_usb_dev_inst *usb)
 
SR_PRIV struct sr_serial_dev_inst * sr_serial_dev_inst_new (const char *port, int fd)
 
SR_PRIV void sr_serial_dev_inst_free (struct sr_serial_dev_inst *serial)
 
SR_API gboolean sr_driver_hwcap_exists (struct sr_dev_driver *driver, int hwcap)
 Find out if a hardware driver has a specific capability. More...
 
SR_API struct sr_hwcap_optionsr_hw_hwcap_get (int hwcap)
 Get a hardware driver capability option. More...
 
SR_PRIV int sr_source_remove (int fd)
 
SR_PRIV int sr_source_add (int fd, int events, int timeout, sr_receive_data_callback_t cb, void *cb_data)
 

Variables

SR_API struct sr_hwcap_option sr_hwcap_options []
 
SR_PRIV struct sr_dev_driver demo_driver_info
 
SR_PRIV struct sr_dev_driver ols_driver_info
 
SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info
 
SR_PRIV struct sr_dev_driver asix_sigma_driver_info
 
SR_PRIV struct sr_dev_driver chronovu_la8_driver_info
 
SR_PRIV struct sr_dev_driver fx2lafw_driver_info
 

Function Documentation

SR_PRIV void sr_dev_inst_free ( struct sr_dev_inst sdi)
SR_PRIV struct sr_dev_inst* sr_dev_inst_get ( GSList *  dev_insts,
int  dev_index 
)
read

Definition at line 178 of file hwdriver.c.

References sr_dev_inst::index, and sr_warn().

Here is the call graph for this function:

SR_PRIV struct sr_dev_inst* sr_dev_inst_new ( int  index,
int  status,
const char *  vendor,
const char *  model,
const char *  version 
)
read

Definition at line 157 of file hwdriver.c.

References sr_dev_inst::index, sr_dev_inst::inst_type, sr_dev_inst::model, sr_dev_inst::priv, sr_err(), sr_dev_inst::status, sr_dev_inst::vendor, and sr_dev_inst::version.

Here is the call graph for this function:

SR_API gboolean sr_driver_hwcap_exists ( struct sr_dev_driver driver,
int  hwcap 
)

Find out if a hardware driver has a specific capability.

Parameters
driverThe hardware driver in which to search for the capability.
hwcapThe capability to find in the list.
Returns
TRUE if the specified capability exists in the specified driver, FALSE otherwise. Also, if 'driver' is NULL or the respective driver returns an invalid capability list, FALSE is returned.

Definition at line 262 of file hwdriver.c.

References sr_dev_driver::hwcap_get_all, and sr_err().

Here is the call graph for this function:

SR_API int sr_driver_init ( struct sr_dev_driver driver)

Initialize a hardware driver.

The specified driver is initialized, and all devices discovered by the driver are instantiated.

Parameters
driverThe driver to initialize.
Returns
The number of devices found and instantiated by the driver.

Definition at line 115 of file hwdriver.c.

References sr_dev_driver::dev_info_get, sr_dev_driver::init, sr_dev_driver::name, sr_dbg(), sr_dev_new(), sr_dev_probe_add(), SR_DI_NUM_PROBES, SR_DI_PROBE_NAMES, and sr_warn().

Referenced by sr_dev_scan().

Here is the call graph for this function:

SR_API struct sr_dev_driver** sr_driver_list ( void  )
read

Return the list of supported hardware drivers.

Returns
Pointer to the NULL-terminated list of hardware driver pointers.

Definition at line 100 of file hwdriver.c.

Referenced by sr_dev_scan(), and sr_hw_cleanup_all().

SR_PRIV void sr_hw_cleanup_all ( void  )

Definition at line 145 of file hwdriver.c.

References sr_dev_driver::cleanup, and sr_driver_list().

Referenced by sr_exit().

Here is the call graph for this function:

SR_API struct sr_hwcap_option* sr_hw_hwcap_get ( int  hwcap)
read

Get a hardware driver capability option.

Parameters
hwcapThe capability to get.
Returns
A pointer to a struct with information about the parameter, or NULL if the capability was not found.

Definition at line 292 of file hwdriver.c.

References sr_hwcap_option::hwcap.

SR_PRIV void sr_serial_dev_inst_free ( struct sr_serial_dev_inst *  serial)

Definition at line 247 of file hwdriver.c.

SR_PRIV struct sr_serial_dev_inst* sr_serial_dev_inst_new ( const char *  port,
int  fd 
)
read

Definition at line 231 of file hwdriver.c.

References sr_err().

Here is the call graph for this function:

SR_PRIV int sr_source_add ( int  fd,
int  events,
int  timeout,
sr_receive_data_callback_t  cb,
void *  cb_data 
)

Definition at line 311 of file hwdriver.c.

References sr_session_source_add().

Here is the call graph for this function:

SR_PRIV int sr_source_remove ( int  fd)

Definition at line 306 of file hwdriver.c.

References sr_session_source_remove().

Here is the call graph for this function:

SR_PRIV void sr_usb_dev_inst_free ( struct sr_usb_dev_inst *  usb)

Definition at line 221 of file hwdriver.c.

SR_PRIV struct sr_usb_dev_inst* sr_usb_dev_inst_new ( uint8_t  bus,
uint8_t  address,
struct libusb_device_handle *  hdl 
)
read

Definition at line 204 of file hwdriver.c.

References sr_err().

Here is the call graph for this function:

Variable Documentation

SR_PRIV struct sr_dev_driver asix_sigma_driver_info

Definition at line 1430 of file asix-sigma.c.

SR_PRIV struct sr_dev_driver chronovu_la8_driver_info

Definition at line 1114 of file chronovu-la8.c.

SR_PRIV struct sr_dev_driver demo_driver_info

Definition at line 498 of file demo.c.

SR_PRIV struct sr_dev_driver fx2lafw_driver_info

Definition at line 881 of file fx2lafw.c.

SR_PRIV struct sr_dev_driver ols_driver_info

Definition at line 1042 of file ols.c.

SR_API struct sr_hwcap_option sr_hwcap_options[]
Initial value:
= {
{SR_HWCAP_SAMPLERATE, SR_T_UINT64, "Sample rate", "samplerate"},
{SR_HWCAP_CAPTURE_RATIO, SR_T_UINT64, "Pre-trigger capture ratio", "captureratio"},
{SR_HWCAP_PATTERN_MODE, SR_T_CHAR, "Pattern generator mode", "pattern"},
{SR_HWCAP_RLE, SR_T_BOOL, "Run Length Encoding", "rle"},
{0, 0, NULL, NULL},
}

Definition at line 34 of file hwdriver.c.

SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info

Definition at line 731 of file zeroplus.c.