iio_core.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* The industrial I/O core function defs.
  2. *
  3. * Copyright (c) 2008 Jonathan Cameron
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published by
  7. * the Free Software Foundation.
  8. *
  9. * These definitions are meant for use only within the IIO core, not individual
  10. * drivers.
  11. */
  12. #ifndef _IIO_CORE_H_
  13. #define _IIO_CORE_H_
  14. #include <linux/kernel.h>
  15. #include <linux/device.h>
  16. struct iio_chan_spec;
  17. struct iio_dev;
  18. int __iio_add_chan_devattr(const char *postfix,
  19. struct iio_chan_spec const *chan,
  20. ssize_t (*func)(struct device *dev,
  21. struct device_attribute *attr,
  22. char *buf),
  23. ssize_t (*writefunc)(struct device *dev,
  24. struct device_attribute *attr,
  25. const char *buf,
  26. size_t len),
  27. u64 mask,
  28. bool generic,
  29. struct device *dev,
  30. struct list_head *attr_list);
  31. /* Event interface flags */
  32. #define IIO_BUSY_BIT_POS 1
  33. #ifdef CONFIG_IIO_BUFFER
  34. struct poll_table_struct;
  35. unsigned int iio_buffer_poll(struct file *filp,
  36. struct poll_table_struct *wait);
  37. ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf,
  38. size_t n, loff_t *f_ps);
  39. #define iio_buffer_poll_addr (&iio_buffer_poll)
  40. #define iio_buffer_read_first_n_outer_addr (&iio_buffer_read_first_n_outer)
  41. #else
  42. #define iio_buffer_poll_addr NULL
  43. #define iio_buffer_read_first_n_outer_addr NULL
  44. #endif
  45. int iio_device_register_eventset(struct iio_dev *indio_dev);
  46. void iio_device_unregister_eventset(struct iio_dev *indio_dev);
  47. int iio_event_getfd(struct iio_dev *indio_dev);
  48. #endif