taskLib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:22k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* taskLib.h - generic kernel interface header */
  2. /* Copyright 1984-2002 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 04t,16jan02,to   add fpStatus to TCB for ARM
  7. 04s,19nov01,aeg  added td_events to TASK_DESC.
  8. 04r,09nov01,jhw  Revert WDB_INFO to reside inside WIND_TCB.
  9. 04q,06nov01,gls  cleaned up compilation warnings
  10. 04p,06nov01,dee  fix offsets in coldfire specific portion
  11.  for EXC_INFO and REG_SET per sh-coldfire.tcl
  12. 04o,30oct01,jhw  Removed wdbInfo and wdbExitHook from WIND_TCB.
  13.     gsl  Reused wdbExitHook for pPthread.
  14. 04n,22oct01,dee  Merge from T2.1.0 ColdFire
  15. 04m,04oct01,yvp  Fix SPR69306: added member pCoprocCtx to PPC section for 
  16.                  Altivec support.
  17. 04l,27sep01,aeg  changed comment on WIND_TCB reservedX fields.
  18. 04k,24sep01,s_l  Fixed a systax error on line "UINT32 regSetPad[2]" missing ';'
  19. 04j,18sep01,aeg  deleted selectSem, pad1, & pSelWakeupNode from WIND_TCB,
  20.  and added pSelContext, events, pWdbTaskInfo, & wdbExitHook;
  21.  added code barriers to TASK_LOCK and TASK_SAFE macros.
  22. 04i,01mar00,frf  Add SH4 support for T2.
  23. 04e,10sep98,kab  expanded WDB_INFO struct to match TOR2.x., moved pDspContext
  24.  to end of TCB, replaced spare4.
  25. 04d,22jul98,mem  added pDspContext to TCB, removed spare4. Added VX_DSP_TASK.
  26. 04c,23apr97,hk   added SH support.
  27. 04i,14mar01,pcs  Added VX_ALTIVEC_TASK.
  28. 04h,12mar99,dbs  add COM task-local storage to TCB
  29. 04g,29may98,cym  added windowsContextValid flag for SIMNT.
  30. 04f,24apr98,kkk  moved wdbInfo after ARM stuff in TCB. (bug created by merge)
  31. 04e,19aug97,cym  added SIMNT support.
  32. 04d,28nov96,cdp  added ARM support.
  33. 04c,06nov97,dbt  modified WIND_TCB for new debugger scheme. Removed Am29K 
  34.  family support.
  35. 04b,22jul96,jmb  merge ease patch for HP Sim
  36. 04a,26may94,yao  added PPC support.
  37. 03z,26may95,ms  added wdbExitHook field to the TCB
  38. 03y,16may95,rrr  add WDB_INFO structure to TCB.
  39. 03y,12jul95,ism  added simsolaris support
  40. 03x,19mar95,dvs  removed #ifdef TRON - tron no longer supported.
  41. 03w,15mar94,smb  modified TASK_SAFE macro
  42. 03v,24jan94,smb  added instrumentation macros
  43. 03u,10dec93,smb  instrumented TASK_LOCK macro
  44. 03t,02dec93,pme  added Am29K family support
  45. 03s,12nov93,hdn  added support for I80X86
  46. 03r,15oct93,cd   removed junk values from MIPS TCB.
  47. 03q,16sep93,jmm  added S_taskLib_ILLEGAL_PRIORITY and taskPriRangeCheck
  48. 03p,11aug93,gae  vxsim hppa.
  49. 03o,20jun93,rrr  vxsim.
  50. 03m,11feb93,jcf  added __PROTOTYPE_5_0 for compatibility.
  51. 03l,08feb93,smb  added a null check to taskIdVerify.
  52. 03k,13nov92,dnw  changed declaration of pSmObjTcb to struct sm_obj_tcb *
  53.  removed include of smObjTcbP.h (SPR #1768)
  54.  moved typedef of DBG_INFO here from dbgLib.h
  55.  removed include of dbgLib.h (SPR #1768)
  56. 03j,22sep92,rrr  added support for c++
  57. 03i,21sep92,smb  removed exit prototype and added include of stdlib.h
  58. 03h,02aug92,jcf  changed reserved3 field to pExcRegSet for exception handling.
  59. 03g,29jul92,smb  made modification for the stdio library.
  60. 03f,28jul92,jcf  added windxLock/reserved[12]; moved dbgInfo/pSmTcbObj;
  61.  removed funcRestart.
  62. 03e,12jul92,yao  replace pDbgState pointer with data structure DBG_INFO
  63.  in WIND_TCB.  added dbgPCWSave to i960.
  64. 03d,19jul92,pme  added shared memory objects support.
  65. 03c,10jul92,jwt  moved padding out of REG_SET in into WIND_TCB for SPARC.
  66. 03b,06jul92,ajm  removed taskSummary from forward declarations
  67. 03a,04jul92,jcf  cleaned up.
  68. 02y,16jun92,yao  made pDbgState available for all architectures.
  69. 02x,26may92,rrr  the tree shuffle
  70.   -changed includes to have absolute path from h/
  71. 02w,19mar92,yao  added ANSI prototype for taskStackAllot().
  72. 02v,12mar92,yao  removed ifdef CPU.  added taskRegsShow().
  73. 02u,10jan92,jwt  added CPU_FAMILY==SPARC architecture dependent prototypes.
  74. 02t,11nov91,rrr  Added funcRestart to tcb for signals.
  75. 02s,28oct91,wmd  Added changes for i960KB from Intel.
  76. 02r,04oct91,rrr  passed through the ansification filter
  77.   -fixed #else and #endif
  78.   -changed VOID to void
  79.   -changed ASMLANGUAGE to _ASMLANGUAGE
  80.   -changed copyright notice
  81. 02q,20sep91,hdn  deleted foroff from WIND_TCB for TRON.
  82.  added pDbgState to WIND_TCB for TRON.
  83. 02p,20aug91,ajm  made architecture independant.
  84. 01o,10jun91,del  added pragma for gnu960 alignment.
  85. 01n,23may91,wmd  added defines and macros for SPARC architecture.
  86. 01m,29apr91,hdn  added defines and macros for TRON architecture.
  87. 01l,08apr91,jdi  added NOMANUAL to prevent mangen.
  88. 02k,24mar91,del  added pDbgState for use with new dbgLib. And I960 defines.
  89. 02j,16oct90,shl  made #else ANSI style.
  90. 02i,05oct90,dnw  deleted private functions.
  91.  made taskSpawn, taskInit, taskCreate take var args.
  92. 02h,05oct90,shl  added ANSI function prototypes.
  93.                  made #endif ANSI style.
  94.                  added copyright notice.
  95. 02g,01oct90,jcf  added addtional spares to WIND_TCB.
  96. 02f,03aug90,jcf  moved arch dependent portion of WIND_TCB to end of struct
  97. 02e,13jul90,rdc  added support for environment variables and additional
  98.  select functionality.
  99. 02d,30jun90,jcf  added assembly language defines.
  100. 02c,26jun90,jcf  removed obsolete generic status codes
  101.  changed inheritance protocol.
  102.  changed safetyQSem to a safetyQHead.
  103.  reworked priority mananagement.
  104.  changed topOfStack to endOfStack.
  105. 02b,17may90,rdc  changed select semaphores in tcb to be binary semaphores.
  106. 02a,17apr90,jcf  added error codes.
  107.  changed to wind 2.0.
  108. 01l,16mar90,rdc  added select semaphore to tcbx.
  109. 01k,25may89,gae  added VX_FORTRAN option.
  110. 01j,21apr89,jcf  added KERNEL_{UNINIT,VRTX,PSOS,WIND}.
  111. 01i,07nov88,rdc  added VX_ADA_DEBUG to task options.
  112. 01h,22jun88,dnw  name tweaks.
  113. 01g,30may88,dnw  changed to v4 names.
  114. 01f,28may88,dnw  deleted obsolete status values.
  115.  added EXC_INFO to tcbx.
  116. 01e,18may88,jcf  added psos semaphore head to tcbx.
  117.   extended maximum number of hooks to 10.
  118. 01d,13may88,rdc  added signal info to tcbx.
  119. 01c,28apr88,ecs  added IMPORTs of idle & taskName.
  120. 01b,13apr88,gae  added function declarations; option bit VX_STDIO;
  121.  taskStd[] to TCB extension.
  122. 01a,25jan88,jcf  written by extracting from vxLib.h v02l.
  123. */
  124. #ifndef __INCtaskLibh
  125. #define __INCtaskLibh
  126. #ifdef __cplusplus
  127. extern "C" {
  128. #endif
  129. #include "vxWorks.h"
  130. #include "vwModNum.h"
  131. #include "classLib.h"
  132. #include "qLib.h"
  133. #include "regs.h"
  134. #include "excLib.h"
  135. #include "private/eventP.h"
  136. #include "private/semLibP.h"
  137. #include "private/objLibP.h"
  138. #include "private/eventLibP.h"
  139. #include "stdlib.h"
  140. /* generic status codes */
  141. #define S_taskLib_NAME_NOT_FOUND (M_taskLib | 101)
  142. #define S_taskLib_TASK_HOOK_TABLE_FULL (M_taskLib | 102)
  143. #define S_taskLib_TASK_HOOK_NOT_FOUND (M_taskLib | 103)
  144. #define S_taskLib_TASK_SWAP_HOOK_REFERENCED (M_taskLib | 104)
  145. #define S_taskLib_TASK_SWAP_HOOK_SET (M_taskLib | 105)
  146. #define S_taskLib_TASK_SWAP_HOOK_CLEAR (M_taskLib | 106)
  147. #define S_taskLib_TASK_VAR_NOT_FOUND (M_taskLib | 107)
  148. #define S_taskLib_TASK_UNDELAYED (M_taskLib | 108)
  149. #define S_taskLib_ILLEGAL_PRIORITY (M_taskLib | 109)
  150. /* miscellaneous */
  151. #define MAX_TASK_ARGS 10 /* max args passed to a task */
  152. #define VX_MAX_TASK_SWITCH_RTNS 16 /* max task switch callout routines */
  153. #define VX_MAX_TASK_SWAP_RTNS 16 /* max task swap callout routines */
  154. #define VX_MAX_TASK_DELETE_RTNS 16 /* max task delete callout routines */
  155. #define VX_MAX_TASK_CREATE_RTNS 16 /* max task create callout routines */
  156. /* task option bits */
  157. #define VX_SUPERVISOR_MODE 0x0001 /* OBSOLETE: tasks always in sup mode */
  158. #define VX_UNBREAKABLE    0x0002 /* INTERNAL: breakpoints ignored */
  159. #define VX_DEALLOC_STACK   0x0004 /* INTERNAL: deallocate stack */
  160. #define VX_FP_TASK     0x0008 /* 1 = f-point coprocessor support */
  161. #define VX_STDIO     0x0010 /* OBSOLETE: need not be set for stdio*/
  162. #define VX_ADA_DEBUG     0x0020 /* 1 = VADS debugger support */
  163. #define VX_FORTRAN     0x0040 /* 1 = NKR FORTRAN support */
  164. #define VX_PRIVATE_ENV  0x0080 /* 1 = private environment variables */
  165. #define VX_NO_STACK_FILL 0x0100 /* 1 = avoid stack fill of 0xee */
  166. #define VX_DSP_TASK 0x0200 /* 1 = dsp coprocessor support */
  167. #define VX_ALTIVEC_TASK         0x0400  /* 1 = ALTIVEC coprocessor support */
  168. /* typedefs */
  169. #if CPU_FAMILY==I960
  170. #pragma align 1 /* tell gcc960 not to optimize alignments */
  171. #endif /* CPU_FAMILY==I960 */
  172. #ifndef _ASMLANGUAGE
  173. typedef struct wdb_info /* task debugging state info */
  174.     {
  175.     int wdbState; /* debug state */
  176.     REG_SET * wdbRegisters; /* cause of trace exception */
  177.     struct
  178.         {
  179. void * wdb1;
  180. void * wdb2;
  181. } wdbEvtList; /* dll_t of ptr to breakpoint info */
  182.     int bpAddr; /* address of last breakpoint */
  183. /* encountered */
  184.     int taskBpAddr; /* task breakpoint address */
  185.     int taskPc; /* task program couner */
  186.     int taskFp; /* task frame pointer */
  187.     int taskSp; /* task stack pointer */
  188.     VOIDFUNCPTR wdbExitHook; /* WDB notify routine on task exit */
  189.   } WDB_INFO;
  190. typedef struct windTcb /* WIND_TCB - task control block */
  191.     {
  192.     Q_NODE qNode; /* 0x00: multiway q node: rdy/pend q */
  193.     Q_NODE tickNode; /* 0x10: multiway q node: tick q */
  194.     Q_NODE activeNode; /* 0x20: multiway q node: active q */
  195.     OBJ_CORE objCore; /* 0x30: object management */
  196.     char * name; /* 0x34: pointer to task name */
  197.     int options; /* 0x38: task option bits */
  198.     UINT status; /* 0x3c: status of task */
  199.     UINT priority; /* 0x40: task's current priority */
  200.     UINT priNormal; /* 0x44: task's normal priority */
  201.     UINT priMutexCnt; /* 0x48: nested priority mutex owned */
  202.     struct semaphore * pPriMutex; /* 0x4c: pointer to inheritance mutex */
  203.     UINT lockCnt; /* 0x50: preemption lock count */
  204.     UINT tslice; /* 0x54: current count of time slice */
  205.     UINT16 swapInMask; /* 0x58: task's switch in hooks */
  206.     UINT16 swapOutMask; /* 0x5a: task's switch out hooks */
  207.     Q_HEAD * pPendQ; /* 0x5c: q head pended on (if any) */
  208.     UINT safeCnt; /* 0x60: safe-from-delete count */
  209.     Q_HEAD safetyQHead; /* 0x64: safe-from-delete q head */
  210.     FUNCPTR entry; /* 0x74: entry point of task */
  211.     char * pStackBase; /* 0x78: points to bottom of stack */
  212.     char * pStackLimit; /* 0x7c: points to stack limit */
  213.     char * pStackEnd; /* 0x80: points to init stack limit */
  214.     int errorStatus; /* 0x84: most recent task error */
  215.     int exitCode; /* 0x88: error passed to exit () */
  216.     struct sigtcb * pSignalInfo; /* 0x8c: ptr to signal info for task */
  217.     struct selContext * pSelectContext; /* 0x90: ptr to select info for task */
  218.     UINT taskTicks; /* 0x94: total number of ticks */
  219.     UINT taskIncTicks; /* 0x98: number of ticks in slice */
  220.     struct taskVar * pTaskVar; /* 0x9c: ptr to task variable list */
  221.     struct rpcModList * pRPCModList; /* 0xa0: ptr to rpc module statics */
  222.     struct fpContext * pFpContext; /* 0xa4: fpoint coprocessor context */
  223.     struct __sFILE * taskStdFp[3]; /* 0xa8: stdin,stdout,stderr fps */
  224.     int taskStd[3]; /* 0xb4: stdin,stdout,stderr fds */
  225.     char ** ppEnviron; /* 0xc0: environment var table */
  226.     int                 envTblSize;     /* 0xc4: number of slots in table */
  227.     int                 nEnvVarEntries; /* 0xc8: num env vars used */
  228.     struct sm_obj_tcb * pSmObjTcb; /* 0xcc: shared mem object TCB */
  229.     int windxLock; /* 0xd0: lock for windX */
  230.     void * pComLocal; /* 0xd4: COM task-local storage ptr */
  231.     REG_SET * pExcRegSet; /* 0xd8: exception regSet ptr or NULL */
  232.     EVENTS events; /* 0xdc: event info for the task */
  233.     WDB_INFO * pWdbInfo; /* 0xe8: ptr to WDB info - future use */
  234.     void * pPthread; /* 0xec: ptr to pthread data structs */
  235.     int reserved1; /* 0xf0: possible WRS extension */
  236.     int reserved2; /* 0xf4: possible WRS extension */
  237.     int spare1; /* 0xf8: possible user extension */
  238.     int spare2; /* 0xfc: possible user extension */
  239.     int spare3; /* 0x100: possible user extension */
  240.     int spare4; /* 0x104: possible user extension */
  241.     /* ARCHITECTURE DEPENDENT */
  242. #if (CPU_FAMILY==MC680X0)
  243.     EXC_INFO excInfo; /* 0x108: exception info */
  244.     /* REG_SET must be aligned on a 4 byte boundary */
  245.     REG_SET regs; /* 0x11c: register set */
  246.     UINT16 foroff; /* 0x164: format/offset from frame */
  247.     UINT16 pad2; /* 0x?  : pad format/offset to UINT */
  248. #endif /* CPU_FAMILY==MC680X0 */
  249. #if (CPU_FAMILY==COLDFIRE)
  250.     EXC_INFO excInfo; /* 0x108: exception info */
  251.     REG_SET regs; /* 0x11c: register set */
  252. #endif /* CPU_FAMILY==COLDFIRE */
  253. #if (CPU_FAMILY==MIPS) 
  254.     EXC_INFO excInfo; /* 0x108: exception info */
  255.     /* REG_SET must be aligned on a ?? byte boundary */
  256.     REG_SET regs; /* 0x128: register set */
  257. #endif /* CPU_FAMILY==MIPS */
  258. #if (CPU_FAMILY == PPC)
  259.     EXC_INFO            excInfo;        /* 0x108: exception info */
  260.     UINT                pCoprocCtx;     /* 0x12c: pointer to Coprocessor Ctx */
  261.     /* REG_SET must be aligned on a 16 byte boundary */
  262.     REG_SET             regs;           /* 0x130: register set */
  263. #endif /* (CPU_FAMILY == PPC) */
  264. #if (CPU_FAMILY == SPARC)
  265.     EXC_INFO excInfo; /* 0x0108:  exception info */
  266.     /* REG_SET must be aligned on an 8 byte boundary */
  267.     UINT regSetPad; /* 0x011c:  double-word alignment */
  268.     REG_SET regs; /* 0x0120:  register set */
  269. #endif /* CPU_FAMILY == SPARC */
  270. #if (CPU_FAMILY==SIMSPARCSUNOS || CPU_FAMILY==SIMSPARCSOLARIS)
  271.     EXC_INFO excInfo; /* 0x0108:  exception info */
  272.     /* REG_SET must be aligned on an 8 byte boundary */
  273.     REG_SET regs; /* 0x0128:  register set */
  274. #endif /* CPU_FAMILY==SIMSPARCSUNOS || CPU_FAMILY==SIMSPARCSOLARIS*/
  275. #if (CPU_FAMILY==SIMNT)
  276.     EXC_INFO            excInfo;        /* 0x0108:  exception info */
  277.     /* REG_SET must be aligned on a 4 byte boundary */
  278.     REG_SET             regs;           /* 0x011c:  register set */
  279.     int                 args[MAX_TASK_ARGS];
  280.     HANDLE              windowsThread;
  281.     unsigned int        windowsThreadId;
  282.     CONTEXT             windowsContext;
  283.     unsigned int windowsContextValid;
  284. #endif /* CPU_FAMILY==SIMNT */
  285. #if (CPU_FAMILY==SIMHPPA)
  286.     EXC_INFO          excInfo;        /* 0x0108:  exception info */
  287.     /* REG_SET must be aligned on a ?? byte boundary */
  288.     REG_SET           regs;           /* 0x0268:  public register set */
  289. #endif /* CPU_FAMILY==SIMHPPA */
  290. #if CPU_FAMILY==I960 /* ARCHITECTURE DEPENDENT */
  291.     EXC_INFO excInfo; /* 0x108: exception info */
  292.     /* REG_SET must be aligned on a 16 byte boundary */
  293.     UINT32 pad0[2]; /* 0x128: pad to align REG_SET */
  294.     REG_SET regs; /* 0x130: register set */
  295.     UINT32 dbgPCWSave; /* 0x?: PCW saved for debugger */
  296. #if CPU==I960KB
  297.     UINT8 intResumptionRec[16];
  298. #endif
  299. #endif /* CPU_FAMILY==I960 */
  300. #if (CPU_FAMILY==I80X86)
  301.     EXC_INFO            excInfo;        /* 0x108: exception info */
  302.     /* REG_SET must be aligned on an 8 byte boundary for PENTIUM */
  303.     REG_SET             regs;           /* 0x160: register set */
  304. #endif /* CPU_FAMILY==I80X86 */
  305. #if (CPU_FAMILY==SH)
  306.     EXC_INFO excInfo; /* 0x108: exception info */
  307.     /* REG_SET must be aligned on a 4 byte boundary */
  308.     REG_SET regs; /* 0x11c: register set */
  309. #endif /* CPU_FAMILY==SH */
  310. #if (CPU_FAMILY==ARM)
  311.     EXC_INFO            excInfo;        /* 0x108: exception info */
  312.     UINT32 fpStatus; /* 0x118: fp status word */
  313.     /* REG_SET must be aligned on a 16 byte boundary */
  314.     UINT32 regSetPad; /* 0x11c: register set padding */
  315.     REG_SET             regs;           /* 0x120: register set */
  316. #endif /* CPU_FAMILY==ARM */
  317.     struct dspContext * pDspContext; /* dsp coprocessor context */
  318.     WDB_INFO wdbInfo; /* target debug info */
  319.     } WIND_TCB;
  320. typedef struct  /* TASK_DESC - information structure */
  321.     {
  322.     int td_id; /* task id */
  323.     char * td_name; /* name of task */
  324.     int td_priority; /* task priority */
  325.     int td_status; /* task status */
  326.     int td_options; /* task option bits (see below) */
  327.     FUNCPTR td_entry; /* original entry point of task */
  328.     char * td_sp; /* saved stack pointer */
  329.     char * td_pStackBase; /* the bottom of the stack */
  330.     char * td_pStackLimit; /* the effective end of the stack */
  331.     char * td_pStackEnd; /* the actual end of the stack */
  332.     int td_stackSize; /* size of stack in bytes */
  333.     int td_stackCurrent;/* current stack usage in bytes */
  334.     int td_stackHigh; /* maximum stack usage in bytes */
  335.     int td_stackMargin; /* current stack margin in bytes */
  336.     int td_errorStatus; /* most recent task error status */
  337.     int td_delay; /* delay/timeout ticks */
  338.     EVENTS td_events; /* VxWorks events information */
  339.     } TASK_DESC;
  340. #if CPU_FAMILY==I960
  341. #pragma align 0 /* turn off alignment requirement */
  342. #endif /* CPU_FAMILY==I960 */
  343. /*******************************************************************************
  344. *
  345. * TASK_ID_VERIFY - check the validity of a task
  346. *
  347. * This macro verifies the existence of the specified object by comparing the
  348. * task's classId with the expected class id.  If the task does not check
  349. * out, errno is set with the appropriate invalid id status.
  350. *
  351. * RETURNS: OK or ERROR if invalid task id
  352. *
  353. * NOMANUAL
  354. */
  355. #define TASK_ID_VERIFY(tid)       
  356.     (          
  357.     ((WIND_TCB *)(tid) == NULL) ? (ERROR)                                     
  358.           : (OBJ_VERIFY (&((WIND_TCB *)(tid))->objCore, taskClassId)) 
  359.     )
  360. /*******************************************************************************
  361. *
  362. * TASK_LOCK - lock preemption for calling task
  363. *
  364. * This macro performs the taskLock (2) routine.
  365. * windview - this marco has been instrumented for windview.
  366. *
  367. * NOMANUAL
  368. */
  369. #define TASK_LOCK()      
  370.     do       
  371.         {      
  372. WRS_ASM ("");      
  373.         EVT_CTX_0 (EVENT_TASKLOCK);      
  374. taskIdCurrent->lockCnt++;      
  375. WRS_ASM ("");      
  376.         } while (0)
  377. /*******************************************************************************
  378. *
  379. * TASK_UNLOCK - unlock preemption for calling task
  380. *
  381. * This macro performs the taskUnlock (2) routine.
  382. *
  383. * NOMANUAL
  384. */
  385. #define TASK_UNLOCK()
  386.     (
  387.     taskUnlock ()
  388.     )
  389. /*******************************************************************************
  390. *
  391. * TASK_SAFE - guard self from deletion
  392. *
  393. * This macro performs the taskSafe (2) routine.
  394. * windview - this marco has been instrumented for windview.
  395. *
  396. * NOMANUAL
  397. */
  398. #define TASK_SAFE()      
  399.     do       
  400.         {      
  401. WRS_ASM ("");      
  402.         EVT_OBJ_2 (TASK, (WIND_TCB *)taskIdCurrent,              
  403.            ((OBJ_ID)(&((WIND_TCB *)taskIdCurrent)->objCore))->pObjClass,     
  404.                     EVENT_TASKSAFE, taskIdCurrent, taskIdCurrent->safeCnt);  
  405.         taskIdCurrent->safeCnt++;      
  406. WRS_ASM ("");      
  407.         } while (0)
  408. /*******************************************************************************
  409. *
  410. * TASK_UNSAFE - unguard self from deletion
  411. *
  412. * This macro performs the taskUnsafe (2) routine.
  413. *
  414. * NOMANUAL
  415. */
  416. #define TASK_UNSAFE()
  417.     (
  418.     taskUnsafe ()
  419.     )
  420. /* variable declarations */
  421. extern CLASS_ID taskClassId; /* task class id */
  422. extern CLASS_ID taskInstClassId;   /* instrumented task class id */
  423. extern WIND_TCB *taskIdCurrent; /* always current executing task */
  424. extern BOOL     taskPriRangeCheck;      /* limit priorities to 0-255 */
  425. /* function declarations */
  426. #if defined(__STDC__) || defined(__cplusplus)
  427. extern STATUS  taskLibInit (void);
  428. #ifdef __PROTOTYPE_5_0
  429. extern int  taskSpawn (char *name, int priority, int options, int stackSize,
  430.           FUNCPTR entryPt, ...);
  431. #else
  432. extern int  taskSpawn (char *name, int priority, int options, int stackSize,
  433.           FUNCPTR entryPt, int arg1, int arg2, int arg3,
  434.           int arg4, int arg5, int arg6, int arg7,
  435.           int arg8, int arg9, int arg10);
  436. #endif /* __PROTOTYPE_5_0 */
  437. extern STATUS  taskInit (WIND_TCB *pTcb, char *name, int priority, int options,
  438.   char *pStackBase, int stackSize, FUNCPTR entryPt,
  439.   int arg1, int arg2, int arg3, int arg4, int arg5,
  440.   int arg6, int arg7, int arg8, int arg9, int arg10);
  441. extern STATUS  taskActivate (int tid);
  442. extern STATUS  taskDelete (int tid);
  443. extern STATUS  taskDeleteForce (int tid);
  444. extern STATUS  taskSuspend (int tid);
  445. extern STATUS  taskResume (int tid);
  446. extern STATUS  taskRestart (int tid);
  447. extern STATUS  taskPrioritySet (int tid, int newPriority);
  448. extern STATUS  taskPriorityGet (int tid, int *pPriority);
  449. extern STATUS  taskLock (void);
  450. extern STATUS  taskUnlock (void);
  451. extern STATUS  taskSafe (void);
  452. extern STATUS  taskUnsafe (void);
  453. extern STATUS  taskDelay (int ticks);
  454. extern STATUS  taskOptionsSet (int tid, int mask, int newOptions);
  455. extern STATUS  taskOptionsGet (int tid, int *pOptions);
  456. extern char * taskName (int tid);
  457. extern int  taskNameToId (char *name);
  458. extern STATUS  taskIdVerify (int tid);
  459. extern int  taskIdSelf (void);
  460. extern int  taskIdDefault (int tid);
  461. extern BOOL  taskIsReady (int tid);
  462. extern BOOL  taskIsSuspended (int tid);
  463. extern WIND_TCB *taskTcb (int tid);
  464. extern int  taskIdListGet (int idList [ ], int maxTasks);
  465. extern STATUS  taskInfoGet (int tid, TASK_DESC *pTaskDesc);
  466. extern STATUS  taskStatusString (int tid, char *pString);
  467. extern STATUS  taskOptionsString (int tid, char *pString);
  468. extern STATUS  taskRegsGet (int tid, REG_SET *pRegs);
  469. extern STATUS  taskRegsSet (int tid, REG_SET *pRegs);
  470. extern void  taskRegsShow (int tid);
  471. extern void * taskStackAllot (int tid, unsigned nBytes);
  472. extern void  taskShowInit (void);
  473. extern STATUS  taskShow (int tid, int level);
  474. #else /* __STDC__ */
  475. extern STATUS  taskLibInit ();
  476. extern int  taskSpawn ();
  477. extern STATUS  taskInit ();
  478. extern STATUS  taskActivate ();
  479. extern STATUS  taskDelete ();
  480. extern STATUS  taskDeleteForce ();
  481. extern STATUS  taskSuspend ();
  482. extern STATUS  taskResume ();
  483. extern STATUS  taskRestart ();
  484. extern STATUS  taskPrioritySet ();
  485. extern STATUS  taskPriorityGet ();
  486. extern STATUS  taskLock ();
  487. extern STATUS  taskUnlock ();
  488. extern STATUS  taskSafe ();
  489. extern STATUS  taskUnsafe ();
  490. extern STATUS  taskDelay ();
  491. extern STATUS  taskOptionsSet ();
  492. extern STATUS  taskOptionsGet ();
  493. extern char * taskName ();
  494. extern int  taskNameToId ();
  495. extern STATUS  taskIdVerify ();
  496. extern int  taskIdSelf ();
  497. extern int  taskIdDefault ();
  498. extern BOOL  taskIsReady ();
  499. extern BOOL  taskIsSuspended ();
  500. extern WIND_TCB *taskTcb ();
  501. extern int  taskIdListGet ();
  502. extern STATUS  taskInfoGet ();
  503. extern STATUS  taskStatusString ();
  504. extern STATUS  taskOptionsString ();
  505. extern STATUS  taskRegsGet ();
  506. extern STATUS  taskRegsSet ();
  507. extern void  taskRegsShow ();
  508. extern void * taskStackAllot ();
  509. extern void  taskShowInit ();
  510. extern STATUS  taskShow ();
  511. #endif /* __STDC__ */
  512. #endif /* _ASMLANGUAGE */
  513. #ifdef __cplusplus
  514. }
  515. #endif
  516. #endif /* __INCtaskLibh */