diff --git a/arch/arm/src/tiva/tiva_qencoder.h b/arch/arm/src/tiva/tiva_qencoder.h index 8714f77105..828eaba352 100644 --- a/arch/arm/src/tiva/tiva_qencoder.h +++ b/arch/arm/src/tiva/tiva_qencoder.h @@ -46,9 +46,9 @@ * Pre-processor Definitions ************************************************************************************/ -#define QEIOC_DIRECTION _QEIOC(QEIOC_USER) -#define QEIOC_VELOCITY _QEIOC(QEIOC_USER+1) -#define QEIOC_PPR _QEIOC(QEIOC_USER+2) +#define QEIOC_DIRECTION _QEIOC(QE_TIVA_FIRST) +#define QEIOC_VELOCITY _QEIOC(QE_TIVA_FIRST+1) +#define QEIOC_PPR _QEIOC(QE_TIVA_FIRST+2) /**************************************************************************** * Public Function Prototypes diff --git a/include/nuttx/sensors/as5048b.h b/include/nuttx/sensors/as5048b.h index 9a274d90ae..76ea307c23 100644 --- a/include/nuttx/sensors/as5048b.h +++ b/include/nuttx/sensors/as5048b.h @@ -59,10 +59,10 @@ /* IOCTL Commands ***********************************************************/ -#define QEIOC_ZEROPOSITION _QEIOC(QEIOC_USER+0) /* Arg: int32_t* pointer */ -#define QEIOC_AUTOGAINCTL _QEIOC(QEIOC_USER+1) /* Arg: uint8_t* pointer */ -#define QEIOC_DIAGNOSTICS _QEIOC(QEIOC_USER+2) /* Arg: uint8_t* pointer */ -#define QEIOC_MAGNITUDE _QEIOC(QEIOC_USER+3) /* Arg: int32_t* pointer */ +#define QEIOC_ZEROPOSITION _QEIOC(QE_AS5048B_FIRST+0) /* Arg: int32_t* pointer */ +#define QEIOC_AUTOGAINCTL _QEIOC(QE_AS5048B_FIRST+1) /* Arg: uint8_t* pointer */ +#define QEIOC_DIAGNOSTICS _QEIOC(QE_AS5048B_FIRST+2) /* Arg: uint8_t* pointer */ +#define QEIOC_MAGNITUDE _QEIOC(QE_AS5048B_FIRST+3) /* Arg: int32_t* pointer */ /* Resolution ***************************************************************/ diff --git a/include/nuttx/sensors/qencoder.h b/include/nuttx/sensors/qencoder.h index 8a240ad131..6e1dde49de 100644 --- a/include/nuttx/sensors/qencoder.h +++ b/include/nuttx/sensors/qencoder.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/qencoder.h * - * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -67,14 +67,25 @@ #define QEIOC_POSITION _QEIOC(0x0001) /* Arg: int32_t* pointer */ #define QEIOC_RESET _QEIOC(0x0002) /* Arg: None */ -/* User defined ioctl cms should use QEIOC_USER like this: - * - * #define QEIOC_MYCMD1 _QEIOC(QEIOC_USER) - * #define QEIOC_MYCMD2 _QEIOC(QEIOC_USER+1) - * ... +#define QE_FIRST 0x0001 /* First required command */ +#define QE_NCMDS 2 /* Two required commands */ + +/* User defined ioctl commands are also supported. These will be forwarded + * by the upper-half QE driver to the lower-half QE driver via the ioclt() + * method fo the QE lower-half interface. However, the lower-half driver + * must reserve a block of commands as follows in order prevent IOCTL + * command numbers from overlapping. */ -#define QEIOC_USER 0x0003 +/* See arch/arm/src/tiva/tiva_qencoder.h */ + +#define QE_TIVA_FIRST (QE_FIRST + QE_NCMDS) +#define QE_TIVA_NCMDS 3 + +/* See include/nuttx/sensors/as5048b.h */ + +#define QE_AS5048B_FIRST (QE_TIVA_FIRST + QEIOC_TIVA_NCMDS) +#define QE_AS5048B_NCMDS 4 /**************************************************************************** * Public Types