⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testtsh.c

📁 Vxworks操作系统上的源码。从中可以学习:任务优先级设置、deadline、rm规则、rmlub准则。管理各task的加载和卸载。
💻 C
字号:
#include "vxWorks.h"
#include "taskLib.h"
#include "taskHookLib.h"
#include "tickLib.h"

unsigned long int gv_switchcnt = 0;
unsigned long int gv_switchtime;


/* Warning: Only code which can be executed in kernel/interrupt context
            can be placed in a taskSwitchHook call-back!

            Please read the VxWorks Ref. Manual carefully before adding
            API calls to ensure that they may be called in this context.
*/

void updateCntHook( WIND_TCB *pOldTcb,    /* pointer to old task's WIND_TCB */
                    WIND_TCB *pNewTcb     /* pointer to new task's WIND_TCB */
                   )
{

  gv_switchcnt++;
  gv_switchtime = tickGet();
  
}


void testhook(void)
{
  if(taskSwitchHookAdd((FUNCPTR)updateCntHook) == ERROR)
    printf("Error adding hook!\n");
  else
    printf("Added hook!\n");

}

void unldhook(void)
{
  if(taskSwitchHookDelete((FUNCPTR)updateCntHook) == ERROR)
    printf("Error deleting hook!\n");
  else
    printf("Deleted hook!\n");

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -