X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/4a8ac5e474741f14492597880e751b3f806cb965..3bd4011c0935e0d41af3ae59c69eec989cc53bbf:/LUFA/Drivers/USB/LowLevel/Pipe.h diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h index f3da9d1ce..30e0fde90 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.h +++ b/LUFA/Drivers/USB/LowLevel/Pipe.h @@ -77,6 +77,12 @@ /* Public Interface - May be used in end-application: */ /* Macros: */ + /** Mask for \ref Pipe_GetErrorFlags(), indicating that an overflow error occurred in the pipe on the received data. */ + #define PIPE_ERRORFLAG_OVERFLOW (1 << 6) + + /** Mask for \ref Pipe_GetErrorFlags(), indicating that an underflow error occurred in the pipe on the received data. */ + #define PIPE_ERRORFLAG_UNDERFLOW (1 << 5) + /** Mask for \ref Pipe_GetErrorFlags(), indicating that a CRC error occurred in the pipe on the received data. */ #define PIPE_ERRORFLAG_CRC16 (1 << 4) @@ -213,7 +219,7 @@ * * \return The current pipe token, as a PIPE_TOKEN_* mask */ - static inline uint8_t Pipe_GetCurrentToken(void); + static inline uint8_t Pipe_GetPipeToken(void); /** Sets the token for the currently selected pipe to one of the tokens specified by the PIPE_TOKEN_* * masks. This can be used on CONTROL type pipes, to allow for bidirectional transfer of data during @@ -426,7 +432,10 @@ #define Pipe_ClearErrorFlags() MACROS{ UPERRX = 0; }MACROE - #define Pipe_GetErrorFlags() UPERRX + #define Pipe_GetErrorFlags() ((UPERRX & (PIPE_ERRORFLAG_CRC16 | PIPE_ERRORFLAG_TIMEOUT | \ + PIPE_ERRORFLAG_PID | PIPE_ERRORFLAG_DATAPID | \ + PIPE_ERRORFLAG_DATATGL)) | \ + (UPSTAX & PIPE_ERRORFLAG_OVERFLOW | PIPE_ERRORFLAG_UNDERFLOW)) #define Pipe_IsReadWriteAllowed() ((UPINTX & (1 << RWAL)) ? true : false) @@ -721,7 +730,11 @@ * * The banking mode may be either \ref PIPE_BANK_SINGLE or \ref PIPE_BANK_DOUBLE. * - * A newly configured pipe is frozen by default, and must be unfrozen before use via the \ref Pipe_Unfreeze() macro. + * A newly configured pipe is frozen by default, and must be unfrozen before use via the \ref Pipe_Unfreeze() + * before being used. Pipes should be kept frozen unless waiting for data from a device while in IN mode, or + * sending data to the device in OUT mode. IN type pipes are also automatically configured to accept infinite + * numbers of IN requests without automatic freezing - this can be overridden by a call to + * \ref Pipe_SetFiniteINRequests(). * * \note The default control pipe does not have to be manually configured, as it is automatically * configured by the library internally. @@ -753,6 +766,9 @@ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are * disabled and this function has the Callback parameter omitted. * + * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * * \ingroup Group_PipeRW * * \param Buffer Pointer to the source data buffer to read from. @@ -777,6 +793,9 @@ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are * disabled and this function has the Callback parameter omitted. * + * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * * \ingroup Group_PipeRW * * \param Buffer Pointer to the source data buffer to read from. @@ -801,6 +820,9 @@ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are * disabled and this function has the Callback parameter omitted. * + * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * * \ingroup Group_PipeRW * * \param Length Number of bytes to send via the currently selected pipe. @@ -824,6 +846,9 @@ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are * disabled and this function has the Callback parameter omitted. * + * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * * \ingroup Group_PipeRW * * \param Buffer Pointer to the source data buffer to write to. @@ -848,6 +873,9 @@ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are * disabled and this function has the Callback parameter omitted. * + * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without + * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). + * * \ingroup Group_PipeRW * * \param Buffer Pointer to the source data buffer to write to.