X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/2ee9fc707784e115d744dbc229bdc893f4bb6bc1..3bd4011c0935e0d41af3ae59c69eec989cc53bbf:/LUFA/Drivers/USB/LowLevel/Pipe.h diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h index befc996a2..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) @@ -709,7 +718,8 @@ /* Function Prototypes: */ /** Configures the specified pipe number with the given pipe type, token, target endpoint number in the * attached device, bank size and banking mode. Pipes should be allocated in ascending order by their - * address in the device (i.e. pipe 1 should be configured before pipe 2 and so on). + * address in the device (i.e. pipe 1 should be configured before pipe 2 and so on) to prevent fragmentation + * of the USB FIFO memory. * * The pipe type may be one of the EP_TYPE_* macros listed in LowLevel.h, the token may be one of the * PIPE_TOKEN_* masks. @@ -720,7 +730,14 @@ * * 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. * * \note This routine will select the specified pipe, and the pipe will remain selected once the * routine completes regardless of if the pipe configuration succeeds. @@ -749,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. @@ -773,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. @@ -797,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. @@ -820,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. @@ -844,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.