Add start of a SDP service table, which will be linked to the Bluetooth SDP code.
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / RNDIS.h
index 9b14055..f64710d 100644 (file)
@@ -1,21 +1,21 @@
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2009.\r
+     Copyright (C) Dean Camera, 2010.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
-  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
-  Permission to use, copy, modify, and distribute this software\r
-  and its documentation for any purpose and without fee is hereby\r
-  granted, provided that the above copyright notice appear in all\r
-  copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting\r
-  documentation, and that the name of the author not be used in\r
-  advertising or publicity pertaining to distribution of the\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
   this software.\r
 */\r
 \r
+/** \file\r
+ *  \brief Host mode driver for the library USB RNDIS Class driver.\r
+ *\r
+ *  Host mode driver for the library USB RNDIS Class driver.\r
+ *\r
+ *  \note This file should not be included directly. It is automatically included as needed by the class driver\r
+ *        dispatch header located in LUFA/Drivers/USB/Class/RNDIS.h.\r
+ */\r
+\r
 /** \ingroup Group_USBClassRNDIS\r
  *  @defgroup Group_USBClassRNDISHost RNDIS Class Host Mode Driver\r
  *\r
                        extern "C" {\r
                #endif\r
 \r
+       /* Preprocessor Checks: */\r
+               #if !defined(__INCLUDE_FROM_RNDIS_DRIVER)\r
+                       #error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead.\r
+               #endif\r
+\r
        /* Public Interface - May be used in end-application: */\r
                /* Type Defines: */\r
-                       /** Class state structure. An instance of this structure should be made within the user application,\r
+                       /** \brief RNDIS Class Host Mode Configuration and State Structure.\r
+                        *\r
+                        *  Class state structure. An instance of this structure should be made within the user application,\r
                         *  and passed to each of the RNDIS class driver functions as the RNDISInterfaceInfo parameter. This\r
                         *  stores each RNDIS interface's configuration and state information.\r
                         */\r
                                \r
                                        uint16_t DataINPipeSize; /**< Size in bytes of the RNDIS interface's IN data pipe */\r
                                        uint16_t DataOUTPipeSize;  /**< Size in bytes of the RNDIS interface's OUT data pipe */\r
-                                       uint16_t NotificationPipeSize;  /**< Size in bytes of the RNDIS interface's IN notification pipe, if used */\r
-                                       \r
-                                       bool BidirectionalDataEndpoints; /**< Indicates if the attached RNDIS interface uses bidirectional data endpoints,\r
-                                                                         *   and this has only the IN pipe configured (with \ref Pipe_SetPipeToken()\r
-                                                                         *   used to switch the pipe's direction)\r
-                                                                         */\r
+                                       uint16_t NotificationPipeSize;  /**< Size in bytes of the RNDIS interface's IN notification pipe, if used */                                    \r
+\r
                                        uint32_t DeviceMaxPacketSize; /**< Maximum size of a packet which can be buffered by the attached RNDIS device */\r
                                        \r
                                        uint32_t RequestID; /**< Request ID counter to give a unique ID for each command/response pair */\r
                        #define RNDIS_COMMAND_FAILED                  0xC0      \r
 \r
                /* Function Prototypes: */\r
-                       /** General management task for a given RNDIS host class interface, required for the correct operation of the interface. This should\r
-                        *  be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().\r
-                        *\r
-                        *  \param[in,out] RNDISInterfaceInfo  Pointer to a structure containing an RNDIS Class host configuration and state\r
-                        */\r
-                       void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
-                       \r
                        /** Host interface configuration routine, to configure a given RNDIS host interface instance using the Configuration\r
                         *  Descriptor read from an attached USB device. This function automatically updates the given RNDIS Host instance's\r
                         *  state values and configures the pipes required to communicate with the interface if it is found within the device.\r
 \r
                        /** Determines if a packet is currently waiting for the host to read in and process.\r
                         *\r
+                        *  \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the\r
+                        *        call will fail.\r
+                        *\r
                         *  \param[in,out] RNDISInterfaceInfo  Pointer to a structure containing an RNDIS Class host configuration and state\r
                         *\r
                         *  \return Boolean true if a packet is waiting to be read in by the host, false otherwise\r
                        /** Retrieves the next pending packet from the device, discarding the remainder of the RNDIS packet header to leave\r
                         *  only the packet contents for processing by the host in the nominated buffer.\r
                         *\r
+                        *  \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the\r
+                        *        call will fail.\r
+                        *\r
                         *  \param[in,out] RNDISInterfaceInfo  Pointer to a structure containing an RNDIS Class host configuration and state\r
                         *  \param[out] Buffer  Pointer to a buffer where the packer data is to be written to\r
                         *  \param[out] PacketLength  Pointer to where the length in bytes of the read packet is to be stored\r
                        uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, void* Buffer, uint16_t* PacketLength)\r
                                                      ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3);\r
 \r
+                       /** Sends the given packet to the attached RNDIS device, after adding a RNDIS packet message header.\r
+                        *\r
+                        *  \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the\r
+                        *        call will fail.\r
+                        *\r
+                        *  \param[in,out] RNDISInterfaceInfo  Pointer to a structure containing an RNDIS Class host configuration and state\r
+                        *  \param[in] Buffer  Pointer to a buffer where the packer data is to be read from\r
+                        *  \param[in] PacketLength  Length in bytes of the packet to send\r
+                        *\r
+                        *  \return A value from the Pipe_Stream_RW_ErrorCodes_t enum\r
+                        */\r
+                       uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, void* Buffer, uint16_t PacketLength)\r
+                                                     ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);\r
+\r
+               /* Inline Functions: */\r
+                       /** General management task for a given RNDIS host class interface, required for the correct operation of the interface. This should\r
+                        *  be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().\r
+                        *\r
+                        *  \param[in,out] RNDISInterfaceInfo  Pointer to a structure containing an RNDIS Class host configuration and state\r
+                        */\r
+                       static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo);\r
+                       static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo)\r
+                       {\r
+                               (void)RNDISInterfaceInfo;\r
+                       }\r
+\r
        /* Private Interface - For use in library only: */\r
        #if !defined(__DOXYGEN__)\r
                /* Macros: */\r
                        #define RNDIS_FOUND_NOTIFICATION_IN       (1 << 2)\r
 \r
                /* Function Prototypes: */\r
-                       #if defined(INCLUDE_FROM_RNDIS_CLASS_HOST_C)\r
+                       #if defined(__INCLUDE_FROM_RNDIS_CLASS_HOST_C)\r
                                static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, \r
                                                                             void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
                                static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,\r