aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class/Host/CDC.h
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-07-30 03:52:11 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-07-30 03:52:11 +0000
commit24e621a8d8424721ed21ce329d2a28dbf8c35343 (patch)
treea014f41c82dfbb50706e1a911a5da2414b9766fd /LUFA/Drivers/USB/Class/Host/CDC.h
parent7c8d16fd7adae430f94004048a7702b7338f5eb1 (diff)
downloadlufa-24e621a8d8424721ed21ce329d2a28dbf8c35343.tar.gz
lufa-24e621a8d8424721ed21ce329d2a28dbf8c35343.tar.bz2
lufa-24e621a8d8424721ed21ce329d2a28dbf8c35343.zip
Altered the CDC Deivice and Host Class drivers' receive byte routines, so that no data is indicated by a negative return value.
Added auto flushing of OUT data to the CDC Host Class driver's USBTask function to automatically flush the send pipe buffer.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/CDC.h')
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h
index 640242819..56bcf3147 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.h
+++ b/LUFA/Drivers/USB/Class/Host/CDC.h
@@ -236,7 +236,10 @@
uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1);
- /** Determines the number of bytes received by the CDC interface from the device, waiting to be read.
+ /** Determines the number of bytes received by the CDC interface from the device, waiting to be read. This indicates the number
+ * of bytes in the IN pipe bank only, and thus the number of calls to \ref CDC_Host_ReceiveByte() which are guaranteed to succeed
+ * immediately. If multiple bytes are to be received, they should be buffered by the user application, as the pipe bank will not be
+ * released back to the USB controller until all bytes are read.
*
* \pre This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail.
@@ -248,17 +251,17 @@
uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Reads a byte of data from the device. If no data is waiting to be read of if a USB device is not connected, the function
- * returns 0. The \ref CDC_Host_BytesReceived() function should be queried before data is received to ensure that no data
- * underflow occurs.
+ * returns a negative value. The \ref CDC_Host_BytesReceived() function may be queried in advance to determine how many bytes
+ * are currently buffered in the CDC interface's data receive pipe.
*
* \pre 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] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state.
*
- * \return Next received byte from the device, or 0 if no data received.
+ * \return Next received byte from the device, or a negative value if no data received.
*/
- uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
+ int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.
*