taskManager.h

Go to the documentation of this file.
00001 /*************************************************************************/
00021 #ifndef _TASKMANAGER_H
00022 #define _TASKMANAGER_H
00023 #include <inttypes.h>
00024 #include <types.h>
00025 #include <atomic.h>
00026 
00027 // \cond internal
00029 typedef enum
00030 {
00031   MAC_PHY_HWD_TASK_ID = 1 << 0,
00032   HAL_TASK_ID         = 1 << 1,
00033   MAC_HWI_TASK_ID     = 1 << 2,
00034   NWK_TASK_ID         = 1 << 3,
00035   ZDO_TASK_ID         = 1 << 4,
00036   APS_TASK_ID         = 1 << 5,
00037   SSP_TASK_ID         = 1 << 6,
00038   TC_TASK_ID          = 1 << 7,
00039   BSP_TASK_ID         = 1 << 8,
00040   APL_TASK_ID         = 1 << 9,
00041   ZSE_TASK_ID         = 1 << 0xA,
00042 } SYS_TaskId_t;
00043 // \endcond
00044 
00049 extern void APL_TaskHandler(void);
00050 // \cond internal
00052 extern void HAL_TaskHandler(void);
00054 extern void BSP_TaskHandler(void);
00056 extern void MAC_PHY_HWD_TaskHandler(void);
00058 extern void MAC_HWI_TaskHandler(void);
00060 extern void NWK_TaskHandler(void);
00062 extern void ZDO_TaskHandler(void);
00064 extern void APS_TaskHandler(void);
00066 extern void SSP_TaskHandler(void);
00068 extern void TC_TaskHandler(void);
00070 extern void ZSE_TaskHandler(void);
00071 
00072 extern volatile uint16_t SYS_taskFlag;
00073 // \endcond
00074 
00075 /**************************************************************************************/
00080 /*
00081 IDs of the tasks are listed in the SYS_TaskId enum. Each task has its own priority and is called
00082 only if there is no any task with higher priority. A handler is called when respective task can be run.
00083 Each task has its own task handler. Correspondence between tasks and handlers is listed below:  \n
00084 HAL - HAL_TaskHandler()                 \n
00085 BSP - BSP_TaskHandler()                 \n
00086 MAC_PHY_HWD - MAC_PHY_HWD_TaskHandler() \n
00087 MAC_HWI - MAC_HWI_TaskHandler()         \n
00088 NWK - NWK_TaskHandler()                 \n
00089 ZDO - ZDO_TaskHandler()                 \n
00090 APS - APS_TaskHandler()                 \n
00091 APL - APL_TaskHandler()                 \n
00092 */
00093 INLINE void SYS_PostTask(SYS_TaskId_t taskId)
00094 {
00095   ATOMIC_SECTION_ENTER
00096    SYS_taskFlag |= taskId;
00097   ATOMIC_SECTION_LEAVE
00098 }
00099 
00100 //\cond internal
00101 /**************************************************************************************/
00104 bool SYS_RunTask();
00105 
00106 /**************************************************************************************//*
00107  \brief To force runTask to help making sync calls
00108 ******************************************************************************************/
00109 void SYS_ForceRunTask();
00110 // \endcond
00111 
00112 #endif

Generated on Mon Feb 16 17:53:40 2009 for BitCloud Stack Documentation by  doxygen 1.5.1-p1