X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/73d9fafc0fe42741ad8f609dd4762e2bc14cbd01..abc7dce10c03bcbc9659e1a9643cec30c465867d:/LUFA/Drivers/USB/LowLevel/Pipe.h diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h index 363b9fd93..b6fad5146 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.h +++ b/LUFA/Drivers/USB/LowLevel/Pipe.h @@ -173,12 +173,7 @@ /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's * numerical address in the attached device. */ - #define PIPE_EPNUM_MASK 0x07 - - /** Endpoint bank size mask, for masking against endpoint addresses to retrieve the endpoint's - * bank size in the attached device. - */ - #define PIPE_EPSIZE_MASK 0x7FF + #define PIPE_EPNUM_MASK 0x0F /* Pseudo-Function Macros: */ #if defined(__DOXYGEN__) @@ -262,6 +257,13 @@ */ static inline bool Pipe_IsConfigured(void); + /** Retrieves the endpoint number of the endpoint within the attached device that the currently selected + * pipe is bound to. + * + * \return Endpoint number the currently selected pipe is bound to + */ + static inline uint8_t Pipe_BoundEndpointNumber(void); + /** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds. * * \param[in] Milliseconds Number of milliseconds between each pipe poll @@ -432,6 +434,8 @@ #define Pipe_IsConfigured() ((UPSTAX & (1 << CFGOK)) ? true : false) + #define Pipe_BoundEndpointNumber() ((UPCFG0X >> PEPNUM0) & PIPE_EPNUM_MASK) + #define Pipe_SetInterruptPeriod(ms) MACROS{ UPCFG2X = ms; }MACROE #define Pipe_GetPipeInterrupts() UPINT @@ -769,14 +773,23 @@ bool Pipe_ConfigurePipe(const uint8_t Number, const uint8_t Type, const uint8_t Token, const uint8_t EndpointNumber, const uint16_t Size, const uint8_t Banks); - /** Spinloops until the currently selected non-control pipe is ready for the next packed of data - * to be read or written to it. + /** Spinloops until the currently selected non-control pipe is ready for the next packed of data to be read + * or written to it, aborting in the case of an error condition (such as a timeout or device disconnect). * * \ingroup Group_PipeRW * * \return A value from the Pipe_WaitUntilReady_ErrorCodes_t enum. */ - uint8_t Pipe_WaitUntilReady(void); + uint8_t Pipe_WaitUntilReady(void); + + /** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given + * endpoint is found, it is automatically selected. + * + * \param EndpointAddress Address of the endpoint within the attached device to check + * + * \return Boolean true if a pipe bound to the given endpoint address is found, false otherwise + */ + bool Pipe_IsEndpointBound(uint8_t EndpointAddress); /** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host * as needed. The last packet is not automatically discarded once the remaining bytes has been read; the @@ -821,7 +834,7 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_Stream_LE(const void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Write_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE. * @@ -833,7 +846,7 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_EStream_LE(const void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Write_EStream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** FLASH buffer source version of \ref Pipe_Write_Stream_LE. * @@ -847,7 +860,7 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_PStream_LE(const void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Write_PStream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** Writes the given number of bytes to the pipe from the given buffer in big endian, * sending full packets to the device as needed. The last packet filled is not automatically sent; @@ -870,7 +883,7 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_Stream_BE(const void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Write_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE. * @@ -882,7 +895,7 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_EStream_BE(const void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Write_EStream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** FLASH buffer source version of \ref Pipe_Write_Stream_BE. * @@ -896,7 +909,7 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_PStream_BE(const void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Write_PStream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** Reads the given number of bytes from the pipe into the given buffer in little endian, * sending full packets to the device as needed. The last packet filled is not automatically sent;