trigger_consumer.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* The industrial I/O core, trigger consumer functions
  2. *
  3. * Copyright (c) 2008-2011 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. /**
  10. * struct iio_poll_func - poll function pair
  11. *
  12. * @indio_dev: data specific to device (passed into poll func)
  13. * @h: the function that is actually run on trigger
  14. * @thread: threaded interrupt part
  15. * @type: the type of interrupt (basically if oneshot)
  16. * @name: name used to identify the trigger consumer.
  17. * @irq: the corresponding irq as allocated from the
  18. * trigger pool
  19. * @timestamp: some devices need a timestamp grabbed as soon
  20. * as possible after the trigger - hence handler
  21. * passes it via here.
  22. **/
  23. struct iio_poll_func {
  24. struct iio_dev *indio_dev;
  25. irqreturn_t (*h)(int irq, void *p);
  26. irqreturn_t (*thread)(int irq, void *p);
  27. int type;
  28. char *name;
  29. int irq;
  30. s64 timestamp;
  31. };
  32. struct iio_poll_func
  33. *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
  34. irqreturn_t (*thread)(int irq, void *p),
  35. int type,
  36. struct iio_dev *indio_dev,
  37. const char *fmt,
  38. ...);
  39. void iio_dealloc_pollfunc(struct iio_poll_func *pf);
  40. irqreturn_t iio_pollfunc_store_time(int irq, void *p);
  41. void iio_trigger_notify_done(struct iio_trigger *trig);
  42. /*
  43. * Two functions for common case where all that happens is a pollfunc
  44. * is attached and detached from a trigger
  45. */
  46. int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
  47. int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);