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