Added const modifiers to device mode class drivers.
Added parameter directions to function parameter documentation. Added new experimental FAST_STREAM_FUNCTIONS compile time option to speed up stream transfers at the expense of a higher FLASH consumption (needs testing to verify improved throughput).
This commit is contained in:
parent
3cbdcd3686
commit
f1076ac4d6
115 changed files with 1031 additions and 633 deletions
|
|
@ -124,15 +124,15 @@
|
|||
* index and language ID. This function MUST be overridden in the user application (added with full, identical
|
||||
* prototype and name so that the library can call it to retrieve descriptor data.
|
||||
*
|
||||
* \param wValue The type of the descriptor to retrieve in the upper byte, and the index in the
|
||||
* lower byte (when more than one descriptor of the given type exists, such as the
|
||||
* case of string descriptors). The type may be one of the standard types defined
|
||||
* in the DescriptorTypes_t enum, or may be a class-specific descriptor type value.
|
||||
* \param wIndex The language ID of the string to return if the wValue type indicates DTYPE_String,
|
||||
* otherwise zero for standard descriptors, or as defined in a class-specific
|
||||
* standards.
|
||||
* \param DescriptorAddress Pointer to the descriptor in memory. This should be set by the routine to
|
||||
* the address of the descriptor.
|
||||
* \param[in] wValue The type of the descriptor to retrieve in the upper byte, and the index in the
|
||||
* lower byte (when more than one descriptor of the given type exists, such as the
|
||||
* case of string descriptors). The type may be one of the standard types defined
|
||||
* in the DescriptorTypes_t enum, or may be a class-specific descriptor type value.
|
||||
* \param[in] wIndex The language ID of the string to return if the wValue type indicates DTYPE_String,
|
||||
* otherwise zero for standard descriptors, or as defined in a class-specific
|
||||
* standards.
|
||||
* \param[out] DescriptorAddress Pointer to the descriptor in memory. This should be set by the routine to
|
||||
* the address of the descriptor.
|
||||
*
|
||||
* \note By default, the library expects all descriptors to be located in flash memory via the PROGMEM attribute.
|
||||
* If descriptors should be located in RAM or EEPROM instead (to speed up access in the case of RAM, or to
|
||||
|
|
|
|||
|
|
@ -119,6 +119,46 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
|
|||
if ((ErrorCode = Endpoint_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
|
||||
#if defined(FAST_STREAM_TRANSFERS)
|
||||
uint8_t BytesRemToAlignment = (Endpoint_BytesInEndpoint() & 0x07);
|
||||
|
||||
if (Length >= 8)
|
||||
{
|
||||
Length -= BytesRemToAlignment;
|
||||
|
||||
switch (BytesRemToAlignment)
|
||||
{
|
||||
default:
|
||||
do
|
||||
{
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
{
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
|
||||
return ENDPOINT_RWSTREAM_CallbackAborted;
|
||||
#endif
|
||||
|
||||
if ((ErrorCode = Endpoint_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
Endpoint_Discard_Byte();
|
||||
case 7: Endpoint_Discard_Byte();
|
||||
case 6: Endpoint_Discard_Byte();
|
||||
case 5: Endpoint_Discard_Byte();
|
||||
case 4: Endpoint_Discard_Byte();
|
||||
case 3: Endpoint_Discard_Byte();
|
||||
case 2: Endpoint_Discard_Byte();
|
||||
case 1: Endpoint_Discard_Byte();
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (Length)
|
||||
{
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
|
|
@ -155,6 +195,46 @@ uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
|
|||
if ((ErrorCode = Endpoint_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
|
||||
#if defined(FAST_STREAM_TRANSFERS)
|
||||
uint8_t BytesRemToAlignment = (Endpoint_BytesInEndpoint() & 0x07);
|
||||
|
||||
if (Length >= 8)
|
||||
{
|
||||
Length -= BytesRemToAlignment;
|
||||
|
||||
switch (BytesRemToAlignment)
|
||||
{
|
||||
default:
|
||||
do
|
||||
{
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
{
|
||||
Endpoint_ClearIN();
|
||||
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
|
||||
return ENDPOINT_RWSTREAM_CallbackAborted;
|
||||
#endif
|
||||
|
||||
if ((ErrorCode = Endpoint_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
Endpoint_Write_Byte(*(DataStream++));
|
||||
case 7: Endpoint_Write_Byte(*(DataStream++));
|
||||
case 6: Endpoint_Write_Byte(*(DataStream++));
|
||||
case 5: Endpoint_Write_Byte(*(DataStream++));
|
||||
case 4: Endpoint_Write_Byte(*(DataStream++));
|
||||
case 3: Endpoint_Write_Byte(*(DataStream++));
|
||||
case 2: Endpoint_Write_Byte(*(DataStream++));
|
||||
case 1: Endpoint_Write_Byte(*(DataStream++));
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (Length)
|
||||
{
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
|
|
@ -175,7 +255,7 @@ uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
|
|||
Length--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ENDPOINT_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -191,6 +271,46 @@ uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
|
|||
if ((ErrorCode = Endpoint_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
|
||||
#if defined(FAST_STREAM_TRANSFERS)
|
||||
uint8_t BytesRemToAlignment = (Endpoint_BytesInEndpoint() & 0x07);
|
||||
|
||||
if (Length >= 8)
|
||||
{
|
||||
Length -= BytesRemToAlignment;
|
||||
|
||||
switch (BytesRemToAlignment)
|
||||
{
|
||||
default:
|
||||
do
|
||||
{
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
{
|
||||
Endpoint_ClearIN();
|
||||
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
|
||||
return ENDPOINT_RWSTREAM_CallbackAborted;
|
||||
#endif
|
||||
|
||||
if ((ErrorCode = Endpoint_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
Endpoint_Write_Byte(*(DataStream--));
|
||||
case 7: Endpoint_Write_Byte(*(DataStream--));
|
||||
case 6: Endpoint_Write_Byte(*(DataStream--));
|
||||
case 5: Endpoint_Write_Byte(*(DataStream--));
|
||||
case 4: Endpoint_Write_Byte(*(DataStream--));
|
||||
case 3: Endpoint_Write_Byte(*(DataStream--));
|
||||
case 2: Endpoint_Write_Byte(*(DataStream--));
|
||||
case 1: Endpoint_Write_Byte(*(DataStream--));
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (Length)
|
||||
{
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
|
|
@ -211,7 +331,7 @@ uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
|
|||
Length--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ENDPOINT_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -227,6 +347,46 @@ uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
|
|||
if ((ErrorCode = Endpoint_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
|
||||
#if defined(FAST_STREAM_TRANSFERS)
|
||||
uint8_t BytesRemToAlignment = (Endpoint_BytesInEndpoint() & 0x07);
|
||||
|
||||
if (Length >= 8)
|
||||
{
|
||||
Length -= BytesRemToAlignment;
|
||||
|
||||
switch (BytesRemToAlignment)
|
||||
{
|
||||
default:
|
||||
do
|
||||
{
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
{
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
|
||||
return ENDPOINT_RWSTREAM_CallbackAborted;
|
||||
#endif
|
||||
|
||||
if ((ErrorCode = Endpoint_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
*(DataStream++) = Endpoint_Read_Byte();
|
||||
case 7: *(DataStream++) = Endpoint_Read_Byte();
|
||||
case 6: *(DataStream++) = Endpoint_Read_Byte();
|
||||
case 5: *(DataStream++) = Endpoint_Read_Byte();
|
||||
case 4: *(DataStream++) = Endpoint_Read_Byte();
|
||||
case 3: *(DataStream++) = Endpoint_Read_Byte();
|
||||
case 2: *(DataStream++) = Endpoint_Read_Byte();
|
||||
case 1: *(DataStream++) = Endpoint_Read_Byte();
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (Length)
|
||||
{
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
|
|
@ -247,7 +407,7 @@ uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
|
|||
Length--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ENDPOINT_RWSTREAM_NoError;
|
||||
}
|
||||
|
||||
|
|
@ -263,6 +423,46 @@ uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length
|
|||
if ((ErrorCode = Endpoint_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
|
||||
#if defined(FAST_STREAM_TRANSFERS)
|
||||
uint8_t BytesRemToAlignment = (Endpoint_BytesInEndpoint() & 0x07);
|
||||
|
||||
if (Length >= 8)
|
||||
{
|
||||
Length -= BytesRemToAlignment;
|
||||
|
||||
switch (BytesRemToAlignment)
|
||||
{
|
||||
default:
|
||||
do
|
||||
{
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
{
|
||||
Endpoint_ClearOUT();
|
||||
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
|
||||
return ENDPOINT_RWSTREAM_CallbackAborted;
|
||||
#endif
|
||||
|
||||
if ((ErrorCode = Endpoint_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
*(DataStream--) = Endpoint_Read_Byte();
|
||||
case 7: *(DataStream--) = Endpoint_Read_Byte();
|
||||
case 6: *(DataStream--) = Endpoint_Read_Byte();
|
||||
case 5: *(DataStream--) = Endpoint_Read_Byte();
|
||||
case 4: *(DataStream--) = Endpoint_Read_Byte();
|
||||
case 3: *(DataStream--) = Endpoint_Read_Byte();
|
||||
case 2: *(DataStream--) = Endpoint_Read_Byte();
|
||||
case 1: *(DataStream--) = Endpoint_Read_Byte();
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (Length)
|
||||
{
|
||||
if (!(Endpoint_IsReadWriteAllowed()))
|
||||
|
|
@ -283,7 +483,7 @@ uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length
|
|||
Length--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ENDPOINT_RWSTREAM_NoError;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -117,13 +117,13 @@
|
|||
|
||||
/** Maximum size in bytes of a given endpoint.
|
||||
*
|
||||
* \param n Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1)
|
||||
* \param[in] n Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1)
|
||||
*/
|
||||
#define ENDPOINT_MAX_SIZE(n) _ENDPOINT_GET_MAXSIZE(n)
|
||||
|
||||
/** Indicates if the given endpoint supports double banking.
|
||||
*
|
||||
* \param n Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1)
|
||||
* \param[in] n Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1)
|
||||
*/
|
||||
#define ENDPOINT_DOUBLEBANK_SUPPORTED(n) _ENDPOINT_GET_DOUBLEBANK(n)
|
||||
|
||||
|
|
@ -169,14 +169,14 @@
|
|||
* Any endpoint operations which do not require the endpoint number to be indicated will operate on
|
||||
* the currently selected endpoint.
|
||||
*
|
||||
* \param EndpointNumber Endpoint number to select
|
||||
* \param[in] EndpointNumber Endpoint number to select
|
||||
*/
|
||||
static inline void Endpoint_SelectEndpoint(uint8_t EndpointNumber);
|
||||
|
||||
/** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's
|
||||
* In and Out pointers to the bank's contents.
|
||||
*
|
||||
* \param EndpointNumber Endpoint number whose FIFO buffers are to be reset
|
||||
* \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset
|
||||
*/
|
||||
static inline void Endpoint_ResetFIFO(uint8_t EndpointNumber);
|
||||
|
||||
|
|
@ -227,7 +227,7 @@
|
|||
/** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type
|
||||
* endpoints).
|
||||
*
|
||||
* \param EndpointNumber Index of the endpoint whose interrupt flag should be tested
|
||||
* \param[in] EndpointNumber Index of the endpoint whose interrupt flag should be tested
|
||||
*
|
||||
* \return Boolean true if the specified endpoint has interrupted, false otherwise
|
||||
*/
|
||||
|
|
@ -454,7 +454,7 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Byte Next byte to write into the the currently selected endpoint's FIFO buffer
|
||||
* \param[in] Byte Next byte to write into the the currently selected endpoint's FIFO buffer
|
||||
*/
|
||||
static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_Write_Byte(const uint8_t Byte)
|
||||
|
|
@ -515,7 +515,7 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Word Next word to write to the currently selected endpoint's FIFO buffer
|
||||
* \param[in] Word Next word to write to the currently selected endpoint's FIFO buffer
|
||||
*/
|
||||
static inline void Endpoint_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_Write_Word_LE(const uint16_t Word)
|
||||
|
|
@ -529,7 +529,7 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Word Next word to write to the currently selected endpoint's FIFO buffer
|
||||
* \param[in] Word Next word to write to the currently selected endpoint's FIFO buffer
|
||||
*/
|
||||
static inline void Endpoint_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_Write_Word_BE(const uint16_t Word)
|
||||
|
|
@ -604,7 +604,7 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param DWord Next double word to write to the currently selected endpoint's FIFO buffer
|
||||
* \param[in] DWord Next double word to write to the currently selected endpoint's FIFO buffer
|
||||
*/
|
||||
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_Write_DWord_LE(const uint32_t DWord)
|
||||
|
|
@ -620,7 +620,7 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param DWord Next double word to write to the currently selected endpoint's FIFO buffer
|
||||
* \param[in] DWord Next double word to write to the currently selected endpoint's FIFO buffer
|
||||
*/
|
||||
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
|
||||
static inline void Endpoint_Write_DWord_BE(const uint32_t DWord)
|
||||
|
|
@ -722,8 +722,8 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Length Number of bytes to send via the currently selected endpoint.
|
||||
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint.
|
||||
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
*
|
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -748,9 +748,9 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Buffer Pointer to the source data buffer to read from.
|
||||
* \param Length Number of bytes to read for the currently selected endpoint into the buffer.
|
||||
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
* \param[in] Buffer Pointer to the source data buffer to read from.
|
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
|
||||
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
*
|
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -775,9 +775,9 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Buffer Pointer to the source data buffer to read from.
|
||||
* \param Length Number of bytes to read for the currently selected endpoint into the buffer.
|
||||
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
* \param[in] Buffer Pointer to the source data buffer to read from.
|
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
|
||||
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
*
|
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -802,9 +802,9 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Buffer Pointer to the destination data buffer to write to.
|
||||
* \param Length Number of bytes to send via the currently selected endpoint.
|
||||
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
* \param[out] Buffer Pointer to the destination data buffer to write to.
|
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint.
|
||||
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
*
|
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -829,9 +829,9 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Buffer Pointer to the destination data buffer to write to.
|
||||
* \param Length Number of bytes to send via the currently selected endpoint.
|
||||
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
* \param[out] Buffer Pointer to the destination data buffer to write to.
|
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint.
|
||||
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
*
|
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -855,8 +855,8 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Buffer Pointer to the source data buffer to read from.
|
||||
* \param Length Number of bytes to read for the currently selected endpoint into the buffer.
|
||||
* \param[in] Buffer Pointer to the source data buffer to read from.
|
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
|
||||
*
|
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -874,8 +874,8 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Buffer Pointer to the source data buffer to read from.
|
||||
* \param Length Number of bytes to read for the currently selected endpoint into the buffer.
|
||||
* \param[in] Buffer Pointer to the source data buffer to read from.
|
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
|
||||
*
|
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -893,8 +893,8 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Buffer Pointer to the destination data buffer to write to.
|
||||
* \param Length Number of bytes to send via the currently selected endpoint.
|
||||
* \param[out] Buffer Pointer to the destination data buffer to write to.
|
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint.
|
||||
*
|
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -912,8 +912,8 @@
|
|||
*
|
||||
* \ingroup Group_EndpointRW
|
||||
*
|
||||
* \param Buffer Pointer to the destination data buffer to write to.
|
||||
* \param Length Number of bytes to send via the currently selected endpoint.
|
||||
* \param[out] Buffer Pointer to the destination data buffer to write to.
|
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint.
|
||||
*
|
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@
|
|||
*
|
||||
* \note After this routine returns, the control pipe will be selected.
|
||||
*
|
||||
* \param ConfigNumber Configuration index to send to the device
|
||||
* \param[in] ConfigNumber Configuration index to send to the device
|
||||
*
|
||||
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
|
||||
*/
|
||||
|
|
@ -194,8 +194,8 @@
|
|||
*
|
||||
* \note After this routine returns, the control pipe will be selected.
|
||||
*
|
||||
* \param DeviceDescriptorPtr Pointer to the destination device descriptor structure where
|
||||
* the read data is to be stored
|
||||
* \param[out] DeviceDescriptorPtr Pointer to the destination device descriptor structure where
|
||||
* the read data is to be stored
|
||||
*
|
||||
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
|
||||
*/
|
||||
|
|
@ -205,7 +205,7 @@
|
|||
*
|
||||
* \note After this routine returns, the control pipe will be selected.
|
||||
*
|
||||
* \param EndpointIndex Index of the endpoint to clear
|
||||
* \param[in] EndpointIndex Index of the endpoint to clear
|
||||
*
|
||||
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@
|
|||
*
|
||||
* \ingroup Group_PipeControlReq
|
||||
*
|
||||
* \param BufferPtr Pointer to the start of the data buffer if the request has a data stage, or
|
||||
* NULL if the request transfers no data to or from the device.
|
||||
* \param[in] BufferPtr Pointer to the start of the data buffer if the request has a data stage, or
|
||||
* NULL if the request transfers no data to or from the device.
|
||||
*
|
||||
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -228,14 +228,14 @@
|
|||
* Calling this function when the USB interface is already initialized will cause a complete USB
|
||||
* interface reset and re-enumeration.
|
||||
*
|
||||
* \param Mode This is a mask indicating what mode the USB interface is to be initialized to.
|
||||
* Valid mode masks are \ref USB_MODE_DEVICE, \ref USB_MODE_HOST or \ref USB_MODE_UID.
|
||||
* \param[in] Mode This is a mask indicating what mode the USB interface is to be initialized to.
|
||||
* Valid mode masks are \ref USB_MODE_DEVICE, \ref USB_MODE_HOST or \ref USB_MODE_UID.
|
||||
*
|
||||
* \param Options Mask indicating the options which should be used when initializing the USB
|
||||
* interface to control the USB interface's behaviour. This should be comprised of
|
||||
* a USB_OPT_REG_* mask to control the regulator, a USB_OPT_*_PLL mask to control the
|
||||
* PLL, and a USB_DEVICE_OPT_* mask (when the device mode is enabled) to set the device
|
||||
* mode speed.
|
||||
* \param[in] Options Mask indicating the options which should be used when initializing the USB
|
||||
* interface to control the USB interface's behaviour. This should be comprised of
|
||||
* a USB_OPT_REG_* mask to control the regulator, a USB_OPT_*_PLL mask to control the
|
||||
* PLL, and a USB_DEVICE_OPT_* mask (when the device mode is enabled) to set the device
|
||||
* mode speed.
|
||||
*
|
||||
* \note To reduce the FLASH requirements of the library if only device or host mode is required,
|
||||
* this can be statically set via defining the token USB_DEVICE_ONLY for device mode or
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@
|
|||
* There are two different methods of sending a SRP - either pulses on the VBUS line, or by
|
||||
* pulsing the Data + line via the internal pull-up resistor.
|
||||
*
|
||||
* \param SRPTypeMask Mask indicating the type of SRP to use, either \ref USB_OTG_SRP_VBUS or \ref USB_OTG_STP_DATA.
|
||||
* \param[in] SRPTypeMask Mask indicating the type of SRP to use, either \ref USB_OTG_SRP_VBUS or \ref USB_OTG_STP_DATA.
|
||||
*/
|
||||
static inline void USB_OTG_Dev_InitiateSRP(uint8_t SRPTypeMask);
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -120,6 +120,46 @@ uint8_t Pipe_Write_Stream_LE(const void* Data, uint16_t Length
|
|||
if ((ErrorCode = Pipe_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
|
||||
#if defined(FAST_STREAM_TRANSFERS)
|
||||
uint8_t BytesRemToAlignment = (Pipe_BytesInPipe() & 0x07);
|
||||
|
||||
if (Length >= 8)
|
||||
{
|
||||
Length -= BytesRemToAlignment;
|
||||
|
||||
switch (BytesRemToAlignment)
|
||||
{
|
||||
default:
|
||||
do
|
||||
{
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
{
|
||||
Pipe_ClearOUT();
|
||||
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
|
||||
return PIPE_RWSTREAM_CallbackAborted;
|
||||
#endif
|
||||
|
||||
if ((ErrorCode = Pipe_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
Pipe_Write_Byte(*(DataStream++));
|
||||
case 7: Pipe_Write_Byte(*(DataStream++));
|
||||
case 6: Pipe_Write_Byte(*(DataStream++));
|
||||
case 5: Pipe_Write_Byte(*(DataStream++));
|
||||
case 4: Pipe_Write_Byte(*(DataStream++));
|
||||
case 3: Pipe_Write_Byte(*(DataStream++));
|
||||
case 2: Pipe_Write_Byte(*(DataStream++));
|
||||
case 1: Pipe_Write_Byte(*(DataStream++));
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (Length)
|
||||
{
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
|
|
@ -158,6 +198,46 @@ uint8_t Pipe_Write_Stream_BE(const void* Data, uint16_t Length
|
|||
if ((ErrorCode = Pipe_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
|
||||
#if defined(FAST_STREAM_TRANSFERS)
|
||||
uint8_t BytesRemToAlignment = (Pipe_BytesInPipe() & 0x07);
|
||||
|
||||
if (Length >= 8)
|
||||
{
|
||||
Length -= BytesRemToAlignment;
|
||||
|
||||
switch (BytesRemToAlignment)
|
||||
{
|
||||
default:
|
||||
do
|
||||
{
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
{
|
||||
Pipe_ClearOUT();
|
||||
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
|
||||
return PIPE_RWSTREAM_CallbackAborted;
|
||||
#endif
|
||||
|
||||
if ((ErrorCode = Pipe_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
Pipe_Write_Byte(*(DataStream--));
|
||||
case 7: Pipe_Write_Byte(*(DataStream--));
|
||||
case 6: Pipe_Write_Byte(*(DataStream--));
|
||||
case 5: Pipe_Write_Byte(*(DataStream--));
|
||||
case 4: Pipe_Write_Byte(*(DataStream--));
|
||||
case 3: Pipe_Write_Byte(*(DataStream--));
|
||||
case 2: Pipe_Write_Byte(*(DataStream--));
|
||||
case 1: Pipe_Write_Byte(*(DataStream--));
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (Length)
|
||||
{
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
|
|
@ -195,6 +275,46 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
|
|||
if ((ErrorCode = Pipe_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
|
||||
#if defined(FAST_STREAM_TRANSFERS)
|
||||
uint8_t BytesRemToAlignment = (Pipe_BytesInPipe() & 0x07);
|
||||
|
||||
if (Length >= 8)
|
||||
{
|
||||
Length -= BytesRemToAlignment;
|
||||
|
||||
switch (BytesRemToAlignment)
|
||||
{
|
||||
default:
|
||||
do
|
||||
{
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
{
|
||||
Pipe_ClearIN();
|
||||
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
|
||||
return PIPE_RWSTREAM_CallbackAborted;
|
||||
#endif
|
||||
|
||||
if ((ErrorCode = Pipe_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
Pipe_Discard_Byte();
|
||||
case 7: Pipe_Discard_Byte();
|
||||
case 6: Pipe_Discard_Byte();
|
||||
case 5: Pipe_Discard_Byte();
|
||||
case 4: Pipe_Discard_Byte();
|
||||
case 3: Pipe_Discard_Byte();
|
||||
case 2: Pipe_Discard_Byte();
|
||||
case 1: Pipe_Discard_Byte();
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (Length)
|
||||
{
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
|
|
@ -233,6 +353,46 @@ uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length
|
|||
if ((ErrorCode = Pipe_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
|
||||
#if defined(FAST_STREAM_TRANSFERS)
|
||||
uint8_t BytesRemToAlignment = (Pipe_BytesInPipe() & 0x07);
|
||||
|
||||
if (Length >= 8)
|
||||
{
|
||||
Length -= BytesRemToAlignment;
|
||||
|
||||
switch (BytesRemToAlignment)
|
||||
{
|
||||
default:
|
||||
do
|
||||
{
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
{
|
||||
Pipe_ClearIN();
|
||||
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
|
||||
return PIPE_RWSTREAM_CallbackAborted;
|
||||
#endif
|
||||
|
||||
if ((ErrorCode = Pipe_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
*(DataStream++) = Pipe_Read_Byte();
|
||||
case 7: *(DataStream++) = Pipe_Read_Byte();
|
||||
case 6: *(DataStream++) = Pipe_Read_Byte();
|
||||
case 5: *(DataStream++) = Pipe_Read_Byte();
|
||||
case 4: *(DataStream++) = Pipe_Read_Byte();
|
||||
case 3: *(DataStream++) = Pipe_Read_Byte();
|
||||
case 2: *(DataStream++) = Pipe_Read_Byte();
|
||||
case 1: *(DataStream++) = Pipe_Read_Byte();
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (Length)
|
||||
{
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
|
|
@ -271,6 +431,46 @@ uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length
|
|||
if ((ErrorCode = Pipe_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
|
||||
#if defined(FAST_STREAM_TRANSFERS)
|
||||
uint8_t BytesRemToAlignment = (Pipe_BytesInPipe() & 0x07);
|
||||
|
||||
if (Length >= 8)
|
||||
{
|
||||
Length -= BytesRemToAlignment;
|
||||
|
||||
switch (BytesRemToAlignment)
|
||||
{
|
||||
default:
|
||||
do
|
||||
{
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
{
|
||||
Pipe_ClearIN();
|
||||
|
||||
#if !defined(NO_STREAM_CALLBACKS)
|
||||
if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
|
||||
return PIPE_RWSTREAM_CallbackAborted;
|
||||
#endif
|
||||
|
||||
if ((ErrorCode = Pipe_WaitUntilReady()))
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
Length -= 8;
|
||||
|
||||
*(DataStream--) = Pipe_Read_Byte();
|
||||
case 7: *(DataStream--) = Pipe_Read_Byte();
|
||||
case 6: *(DataStream--) = Pipe_Read_Byte();
|
||||
case 5: *(DataStream--) = Pipe_Read_Byte();
|
||||
case 4: *(DataStream--) = Pipe_Read_Byte();
|
||||
case 3: *(DataStream--) = Pipe_Read_Byte();
|
||||
case 2: *(DataStream--) = Pipe_Read_Byte();
|
||||
case 1: *(DataStream--) = Pipe_Read_Byte();
|
||||
} while (Length >= 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (Length)
|
||||
{
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
|
|
|
|||
|
|
@ -187,13 +187,13 @@
|
|||
/** Selects the given pipe number. Any pipe operations which do not require the pipe number to be
|
||||
* indicated will operate on the currently selected pipe.
|
||||
*
|
||||
* \param PipeNumber Index of the pipe to select
|
||||
* \param[in] PipeNumber Index of the pipe to select
|
||||
*/
|
||||
static inline void Pipe_SelectPipe(uint8_t PipeNumber);
|
||||
|
||||
/** Resets the desired pipe, including the pipe banks and flags.
|
||||
*
|
||||
* \param PipeNumber Index of the pipe to reset
|
||||
* \param[in] PipeNumber Index of the pipe to reset
|
||||
*/
|
||||
static inline void Pipe_ResetPipe(uint8_t PipeNumber);
|
||||
|
||||
|
|
@ -226,7 +226,7 @@
|
|||
* control requests, or on regular pipes to allow for half-duplex bidirectional data transfer to devices
|
||||
* which have two endpoints of opposite direction sharing the same endpoint address within the device.
|
||||
*
|
||||
* \param Token New pipe token to set the selected pipe to, as a PIPE_TOKEN_* mask
|
||||
* \param[in] Token New pipe token to set the selected pipe to, as a PIPE_TOKEN_* mask
|
||||
*/
|
||||
static inline void Pipe_SetPipeToken(uint8_t Token);
|
||||
|
||||
|
|
@ -236,7 +236,7 @@
|
|||
/** Configures the currently selected pipe to only allow the specified number of IN requests to be
|
||||
* accepted by the pipe before it is automatically frozen.
|
||||
*
|
||||
* \param TotalINRequests Total number of IN requests that the pipe may receive before freezing
|
||||
* \param[in] TotalINRequests Total number of IN requests that the pipe may receive before freezing
|
||||
*/
|
||||
static inline void Pipe_SetFiniteINRequests(uint8_t TotalINRequests);
|
||||
|
||||
|
|
@ -248,7 +248,7 @@
|
|||
|
||||
/** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds.
|
||||
*
|
||||
* \param Milliseconds Number of milliseconds between each pipe poll
|
||||
* \param[in] Milliseconds Number of milliseconds between each pipe poll
|
||||
*/
|
||||
static inline void Pipe_SetInterruptPeriod(uint8_t Milliseconds);
|
||||
|
||||
|
|
@ -262,7 +262,7 @@
|
|||
/** Determines if the specified pipe number has interrupted (valid only for INTERRUPT type
|
||||
* pipes).
|
||||
*
|
||||
* \param PipeNumber Index of the pipe whose interrupt flag should be tested
|
||||
* \param[in] PipeNumber Index of the pipe whose interrupt flag should be tested
|
||||
*
|
||||
* \return Boolean true if the specified pipe has interrupted, false otherwise
|
||||
*/
|
||||
|
|
@ -516,7 +516,7 @@
|
|||
*
|
||||
* \ingroup Group_PipeRW
|
||||
*
|
||||
* \param Byte Next byte to write into the the currently selected pipe's FIFO buffer
|
||||
* \param[in] Byte Next byte to write into the the currently selected pipe's FIFO buffer
|
||||
*/
|
||||
static inline void Pipe_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
|
||||
static inline void Pipe_Write_Byte(const uint8_t Byte)
|
||||
|
|
@ -577,7 +577,7 @@
|
|||
*
|
||||
* \ingroup Group_PipeRW
|
||||
*
|
||||
* \param Word Next word to write to the currently selected pipe's FIFO buffer
|
||||
* \param[in] Word Next word to write to the currently selected pipe's FIFO buffer
|
||||
*/
|
||||
static inline void Pipe_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;
|
||||
static inline void Pipe_Write_Word_LE(const uint16_t Word)
|
||||
|
|
@ -591,7 +591,7 @@
|
|||
*
|
||||
* \ingroup Group_PipeRW
|
||||
*
|
||||
* \param Word Next word to write to the currently selected pipe's FIFO buffer
|
||||
* \param[in] Word Next word to write to the currently selected pipe's FIFO buffer
|
||||
*/
|
||||
static inline void Pipe_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;
|
||||
static inline void Pipe_Write_Word_BE(const uint16_t Word)
|
||||
|
|
@ -666,7 +666,7 @@
|
|||
*
|
||||
* \ingroup Group_PipeRW
|
||||
*
|
||||
* \param DWord Next double word to write to the currently selected pipe's FIFO buffer
|
||||
* \param[in] DWord Next double word to write to the currently selected pipe's FIFO buffer
|
||||
*/
|
||||
static inline void Pipe_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
|
||||
static inline void Pipe_Write_DWord_LE(const uint32_t DWord)
|
||||
|
|
@ -680,7 +680,7 @@
|
|||
*
|
||||
* \ingroup Group_PipeRW
|
||||
*
|
||||
* \param DWord Next double word to write to the currently selected pipe's FIFO buffer
|
||||
* \param[in] DWord Next double word to write to the currently selected pipe's FIFO buffer
|
||||
*/
|
||||
static inline void Pipe_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;
|
||||
static inline void Pipe_Write_DWord_BE(const uint32_t DWord)
|
||||
|
|
@ -771,9 +771,9 @@
|
|||
*
|
||||
* \ingroup Group_PipeRW
|
||||
*
|
||||
* \param Buffer Pointer to the source data buffer to read from.
|
||||
* \param Length Number of bytes to read for the currently selected pipe into the buffer.
|
||||
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
* \param[in] Buffer Pointer to the source data buffer to read from.
|
||||
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
|
||||
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
*
|
||||
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -798,9 +798,9 @@
|
|||
*
|
||||
* \ingroup Group_PipeRW
|
||||
*
|
||||
* \param Buffer Pointer to the source data buffer to read from.
|
||||
* \param Length Number of bytes to read for the currently selected pipe into the buffer.
|
||||
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
* \param[in] Buffer Pointer to the source data buffer to read from.
|
||||
* \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
|
||||
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
*
|
||||
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -825,8 +825,8 @@
|
|||
*
|
||||
* \ingroup Group_PipeRW
|
||||
*
|
||||
* \param Length Number of bytes to send via the currently selected pipe.
|
||||
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
* \param[in] Length Number of bytes to send via the currently selected pipe.
|
||||
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
*
|
||||
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -851,9 +851,9 @@
|
|||
*
|
||||
* \ingroup Group_PipeRW
|
||||
*
|
||||
* \param Buffer Pointer to the source data buffer to write to.
|
||||
* \param Length Number of bytes to read for the currently selected pipe to read from.
|
||||
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
* \param[out] Buffer Pointer to the source data buffer to write to.
|
||||
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
|
||||
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
*
|
||||
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
@ -878,9 +878,9 @@
|
|||
*
|
||||
* \ingroup Group_PipeRW
|
||||
*
|
||||
* \param Buffer Pointer to the source data buffer to write to.
|
||||
* \param Length Number of bytes to read for the currently selected pipe to read from.
|
||||
* \param Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
* \param[out] Buffer Pointer to the source data buffer to write to.
|
||||
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
|
||||
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
|
||||
*
|
||||
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue