|
@@ -24,6 +24,7 @@
|
|
|
#include "iio.h"
|
|
|
#include "iio_core.h"
|
|
|
#include "iio_core_trigger.h"
|
|
|
+#include "chrdev.h"
|
|
|
|
|
|
#define IIO_ID_PREFIX "device"
|
|
|
#define IIO_ID_FORMAT IIO_ID_PREFIX "%d"
|
|
@@ -117,6 +118,37 @@ static void iio_free_ida_val(struct ida *this_ida, int id)
|
|
|
spin_unlock(&iio_ida_lock);
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * struct iio_detected_event_list - list element for events that have occurred
|
|
|
+ * @list: linked list header
|
|
|
+ * @ev: the event itself
|
|
|
+ */
|
|
|
+struct iio_detected_event_list {
|
|
|
+ struct list_head list;
|
|
|
+ struct iio_event_data ev;
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * struct iio_event_interface - chrdev interface for an event line
|
|
|
+ * @dev: device assocated with event interface
|
|
|
+ * @handler: fileoperations and related control for the chrdev
|
|
|
+ * @wait: wait queue to allow blocking reads of events
|
|
|
+ * @event_list_lock: mutex to protect the list of detected events
|
|
|
+ * @det_events: list of detected events
|
|
|
+ * @max_events: maximum number of events before new ones are dropped
|
|
|
+ * @current_events: number of events in detected list
|
|
|
+ */
|
|
|
+struct iio_event_interface {
|
|
|
+ struct device dev;
|
|
|
+ struct iio_handler handler;
|
|
|
+ wait_queue_head_t wait;
|
|
|
+ struct mutex event_list_lock;
|
|
|
+ struct list_head det_events;
|
|
|
+ int max_events;
|
|
|
+ int current_events;
|
|
|
+ struct list_head dev_attr_list;
|
|
|
+};
|
|
|
+
|
|
|
int iio_push_event(struct iio_dev *dev_info,
|
|
|
int ev_line,
|
|
|
int ev_code,
|