X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c..2a0c28e6e47c8a173f32fc99cd8666a2633c5c12:/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h?ds=inline diff --git a/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h b/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h index 300a3f217..0d432e72f 100644 --- a/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h +++ b/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h @@ -27,18 +27,13 @@ arising out of or in connection with the use or performance of this software. */ - -/** \file - * - * Macros and enums for the stream callback routines in Endpoint.h and Pipe.c. This module contains the - * code required to easily set up stream callback functions which can be used to force early abort of a - * stream read/write process. - */ /** \ingroup Group_USB * @defgroup Group_StreamCallbacks Endpoint and Pipe Stream Callbacks * - * Functions, macros, variables, enums and types related to endpoint and pipe stream callback functions. + * Macros and enums for the stream callback routines. This module contains the code required to easily set up + * stream callback functions which can be used to force early abort of a stream read/write process. Each callback + * should take no arguments, and return a value from the \ref StreamCallback_Return_ErrorCodes_t enum. * * @{ */ @@ -48,37 +43,6 @@ /* Public Interface - May be used in end-application: */ /* Macros: */ - /** Creates a prototype for or begins a stream callback routine. Stream callback routines are small - * routines which are executed during stream read or writes (if the callback-enabled versions of - * these functions are used) which allow the user application to abort the transfer when certain - * arbitrary conditions are met. - * - * Stream callback functions should return a value from the StreamCallback_Return_ErrorCodes_t - * enum. - * - * Usage Example (Device Endpoint, but applicable for Host Pipes also): - * \code - * STREAM_CALLBACK(GlobalNotSet); // Callback Prototype - * - * STREAM_CALLBACK(GlobalNotSet) - * { - * if (MyGlobal == false) - * return ENDPOINT_STREAMCALLBACK_Continue; - * else - * return ENDPOINT_STREAMCALLBACK_Abort; - * } - * - * //... - * // Inside some routine: - * if (Endpoint_Write_Stream_LE(DataBuffer, sizeof(DataBuffer), GlobalNotSet) == - * ENDPOINT_RWSTREAM_ERROR_CallbackAborted) - * { - * // Do something when the callback aborted the transfer early - * } - * \endcode - */ - #define STREAM_CALLBACK(name) uint8_t name (void) - /** Used with the Endpoint and Pipe stream functions as the callback function parameter, indicating that the stream * call has no callback function to be called between USB packets. */ @@ -91,7 +55,14 @@ STREAMCALLBACK_Continue = 0, /**< Continue sending or receiving the stream. */ STREAMCALLBACK_Abort = 1, /**< Abort the stream send or receiving process. */ }; - + + /* Type Defines: */ + /** Type define for a Stream Callback function (function taking no arguments and retuning a + * uint8_t value). Stream callback functions should have an identical function signature if they + * are to be used as the callback parameter of the stream functions. + */ + typedef uint8_t (* const StreamCallbackPtr_t)(void); + #endif /** @} */