* @return Pointer to the newly allocated device, or NULL upon errors.
*/
SR_API struct sr_device *sr_dev_new(const struct sr_device_plugin *plugin,
- int plugin_index)
+ int plugin_index)
{
struct sr_device *device;
*
* @param device Pointer to the device to be checked. Must not be NULL.
* The device's 'plugin' field must not be NULL either.
- * @param id The type of information.
- * @param data The return value. Must not be NULL.
+ * @param id The type of information.
+ * @param data The return value. Must not be NULL.
*
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or SR_ERR
* upon other errors.
return SR_OK;
}
-
}
/**
- * Returns the list of loaded hardware plugins.
+ * Return the list of loaded hardware plugins.
*
* The list of plugins is initialized from sr_init(), and can only be reset
* by calling sr_exit().
*/
SR_API GSList *sr_hw_list(void)
{
-
return plugins;
}
/**
* Find out if a hardware plugin has a specific capability.
*
- * @param capabilities A NULL-terminated integer array of capabilities, as
- * returned by a plugin's get_capabilities() function.
+ * @param plugin The hardware plugin in which to search for the capability.
* @param hwcap The capability to find in the list.
*
* @return TRUE if found, FALSE otherwise.
*
* @param hwcap The capability to get.
*
- * @return A struct with information about the parameter, or NULL
- * if not found.
+ * @return A pointer to a struct with information about the parameter, or NULL
+ * if the capability was not found.
*/
SR_API struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap)
{
* Max. value for divcount: 0xfe (2550ns sample period, 392.15kHz samplerate).
*
* @param divcount The divcount value as needed by the hardware.
+ *
* @return The samplerate in Hz, or 0xffffffffffffffff upon errors.
*/
static uint64_t divcount_to_samplerate(uint8_t divcount)
*
* @param loglevel The loglevel to set (SR_LOG_NONE, SR_LOG_ERR, SR_LOG_WARN,
* SR_LOG_INFO, SR_LOG_DBG, or SR_LOG_SPEW).
+ *
* @return SR_OK upon success, SR_ERR_ARG upon invalid loglevel.
*/
SR_API int sr_log_loglevel_set(int loglevel)
* In order to not use a logdomain, pass an empty string.
* The function makes its own copy of the input string, i.e.
* the caller does not need to keep it around.
+ *
* @return SR_OK upon success, SR_ERR_ARG upon invalid logdomain.
*/
SR_API int sr_log_logdomain_set(const char *logdomain)
* pointer is only stored or passed on by libsigrok, and
* is never used or interpreted in any way. The pointer is allowed
* to be NULL if the caller doesn't need/want to pass any data.
+ *
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
*/
SR_API int sr_log_handler_set(sr_log_handler_t handler, void *data)
* Check if the given samplerate is supported by the LA8 hardware.
*
* @param samplerate The samplerate (in Hz) to check.
+ *
* @return 1 if the samplerate is supported/valid, 0 otherwise.
*/
static int is_valid_samplerate(uint64_t samplerate)
* Max. value for divcount: 0xfe (2550ns sample period, 392.15kHz samplerate).
*
* @param samplerate The samplerate in Hz.
+ *
* @return The divcount value as needed by the hardware, or 0xff upon errors.
*/
static uint8_t samplerate_to_divcount(uint64_t samplerate)
/**
* Halt the current session.
*
- * This requests the current session be stopped as soon as possible, for example
- * on receiving an SR_DF_END packet.
+ * This requests the current session be stopped as soon as possible, for
+ * example on receiving an SR_DF_END packet.
*
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
*/
* Debug helper.
*
* @param packet The packet to show debugging information for.
- *
*/
static void datafeed_dump(struct sr_datafeed_packet *packet)
{
*
* @param device TODO.
* @param packet TODO.
+ *
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
*/
SR_PRIV int sr_session_bus(struct sr_device *device,
* @param timeout TODO.
* @param callback TODO.
* @param user_data TODO.
+ *
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or
* SR_ERR_MALLOC upon memory allocation errors.
*/
* TODO: More error checks.
*
* @param fd TODO.
+ *
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or
* SR_ERR_MALLOC upon memory allocation errors, SR_ERR_BUG upon
* internal errors.
return SR_OK;
}
-/* Not static, it's used elsewhere (via 'extern'). */
-struct sr_device_plugin session_driver = {
+SR_PRIV struct sr_device_plugin session_driver = {
"session",
"Session-emulating driver",
1,
#include "sigrok-internal.h"
extern struct sr_session *session;
-extern struct sr_device_plugin session_driver;
+extern SR_PRIV struct sr_device_plugin session_driver;
/**
* Load the session from the specified filename.
/* Serial-specific instances */
SR_PRIV struct sr_serial_device_instance *sr_serial_dev_inst_new(
const char *port, int fd);
-SR_PRIV void sr_serial_dev_inst_free(
- struct sr_serial_device_instance *serial);
+SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_device_instance *serial);
/*--- log.c -----------------------------------------------------------------*/
/*--- session.c -------------------------------------------------------------*/
SR_PRIV int sr_session_bus(struct sr_device *device,
- struct sr_datafeed_packet *packet);
+ struct sr_datafeed_packet *packet);
/* Generic device instances */
SR_PRIV struct sr_device_instance *sr_dev_inst_new(int index,
SR_PRIV void sr_source_remove(int fd);
SR_PRIV 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);
/*--- hardware/common/serial.c ----------------------------------------------*/
#define SR_HZ_TO_NS(n) (1000000000 / (n))
/* libsigrok loglevels. */
-#define SR_LOG_NONE 0 /**< Output no messages at all. */
+#define SR_LOG_NONE 0 /**< Output no messages at all. */
#define SR_LOG_ERR 1 /**< Output error messages. */
-#define SR_LOG_WARN 2 /**< Output warnings. */
-#define SR_LOG_INFO 3 /**< Output informational messages. */
+#define SR_LOG_WARN 2 /**< Output warnings. */
+#define SR_LOG_INFO 3 /**< Output informational messages. */
#define SR_LOG_DBG 4 /**< Output debug messages. */
-#define SR_LOG_SPEW 5 /**< Output very noisy debug messages. */
+#define SR_LOG_SPEW 5 /**< Output very noisy debug messages. */
/*
* Use SR_API to mark public API symbols, and SR_PRIV for private symbols.
* E.g. a value of 3000000 would be converted to "3 MHz", 20000 to "20 kHz".
*
* @param samplerate The samplerate in Hz.
+ *
* @return A g_try_malloc()ed string representation of the samplerate value,
* or NULL upon errors. The caller is responsible to g_free() the
* memory.
* E.g. a value of 3000000 would be converted to "3 us", 20000 to "50 ms".
*
* @param frequency The frequency in Hz.
+ *
* @return A g_try_malloc()ed string representation of the frequency value,
* or NULL upon errors. The caller is responsible to g_free() the
* memory.
*
* @param device TODO
* @param triggerstring TODO
+ *
* @return TODO
*/
SR_API char **sr_parse_triggerstring(struct sr_device *device,
*
* @param sizestring A string containing a (decimal) size value.
* @param size Pointer to uint64_t which will contain the string's size value.
- * @return SR_OK or error code
*
+ * @return SR_OK upon success, SR_ERR upon errors.
*/
SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size)
{