diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2011-12-04 19:10:59 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-08 11:32:35 -0800 |
commit | 117cf8b7e879a33b24b7bea7ca598715c4654846 (patch) | |
tree | d72b9214637470eb0974679e672c581a93286777 /drivers/staging/iio/Documentation/iio_utils.h | |
parent | staging:iio:Documentation: cleanup properly in buffer handling code (diff) | |
download | linux-dev-117cf8b7e879a33b24b7bea7ca598715c4654846.tar.xz linux-dev-117cf8b7e879a33b24b7bea7ca598715c4654846.zip |
staging:iio:generic_buffer example - handle endian differences
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/Documentation/iio_utils.h')
-rw-r--r-- | drivers/staging/iio/Documentation/iio_utils.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 986889b6a1f6..6f3a392297ec 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -74,6 +74,7 @@ struct iio_channel_info { unsigned bits_used; unsigned shift; uint64_t mask; + unsigned be; unsigned is_signed; unsigned enabled; unsigned location; @@ -84,6 +85,7 @@ struct iio_channel_info { * @is_signed: output whether channel is signed * @bytes: output how many bytes the channel storage occupies * @mask: output a bit mask for the raw data + * @be: big endian * @device_dir: the iio device directory * @name: the channel name * @generic_name: the channel type name @@ -93,6 +95,7 @@ inline int iioutils_get_type(unsigned *is_signed, unsigned *bits_used, unsigned *shift, uint64_t *mask, + unsigned *be, const char *device_dir, const char *name, const char *generic_name) @@ -101,7 +104,7 @@ inline int iioutils_get_type(unsigned *is_signed, int ret; DIR *dp; char *scan_el_dir, *builtname, *builtname_generic, *filename = 0; - char signchar; + char signchar, endianchar; unsigned padint; const struct dirent *ent; @@ -156,6 +159,7 @@ inline int iioutils_get_type(unsigned *is_signed, printf("failed to pass scan type description\n"); return ret; } + *be = (endianchar == 'b'); *bytes = padint / 8; if (*bits_used == 64) *mask = ~0; @@ -399,6 +403,7 @@ inline int build_channel_array(const char *device_dir, ¤t->bits_used, ¤t->shift, ¤t->mask, + ¤t->be, device_dir, current->name, current->generic_name); |