Create a new function pointer type in StreamCallbacks.h for endpoint/pipe stream callbacks, to make stream function prototypes clearer.
This commit is contained in:
parent
76d5e99bb8
commit
eeba38e343
11 changed files with 64 additions and 37 deletions
|
|
@ -114,13 +114,13 @@ void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,
|
|||
USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, Type);
|
||||
}
|
||||
|
||||
uint8_t USB_GetNextDescriptorComp_Prv(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ComparatorPtr_t ComparatorRoutine)
|
||||
uint8_t USB_GetNextDescriptorComp_Prv(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine)
|
||||
{
|
||||
uint8_t ErrorCode;
|
||||
|
||||
while (*BytesRem)
|
||||
{
|
||||
uint8_t* PrevDescLoc = *CurrConfigLoc;
|
||||
uint8_t* PrevDescLoc = *CurrConfigLoc;
|
||||
uint16_t PrevBytesRem = *BytesRem;
|
||||
|
||||
USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
|
||||
|
|
|
|||
|
|
@ -264,13 +264,18 @@
|
|||
*BytesRem -= CurrDescriptorSize;
|
||||
}
|
||||
|
||||
/* Type Defines: */
|
||||
/** Type define for a Configuration Descriptor comparator function (function taking a pointer to an array
|
||||
* of type void, returning a uint8_t value).
|
||||
*
|
||||
* \see \ref USB_GetNextDescriptorComp function for more details
|
||||
*/
|
||||
typedef uint8_t (* const ConfigComparatorPtr_t)(void* const);
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
/* Type Defines: */
|
||||
typedef uint8_t (* const ComparatorPtr_t)(void* const);
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint8_t USB_GetNextDescriptorComp_Prv(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ComparatorPtr_t ComparatorRoutine);
|
||||
uint8_t USB_GetNextDescriptorComp_Prv(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine);
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
|
|
|
|||
|
|
@ -85,7 +85,15 @@
|
|||
STREAMCALLBACK_Continue = 0, /**< Continue sending or receiving the stream. */
|
||||
STREAMCALLBACK_Abort = 1, /**< Abort the stream send or receiving process. */
|
||||
};
|
||||
|
||||
|
||||
/* Type Defines: */
|
||||
/** Type define for a Stream Callback function (function taking no arguments and retuning a
|
||||
* uint8_t value).
|
||||
*
|
||||
* \see \ref STREAM_CALLBACK macro for more details
|
||||
*/
|
||||
typedef uint8_t (* const StreamCallbackPtr_t)(void);
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -74,7 +74,11 @@ void Endpoint_ClearEndpoints(void)
|
|||
#if !defined(CONTROL_ONLY_DEVICE)
|
||||
uint8_t Endpoint_WaitUntilReady(void)
|
||||
{
|
||||
#if (USB_STREAM_TIMEOUT_MS < 0xFF)
|
||||
uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
|
||||
#else
|
||||
uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
|
||||
#endif
|
||||
|
||||
USB_INT_Clear(USB_INT_SOFI);
|
||||
|
||||
|
|
@ -108,7 +112,7 @@ uint8_t Endpoint_WaitUntilReady(void)
|
|||
|
||||
uint8_t Endpoint_Discard_Stream(uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
@ -143,7 +147,7 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
|
|||
|
||||
uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
@ -179,7 +183,7 @@ uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
|
|||
|
||||
uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
@ -215,7 +219,7 @@ uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
|
|||
|
||||
uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
@ -251,7 +255,7 @@ uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
|
|||
|
||||
uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -727,7 +727,7 @@
|
|||
*/
|
||||
uint8_t Endpoint_Discard_Stream(uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
);
|
||||
|
||||
|
|
@ -754,7 +754,7 @@
|
|||
*/
|
||||
uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
|
@ -781,7 +781,7 @@
|
|||
*/
|
||||
uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
|
@ -808,7 +808,7 @@
|
|||
*/
|
||||
uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
|
@ -835,7 +835,7 @@
|
|||
*/
|
||||
uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,11 @@ End_Of_Control_Send:
|
|||
|
||||
static uint8_t USB_Host_Wait_For_Setup_IOS(const uint8_t WaitType)
|
||||
{
|
||||
#if (USB_HOST_TIMEOUT_MS < 0xFF)
|
||||
uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
|
||||
#else
|
||||
uint16_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
|
||||
#endif
|
||||
|
||||
while (!(((WaitType == USB_HOST_WAITFOR_SetupSent) && Pipe_IsSETUPSent()) ||
|
||||
((WaitType == USB_HOST_WAITFOR_InReceived) && Pipe_IsINReceived()) ||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,11 @@ void Pipe_ClearPipes(void)
|
|||
|
||||
uint8_t Pipe_WaitUntilReady(void)
|
||||
{
|
||||
#if (USB_STREAM_TIMEOUT_MS < 0xFF)
|
||||
uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
|
||||
#else
|
||||
uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
|
||||
#endif
|
||||
|
||||
USB_INT_Clear(USB_INT_HSOFI);
|
||||
|
||||
|
|
@ -104,7 +108,7 @@ uint8_t Pipe_WaitUntilReady(void)
|
|||
|
||||
uint8_t Pipe_Write_Stream_LE(const void* Data, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
@ -140,7 +144,7 @@ uint8_t Pipe_Write_Stream_LE(const void* Data, uint16_t Length
|
|||
|
||||
uint8_t Pipe_Write_Stream_BE(const void* Data, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
@ -176,7 +180,7 @@ uint8_t Pipe_Write_Stream_BE(const void* Data, uint16_t Length
|
|||
|
||||
uint8_t Pipe_Discard_Stream(uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
@ -211,7 +215,7 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
|
|||
|
||||
uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
@ -247,7 +251,7 @@ uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length
|
|||
|
||||
uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -759,7 +759,7 @@
|
|||
*/
|
||||
uint8_t Pipe_Write_Stream_LE(const void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
|
@ -783,7 +783,7 @@
|
|||
*/
|
||||
uint8_t Pipe_Write_Stream_BE(const void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
|
@ -806,7 +806,7 @@
|
|||
*/
|
||||
uint8_t Pipe_Discard_Stream(uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
);
|
||||
|
||||
|
|
@ -830,7 +830,7 @@
|
|||
*/
|
||||
uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
|
@ -854,7 +854,7 @@
|
|||
*/
|
||||
uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length
|
||||
#if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
|
||||
, uint8_t (* const Callback)(void)
|
||||
, StreamCallbackPtr_t Callback
|
||||
#endif
|
||||
) ATTR_NON_NULL_PTR_ARG(1);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue