?? hook.c
字號:
/* * TOPPERS/JSP Kernel * Toyohashi Open Platform for Embedded Real-Time Systems/ * Just Standard Profile Kernel * * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory * Toyohashi Univ. of Technology, JAPAN * 2003 by Advanced Data Controls, Corp * * 懼淡螟侯涪莢は·笆布の (1)×(4) の掘鳳か·Free Software Foundation * によって給山されている GNU General Public License の Version 2 に淡 * 揭されている掘鳳を塔たす眷圭に嘎り·塑ソフトウェア∈塑ソフトウェア * を猖恃したものを崔むˉ笆布票じ∷を蝗脫ˇ剩瀾ˇ猖恃ˇ浩芹邵∈笆布· * 網脫と鈣ぶ∷することを痰浸で釣滿するˉ * (1) 塑ソフトウェアをソ〖スコ〖ドの妨で網脫する眷圭には·懼淡の螟侯 * 涪山績·この網脫掘鳳および布淡の痰瘦沮憚年が·そのままの妨でソ〖 * スコ〖ド面に崔まれていることˉ * (2) 塑ソフトウェアを·ライブラリ妨及など·戮のソフトウェア倡券に蝗 * 脫できる妨で浩芹邵する眷圭には·浩芹邵に燃うドキュメント∈網脫 * 莢マニュアルなど∷に·懼淡の螟侯涪山績·この網脫掘鳳および布淡 * の痰瘦沮憚年を非很することˉ * (3) 塑ソフトウェアを·怠達に寥み哈むなど·戮のソフトウェア倡券に蝗 * 脫できない妨で浩芹邵する眷圭には·肌のいずれかの掘鳳を塔たすこ * とˉ * (a) 浩芹邵に燃うドキュメント∈網脫莢マニュアルなど∷に·懼淡の螟 * 侯涪山績·この網脫掘鳳および布淡の痰瘦沮憚年を非很することˉ * (b) 浩芹邵の妨輪を·侍に年める數恕によって·TOPPERSプロジェクトに * 鼠桂することˉ * (4) 塑ソフトウェアの網脫により木儡弄または粗儡弄に欄じるいかなる祿 * 巢からも·懼淡螟侯涪莢およびTOPPERSプロジェクトを倘勒することˉ * * 塑ソフトウェアは·痰瘦沮で捏丁されているものであるˉ懼淡螟侯涪莢お * よびTOPPERSプロジェクトは·塑ソフトウェアに簇して·その努脫材墻拉も * 崔めて·いかなる瘦沮も乖わないˉまた·塑ソフトウェアの網脫により木 * 儡弄または粗儡弄に欄じたいかなる祿巢に簇しても·その勒扦を砷わないˉ * * @(#) $Id: hook.c,v 1.2 2003/12/19 11:48:37 honda Exp $ */#ifdef GHS_HOOK#include "jsp_kernel.h"#include "kernel.h"#include "task.h"#include "ghs_hook.h"void sys_hook0(int grp, int code){ ID tskid=TSKID(runtsk);#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_SYS) || !(Ros_buf.hook.sys_grp & grp)) return; if (tskid > TRACE_TNUM_TSKID || !(Ros_buf.hook.task_id[tskid])) return;#endif t_lock_cpu(); ghs_hook4(THG_SYS, tskid, code); t_unlock_cpu();}void sys_hook0_i(int grp, int code){#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_SYS) || !(Ros_buf.hook.sys_grp & grp)) return; if (!(Ros_buf.hook.task_id[0])) return;#endif t_lock_cpu(); ghs_hook4(THG_SYS, 0, code); t_unlock_cpu();}void sys_hook1(int grp, int code, int p1){ ID tskid = TSKID(runtsk);#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_SYS) || !(Ros_buf.hook.sys_grp & grp)) return; if (tskid > TRACE_TNUM_TSKID || !(Ros_buf.hook.task_id[tskid])) return;#endif t_lock_cpu(); ghs_hook5(THG_SYS, tskid, code, p1); t_unlock_cpu();}void sys_hook1_i(int grp, int code, int p1){#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_SYS) || !(Ros_buf.hook.sys_grp & grp)) return; if (!(Ros_buf.hook.task_id[0])) return;#endif t_lock_cpu(); ghs_hook5(THG_SYS, 0, code, p1); t_unlock_cpu();}void sys_hook2(int grp, int code, int p1, int p2){ ID tskid = TSKID(runtsk);#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_SYS) || !(Ros_buf.hook.sys_grp & grp)) return; if (tskid > TRACE_TNUM_TSKID || !(Ros_buf.hook.task_id[tskid])) return;#endif t_lock_cpu(); ghs_hook6(THG_SYS, tskid, code, p1, p2); t_unlock_cpu();}void sys_hook2_i(int grp, int code, int p1, int p2){#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_SYS) || !(Ros_buf.hook.sys_grp & grp)) return; if (!(Ros_buf.hook.task_id[0])) return;#endif t_lock_cpu(); ghs_hook6(THG_SYS, 0, code, p1, p2); t_unlock_cpu();}void sys_hook3(int grp, int code, int p1, int p2, int p3){ ID tskid = TSKID(runtsk);#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_SYS) || !(Ros_buf.hook.sys_grp & grp)) return; if (!(Ros_buf.hook.task_id[tskid & (TRACE_TNUM_TSKID-1)])) return;#endif t_lock_cpu(); ghs_hook7(THG_SYS, tskid, code, p1, p2, p3); t_unlock_cpu();}void sys_hook4(int grp, int code, int p1, int p2, int p3, int p4){ ID tskid = TSKID(runtsk);#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_SYS) || !(Ros_buf.hook.sys_grp & grp)) return; if (tskid > TRACE_TNUM_TSKID || !(Ros_buf.hook.task_id[tskid])) return;#endif t_lock_cpu(); ghs_hook8(THG_SYS, tskid, code, p1, p2, p3, p4); t_unlock_cpu();}void trc_rtn_hook(int grp, int code, int ercd){ ID tskid = TSKID(runtsk);#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_RET)) return; if (!(Ros_buf.hook.trc_grp & THG_SYS) || !(Ros_buf.hook.sys_grp & grp)) return; if (tskid > TRACE_TNUM_TSKID || !(Ros_buf.hook.task_id[tskid])) return;#endif t_lock_cpu(); ghs_hook5(THG_RET, tskid, code, ercd); t_unlock_cpu();}/*CPUロック覺輪で鈣ばれるため、CPUをロックする澀妥はない*/void sts_hook(ID tskid){ TCB *tcb; int tstat;#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_STS)) return; if (tskid > TRACE_TNUM_TSKID || !(Ros_buf.hook.task_id[tskid])) return;#endif tcb = get_tcb(tskid); tstat = (int)(tcb->tstat); if(TSTAT_DORMANT(tstat)) tstat = 0x1; /* 0x1:Dormant */ else if(TSTAT_RUNNABLE(tstat)) tstat = 0x0; /* 0x0:Ready */ else if(TSTAT_WAITING(tstat)) { if((tstat & (TS_WAIT_SLEEP | TS_WAIT_WOBJ)) == 0) tstat = 0x09; /* 0x9:Delay */ else { if((tstat & TS_WAIT_SLEEP) != 0) tstat = 0x08; /* 0x8:Sleep */ else tstat = 0x0a; /* 0xa:Waiting */ } if(TSTAT_SUSPENDED(tstat)) tstat |= 0x10; } else if(TSTAT_SUSPENDED(tstat)) tstat = 0x10; ghs_hook4(THG_STS, tskid, tstat);}void dispatch_hook(TCB *tcb){ ID tskid;#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_DSP)) return;#endif tskid = runtsk == NULL ? 0 : TSKID(runtsk); t_lock_cpu(); ghs_hook4(THG_DSP, tskid, TSKID(tcb));}void exception_hook(int code, int addr){ int i; ID tskid;#if(GHS_HOOK != 1) if (!(Ros_buf.hook.trc_grp & THG_INT)) return;#endif for(i = 0; i < TRACE_TNUM_EVT; i++){ if(Ros_buf.hook.evtcode[i] == 0) return; if(Ros_buf.hook.evtcode[i] == code){ tskid = runtsk == NULL ? 0 : TSKID(runtsk); ghs_hook5(THG_INT, tskid, code, addr); return; } }}#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -