X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Finclude%2Ftpl_drv_common.h;h=632f3dcb50c2e6615bed78e945c6c48d90c77017;hb=41769c02317835472d7678d3531ecfc23df8e17a;hp=f20539a916c88400c72fc5b4af4ede3cbb942de7;hpb=1e7db40300bc594cf708bb6082a6e05a268da946;p=tpg%2Facess2.git diff --git a/Kernel/include/tpl_drv_common.h b/Kernel/include/tpl_drv_common.h index f20539a9..632f3dcb 100644 --- a/Kernel/include/tpl_drv_common.h +++ b/Kernel/include/tpl_drv_common.h @@ -47,11 +47,11 @@ enum eTplDrv_IOCtl { DRV_IOCTL_TYPE, /** - * ioctl(..., char *dest[4]) + * ioctl(..., char *dest[32]) * \brief Get driver identifier string * \return 0 on no error * - * This call sets the 4-byte array \a dest to the drivers 4-byte + * This call sets the 32-byte array \a dest to the drivers 31 charater * identifier. This identifier must be unique to the driver series. */ DRV_IOCTL_IDENT, @@ -59,10 +59,10 @@ enum eTplDrv_IOCtl { /** * ioctl(...) * \brief Get driver version number - * \return 24-bit BCD version number (2.2) + * \return 24-bit BCD version number (2.2.2) * - * This call returns the 6-digit (2 major, 2 minor, 2 patch) version number - * of the driver. + * This call returns the 6-digit (2 major, 2 minor, 2 patch) version + * number of the driver. */ DRV_IOCTL_VERSION, @@ -78,10 +78,44 @@ enum eTplDrv_IOCtl { DRV_IOCTL_LOOKUP }; -//! \brief eTplDrv_IOCtl.DRV_IOCTL_LOOKUP names for the core IOCtls -//! These are the official lookup names of the core calls +/** + * \brief eTplDrv_IOCtl.DRV_IOCTL_LOOKUP names for the core IOCtls + * These are the official lookup names of the core calls + */ #define DRV_IOCTLNAMES "type", "ident", "version", "lookup" +/** + * \brief Helper macro for the base IOCtl calls + * \param _type Type number from eTplDrv_Type to return + * \param _ident String of max 32-characters that identifies this driver + * \param _version Driver's 8.8.8 BCD version number + * \param _ioctls Pointer to the IOCtls string array + * \warning If you have DEBUG enabled in the calling file, this function + * will do LEAVE()s before returning, so make sure that the + * IOCtl function is ENTER()ed when using debug with this macro + * + * Usage: (Id is the IOCtl call ID) + * \code + * switch(Id) + * { + * BASE_IOCTLS(DRV_TYPE_MISC, "Ident", 0x100, csaIOCtls) + * // Your IOCtls go here, starting at index 4 + * } + * \endcode + */ +#define BASE_IOCTLS(_type, _ident, _version, _ioctls) \ + case DRV_IOCTL_TYPE: LEAVE('i', (_type)); return (_type);\ + case DRV_IOCTL_IDENT: {\ + int tmp = ModUtil_SetIdent(Data, (_ident));\ + LEAVE('i', tmp); return tmp;\ + }\ + case DRV_IOCTL_VERSION: LEAVE('x', (_version)); return (_version);\ + case DRV_IOCTL_LOOKUP:{\ + int tmp = ModUtil_LookupString( (char**)(_ioctls), (char*)Data );\ + LEAVE('i', tmp);\ + return tmp;\ + } + /** * \enum eTplDrv_Type * \brief Driver Types returned by DRV_IOCTL_TYPE