X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/6b5e684c77e5fa855b609d01e9a07fec296e9257..d36c96d6a526f74e3853466bcecf49261c58b9bd:/LUFA/Drivers/USB/Class/Host/RNDIS.h diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.h b/LUFA/Drivers/USB/Class/Host/RNDIS.h index 1695d6725..0cb5f46ce 100644 --- a/LUFA/Drivers/USB/Class/Host/RNDIS.h +++ b/LUFA/Drivers/USB/Class/Host/RNDIS.h @@ -119,17 +119,16 @@ /* Enums: */ /** Enum for the possible error codes returned by the \ref RNDIS_Host_ConfigurePipes() function. */ - enum RNDISHost_EnumerationFailure_ErrorCodes_t + enum RNDIS_Host_EnumerationFailure_ErrorCodes_t { RNDIS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ RNDIS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ - RNDIS_ENUMERROR_NoRNDISInterfaceFound = 2, /**< A compatible RNDIS interface was not found in the device's Configuration Descriptor. */ - RNDIS_ENUMERROR_EndpointsNotFound = 3, /**< Compatible RNDIS endpoints were not found in the device's RNDIS interface. */ + RNDIS_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible RNDIS interface was not found in the device's Configuration Descriptor. */ }; /* Macros: */ /** Additional error code for RNDIS functions when a device returns a logical command failure. */ - #define RNDIS_COMMAND_FAILED 0xC0 + #define RNDIS_COMMAND_FAILED 0xC0 /* Function Prototypes: */ /** Host interface configuration routine, to configure a given RNDIS host interface instance using the Configuration @@ -138,14 +137,19 @@ * This should be called once after the stack has enumerated the attached device, while the host state machine is in * the Addressed state. * + * \note The pipe index numbers as given in the interface's configuration structure must not overlap with any other + * interface, or pipe bank corruption will occur. Gaps in the allocated pipe numbers or non-sequential indexes + * within a single interface is allowed, but no two interfaces of any type have have interleaved pipe indexes. + * * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state. * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. * \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor. * - * \return A value from the \ref RNDISHost_EnumerationFailure_ErrorCodes_t enum. + * \return A value from the \ref RNDIS_Host_EnumerationFailure_ErrorCodes_t enum. */ - uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, uint16_t ConfigDescriptorSize, - void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); + uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, + uint16_t ConfigDescriptorSize, + void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); /** Sends a RNDIS KEEPALIVE command to the device, to ensure that it does not enter standby mode after periods * of long inactivity. @@ -157,7 +161,7 @@ */ uint8_t RNDIS_Host_SendKeepAlive(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - /** Initializes the attached RNDIS device's RNDIS interface. This should be called after the device's pipes have been + /** Initialises the attached RNDIS device's RNDIS interface. This should be called after the device's pipes have been * configured via the call to \ref RNDIS_Host_ConfigurePipes(). * * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state. @@ -177,8 +181,10 @@ * \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a * logical command failure. */ - uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, const uint32_t Oid, void* Buffer, - const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); + uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, + const uint32_t Oid, + void* Buffer, + const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); /** Gets a given RNDIS property of an attached RNDIS device. * @@ -190,7 +196,9 @@ * \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a * logical command failure. */ - uint8_t RNDIS_Host_QueryRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, const uint32_t Oid, void* Buffer, + uint8_t RNDIS_Host_QueryRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, + const uint32_t Oid, + void* Buffer, const uint16_t MaxLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); /** Determines if a packet is currently waiting for the host to read in and process. @@ -216,8 +224,10 @@ * * \return A value from the Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, void* Buffer, uint16_t* const PacketLength) - ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3); + uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, + void* Buffer, + uint16_t* const PacketLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) + ATTR_NON_NULL_PTR_ARG(3); /** Sends the given packet to the attached RNDIS device, after adding a RNDIS packet message header. * @@ -230,8 +240,9 @@ * * \return A value from the Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, void* Buffer, const uint16_t PacketLength) - ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, + void* Buffer, + const uint16_t PacketLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); /* Inline Functions: */ /** General management task for a given RNDIS host class interface, required for the correct operation of the interface. This should @@ -254,26 +265,24 @@ #define RNDIS_DATA_CLASS 0x0A #define RNDIS_DATA_SUBCLASS 0x00 #define RNDIS_DATA_PROTOCOL 0x00 - - #define RNDIS_FOUND_DATAPIPE_IN (1 << 0) - #define RNDIS_FOUND_DATAPIPE_OUT (1 << 1) - #define RNDIS_FOUND_NOTIFICATION_IN (1 << 2) /* Function Prototypes: */ #if defined(__INCLUDE_FROM_RNDIS_CLASS_HOST_C) static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - void* Buffer, const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) + void* Buffer, + const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - void* Buffer, const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) + void* Buffer, + const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); static uint8_t DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); - #endif + #endif #endif - + /* Disable C linkage for C++ Compilers: */ #if defined(__cplusplus) }