u16 uval;
s16 signval;
- switch (IIO_EVENT_CODE_EXTRACT_TYPE(event_code)) {
+ switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) {
case IIO_VOLTAGE:
reg = ad7291_limit_regs[IIO_EVENT_CODE_EXTRACT_NUM(event_code)]
[!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) ==
u8 reg;
s16 signval;
- switch (IIO_EVENT_CODE_EXTRACT_TYPE(event_code)) {
+ switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) {
case IIO_VOLTAGE:
if (val > 0xFFF || val < 0)
return -EINVAL;
/* To be enabled the channel must simply be on. If any are enabled
we are in continuous sampling mode */
- switch (IIO_EVENT_CODE_EXTRACT_TYPE(event_code)) {
+ switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) {
case IIO_VOLTAGE:
if (chip->c_mask &
(1 << IIO_EVENT_CODE_EXTRACT_NUM(event_code)))
IIO_EVENT_CODE(channelclass, 0, 0, direction, type, number, 0, 0)
#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
+
#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF)
+#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
+
/* Event code number extraction depends on which type of event we have.
* Perhaps review this function in the future*/
#define IIO_EVENT_CODE_EXTRACT_NUM(mask) (mask & 0xFFFF)