uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
croutine.h File Reference
#include "list.h"

Go to the source code of this file.

Classes

struct  corCoRoutineControlBlock
 

Macros

#define crSTART(pxCRCB)   switch( ( ( corCRCB * )( pxCRCB ) )->uxState ) { case 0:
 
#define crEND()   }
 
#define crSET_STATE0(xHandle)   ( ( corCRCB * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):
 
#define crSET_STATE1(xHandle)   ( ( corCRCB * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):
 
#define crDELAY(xHandle, xTicksToDelay)
 
#define crQUEUE_SEND(xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult)
 
#define crQUEUE_RECEIVE(xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult)
 
#define crQUEUE_SEND_FROM_ISR(pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken)   xQueueCRSendFromISR( ( pxQueue ), ( pvItemToQueue ), ( xCoRoutinePreviouslyWoken ) )
 
#define crQUEUE_RECEIVE_FROM_ISR(pxQueue, pvBuffer, pxCoRoutineWoken)   xQueueCRReceiveFromISR( ( pxQueue ), ( pvBuffer ), ( pxCoRoutineWoken ) )
 

Typedefs

typedef void * xCoRoutineHandle
 
typedef void(* crCOROUTINE_CODE )(xCoRoutineHandle, unsigned portBASE_TYPE)
 
typedef struct
corCoRoutineControlBlock 
corCRCB
 

Functions

signed portBASE_TYPE xCoRoutineCreate (crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex)
 
void vCoRoutineSchedule (void)
 
void vCoRoutineAddToDelayedList (portTickType xTicksToDelay, xList *pxEventList)
 
signed portBASE_TYPE xCoRoutineRemoveFromEventList (const xList *pxEventList)
 

Macro Definition Documentation

#define crDELAY (   xHandle,
  xTicksToDelay 
)
Value:
if( ( xTicksToDelay ) > 0 ) \
{ \
vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL ); \
} \
crSET_STATE0( ( xHandle ) );

Definition at line 328 of file croutine.h.

#define crEND ( )    }

Definition at line 273 of file croutine.h.

#define crQUEUE_RECEIVE (   xHandle,
  pxQueue,
  pvBuffer,
  xTicksToWait,
  pxResult 
)
Value:
{ \
*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), ( xTicksToWait ) ); \
if( *( pxResult ) == errQUEUE_BLOCKED ) \
{ \
crSET_STATE0( ( xHandle ) ); \
*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), 0 ); \
} \
if( *( pxResult ) == errQUEUE_YIELD ) \
{ \
crSET_STATE1( ( xHandle ) ); \
*( pxResult ) = pdPASS; \
} \
}

Definition at line 510 of file croutine.h.

#define crQUEUE_RECEIVE_FROM_ISR (   pxQueue,
  pvBuffer,
  pxCoRoutineWoken 
)    xQueueCRReceiveFromISR( ( pxQueue ), ( pvBuffer ), ( pxCoRoutineWoken ) )

Definition at line 732 of file croutine.h.

#define crQUEUE_SEND (   xHandle,
  pxQueue,
  pvItemToQueue,
  xTicksToWait,
  pxResult 
)
Value:
{ \
*( pxResult ) = xQueueCRSend( ( pxQueue) , ( pvItemToQueue) , ( xTicksToWait ) ); \
if( *( pxResult ) == errQUEUE_BLOCKED ) \
{ \
crSET_STATE0( ( xHandle ) ); \
*pxResult = xQueueCRSend( ( pxQueue ), ( pvItemToQueue ), 0 ); \
} \
if( *pxResult == errQUEUE_YIELD ) \
{ \
crSET_STATE1( ( xHandle ) ); \
*pxResult = pdPASS; \
} \
}

Definition at line 418 of file croutine.h.

#define crQUEUE_SEND_FROM_ISR (   pxQueue,
  pvItemToQueue,
  xCoRoutinePreviouslyWoken 
)    xQueueCRSendFromISR( ( pxQueue ), ( pvItemToQueue ), ( xCoRoutinePreviouslyWoken ) )

Definition at line 619 of file croutine.h.

#define crSET_STATE0 (   xHandle)    ( ( corCRCB * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):

Definition at line 279 of file croutine.h.

#define crSET_STATE1 (   xHandle)    ( ( corCRCB * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):

Definition at line 280 of file croutine.h.

#define crSTART (   pxCRCB)    switch( ( ( corCRCB * )( pxCRCB ) )->uxState ) { case 0:

Definition at line 242 of file croutine.h.

Typedef Documentation

typedef void(* crCOROUTINE_CODE)(xCoRoutineHandle, unsigned portBASE_TYPE)

Definition at line 85 of file croutine.h.

typedef void* xCoRoutineHandle

Definition at line 82 of file croutine.h.

Function Documentation

void vCoRoutineAddToDelayedList ( portTickType  xTicksToDelay,
xList pxEventList 
)

Definition at line 194 of file croutine.c.

void vCoRoutineSchedule ( void  )

Definition at line 313 of file croutine.c.

signed portBASE_TYPE xCoRoutineCreate ( crCOROUTINE_CODE  pxCoRoutineCode,
unsigned portBASE_TYPE  uxPriority,
unsigned portBASE_TYPE  uxIndex 
)

Definition at line 137 of file croutine.c.

signed portBASE_TYPE xCoRoutineRemoveFromEventList ( const xList pxEventList)

Definition at line 363 of file croutine.c.