2 * Author: Lay, Kuan Loon <kuan.loon.lay@intel.com>
3 * Copyright (c) 2015 Intel Corporation.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 //#include <linux/iio/types.h>
27 //#include <linux/iio/events.h>
65 IIO_MOD_X_AND_Y_AND_Z,
72 IIO_MOD_ROOT_SUM_SQUARED_X_Y,
73 IIO_MOD_SUM_SQUARED_X_Y_Z,
83 IIO_MOD_NORTH_MAGN_TILT_COMP,
84 IIO_MOD_NORTH_TRUE_TILT_COMP,
89 IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
96 IIO_EV_TYPE_THRESH_ADAPTIVE,
97 IIO_EV_TYPE_MAG_ADAPTIVE,
101 enum iio_event_direction {
109 #include <linux/ioctl.h>
112 * struct iio_event_data - The actual event being pushed to userspace
113 * @id: event identifier
114 * @timestamp: best estimate of time of event occurrence (often from
115 * the interrupt handler)
117 struct iio_event_data {
118 unsigned long long int id;
119 long long int timestamp;
122 #define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
124 #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
126 #define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
128 #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
130 /* Event code number extraction depends on which type of event we have.
131 * Perhaps review this function in the future*/
132 #define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((short int)(mask & 0xFFFF))
133 #define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((short int)(((mask) >> 16) & 0xFFFF))
135 #define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
136 #define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)