[PATCH 02/15] staging: comedi: add abstracted NI signal/terminal named constants

Ian Abbott abbotti at mev.co.uk
Thu Nov 10 19:13:43 UTC 2016


On 10/11/16 18:57, Spencer E Olson wrote:
> On Thu, 2016-11-10 at 16:29 +0000, Ian Abbott wrote:
>> On 12/10/16 12:05, Spencer E. Olson wrote:
>>> + * Base of abstracted NI names.
>>> + * The first 16 bits of *_arg are reserved for channel selection.
>>> + * Since we only actually need the first 4 or 5 bits for all register values on
>>> + * NI select registers anyways, we'll identify all values >= (1<<15) as being an
>>> + * abstracted NI signal/terminal name.
>>> + * These values are also used/returned by INSN_DEVICE_CONFIG_TEST_ROUTE,
>>> + * INSN_DEVICE_CONFIG_CONNECT_ROUTE, INSN_DEVICE_CONFIG_DISCONNECT_ROUTE,
>>> + * and INSN_DEVICE_CONFIG_GET_ROUTES.
>>> + */
>>> +#define NI_NAMES_BASE	BIT(15)
>>
>> comedi.h is intended to be moved to uapi/linux/comedi.h, and the BIT(n)
>> macro cannot be used there.  On the other hand, writing `(1U << 15)`
>> encourages people to submit patches to change it back to `BIT(15)`. So a
>> `0x8000u` works well here.
>
> So, out of curiosity, will this mean that the userland comedilib library
> might in the future be able to directly reference the kernel version of
> comedi.h instead of us needing the keep these in sync manually?

That would mean that comedilib and comedi applications could only be 
built if the kernel headers include linux/comedi.h, so probably not.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-


More information about the devel mailing list