Re: IIO_CONST_ATTR_SCAN_EL_TYPE add result shift?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/05/10 12:24, Hennerich, Michael wrote:
> /**
>  * IIO_CONST_ATTR_SCAN_EL_TYPE - attr to specify the data format of a scan el
>  * @name: the scan el name (may be more general and cover a set of scan elements
>  * @_sign: either s or u for signed or unsigned
>  * @_bits: number of actual bits occuplied by the value
>  * @_storagebits: number of bits _bits is padded to when read out of buffer
>  **/
> #define IIO_CONST_ATTR_SCAN_EL_TYPE(_name, _sign, _bits, _storagebits) \
>         IIO_CONST_ATTR(_name##_type, #_sign#_bits"/"#_storagebits);
> 
> There are cases where bits < storagebits and the result is not alligned to the LSB.
> Lets say we have an 10-bit ADC.
> The output is stored in a 16-bit word, with four leading zeros, then the 10-bit datum, followed by 2 don't care bits.
> 
> So it would be good to provide an additional shift value?
> Or how shall we handle these cases?
This was discussed in the original debate and we simply proposed leaving it until
we had a user.  So the question is how to describe the shift.

So taking your example, how about:

u10/16>>2

Where the shift is optional.

Other suggestions welcome given I made that up with 2 seconds thought.
> 
> Greetings,
> Michael
> 
> Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
> Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 4036
> Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif
> 
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux