linux/include/linux/iio/trigger_consumer.h
<<
>>
Prefs
   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#ifndef __LINUX_IIO_TRIGGER_CONSUMER_H__
  11#define __LINUX_IIO_TRIGGER_CONSUMER_H__
  12
  13#include <linux/interrupt.h>
  14#include <linux/types.h>
  15
  16struct iio_dev;
  17struct iio_trigger;
  18
  19/**
  20 * struct iio_poll_func - poll function pair
  21 *
  22 * @indio_dev:                  data specific to device (passed into poll func)
  23 * @h:                          the function that is actually run on trigger
  24 * @thread:                     threaded interrupt part
  25 * @type:                       the type of interrupt (basically if oneshot)
  26 * @name:                       name used to identify the trigger consumer.
  27 * @irq:                        the corresponding irq as allocated from the
  28 *                              trigger pool
  29 * @timestamp:                  some devices need a timestamp grabbed as soon
  30 *                              as possible after the trigger - hence handler
  31 *                              passes it via here.
  32 **/
  33struct iio_poll_func {
  34        struct iio_dev *indio_dev;
  35        irqreturn_t (*h)(int irq, void *p);
  36        irqreturn_t (*thread)(int irq, void *p);
  37        int type;
  38        char *name;
  39        int irq;
  40        s64 timestamp;
  41};
  42
  43
  44struct iio_poll_func
  45*iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
  46                    irqreturn_t (*thread)(int irq, void *p),
  47                    int type,
  48                    struct iio_dev *indio_dev,
  49                    const char *fmt,
  50                    ...);
  51void iio_dealloc_pollfunc(struct iio_poll_func *pf);
  52irqreturn_t iio_pollfunc_store_time(int irq, void *p);
  53
  54void iio_trigger_notify_done(struct iio_trigger *trig);
  55
  56/*
  57 * Two functions for common case where all that happens is a pollfunc
  58 * is attached and detached from a trigger
  59 */
  60int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
  61int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);
  62
  63#endif
  64