StreamCallbacks.h File Reference


Defines

#define STREAM_CALLBACK(name)   uint8_t name (void)
#define NO_STREAM_CALLBACK   NULL

Enumerations

enum  StreamCallback_Return_ErrorCodes_t {
  STREAMCALLBACK_Continue = 0,
  STREAMCALLBACK_Abort = 1
}

Detailed Description

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.

Define Documentation

#define NO_STREAM_CALLBACK   NULL

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.

#define STREAM_CALLBACK ( name   )     uint8_t name (void)

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):

  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_CStream_LE(DataBuffer, sizeof(DataBuffer), GlobalNotSet) == 
                                ENDPOINT_RWSTREAM_ERROR_CallbackAborted)
  {
      // Do something when the callback aborted the transfer early
  }


Enumeration Type Documentation

Enum for the possible error return codes of a stream callback function

Enumerator:
STREAMCALLBACK_Continue  Continue sending or receiving the stream.
STREAMCALLBACK_Abort  Abort the stream send or reciving process.


Generated on Thu Oct 2 18:01:18 2008 for MyUSB Library by  doxygen 1.5.5