📄 vxwk2pthread.h
字号:
/***************************************************************************** * vxwk2pthread.h - declares the wrapper functions and data structures needed * to implement a VxWorks kernel API in a POSIX Threads * environment. * * Copyright (C) 2000 Monta Vista Software Inc. * * Author : Gary S. Robertson * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. ****************************************************************************/#include <pthread.h>#if __cplusplusextern "C" {#endif#ifndef FALSE#define FALSE 0#endif#ifndef TRUE#define TRUE !FALSE#endif#define VXWK_TICK 10 /* milliseconds per VxWorks scheduler tick *//*** Task Scheduling Priorities in VxWorks are higher as numbers decrease...** define the largest and smallest possible priority numbers.*/#define MIN_VXWK_PRIORITY 255#define MAX_VXWK_PRIORITY 0#ifndef OK#define OK 0 /* Normal return value */#endif#ifndef ERROR#define ERROR -1 /* Error return value */#endif/******************************************************************************* Task state bit masks*****************************************************************************/#define READY 0x0000#define PEND 0x0001#define DELAY 0x0002#define SUSPEND 0x0004#define TIMEOUT 0x0008#define INH_PRI 0x0010#define DEAD 0x0080#define RDY_MSK 0x008f/******************************************************************************* Control block for pthread wrapper for VxWorks task*****************************************************************************/typedef struct vxwk_pthread_ctl_blk{ /* ** Task ID for task */ int taskid; /* ** Task Name */ char *taskname; /* ** Thread ID for task */ pthread_t pthrid; /* ** Thread attributes for task */ pthread_attr_t attr; /* ** Previous scheduler priority for task */ struct sched_param prv_priority; /* ** Execution entry point address for task */ int (*entry_point)( int, int, int, int, int, int, int, int, int, int ); /* ** Task parameter block address */ int parms[10]; /* ** Flag indicating if task control block allocated dynamically ( == 0 ) ** or statically ( == 1 ) */ int static_tcb; /* ** Option flags for task */ int flags; /* ** Task state */ int state; /* ** Task VxWorks priority level */ int vxw_priority; /* ** Pointer to suspended task list for object task is waiting on */ struct vxwk_pthread_ctl_blk ** suspend_list; /* ** Next task control block in list of tasks waiting on object */ struct vxwk_pthread_ctl_blk * nxt_susp; /* ** Nesting level for number of taskSafe calls */ int delete_safe_count; /* ** Mutex and Condition variable for task delete 'pend' */ pthread_mutex_t tdelete_lock; pthread_cond_t t_deletable; /* ** Mutex and Condition variable for task delete 'broadcast' */ pthread_mutex_t dbcst_lock; pthread_cond_t delete_bcplt; /* ** First task control block in list of tasks waiting on this task ** (for deletion purposes) */ struct vxwk_pthread_ctl_blk * first_susp; /* ** Next task control block in list */ struct vxwk_pthread_ctl_blk * nxt_task;} vxwk2pthread_cb_t;#if __cplusplus}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -