diff options
author | Dean Camera <[email protected]> | 2010-01-04 13:34:02 +0000 |
---|---|---|
committer | Dean Camera <[email protected]> | 2010-01-04 13:34:02 +0000 |
commit | 6122ba93cf957bd495fdd1838bac16fb24896a17 (patch) | |
tree | b8cef2eb41161e5beb7523f30b54ac03dfd7e9b4 /LUFA/Drivers/USB/Class/Host | |
parent | 1e1cf2c499d7ac0cfae536e1264af4645350813b (diff) | |
download | qmk_firmware-6122ba93cf957bd495fdd1838bac16fb24896a17.tar.gz qmk_firmware-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/Host')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/CDC.h | 15 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/HID.c | 3 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/HID.h | 12 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/MIDI.h | 6 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/MassStorage.h | 18 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/Printer.h | 3 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/RNDIS.h | 9 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/StillImage.h | 38 |
8 files changed, 100 insertions, 4 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h index d2e98c0fa9..20ee3209ed 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.h +++ b/LUFA/Drivers/USB/Class/Host/CDC.h @@ -177,6 +177,9 @@ /** Sends a given string to the attached USB device, if connected. If a device is not connected when the function is called, the
* string is discarded.
*
+ * \note 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
* \param[in] Data Pointer to the string to send to the device
* \param[in] Length Size in bytes of the string to send to the device
@@ -189,6 +192,9 @@ /** Sends a given byte to the attached USB device, 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 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
* \param[in] Data Byte of data to send to the device
*
@@ -198,6 +204,9 @@ /** Determines the number of bytes received by the CDC interface from the device, waiting to be read.
*
+ * \note 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 Total number of buffered bytes received from the device
@@ -208,6 +217,9 @@ * returns 0. The \ref CDC_Host_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 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
@@ -216,6 +228,9 @@ /** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.
*
+ * \note 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 A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum
diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c index 010b27b7a5..e297ee5a75 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.c +++ b/LUFA/Drivers/USB/Class/Host/HID.c @@ -220,6 +220,9 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo void* Buffer, const uint16_t ReportSize)
{
#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)
+ if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive))
+ return false;
+
if (HIDInterfaceInfo->State.DeviceUsesOUTPipe)
{
uint8_t ErrorCode;
diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h index 01174c5360..72478c2e63 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.h +++ b/LUFA/Drivers/USB/Class/Host/HID.h @@ -159,6 +159,9 @@ /** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \note The destination buffer should be large enough to accommodate the largest report that the attached device
* can generate.
*
@@ -173,6 +176,9 @@ #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)
/** Receives a HID IN report from the attached device, by the report ID.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.
*
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state
@@ -188,6 +194,9 @@ /** Sends an OUT report to the currently attached HID device, using the device's OUT pipe if available or the device's
* Control pipe if not.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, the ReportID parameter is removed
* from the parameter list of this function.
*
@@ -212,6 +221,9 @@ /** Determines if a HID IN report has been received from the attached device on the data IN pipe.
*
+ * \note 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] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state
*
* \return Boolean true if a report has been received, false otherwise
diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.h b/LUFA/Drivers/USB/Class/Host/MIDI.h index 31b79912fe..2a64dc099f 100644 --- a/LUFA/Drivers/USB/Class/Host/MIDI.h +++ b/LUFA/Drivers/USB/Class/Host/MIDI.h @@ -121,6 +121,9 @@ /** Sends a MIDI event packet to the device. If no device is connected, the event packet is discarded.
*
+ * \note 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] 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
*
@@ -131,6 +134,9 @@ /** Receives a MIDI event packet from the device.
*
+ * \note 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] 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
*
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.h b/LUFA/Drivers/USB/Class/Host/MassStorage.h index c6ca67c3f1..7c304097b0 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.h +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.h @@ -164,6 +164,9 @@ /** Retrieves the Mass Storage device's inquiry data for the specified LUN, indicating the device characteristics and
* properties.
*
+ * \note 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] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[out] InquiryData Location where the read inquiry data should be stored
@@ -186,6 +189,9 @@ /** Retrieves the total capacity of the attached USB Mass Storage device, in blocks, and block size.
*
+ * \note 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] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[out] DeviceCapacity Pointer to the location where the capacity information should be stored
@@ -199,6 +205,9 @@ /** Retrieves the device sense data, indicating the current device state and error codes for the previously
* issued command.
*
+ * \note 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] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[out] SenseData Pointer to the location where the sense information should be stored
@@ -212,6 +221,9 @@ /** Issues a PREVENT MEDIUM REMOVAL command, to logically (or, depending on the type of device, physically) lock
* the device from removal so that blocks of data on the medium can be read or altered.
*
+ * \note 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] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[in] PreventRemoval Boolean true if the device should be locked from removal, false otherwise
@@ -223,6 +235,9 @@ /** Reads blocks of data from the attached Mass Storage device's medium.
*
+ * \note 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] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[in] BlockAddress Starting block address within the device to read from
@@ -238,6 +253,9 @@ /** Writes blocks of data to the attached Mass Storage device's medium.
*
+ * \note 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] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[in] BlockAddress Starting block address within the device to write to
diff --git a/LUFA/Drivers/USB/Class/Host/Printer.h b/LUFA/Drivers/USB/Class/Host/Printer.h index b7a1ae7a30..c424dafab2 100644 --- a/LUFA/Drivers/USB/Class/Host/Printer.h +++ b/LUFA/Drivers/USB/Class/Host/Printer.h @@ -156,6 +156,9 @@ * printer is able to understand - for example, PCL data. Not all printers accept all printer languages; see
* \ref PRNT_Host_GetDeviceID() for details on determining acceptable languages for an attached printer.
*
+ * \note 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] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state
* \param[in] PrinterCommands Pointer to a buffer containing the raw command stream to send to the printer
* \param[in] CommandSize Size in bytes of the command stream to be sent
diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.h b/LUFA/Drivers/USB/Class/Host/RNDIS.h index 827cd65a04..fad27b9ad1 100644 --- a/LUFA/Drivers/USB/Class/Host/RNDIS.h +++ b/LUFA/Drivers/USB/Class/Host/RNDIS.h @@ -190,6 +190,9 @@ /** Determines if a packet is currently waiting for the host to read in and process.
*
+ * \note 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] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state
*
* \return Boolean true if a packet is waiting to be read in by the host, false otherwise
@@ -200,6 +203,9 @@ /** Retrieves the next pending packet from the device, discarding the remainder of the RNDIS packet header to leave
* only the packet contents for processing by the host in the nominated buffer.
*
+ * \note 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] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state
* \param[out] Buffer Pointer to a buffer where the packer data is to be written to
* \param[out] PacketLength Pointer to where the length in bytes of the read packet is to be stored
@@ -211,6 +217,9 @@ /** Sends the given packet to the attached RNDIS device, after adding a RNDIS packet message header.
*
+ * \note 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] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state
* \param[in] Buffer Pointer to a buffer where the packer data is to be read from
* \param[in] PacketLength Length in bytes of the packet to send
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.h b/LUFA/Drivers/USB/Class/Host/StillImage.h index 5dec6f06b3..9b655967f5 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.h +++ b/LUFA/Drivers/USB/Class/Host/StillImage.h @@ -134,7 +134,10 @@ /** Opens a new PIMA session with the attached device. This should be used before any session-orientated PIMA commands
* are issued to the device. Only one session can be open at the one time.
- *
+ *
+ * \note 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] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
@@ -144,7 +147,10 @@ /** Closes an already opened PIMA session with the attached device. This should be used after all session-orientated
* PIMA commands have been issued to the device.
- *
+ *
+ * \note 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] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
@@ -155,6 +161,9 @@ /** Sends a raw PIMA block header to the device, filling out the transaction ID automatically. This can be used to send
* arbitrary PIMA blocks to the device with or without parameters.
*
+ * \note 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] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[in] PIMAHeader Pointer to a PIMA container structure that is to be sent
*
@@ -165,6 +174,9 @@ /** Receives a raw PIMA block header to the device. This can be used to receive arbitrary PIMA blocks from the device with
* or without parameters.
*
+ * \note 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] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[out] PIMAHeader Pointer to a PIMA container structure where the received block is to be stored
*
@@ -173,7 +185,10 @@ uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, SI_PIMA_Container_t* const PIMAHeader);
/** Sends a given PIMA command to the attached device, filling out the PIMA command header's Transaction ID automatically.
- *
+ *
+ * \note 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] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[in] Operation PIMA operation code to issue to the device
* \param[in] TotalParams Total number of 32-bit parameters to send to the device in the issued command block
@@ -187,7 +202,10 @@ /** Receives and checks a response block from the attached PIMA device, once a command has been issued and all data
* associated with the command has been transferred.
- *
+ *
+ * \note 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] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
@@ -197,6 +215,9 @@ /** Indicates if the device has issued a PIMA event block to the host via the asynchronous events pipe.
*
+ * \note 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] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
*
* \return Boolean true if an event is waiting to be read, false otherwise
@@ -205,6 +226,9 @@ /** Receives an asynchronous event block from the device via the asynchronous events pipe.
*
+ * \note 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] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[out] PIMAHeader Pointer to a PIMA container structure where the event should be stored
*
@@ -218,6 +242,9 @@ /** Sends arbitrary data to the attached device, for use in the data phase of PIMA commands which require data
* transfer beyond the regular PIMA command block parameters.
*
+ * \note 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] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[in] Buffer Pointer to a buffer where the data to send has been stored
* \param[in] Bytes Length in bytes of the data in the buffer to send to the attached device
@@ -230,6 +257,9 @@ /** Receives arbitrary data from the attached device, for use in the data phase of PIMA commands which require data
* transfer beyond the regular PIMA command block parameters.
*
+ * \note 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] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[out] Buffer Pointer to a buffer where the received data is to be stored
* \param[in] Bytes Length in bytes of the data to read
|