Paste: Proposed task structure

Author: Sam
Mode: c
Date: Wed, 29 Apr 2009 15:38:35
Plain Text |
#define TASK(name_handle, stack_size)                               \
 static struct {                                                    \
   // Common task fields there as expected by the scheduler         \
   ...                                                              \
   ...                                                              \
   // Stack                                                         \
   portBASE_TYPE stack[stack_size];                                 \
   portBASE_TYPE end_of_stack[0];                                   \
 } name_handle # _STATIC;                                           \
 xTaskHandle name_handle = (xTaskHandle *) &name_handle # _STATIC

#define xTaskRegister(name_handle, pvTaskCode, pcName, pvParameters, uxPriority) \
  prvTaskRegister(name_handle,                                                   \
                  &name_handle # _STATIC.stack,                                  \
                  &name_handle # _STATIC.end_of_stack,                           \
                  pvTaskCode, pcName, pvParameters, uxPriority)

New Annotation

Summary:
Author:
Mode:
Body: