diff options
Diffstat (limited to 'LUFA')
-rw-r--r-- | LUFA/Doxygen.conf | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/CDC.c | 3 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/CDC.c | 113 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/CDC.h | 9 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/HID.c | 8 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/HID.h | 4 | ||||
-rw-r--r-- | LUFA/ManPages/ChangeLog.txt | 11 | ||||
-rw-r--r-- | LUFA/ManPages/FutureChanges.txt | 5 | ||||
-rw-r--r-- | LUFA/ManPages/LUFAPoweredProjects.txt | 4 | ||||
-rw-r--r-- | LUFA/ManPages/MigrationInformation.txt | 3 | ||||
-rw-r--r-- | LUFA/Version.h | 4 |
11 files changed, 156 insertions, 10 deletions
diff --git a/LUFA/Doxygen.conf b/LUFA/Doxygen.conf index a3903a8a3..260340c05 100644 --- a/LUFA/Doxygen.conf +++ b/LUFA/Doxygen.conf @@ -31,7 +31,7 @@ PROJECT_NAME = "LUFA (Formerly MyUSB) Library" # This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 090810
+PROJECT_NUMBER = 000000
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c index 0d6b37850..47290ceb6 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.c +++ b/LUFA/Drivers/USB/Class/Device/CDC.c @@ -161,6 +161,9 @@ uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterface {
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);
+ if (Endpoint_IsOUTReceived() && !(Endpoint_BytesInEndpoint()))
+ Endpoint_ClearOUT();
+
return Endpoint_BytesInEndpoint();
}
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c index b7a192ac0..e0e15e145 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.c +++ b/LUFA/Drivers/USB/Class/Host/CDC.c @@ -51,6 +51,13 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint {
return CDC_ENUMERROR_NoCDCInterfaceFound;
}
+
+ CDCInterfaceInfo->State.ControlInterfaceNumber =
+#if defined(USE_NONSTANDARD_DESCRIPTOR_NAMES)
+ DESCRIPTOR_CAST(ConfigDescriptorData, USB_Descriptor_Interface_t).InterfaceNumber;
+#else
+ DESCRIPTOR_CAST(ConfigDescriptorData, USB_Descriptor_Interface_t).bInterfaceNumber;
+#endif
while (FoundEndpoints != (CDC_FOUND_DATAPIPE_IN | CDC_FOUND_DATAPIPE_OUT | CDC_FOUND_DATAPIPE_NOTIFICATION))
{
@@ -126,6 +133,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint }
}
+ CDCInterfaceInfo->State.Active = true;
return CDC_ENUMERROR_NoError;
}
@@ -190,6 +198,111 @@ static uint8_t DComp_CDC_Host_NextInterfaceCDCDataEndpoint(void* CurrentDescript void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)
{
+ EVENT_CDC_Host_ControLineStateChanged(CDCInterfaceInfo);
+}
+
+uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)
+{
+ USB_ControlRequest = (USB_Request_Header_t)
+ {
+ .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
+ .bRequest = REQ_SetControlLineState,
+ .wValue = 0,
+ .wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber,
+ .wLength = sizeof(CDCInterfaceInfo->State.LineEncoding),
+ };
+
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
+ return USB_Host_SendControlRequest(&CDCInterfaceInfo->State.LineEncoding);
+}
+
+uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)
+{
+ USB_ControlRequest = (USB_Request_Header_t)
+ {
+ .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
+ .bRequest = REQ_SetControlLineState,
+ .wValue = CDCInterfaceInfo->State.ControlLineStates.HostToDevice,
+ .wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber,
+ .wLength = 0,
+ };
+
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
+ return USB_Host_SendControlRequest(NULL);
+}
+
+void CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, char* Data, uint16_t Length)
+{
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))
+ return;
+
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
+ Pipe_Unfreeze();
+ Pipe_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);
+ Pipe_Freeze();
+}
+
+void CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint8_t Data)
+{
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))
+ return;
+
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
+ Pipe_Unfreeze();
+
+ if (!(Pipe_IsReadWriteAllowed()))
+ {
+ Pipe_ClearOUT();
+ Pipe_WaitUntilReady();
+ }
+
+ Pipe_Write_Byte(Data);
+ Pipe_Freeze();
+}
+
+uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)
+{
+ uint16_t BytesInPipe = 0;
+
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))
+ return BytesInPipe;
+
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
+ Pipe_Unfreeze();
+
+ if (Pipe_IsINReceived() && !(Pipe_BytesInPipe()))
+ Pipe_ClearIN();
+
+ BytesInPipe = Pipe_BytesInPipe();
+ Pipe_Freeze();
+
+ return BytesInPipe;
+}
+
+uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)
+{
+ uint8_t ReceivedByte = 0;
+
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))
+ return ReceivedByte;
+
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
+ Pipe_Unfreeze();
+
+ ReceivedByte = Pipe_Read_Byte();
+
+ if (!(Pipe_BytesInPipe()))
+ Pipe_ClearIN();
+
+ Pipe_Freeze();
+
+ return ReceivedByte;
+}
+
+void CDC_Host_Event_Stub(void)
+{
}
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h index 5e0e4690c..79df489ff 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.h +++ b/LUFA/Drivers/USB/Class/Host/CDC.h @@ -71,6 +71,10 @@ */
struct
{
+ bool Active; /**< Indicates if the current interface instance is connected to an attached device */
+
+ uint8_t ControlInterfaceNumber; /**< Interface index of the CDC-ACM control interface within the attached device */
+
uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe */
uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe */
uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
@@ -118,8 +122,6 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint16_t ConfigDescriptorLength,
uint8_t* DeviceConfigDescriptor);
- void EVENT_CDC_Host_ControLineStateChanged(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo);
-
uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo);
uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo);
@@ -144,6 +146,9 @@ /* Function Prototypes: */
#if defined(INCLUDE_FROM_CDC_CLASS_HOST_C)
+ void CDC_Host_Event_Stub(void);
+ void EVENT_CDC_Host_ControLineStateChanged(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)
+ ATTR_WEAK ATTR_ALIAS(CDC_Host_Event_Stub);
static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* CurrentDescriptor);
static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* CurrentDescriptor);
static uint8_t DComp_CDC_Host_NextInterfaceCDCDataEndpoint(void* CurrentDescriptor);
diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c index 2f66dc2b1..3a4faffbd 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.c +++ b/LUFA/Drivers/USB/Class/Host/HID.c @@ -86,6 +86,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, uint }
}
+ HIDInterfaceInfo->State.Active = true;
return HID_ENUMERROR_NoError;
}
@@ -126,4 +127,11 @@ void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo) }
+void HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)
+{
+ Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
+
+ return Pipe_IsReadWriteAllowed();
+}
+
#endif
diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h index 344c06f06..0386881d2 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.h +++ b/LUFA/Drivers/USB/Class/Host/HID.h @@ -78,6 +78,8 @@ */
struct
{
+ bool Active; /**< Indicates if the current interface instance is connected to an attached device */
+
uint16_t DataINPipeSize; /**< Size in bytes of the HID interface's IN data pipe */
uint16_t DataOUTPipeSize; /**< Size in bytes of the HID interface's OUT data pipe */
} State; /**< State data for the USB class interface within the device. All elements in this section
@@ -99,6 +101,8 @@ void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo);
uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, uint16_t ConfigDescriptorLength,
uint8_t* DeviceConfigDescriptor);
+
+ void HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo);
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index dab0ec6b6..ed3976975 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -6,6 +6,17 @@ /** \page Page_ChangeLog Project Changelog
*
+ * \section Sec_ChangeLogXXXXXX Version XXXXXX
+ *
+ * <b>New:</b>
+ *
+ * <b>Changed:</b>
+ *
+ * <b>Fixed:</b>
+ * - Fixed possible lockup in the CDC device class driver, when the host sends data that is a multiple of the
+ * endpoint's bank
+ *
+ *
* \section Sec_ChangeLog090810 Version 090810
*
* <b>New:</b>
diff --git a/LUFA/ManPages/FutureChanges.txt b/LUFA/ManPages/FutureChanges.txt index b36e03b90..e69103e8e 100644 --- a/LUFA/ManPages/FutureChanges.txt +++ b/LUFA/ManPages/FutureChanges.txt @@ -12,15 +12,14 @@ * or post your suggestion as an enhancement request to the project bug tracker.
*
* <b>Targeted for This Release:</b>
- * - N/A
- *
- * <b>Targeted for Future Releases:</b>
* - Host Mode Class Drivers
* -# Make new host class drivers
* -# Document new host class drivers
* -# Convert Host mode demos to class drivers
* -# Re-enable Host mode Class driver builds after completion
* -# Update Host mode Class Driver demo .txt files
+ *
+ * <b>Targeted for Future Releases:</b>
* - Add standardized descriptor names to device and host class driver structures
* - Remake AVRStudio project files
* - Add detailed overviews of how each demo works
diff --git a/LUFA/ManPages/LUFAPoweredProjects.txt b/LUFA/ManPages/LUFAPoweredProjects.txt index 11d16480e..971749120 100644 --- a/LUFA/ManPages/LUFAPoweredProjects.txt +++ b/LUFA/ManPages/LUFAPoweredProjects.txt @@ -19,8 +19,8 @@ * are open design, and all are available for purchase as completed development boards suitable for project development.
*
* - AVROpendous, an open design/source set of AVR USB development boards: http://avropendous.org/
- * - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/blog/feurig/benito_7_the_next_big_thing
- * - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/
+ * - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/wiki/benito
+ * - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/bumble-b
* - USB10 AKA "The Ferret", a AT90USB162 development board: http://www.soc-machines.com
* - USBFoo, an AT90USB162 based development board: http://shop.kernelconcepts.de/product_info.php?products_id=102
* - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html
diff --git a/LUFA/ManPages/MigrationInformation.txt b/LUFA/ManPages/MigrationInformation.txt index d1e0c8a10..36c7d3580 100644 --- a/LUFA/ManPages/MigrationInformation.txt +++ b/LUFA/ManPages/MigrationInformation.txt @@ -10,6 +10,9 @@ * to the next version released. It does not indicate all new additions to the library in each version change, only
* areas relevant to making older projects compatible with the API changes of each new release.
*
+ * \section Sec_MigrationXXXXXX Migrating from 090810 to XXXXXX
+ * No migration information for this version yet.
+ *
* \section Sec_Migration090810 Migrating from 090605 to 090810
*
* <b>All</b>
diff --git a/LUFA/Version.h b/LUFA/Version.h index 35c5c0738..3cb333ebb 100644 --- a/LUFA/Version.h +++ b/LUFA/Version.h @@ -41,9 +41,9 @@ /* Public Interface - May be used in end-application: */
/* Macros: */
/** Indicates the version number of the library, as an integer. */
- #define LUFA_VERSION_INTEGER 090810
+ #define LUFA_VERSION_INTEGER 000000
/** Indicates the version number of the library, as a string. */
- #define LUFA_VERSION_STRING "090810"
+ #define LUFA_VERSION_STRING "XXXXXX"
#endif
|