Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /* The industrial I/O - event passing to userspace
0003  *
0004  * Copyright (c) 2008-2011 Jonathan Cameron
0005  *
0006  * This program is free software; you can redistribute it and/or modify it
0007  * under the terms of the GNU General Public License version 2 as published by
0008  * the Free Software Foundation.
0009  */
0010 #ifndef _UAPI_IIO_EVENTS_H_
0011 #define _UAPI_IIO_EVENTS_H_
0012 
0013 #include <linux/ioctl.h>
0014 #include <linux/types.h>
0015 
0016 /**
0017  * struct iio_event_data - The actual event being pushed to userspace
0018  * @id:     event identifier
0019  * @timestamp:  best estimate of time of event occurrence (often from
0020  *      the interrupt handler)
0021  */
0022 struct iio_event_data {
0023     __u64   id;
0024     __s64   timestamp;
0025 };
0026 
0027 #define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
0028 
0029 #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
0030 
0031 #define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
0032 
0033 #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
0034 
0035 /* Event code number extraction depends on which type of event we have.
0036  * Perhaps review this function in the future*/
0037 #define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
0038 #define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF))
0039 
0040 #define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
0041 #define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
0042 
0043 #endif /* _UAPI_IIO_EVENTS_H_ */