IIO Application Library

Dependents:  

Committer:
mahphalke
Date:
Mon Oct 05 12:28:13 2020 +0530
Revision:
1:182a6f54cab0
Parent:
0:5bcbac04328c
IIO application library- Initial Revision

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mahphalke 1:182a6f54cab0 1 /***************************************************************************//**
mahphalke 1:182a6f54cab0 2 * @file iio.h
mahphalke 1:182a6f54cab0 3 * @brief Header file of iio
mahphalke 1:182a6f54cab0 4 * @author Cristian Pop (cristian.pop@analog.com)
mahphalke 1:182a6f54cab0 5 ********************************************************************************
mahphalke 1:182a6f54cab0 6 * Copyright 2013(c) Analog Devices, Inc.
mahphalke 1:182a6f54cab0 7 *
mahphalke 1:182a6f54cab0 8 * All rights reserved.
mahphalke 1:182a6f54cab0 9 *
mahphalke 1:182a6f54cab0 10 * Redistribution and use in source and binary forms, with or without
mahphalke 1:182a6f54cab0 11 * modification, are permitted provided that the following conditions are met:
mahphalke 1:182a6f54cab0 12 * - Redistributions of source code must retain the above copyright
mahphalke 1:182a6f54cab0 13 * notice, this list of conditions and the following disclaimer.
mahphalke 1:182a6f54cab0 14 * - Redistributions in binary form must reproduce the above copyright
mahphalke 1:182a6f54cab0 15 * notice, this list of conditions and the following disclaimer in
mahphalke 1:182a6f54cab0 16 * the documentation and/or other materials provided with the
mahphalke 1:182a6f54cab0 17 * distribution.
mahphalke 1:182a6f54cab0 18 * - Neither the name of Analog Devices, Inc. nor the names of its
mahphalke 1:182a6f54cab0 19 * contributors may be used to endorse or promote products derived
mahphalke 1:182a6f54cab0 20 * from this software without specific prior written permission.
mahphalke 1:182a6f54cab0 21 * - The use of this software may or may not infringe the patent rights
mahphalke 1:182a6f54cab0 22 * of one or more patent holders. This license does not release you
mahphalke 1:182a6f54cab0 23 * from the requirement that you obtain separate licenses from these
mahphalke 1:182a6f54cab0 24 * patent holders to use this software.
mahphalke 1:182a6f54cab0 25 * - Use of the software either in source or binary form, must be run
mahphalke 1:182a6f54cab0 26 * on or directly connected to an Analog Devices Inc. component.
mahphalke 1:182a6f54cab0 27 *
mahphalke 1:182a6f54cab0 28 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
mahphalke 1:182a6f54cab0 29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
mahphalke 1:182a6f54cab0 30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
mahphalke 1:182a6f54cab0 31 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
mahphalke 1:182a6f54cab0 32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
mahphalke 1:182a6f54cab0 33 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
mahphalke 1:182a6f54cab0 34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mahphalke 1:182a6f54cab0 35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mahphalke 1:182a6f54cab0 36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mahphalke 1:182a6f54cab0 37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mahphalke 1:182a6f54cab0 38 *******************************************************************************/
mahphalke 1:182a6f54cab0 39
mahphalke 1:182a6f54cab0 40 #ifndef IIO_H_
mahphalke 1:182a6f54cab0 41 #define IIO_H_
mahphalke 1:182a6f54cab0 42
mahphalke 1:182a6f54cab0 43 /******************************************************************************/
mahphalke 1:182a6f54cab0 44 /***************************** Include Files **********************************/
mahphalke 1:182a6f54cab0 45 /******************************************************************************/
mahphalke 1:182a6f54cab0 46
mahphalke 1:182a6f54cab0 47 #include "tinyiiod.h"
mahphalke 1:182a6f54cab0 48 #include "iio_types.h"
mahphalke 1:182a6f54cab0 49
mahphalke 1:182a6f54cab0 50 /******************************************************************************/
mahphalke 1:182a6f54cab0 51 /*************************** Types Declarations *******************************/
mahphalke 1:182a6f54cab0 52 /******************************************************************************/
mahphalke 1:182a6f54cab0 53
mahphalke 1:182a6f54cab0 54 /**
mahphalke 1:182a6f54cab0 55 * @struct iio_interface
mahphalke 1:182a6f54cab0 56 * @brief Links a physical device instance "void *dev_instance"
mahphalke 1:182a6f54cab0 57 * with a "iio_device *iio" that describes capabilities of the device.
mahphalke 1:182a6f54cab0 58 */
mahphalke 1:182a6f54cab0 59 struct iio_interface {
mahphalke 1:182a6f54cab0 60 /** Device name */
mahphalke 1:182a6f54cab0 61 const char *name;
mahphalke 1:182a6f54cab0 62 /** Opened channels */
mahphalke 1:182a6f54cab0 63 uint32_t ch_mask;
mahphalke 1:182a6f54cab0 64 /** Physical instance of a device */
mahphalke 1:182a6f54cab0 65 void *dev_instance;
mahphalke 1:182a6f54cab0 66 /** Device descriptor(describes channels and attributes) */
mahphalke 1:182a6f54cab0 67 struct iio_device *iio;
mahphalke 1:182a6f54cab0 68 /** Generate device xml */
mahphalke 1:182a6f54cab0 69 ssize_t (*get_xml)(char **xml, struct iio_device *iio);
mahphalke 1:182a6f54cab0 70 /** Transfer data from device into RAM */
mahphalke 1:182a6f54cab0 71 ssize_t (*transfer_dev_to_mem)(void *dev_instance, size_t bytes_count,
mahphalke 1:182a6f54cab0 72 uint32_t ch_mask);
mahphalke 1:182a6f54cab0 73 /** Read data from RAM to pbuf. It should be called after "transfer_dev_to_mem" */
mahphalke 1:182a6f54cab0 74 ssize_t (*read_data)(void *dev_instance, char *pbuf, size_t offset,
mahphalke 1:182a6f54cab0 75 size_t bytes_count, uint32_t ch_mask);
mahphalke 1:182a6f54cab0 76 /** Transfer data from RAM to device */
mahphalke 1:182a6f54cab0 77 ssize_t (*transfer_mem_to_dev)(void *dev_instance, size_t bytes_count,
mahphalke 1:182a6f54cab0 78 uint32_t ch_mask);
mahphalke 1:182a6f54cab0 79 /** Write data to RAM. It should be called before "transfer_mem_to_dev" */
mahphalke 1:182a6f54cab0 80 ssize_t (*write_data)(void *dev_instance, char *pbuf, size_t offset,
mahphalke 1:182a6f54cab0 81 size_t bytes_count, uint32_t ch_mask);
mahphalke 1:182a6f54cab0 82 };
mahphalke 1:182a6f54cab0 83
mahphalke 1:182a6f54cab0 84 /******************************************************************************/
mahphalke 1:182a6f54cab0 85 /************************ Functions Declarations ******************************/
mahphalke 1:182a6f54cab0 86 /******************************************************************************/
mahphalke 1:182a6f54cab0 87
mahphalke 1:182a6f54cab0 88 /* Set communication ops and read/write ops that will be called from
mahphalke 1:182a6f54cab0 89 * "libtinyiiod". */
mahphalke 1:182a6f54cab0 90 ssize_t iio_init(struct tinyiiod **iiod, struct iio_server_ops *comm_ops);
mahphalke 1:182a6f54cab0 91 /* Free the resources allocated by iio_init(). */
mahphalke 1:182a6f54cab0 92 ssize_t iio_remove(struct tinyiiod *iiod);
mahphalke 1:182a6f54cab0 93 /* Register interface. */
mahphalke 1:182a6f54cab0 94 ssize_t iio_register(struct iio_interface *iio_interface);
mahphalke 1:182a6f54cab0 95 /* Unregister interface. */
mahphalke 1:182a6f54cab0 96 ssize_t iio_unregister(struct iio_interface *iio_interface);
mahphalke 1:182a6f54cab0 97
mahphalke 1:182a6f54cab0 98 #endif /* IIO_H_ */