X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/cb779e3d7d32d7c43e0a45bb526de0a04135b0c7..46f2e488b0508d12be63b14213b8e0499eb01fc0:/LUFA/Drivers/USB/LowLevel/Pipe.h diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h index 62d0935dc..0e877f623 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.h +++ b/LUFA/Drivers/USB/LowLevel/Pipe.h @@ -98,6 +98,8 @@ /* Public Interface - May be used in end-application: */ /* Macros: */ + /** \name Pipe Error Flag Masks */ + //@{ /** Mask for \ref Pipe_GetErrorFlags(), indicating that an overflow error occurred in the pipe on the received data. */ #define PIPE_ERRORFLAG_OVERFLOW (1 << 6) @@ -118,7 +120,10 @@ /** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware data toggle error occurred in the pipe. */ #define PIPE_ERRORFLAG_DATATGL (1 << 0) + //@} + /** \name Pipe Token Masks */ + //@{ /** Token mask for \ref Pipe_ConfigurePipe(). This sets the pipe as a SETUP token (for CONTROL type pipes), * which will trigger a control request on the attached device when data is written to the pipe. */ @@ -133,7 +138,10 @@ * indicating that the pipe data will flow from host to device. */ #define PIPE_TOKEN_OUT (2 << PTOKEN0) - + //@} + + /** \name Pipe Bank Mode Masks */ + //@{ /** Mask for the bank mode selection for the \ref Pipe_ConfigurePipe() macro. This indicates that the pipe * should have one single bank, which requires less USB FIFO memory but results in slower transfers as * only one USB device (the AVR or the attached device) can access the pipe's bank at the one time. @@ -146,7 +154,8 @@ * bank. */ #define PIPE_BANK_DOUBLE (1 << EPBK0) - + //@} + /** Pipe address for the default control pipe, which always resides in address 0. This is * defined for convenience to give more readable code when used with the pipe macros. */ @@ -443,6 +452,19 @@ PIPE_ERRORFLAG_DATATGL)) | (UPSTAX & (PIPE_ERRORFLAG_OVERFLOW | PIPE_ERRORFLAG_UNDERFLOW))); } + + /** Retrieves the number of busy banks in the currently selected pipe, which have been queued for + * transmission via the \ref Pipe_ClearOUT() command, or are awaiting acknowledgement via the + * \ref Pipe_ClearIN() command. + * + * \ingroup Group_PipePacketManagement + * + * \return Total number of busy banks in the selected pipe. + */ + static inline uint8_t Pipe_GetBusyBanks(void) + { + return (UPSTAX & (0x03 << NBUSYBK0)); + } /** Determines if the currently selected pipe may be read from (if data is waiting in the pipe * bank and the pipe is an IN direction, or if the bank is not yet full if the pipe is an OUT