X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/7f9f97c792dee6875fbca9806422bdd7d6c5a657..e55f33866334615e705ff68c0f3bea8e5b1b9b8b:/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 827cd65a0..f64710d5b 100644 --- a/LUFA/Drivers/USB/Class/Host/RNDIS.h +++ b/LUFA/Drivers/USB/Class/Host/RNDIS.h @@ -28,6 +28,15 @@ this software. */ +/** \file + * \brief Host mode driver for the library USB RNDIS Class driver. + * + * Host mode driver for the library USB RNDIS Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the class driver + * dispatch header located in LUFA/Drivers/USB/Class/RNDIS.h. + */ + /** \ingroup Group_USBClassRNDIS * @defgroup Group_USBClassRNDISHost RNDIS Class Host Mode Driver * @@ -57,9 +66,16 @@ extern "C" { #endif + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_RNDIS_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead. + #endif + /* Public Interface - May be used in end-application: */ /* Type Defines: */ - /** Class state structure. An instance of this structure should be made within the user application, + /** \brief RNDIS Class Host Mode Configuration and State Structure. + * + * Class state structure. An instance of this structure should be made within the user application, * and passed to each of the RNDIS class driver functions as the RNDISInterfaceInfo parameter. This * stores each RNDIS interface's configuration and state information. */ @@ -90,12 +106,8 @@ uint16_t DataINPipeSize; /**< Size in bytes of the RNDIS interface's IN data pipe */ uint16_t DataOUTPipeSize; /**< Size in bytes of the RNDIS interface's OUT data pipe */ - uint16_t NotificationPipeSize; /**< Size in bytes of the RNDIS interface's IN notification pipe, if used */ - - bool BidirectionalDataEndpoints; /**< Indicates if the attached RNDIS interface uses bidirectional data endpoints, - * and this has only the IN pipe configured (with \ref Pipe_SetPipeToken() - * used to switch the pipe's direction) - */ + uint16_t NotificationPipeSize; /**< Size in bytes of the RNDIS interface's IN notification pipe, if used */ + uint32_t DeviceMaxPacketSize; /**< Maximum size of a packet which can be buffered by the attached RNDIS device */ uint32_t RequestID; /**< Request ID counter to give a unique ID for each command/response pair */ @@ -120,13 +132,6 @@ #define RNDIS_COMMAND_FAILED 0xC0 /* Function Prototypes: */ - /** General management task for a given RNDIS host class interface, required for the correct operation of the interface. This should - * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state - */ - void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - /** Host interface configuration routine, to configure a given RNDIS host interface instance using the Configuration * Descriptor read from an attached USB device. This function automatically updates the given RNDIS Host instance's * state values and configures the pipes required to communicate with the interface if it is found within the device. @@ -190,6 +195,9 @@ /** Determines if a packet is currently waiting for the host to read in and process. * + * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the + * call will fail. + * * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * * \return Boolean true if a packet is waiting to be read in by the host, false otherwise @@ -200,6 +208,9 @@ /** Retrieves the next pending packet from the device, discarding the remainder of the RNDIS packet header to leave * only the packet contents for processing by the host in the nominated buffer. * + * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the + * call will fail. + * * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * \param[out] Buffer Pointer to a buffer where the packer data is to be written to * \param[out] PacketLength Pointer to where the length in bytes of the read packet is to be stored @@ -211,6 +222,9 @@ /** Sends the given packet to the attached RNDIS device, after adding a RNDIS packet message header. * + * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the + * call will fail. + * * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state * \param[in] Buffer Pointer to a buffer where the packer data is to be read from * \param[in] PacketLength Length in bytes of the packet to send @@ -220,6 +234,18 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, void* Buffer, 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 + * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). + * + * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state + */ + static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo); + static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) + { + (void)RNDISInterfaceInfo; + } + /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ @@ -235,7 +261,7 @@ #define RNDIS_FOUND_NOTIFICATION_IN (1 << 2) /* Function Prototypes: */ - #if defined(INCLUDE_FROM_RNDIS_CLASS_HOST_C) + #if defined(__INCLUDE_FROM_RNDIS_CLASS_HOST_C) static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,