Further work on the new CDC and HID host mode class drivers.
Reset changelog et. al. to reset development information for the new version currently under development.
USB_HostState = HOST_STATE_Configured;\r
break;\r
case HOST_STATE_Configured:\r
+ if (CDC_Host_BytesReceived(&VirtualSerial_CDC_Interface))\r
+ {\r
+ /* Echo received bytes from the attached device through the USART */\r
+ while (CDC_Host_BytesReceived(&VirtualSerial_CDC_Interface))\r
+ putchar(CDC_Host_ReceiveByte(&VirtualSerial_CDC_Interface));\r
+ }\r
+ \r
break;\r
}\r
\r
# LUFA library compile-time options\r
LUFA_OPTS = -D USE_NONSTANDARD_DESCRIPTOR_NAMES\r
LUFA_OPTS += -D USB_HOST_ONLY\r
-LUFA_OPTS += -D NO_STREAM_CALLBACKS\r
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
case HOST_STATE_Configured:\r
+ if (HID_Host_ReportReceived(&Mouse_HID_Interface))\r
+ {\r
+ \r
+ }\r
+ \r
break;\r
}\r
\r
# This could be handy for archiving the generated documentation or \r
# if some version control system is used.\r
\r
-PROJECT_NUMBER = 090810\r
+PROJECT_NUMBER = 000000\r
\r
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) \r
# base path where the generated documentation will be put. \r
{\r
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);\r
\r
+ if (Endpoint_IsOUTReceived() && !(Endpoint_BytesInEndpoint()))\r
+ Endpoint_ClearOUT();\r
+\r
return Endpoint_BytesInEndpoint();\r
}\r
\r
{\r
return CDC_ENUMERROR_NoCDCInterfaceFound;\r
}\r
+ \r
+ CDCInterfaceInfo->State.ControlInterfaceNumber =\r
+#if defined(USE_NONSTANDARD_DESCRIPTOR_NAMES)\r
+ DESCRIPTOR_CAST(ConfigDescriptorData, USB_Descriptor_Interface_t).InterfaceNumber;\r
+#else\r
+ DESCRIPTOR_CAST(ConfigDescriptorData, USB_Descriptor_Interface_t).bInterfaceNumber;\r
+#endif\r
\r
while (FoundEndpoints != (CDC_FOUND_DATAPIPE_IN | CDC_FOUND_DATAPIPE_OUT | CDC_FOUND_DATAPIPE_NOTIFICATION))\r
{\r
}\r
}\r
\r
+ CDCInterfaceInfo->State.Active = true;\r
return CDC_ENUMERROR_NoError;\r
}\r
\r
\r
void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)\r
{\r
+ EVENT_CDC_Host_ControLineStateChanged(CDCInterfaceInfo);\r
+}\r
+\r
+uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)\r
+{\r
+ USB_ControlRequest = (USB_Request_Header_t)\r
+ {\r
+ .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),\r
+ .bRequest = REQ_SetControlLineState,\r
+ .wValue = 0,\r
+ .wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber,\r
+ .wLength = sizeof(CDCInterfaceInfo->State.LineEncoding),\r
+ };\r
+\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+ \r
+ return USB_Host_SendControlRequest(&CDCInterfaceInfo->State.LineEncoding);\r
+}\r
+\r
+uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)\r
+{\r
+ USB_ControlRequest = (USB_Request_Header_t)\r
+ {\r
+ .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),\r
+ .bRequest = REQ_SetControlLineState,\r
+ .wValue = CDCInterfaceInfo->State.ControlLineStates.HostToDevice,\r
+ .wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber,\r
+ .wLength = 0,\r
+ };\r
+\r
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
+ \r
+ return USB_Host_SendControlRequest(NULL);\r
+}\r
+\r
+void CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, char* Data, uint16_t Length)\r
+{\r
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))\r
+ return;\r
+\r
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); \r
+ Pipe_Unfreeze();\r
+ Pipe_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK); \r
+ Pipe_Freeze();\r
+}\r
+\r
+void CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint8_t Data)\r
+{\r
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))\r
+ return;\r
+\r
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); \r
+ Pipe_Unfreeze();\r
+ \r
+ if (!(Pipe_IsReadWriteAllowed()))\r
+ {\r
+ Pipe_ClearOUT();\r
+ Pipe_WaitUntilReady();\r
+ }\r
+\r
+ Pipe_Write_Byte(Data); \r
+ Pipe_Freeze();\r
+}\r
+\r
+uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)\r
+{\r
+ uint16_t BytesInPipe = 0;\r
+\r
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))\r
+ return BytesInPipe;\r
+ \r
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber); \r
+ Pipe_Unfreeze();\r
+\r
+ if (Pipe_IsINReceived() && !(Pipe_BytesInPipe()))\r
+ Pipe_ClearIN();\r
+ \r
+ BytesInPipe = Pipe_BytesInPipe();\r
+ Pipe_Freeze();\r
+ \r
+ return BytesInPipe;\r
+}\r
+\r
+uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)\r
+{\r
+ uint8_t ReceivedByte = 0;\r
+\r
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))\r
+ return ReceivedByte;\r
+ \r
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber); \r
+ Pipe_Unfreeze();\r
+\r
+ ReceivedByte = Pipe_Read_Byte();\r
+ \r
+ if (!(Pipe_BytesInPipe()))\r
+ Pipe_ClearIN();\r
+ \r
+ Pipe_Freeze();\r
+ \r
+ return ReceivedByte;\r
+}\r
+\r
+void CDC_Host_Event_Stub(void)\r
+{\r
\r
}\r
\r
*/\r
struct\r
{\r
+ bool Active; /**< Indicates if the current interface instance is connected to an attached device */\r
+ \r
+ uint8_t ControlInterfaceNumber; /**< Interface index of the CDC-ACM control interface within the attached device */\r
+ \r
uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe */\r
uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe */\r
uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */\r
uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint16_t ConfigDescriptorLength,\r
uint8_t* DeviceConfigDescriptor);\r
\r
- void EVENT_CDC_Host_ControLineStateChanged(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo);\r
- \r
uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo);\r
uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo);\r
\r
\r
/* Function Prototypes: */\r
#if defined(INCLUDE_FROM_CDC_CLASS_HOST_C)\r
+ void CDC_Host_Event_Stub(void);\r
+ void EVENT_CDC_Host_ControLineStateChanged(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)\r
+ ATTR_WEAK ATTR_ALIAS(CDC_Host_Event_Stub);\r
static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* CurrentDescriptor);\r
static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* CurrentDescriptor);\r
static uint8_t DComp_CDC_Host_NextInterfaceCDCDataEndpoint(void* CurrentDescriptor);\r
}\r
}\r
\r
+ HIDInterfaceInfo->State.Active = true;\r
return HID_ENUMERROR_NoError;\r
}\r
\r
\r
}\r
\r
+void HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)\r
+{\r
+ Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);\r
+\r
+ return Pipe_IsReadWriteAllowed();\r
+}\r
+\r
#endif\r
*/\r
struct\r
{\r
+ bool Active; /**< Indicates if the current interface instance is connected to an attached device */\r
+\r
uint16_t DataINPipeSize; /**< Size in bytes of the HID interface's IN data pipe */\r
uint16_t DataOUTPipeSize; /**< Size in bytes of the HID interface's OUT data pipe */\r
} State; /**< State data for the USB class interface within the device. All elements in this section\r
void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo);\r
uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, uint16_t ConfigDescriptorLength,\r
uint8_t* DeviceConfigDescriptor);\r
+\r
+ void HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo);\r
\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
\r
/** \page Page_ChangeLog Project Changelog\r
*\r
+ * \section Sec_ChangeLogXXXXXX Version XXXXXX\r
+ *\r
+ * <b>New:</b>\r
+ *\r
+ * <b>Changed:</b>\r
+ *\r
+ * <b>Fixed:</b>\r
+ * - Fixed possible lockup in the CDC device class driver, when the host sends data that is a multiple of the\r
+ * endpoint's bank\r
+ *\r
+ *\r
* \section Sec_ChangeLog090810 Version 090810\r
*\r
* <b>New:</b>\r
* or post your suggestion as an enhancement request to the project bug tracker.\r
*\r
* <b>Targeted for This Release:</b>\r
- * - N/A\r
- *\r
- * <b>Targeted for Future Releases:</b>\r
* - Host Mode Class Drivers\r
* -# Make new host class drivers\r
* -# Document new host class drivers\r
* -# Convert Host mode demos to class drivers\r
* -# Re-enable Host mode Class driver builds after completion\r
* -# Update Host mode Class Driver demo .txt files\r
+ *\r
+ * <b>Targeted for Future Releases:</b>\r
* - Add standardized descriptor names to device and host class driver structures\r
* - Remake AVRStudio project files\r
* - Add detailed overviews of how each demo works\r
* are open design, and all are available for purchase as completed development boards suitable for project development.\r
*\r
* - AVROpendous, an open design/source set of AVR USB development boards: http://avropendous.org/\r
- * - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/blog/feurig/benito_7_the_next_big_thing\r
- * - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/\r
+ * - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/wiki/benito\r
+ * - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/bumble-b\r
* - USB10 AKA "The Ferret", a AT90USB162 development board: http://www.soc-machines.com\r
* - USBFoo, an AT90USB162 based development board: http://shop.kernelconcepts.de/product_info.php?products_id=102\r
* - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html\r
* to the next version released. It does not indicate all new additions to the library in each version change, only\r
* areas relevant to making older projects compatible with the API changes of each new release.\r
*\r
+ * \section Sec_MigrationXXXXXX Migrating from 090810 to XXXXXX\r
+ * No migration information for this version yet.\r
+ *\r
* \section Sec_Migration090810 Migrating from 090605 to 090810\r
*\r
* <b>All</b>\r
/* Public Interface - May be used in end-application: */\r
/* Macros: */\r
/** Indicates the version number of the library, as an integer. */\r
- #define LUFA_VERSION_INTEGER 090810\r
+ #define LUFA_VERSION_INTEGER 000000\r
\r
/** Indicates the version number of the library, as a string. */\r
- #define LUFA_VERSION_STRING "090810"\r
+ #define LUFA_VERSION_STRING "XXXXXX"\r
\r
#endif\r