{\r
/* Get the length of the pipe data, and create a new buffer to hold it */\r
uint16_t BufferLength = Pipe_BytesInPipe();\r
- uint8_t Buffer[BufferLength];\r
+ uint8_t Buffer[BufferLength];\r
\r
/* Read in the pipe data to the temporary buffer */\r
Pipe_Read_Stream_LE(Buffer, BufferLength);\r
/* Check if a packet has been received */\r
if (Pipe_IsINReceived())\r
{\r
- /* Discard the event notification */\r
+ /* Discard the unused event notification */\r
Pipe_ClearIN();\r
}\r
\r
* - Moved control endpoint interrupt handling into the library itself, enable via the new INTERRUPT_CONTROL_ENDPOINT token\r
* - Fixed CDCHost not clearing configured pipes and resetting configured pipes mask when a partially enumerated invalid CDC\r
* interface is skipped\r
+ * - Clarified the size of library tokens which accept integer values in the Compile Time Tokens page, values now use the smallest datatype\r
+ * inside the library that is able to hold their defined value to save space\r
*\r
*\r
* \section Sec_ChangeLog090510 Version 090510\r
* <b>HID_STATETABLE_STACK_DEPTH</b> - ( \ref Group_HIDParser ) \n\r
* HID reports may contain PUSH and POP elements, to store and retrieve the current HID state table onto a stack. This\r
* allows for reports to save the state table before modifying it slightly for a data item, and then restore the previous\r
- * state table in a compact manner. This token may be defined to a non-zero value to give the maximum depth of the state\r
+ * state table in a compact manner. This token may be defined to a non-zero 8-bit value to give the maximum depth of the state\r
* table stack. If not defined, this defaults to the value indicated in the HID.h file documentation.\r
*\r
* <b>HID_USAGE_STACK_DEPTH</b> - ( \ref Group_HIDParser ) \n\r
* HID reports generally contain many USAGE elements, which are assigned to INPUT, OUTPUT and FEATURE items in succession\r
* when multiple items are defined at once (via REPORT COUNT elements). This allows for several items to be defined with\r
- * different usages in a compact manner. This token may be defined to a non-zero value to set the maximum depth of the\r
+ * different usages in a compact manner. This token may be defined to a non-zero 8-bit value to set the maximum depth of the\r
* usage stack, indicating the maximum number of USAGE items which can be stored temporarily until the next INPUT, OUTPUT\r
* and FEATURE item. If not defined, this defaults to the value indicated in the HID.h file documentation.\r
*\r
* <b>HID_MAX_COLLECTIONS</b> - ( \ref Group_HIDParser ) \n\r
* HID reports generally contain several COLLECTION elements, used to group related data items together. Collection information\r
* is stored separately in the processed usage structure (and referred to by the data elements in the structure) to save space.\r
- * This token may be defined to a non-zero value to set the maximum number of COLLECTION items which can be processed by the\r
+ * This token may be defined to a non-zero 8-bit value to set the maximum number of COLLECTION items which can be processed by the\r
* parser into the resultant processed report structure. If not defined, this defaults to the value indicated in the HID.h file\r
* documentation.\r
*\r
* <b>HID_MAX_REPORTITEMS</b> - ( \ref Group_HIDParser ) \n\r
* All HID reports contain one or more INPUT, OUTPUT and/or FEATURE items describing the data which can be sent to and from the HID\r
* device. Each item has associated usages, bit offsets in the item reports and other associated data indicating the manner in which\r
- * the report data should be interpreted by the host. This token may be defined to a non-zero value to set the maximum number of\r
+ * the report data should be interpreted by the host. This token may be defined to a non-zero 8-bit value to set the maximum number of\r
* data elements which can be stored in the processed HID report structure, including INPUT, OUTPUT and (if enabled) FEATURE items.\r
* If a item has a multiple count (i.e. a REPORT COUNT of more than 1), each item in the report count is placed separately in the\r
* processed HID report table. If not defined, this defaults to the value indicated in the HID.h file documentation.\r
*\r
* <b>USB_HOST_TIMEOUT_MS</b> - ( \ref Group_Host ) \n\r
* When a control transfer is initiated in host mode to an attached device, a timeout is used to abort the transfer if the attached\r
- * device fails to respond within the timeout period. This token may be defined to a non-zero value to set the timeout period for\r
+ * device fails to respond within the timeout period. This token may be defined to a non-zero 16-bit value to set the timeout period for\r
* control transfers, specified in milliseconds. If not defined, the default value specified in Host.h is used instead.\r
*\r
* <b>HOST_DEVICE_SETTLE_DELAY_MS</b> - ( \ref Group_Host ) \n\r
* Some devices require a delay of up to 5 seconds after they are connected to VBUS before the enumeration process can be started, or\r
* they will fail to enumerate correctly. By placing a delay before the enumeration process, it can be ensured that the bus has settled\r
- * back to a known idle state before communications occur with the device. This token may be defined to a non-zero value to set the\r
- * device settle period, specified in milliseconds. If not defined, the default value specified in Host.h is used instead.\r
+ * back to a known idle state before communications occur with the device. This token may be defined to a non-zero 16-bit value to set\r
+ * the device settle period, specified in milliseconds. If not defined, the default value specified in Host.h is used instead.\r
*\r
* <b>USE_STATIC_OPTIONS</b> - ( \ref Group_USBManagement ) \n\r
* By default, the USB_Init() function accepts dynamic options at runtime to alter the library behaviour, including whether the USB pad\r
*\r
* <b>USB_STREAM_TIMEOUT_MS</b> - ( \ref Group_USBManagement ) \n\r
* When endpoint and/or pipe stream functions are used, by default there is a timeout between each transfer which the connected device or host\r
- * must satisfy, or the stream function aborts the remaining data transfer. This token may be defined to a non-zero value to set the timeout\r
+ * must satisfy, or the stream function aborts the remaining data transfer. This token may be defined to a non-zero 16-bit value to set the timeout\r
* period for stream transfers, specified in milliseconds. If not defined, the default value specified in LowLevel.h is used instead.\r
*\r
* <b>NO_LIMITED_CONTROLLER_CONNECT</b> - ( \ref Group_Events ) \n\r
USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, Type);\r
}\r
\r
-uint8_t USB_GetNextDescriptorComp_Prv(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ComparatorPtr_t ComparatorRoutine)\r
+uint8_t USB_GetNextDescriptorComp_Prv(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine)\r
{\r
uint8_t ErrorCode;\r
\r
while (*BytesRem)\r
{\r
- uint8_t* PrevDescLoc = *CurrConfigLoc;\r
+ uint8_t* PrevDescLoc = *CurrConfigLoc;\r
uint16_t PrevBytesRem = *BytesRem;\r
\r
USB_GetNextDescriptor(BytesRem, CurrConfigLoc);\r
*BytesRem -= CurrDescriptorSize;\r
}\r
\r
- /* Private Interface - For use in library only: */\r
- #if !defined(__DOXYGEN__)\r
/* Type Defines: */\r
- typedef uint8_t (* const ComparatorPtr_t)(void* const);\r
+ /** Type define for a Configuration Descriptor comparator function (function taking a pointer to an array\r
+ * of type void, returning a uint8_t value).\r
+ *\r
+ * \see \ref USB_GetNextDescriptorComp function for more details\r
+ */\r
+ typedef uint8_t (* const ConfigComparatorPtr_t)(void* const);\r
\r
+ /* Private Interface - For use in library only: */\r
+ #if !defined(__DOXYGEN__)\r
/* Function Prototypes: */\r
- uint8_t USB_GetNextDescriptorComp_Prv(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ComparatorPtr_t ComparatorRoutine);\r
+ uint8_t USB_GetNextDescriptorComp_Prv(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine);\r
#endif\r
\r
/* Disable C linkage for C++ Compilers: */\r
STREAMCALLBACK_Continue = 0, /**< Continue sending or receiving the stream. */\r
STREAMCALLBACK_Abort = 1, /**< Abort the stream send or receiving process. */\r
};\r
- \r
+\r
+ /* Type Defines: */\r
+ /** Type define for a Stream Callback function (function taking no arguments and retuning a\r
+ * uint8_t value).\r
+ *\r
+ * \see \ref STREAM_CALLBACK macro for more details\r
+ */\r
+ typedef uint8_t (* const StreamCallbackPtr_t)(void);\r
+ \r
#endif\r
\r
/** @} */\r
#if !defined(CONTROL_ONLY_DEVICE)\r
uint8_t Endpoint_WaitUntilReady(void)\r
{\r
+ #if (USB_STREAM_TIMEOUT_MS < 0xFF)\r
+ uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; \r
+ #else\r
uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;\r
+ #endif\r
\r
USB_INT_Clear(USB_INT_SOFI);\r
\r
\r
uint8_t Endpoint_Discard_Stream(uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
)\r
{\r
\r
uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
)\r
{\r
\r
uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
)\r
{\r
\r
uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
)\r
{\r
\r
uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
)\r
{\r
*/\r
uint8_t Endpoint_Discard_Stream(uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
);\r
\r
*/\r
uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
) ATTR_NON_NULL_PTR_ARG(1);\r
\r
*/\r
uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
) ATTR_NON_NULL_PTR_ARG(1);\r
\r
*/\r
uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
) ATTR_NON_NULL_PTR_ARG(1);\r
\r
*/\r
uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
) ATTR_NON_NULL_PTR_ARG(1);\r
\r
\r
static uint8_t USB_Host_Wait_For_Setup_IOS(const uint8_t WaitType)\r
{\r
+ #if (USB_HOST_TIMEOUT_MS < 0xFF)\r
+ uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS; \r
+ #else\r
uint16_t TimeoutCounter = USB_HOST_TIMEOUT_MS;\r
+ #endif\r
\r
while (!(((WaitType == USB_HOST_WAITFOR_SetupSent) && Pipe_IsSETUPSent()) ||\r
((WaitType == USB_HOST_WAITFOR_InReceived) && Pipe_IsINReceived()) ||\r
\r
uint8_t Pipe_WaitUntilReady(void)\r
{\r
+ #if (USB_STREAM_TIMEOUT_MS < 0xFF)\r
+ uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; \r
+ #else\r
uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;\r
+ #endif\r
\r
USB_INT_Clear(USB_INT_HSOFI);\r
\r
\r
uint8_t Pipe_Write_Stream_LE(const void* Data, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
)\r
{\r
\r
uint8_t Pipe_Write_Stream_BE(const void* Data, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
)\r
{\r
\r
uint8_t Pipe_Discard_Stream(uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
)\r
{\r
\r
uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
)\r
{\r
\r
uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
)\r
{\r
*/\r
uint8_t Pipe_Write_Stream_LE(const void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
) ATTR_NON_NULL_PTR_ARG(1); \r
\r
*/\r
uint8_t Pipe_Write_Stream_BE(const void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
) ATTR_NON_NULL_PTR_ARG(1);\r
\r
*/\r
uint8_t Pipe_Discard_Stream(uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
);\r
\r
*/\r
uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
) ATTR_NON_NULL_PTR_ARG(1);\r
\r
*/\r
uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length\r
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
- , uint8_t (* const Callback)(void)\r
+ , StreamCallbackPtr_t Callback\r
#endif\r
) ATTR_NON_NULL_PTR_ARG(1);\r
\r