专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > VxWorks

TCB是什么?解决办法

发布时间:2010-06-14 16:44:39 文章来源:www.iduyao.cn 采编人员:星星草
TCB是什么?
TCB是什么?看到描写他的数据结构是WIND_TCB ,具体是怎样的类型呢?获得TCB能对task进行什么操作呢?


------解决方案--------------------
对于信号量的部分通常是通过在TCB中确定它挂接在那个阻塞队列的队列头来体现
------解决方案--------------------
TCB是任务控制块,相当于每个任务的信息都保存在这个结构中,这样在任务切换时,这个任务的信息就可以保存在任务上下文中。
有些操作(如taskInit)需要TCB地址做参数,参看手册。
需要TCB地址时可以通过taskTcb从taskID获取TCB地址,参看手册。
WIND_TCB的具体数据结构定义在taskLib.h中有定义,是:
typedef struct windTcb /* WIND_TCB - task control block */
{
Q_NODE qNode; /* 0x00: multiway q node: rdy/pend q */
Q_NODE tickNode; /* 0x10: multiway q node: tick q */
Q_NODE activeNode; /* 0x20: multiway q node: active q */

OBJ_CORE objCore; /* 0x30: object management */
char * name; /* 0x34: pointer to task name */
int options; /* 0x38: task option bits */
UINT status; /* 0x3c: status of task */
UINT priority; /* 0x40: task's current priority */
UINT priNormal; /* 0x44: task's normal priority */
UINT priMutexCnt; /* 0x48: nested priority mutex owned */
struct semaphore * pPriMutex; /* 0x4c: pointer to inheritance mutex */

UINT lockCnt; /* 0x50: preemption lock count */
UINT tslice; /* 0x54: current count of time slice */

UINT16 swapInMask; /* 0x58: task's switch in hooks */
UINT16 swapOutMask; /* 0x5a: task's switch out hooks */

Q_HEAD * pPendQ; /* 0x5c: q head pended on (if any) */

UINT safeCnt; /* 0x60: safe-from-delete count */
Q_HEAD safetyQHead; /* 0x64: safe-from-delete q head */

FUNCPTR entry; /* 0x74: entry point of task */

char * pStackBase; /* 0x78: points to bottom of stack */
char * pStackLimit; /* 0x7c: points to stack limit */
char * pStackEnd; /* 0x80: points to init stack limit */

int errorStatus; /* 0x84: most recent task error */
int exitCode; /* 0x88: error passed to exit () */

struct sigtcb * pSignalInfo; /* 0x8c: ptr to signal info for task */
struct selContext * pSelectContext; /* 0x90: ptr to select info for task */

UINT taskTicks; /* 0x94: total number of ticks */
UINT taskIncTicks; /* 0x98: number of ticks in slice */

struct taskVar * pTaskVar; /* 0x9c: ptr to task variable list */
struct rpcModList * pRPCModList; /* 0xa0: ptr to rpc module statics */
struct fpContext * pFpContext; /* 0xa4: fpoint coprocessor context */

struct __sFILE * taskStdFp[3]; /* 0xa8: stdin,stdout,stderr fps */
int taskStd[3]; /* 0xb4: stdin,stdout,stderr fds */

char ** ppEnviron; /* 0xc0: environment var table */
int envTblSize; /* 0xc4: number of slots in table */
int nEnvVarEntries; /* 0xc8: num env vars used */
struct sm_obj_tcb * pSmObjTcb; /* 0xcc: shared mem object TCB */
int windxLock; /* 0xd0: lock for windX */
void * pComLocal; /* 0xd4: COM task-local storage ptr */
REG_SET * pExcRegSet; /* 0xd8: exception regSet ptr or NULL */
EVENTS events; /* 0xdc: event info for the task */
WDB_INFO * pWdbInfo; /* 0xe8: ptr to WDB info - future use */
void * pPthread; /* 0xec: ptr to pthread data structs */
int reserved1; /* 0xf0: possible WRS extension */
int compiler1; /* 0xf4: compiler reserved extension */
int spare1; /* 0xf8: possible user extension */
int spare2; /* 0xfc: possible user extension */
int spare3; /* 0x100: possible user extension */
int spare4; /* 0x104: possible user extension */

/* ARCHITECTURE DEPENDENT */

#if (CPU_FAMILY==MC680X0)
EXC_INFO excInfo; /* 0x108: exception info */

/* REG_SET must be aligned on a 4 byte boundary */

REG_SET regs; /* 0x11c: register set */
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: