aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class/Device
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-01-04 13:34:02 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-01-04 13:34:02 +0000
commit6122ba93cf957bd495fdd1838bac16fb24896a17 (patch)
treeb8cef2eb41161e5beb7523f30b54ac03dfd7e9b4 /LUFA/Drivers/USB/Class/Device
parent1e1cf2c499d7ac0cfae536e1264af4645350813b (diff)
downloadlufa-6122ba93cf957bd495fdd1838bac16fb24896a17.tar.gz
lufa-6122ba93cf957bd495fdd1838bac16fb24896a17.tar.bz2
lufa-6122ba93cf957bd495fdd1838bac16fb24896a17.zip
Fix MassStorageKeyboard demo USE_INTERNAL_SERIAL check being performed before the required library headers were included, causing a compilation error.
Added notes to the class driver functions indicating which functions require what Device/Host state machine states to function.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Device')
-rw-r--r--LUFA/Drivers/USB/Class/Device/Audio.h6
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.h18
-rw-r--r--LUFA/Drivers/USB/Class/Device/HID.c6
-rw-r--r--LUFA/Drivers/USB/Class/Device/HID.h7
-rw-r--r--LUFA/Drivers/USB/Class/Device/MIDI.h6
5 files changed, 36 insertions, 7 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.h b/LUFA/Drivers/USB/Class/Device/Audio.h
index fcfd65d72..e516b7101 100644
--- a/LUFA/Drivers/USB/Class/Device/Audio.h
+++ b/LUFA/Drivers/USB/Class/Device/Audio.h
@@ -123,6 +123,9 @@
/** Determines if the given audio interface is ready for a sample to be read from it, and selects the streaming
* OUT endpoint ready for reading.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state
*
* \return Boolean true if the given Audio interface has a sample to be read, false otherwise
@@ -132,6 +135,9 @@
/** Determines if the given audio interface is ready to accept the next sample to be written to it, and selects
* the streaming IN endpoint ready for writing.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state
*
* \return Boolean true if the given Audio interface is ready to accept the next sample, false otherwise
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.h b/LUFA/Drivers/USB/Class/Device/CDC.h
index fb64d9e42..30d3526b3 100644
--- a/LUFA/Drivers/USB/Class/Device/CDC.h
+++ b/LUFA/Drivers/USB/Class/Device/CDC.h
@@ -157,6 +157,9 @@
/** Sends a given string to the attached USB host, if connected. If a host is not connected when the function is called, the
* string is discarded.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
* \param[in] Data Pointer to the string to send to the host
* \param[in] Length Size in bytes of the string to send to the host
@@ -169,6 +172,9 @@
/** Sends a given byte to the attached USB host, if connected. If a host is not connected when the function is called, the
* byte is discarded.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
* \param[in] Data Byte of data to send to the host
*
@@ -178,6 +184,9 @@
/** Determines the number of bytes received by the CDC interface from the host, waiting to be read.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
*
* \return Total number of buffered bytes received from the host
@@ -188,6 +197,9 @@
* returns 0. The \ref CDC_Device_BytesReceived() function should be queried before data is received to ensure that no data
* underflow occurs.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
*
* \return Next received byte from the host, or 0 if no data received
@@ -196,6 +208,9 @@
/** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
*
* \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum
@@ -207,6 +222,9 @@
* until they are cleared via a second notification. This should be called each time the CDC class driver's
* ControlLineStates.DeviceToHost value is updated to push the new states to the USB host.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
*/
void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c
index 1c638bcb1..a5c03f726 100644
--- a/LUFA/Drivers/USB/Class/Device/HID.c
+++ b/LUFA/Drivers/USB/Class/Device/HID.c
@@ -186,10 +186,4 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
}
}
-void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo)
-{
- if (HIDInterfaceInfo->State.IdleMSRemaining)
- HIDInterfaceInfo->State.IdleMSRemaining--;
-}
-
#endif
diff --git a/LUFA/Drivers/USB/Class/Device/HID.h b/LUFA/Drivers/USB/Class/Device/HID.h
index fcea5aec0..14a5ff601 100644
--- a/LUFA/Drivers/USB/Class/Device/HID.h
+++ b/LUFA/Drivers/USB/Class/Device/HID.h
@@ -138,7 +138,12 @@
*
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state
*/
- void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
+ static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo);
+ static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo)
+ {
+ if (HIDInterfaceInfo->State.IdleMSRemaining)
+ HIDInterfaceInfo->State.IdleMSRemaining--;
+ }
/** HID class driver callback for the user creation of a HID IN report. This callback may fire in response to either
* HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback the
diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.h b/LUFA/Drivers/USB/Class/Device/MIDI.h
index bccaa2037..3899f6e71 100644
--- a/LUFA/Drivers/USB/Class/Device/MIDI.h
+++ b/LUFA/Drivers/USB/Class/Device/MIDI.h
@@ -113,6 +113,9 @@
/** Sends a MIDI event packet to the host. If no host is connected, the event packet is discarded.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state
* \param[in] Event Pointer to a populated USB_MIDI_EventPacket_t structure containing the MIDI event to send
*
@@ -123,6 +126,9 @@
/** Receives a MIDI event packet from the host.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state
* \param[out] Event Pointer to a USB_MIDI_EventPacket_t structure where the received MIDI event is to be placed
*