Tiny IIO Daemon Library

Dependents:  

Committer:
mahphalke
Date:
Wed Oct 07 15:36:37 2020 +0530
Revision:
2:2119a523fbbc
Parent:
1:6cb62c8c58d6
Added dual license support (LGPL and ADI-BSD)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mahphalke 1:6cb62c8c58d6 1 /***************************************************************************//**
mahphalke 1:6cb62c8c58d6 2 * @file tinyiiod.h
mahphalke 1:6cb62c8c58d6 3 * @brief Tiny IIO Daemon Library headers
mahphalke 1:6cb62c8c58d6 4 * @author Paul Cercueil <paul.cercueil@analog.com>
mahphalke 1:6cb62c8c58d6 5 ********************************************************************************
mahphalke 1:6cb62c8c58d6 6 * Copyright (c) 2016, 2020 Analog Devices, Inc.
mahphalke 1:6cb62c8c58d6 7 *
mahphalke 1:6cb62c8c58d6 8 * All rights reserved.
mahphalke 1:6cb62c8c58d6 9 *
mahphalke 1:6cb62c8c58d6 10 * This software is proprietary to Analog Devices, Inc. and its licensors.
mahphalke 1:6cb62c8c58d6 11 * By using this software you agree to the terms of the associated
mahphalke 1:6cb62c8c58d6 12 * Analog Devices Software License Agreement.
mahphalke 1:6cb62c8c58d6 13 *******************************************************************************/
mahphalke 1:6cb62c8c58d6 14
mahphalke 1:6cb62c8c58d6 15 #ifndef TINYIIOD_H
mahphalke 1:6cb62c8c58d6 16 #define TINYIIOD_H
mahphalke 1:6cb62c8c58d6 17
mahphalke 1:6cb62c8c58d6 18 #include "compat.h"
mahphalke 1:6cb62c8c58d6 19
mahphalke 1:6cb62c8c58d6 20 #define TINYIIOD_VERSION_MAJOR 0
mahphalke 1:6cb62c8c58d6 21 #define TINYIIOD_VERSION_MINOR 0
mahphalke 1:6cb62c8c58d6 22 #define TINYIIOD_VERSION_PATCH 1
mahphalke 1:6cb62c8c58d6 23 #define TINYIIOD_VERSION_GIT "v0.1"
mahphalke 1:6cb62c8c58d6 24
mahphalke 1:6cb62c8c58d6 25 #define IIOD_BUFFER_SIZE 0x1000
mahphalke 1:6cb62c8c58d6 26
mahphalke 1:6cb62c8c58d6 27 struct tinyiiod;
mahphalke 1:6cb62c8c58d6 28
mahphalke 1:6cb62c8c58d6 29 struct tinyiiod_ops {
mahphalke 1:6cb62c8c58d6 30 /* Read from the input stream */
mahphalke 1:6cb62c8c58d6 31 ssize_t (*read)(char *buf, size_t len);
mahphalke 1:6cb62c8c58d6 32
mahphalke 1:6cb62c8c58d6 33 /* Write to the output stream */
mahphalke 1:6cb62c8c58d6 34 ssize_t (*write)(const char *buf, size_t len);
mahphalke 1:6cb62c8c58d6 35 ssize_t (*read_line)(char *buf, size_t len);
mahphalke 1:6cb62c8c58d6 36
mahphalke 1:6cb62c8c58d6 37 ssize_t (*open_instance)();
mahphalke 1:6cb62c8c58d6 38
mahphalke 1:6cb62c8c58d6 39 ssize_t (*close_instance)();
mahphalke 1:6cb62c8c58d6 40
mahphalke 1:6cb62c8c58d6 41 ssize_t (*read_attr)(const char *device, const char *attr,
mahphalke 1:6cb62c8c58d6 42 char *buf, size_t len, bool debug);
mahphalke 1:6cb62c8c58d6 43 ssize_t (*write_attr)(const char *device, const char *attr,
mahphalke 1:6cb62c8c58d6 44 const char *buf, size_t len, bool debug);
mahphalke 1:6cb62c8c58d6 45
mahphalke 1:6cb62c8c58d6 46 ssize_t (*ch_read_attr)(const char *device, const char *channel,
mahphalke 1:6cb62c8c58d6 47 bool ch_out, const char *attr, char *buf, size_t len);
mahphalke 1:6cb62c8c58d6 48 ssize_t (*ch_write_attr)(const char *device, const char *channel,
mahphalke 1:6cb62c8c58d6 49 bool ch_out, const char *attr,
mahphalke 1:6cb62c8c58d6 50 const char *buf, size_t len);
mahphalke 1:6cb62c8c58d6 51
mahphalke 1:6cb62c8c58d6 52 int32_t (*open)(const char *device, size_t sample_size, uint32_t mask);
mahphalke 1:6cb62c8c58d6 53 int32_t (*close)(const char *device);
mahphalke 1:6cb62c8c58d6 54
mahphalke 1:6cb62c8c58d6 55 ssize_t (*transfer_dev_to_mem)(const char *device, size_t bytes_count);
mahphalke 1:6cb62c8c58d6 56 ssize_t (*read_data)(const char *device, char *buf, size_t offset,
mahphalke 1:6cb62c8c58d6 57 size_t bytes_count);
mahphalke 1:6cb62c8c58d6 58
mahphalke 1:6cb62c8c58d6 59 ssize_t (*transfer_mem_to_dev)(const char *device, size_t bytes_count);
mahphalke 1:6cb62c8c58d6 60 ssize_t (*write_data)(const char *device, const char *buf, size_t offset,
mahphalke 1:6cb62c8c58d6 61 size_t bytes_count);
mahphalke 1:6cb62c8c58d6 62
mahphalke 1:6cb62c8c58d6 63 int32_t (*get_mask)(const char *device, uint32_t *mask);
mahphalke 1:6cb62c8c58d6 64
mahphalke 1:6cb62c8c58d6 65 int32_t (*set_timeout)(uint32_t timeout);
mahphalke 1:6cb62c8c58d6 66
mahphalke 1:6cb62c8c58d6 67 ssize_t (*get_xml)(char **outxml);
mahphalke 1:6cb62c8c58d6 68 };
mahphalke 1:6cb62c8c58d6 69
mahphalke 1:6cb62c8c58d6 70 struct tinyiiod * tinyiiod_create(struct tinyiiod_ops *ops);
mahphalke 1:6cb62c8c58d6 71 void tinyiiod_destroy(struct tinyiiod *iiod);
mahphalke 1:6cb62c8c58d6 72 int32_t tinyiiod_read_command(struct tinyiiod *iiod);
mahphalke 1:6cb62c8c58d6 73
mahphalke 1:6cb62c8c58d6 74 #endif /* TINYIIOD_H */