[117] | 1 | /*
|
---|
| 2 | * TOPPERS ATK2
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
| 4 | * Automotive Kernel Version 2
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2007-2014 by Center for Embedded Computing Systems
|
---|
| 7 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
| 8 | * Copyright (C) 2011-2014 by FUJI SOFT INCORPORATED, JAPAN
|
---|
| 9 | * Copyright (C) 2011-2013 by Spansion LLC, USA
|
---|
| 10 | * Copyright (C) 2011-2013 by NEC Communication Systems, Ltd., JAPAN
|
---|
| 11 | * Copyright (C) 2011-2014 by Panasonic Advanced Technology Development Co., Ltd., JAPAN
|
---|
| 12 | * Copyright (C) 2011-2014 by Renesas Electronics Corporation, JAPAN
|
---|
| 13 | * Copyright (C) 2011-2014 by Sunny Giken Inc., JAPAN
|
---|
| 14 | * Copyright (C) 2011-2014 by TOSHIBA CORPORATION, JAPAN
|
---|
| 15 | * Copyright (C) 2011-2014 by Witz Corporation, JAPAN
|
---|
| 16 | *
|
---|
| 17 | * 上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
|
---|
| 18 | * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
---|
| 19 | * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
---|
| 20 | * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
---|
| 21 | * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
---|
| 22 | * スコード中に含まれていること.
|
---|
| 23 | * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
---|
| 24 | * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
---|
| 25 | * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
---|
| 26 | * の無保証規定を掲載すること.
|
---|
| 27 | * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
---|
| 28 | * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
---|
| 29 | * と.
|
---|
| 30 | * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
---|
| 31 | * 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
---|
| 32 | * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
---|
| 33 | * 報告すること.
|
---|
| 34 | * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
---|
| 35 | * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
---|
| 36 | * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
---|
| 37 | * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
---|
| 38 | * 免責すること.
|
---|
| 39 | *
|
---|
| 40 | * 本ソフトウェアは,AUTOSAR(AUTomotive Open System ARchitecture)仕
|
---|
| 41 | * 様に基づいている.上記の許諾は,AUTOSARの知的財産権を許諾するもので
|
---|
| 42 | * はない.AUTOSARは,AUTOSAR仕様に基づいたソフトウェアを商用目的で利
|
---|
| 43 | * 用する者に対して,AUTOSARパートナーになることを求めている.
|
---|
| 44 | *
|
---|
| 45 | * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
---|
| 46 | * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
---|
| 47 | * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
---|
| 48 | * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
---|
| 49 | * の責任を負わない.
|
---|
| 50 | *
|
---|
| 51 | * $Id: trace_dump.c 115 2014-12-10 01:33:17Z t_ishikawa $
|
---|
| 52 | */
|
---|
| 53 |
|
---|
| 54 | /*
|
---|
| 55 | * トレースログのダンプ
|
---|
| 56 | */
|
---|
| 57 |
|
---|
| 58 | #include "kernel_impl.h"
|
---|
| 59 | #include "task.h"
|
---|
| 60 | #include "alarm.h"
|
---|
| 61 | #include "scheduletable.h"
|
---|
| 62 | #include "log_output.h"
|
---|
| 63 | #include "Os_Lcfg.h"
|
---|
| 64 | #include "t_stdlib.h" /* atk2_strerror */
|
---|
| 65 |
|
---|
| 66 | /*
|
---|
| 67 | * 処理単位の種別
|
---|
| 68 | */
|
---|
| 69 | typedef enum {
|
---|
| 70 | PR_UNIT_TASK, /* タスク */
|
---|
| 71 | PR_UNIT_ALARM, /* アラーム満了処理 */
|
---|
| 72 | PR_UNIT_ISR, /* C2ISR */
|
---|
| 73 | PR_UNIT_SCHTBL, /* スケジュールテーブル満了処理 */
|
---|
| 74 | PR_UNIT_STA, /* スタートアップフック */
|
---|
| 75 | PR_UNIT_ERR, /* エラーフック */
|
---|
| 76 | PR_UNIT_PRO, /* プロテクションフック */
|
---|
| 77 | PR_UNIT_SHUT, /* シャットダウンフック */
|
---|
| 78 | PR_UNIT_TFN, /* 信頼関数 */
|
---|
| 79 | PR_UNIT_STAOSAP, /* OSAP固有スタートアップフック */
|
---|
| 80 | PR_UNIT_ERROSAP, /* OSAP固有エラーフック */
|
---|
| 81 | PR_UNIT_SHUTOSAP /* OSAP固有シャットダウンフック */
|
---|
| 82 | } PR_UNIT_TYPE;
|
---|
| 83 |
|
---|
| 84 | /*
|
---|
| 85 | * 処理単位のID
|
---|
| 86 | */
|
---|
| 87 | typedef struct {
|
---|
| 88 | PR_UNIT_TYPE type; /* 処理単位の種別 */
|
---|
| 89 | ObjectIDType id; /* 処理単位のID */
|
---|
| 90 | } OBJ_ID;
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 | /* 内部関数のプロトタイプ宣言 */
|
---|
| 94 | static const char8 *trace_proret_str(ProtectionReturnType ret);
|
---|
| 95 | static const char8 *trace_schtblstatus_str(ScheduleTableStatusType status);
|
---|
| 96 | static const char8 *atk2_task_state_str(TaskStateType state);
|
---|
| 97 | static const char8 *atk2_osap_state_str(ApplicationStateType state);
|
---|
| 98 | static const char8 *atk2_access_str(ObjectAccessType access);
|
---|
| 99 | static uintptr trace_get_tskid(uintptr info);
|
---|
| 100 | static const char8 *trace_print_tskenter(const TRACE *trace, uintptr info[]);
|
---|
| 101 | static const char8 *trace_print_tskleave(const TRACE *trace, uintptr info[]);
|
---|
| 102 | static const char8 *trace_print_evententer(const TRACE *trace, uintptr info[]);
|
---|
| 103 | static const char8 *trace_print_eventleave(const TRACE *trace, uintptr info[]);
|
---|
| 104 | static const char8 *trace_print_resenter(const TRACE *trace, uintptr info[]);
|
---|
| 105 | static const char8 *trace_print_resleave(const TRACE *trace, uintptr info[]);
|
---|
| 106 | static const char8 *trace_print_almenter(const TRACE *trace, uintptr info[]);
|
---|
| 107 | static const char8 *trace_print_almleave(const TRACE *trace, uintptr info[]);
|
---|
| 108 | static const char8 *trace_print_schtblenter(const TRACE *trace, uintptr info[]);
|
---|
| 109 | static const char8 *trace_print_schtblleave(const TRACE *trace, uintptr info[]);
|
---|
| 110 | static const char8 *trace_print_intenter(const TRACE *trace, uintptr info[]);
|
---|
| 111 | static const char8 *trace_print_intleave(const TRACE *trace, uintptr info[]);
|
---|
| 112 | static const char8 *trace_print_sysenter(const TRACE *trace, uintptr info[]);
|
---|
| 113 | static const char8 *trace_print_sysleave(const TRACE *trace, uintptr info[]);
|
---|
| 114 | static const char8 *trace_print_kerenter(const TRACE *trace, uintptr info[], void (*outputc)(char8 c));
|
---|
| 115 | static const char8 *trace_print_osapenter(const TRACE *trace, uintptr info[]);
|
---|
| 116 | static const char8 *trace_print_osapleave(const TRACE *trace, uintptr info[]);
|
---|
| 117 | static const char8 *trace_print_memoryenter(const TRACE *trace, uintptr info[]);
|
---|
| 118 | static void trace_get_memory_access(AccessType access, uintptr info[]);
|
---|
| 119 | static const char8 *trace_print_memoryleave(const TRACE *trace, uintptr info[]);
|
---|
| 120 | static const char8 *trace_print_svcenter(const TRACE *trace, uintptr info[], void (*outputc)(char8 c));
|
---|
| 121 | static const char8 *trace_print_svcleave(const TRACE *trace, uintptr info[]);
|
---|
| 122 | static void trace_set_context(PR_UNIT_TYPE type, ObjectIDType id);
|
---|
| 123 | static void trace_push_context(PR_UNIT_TYPE type, ObjectIDType id);
|
---|
| 124 | static void trace_get_context(uintptr *p_obj_type_str, uintptr *p_id);
|
---|
| 125 | static void trace_pop_context(uintptr *p_obj_type_str, uintptr *p_id);
|
---|
| 126 | static void trace_change_context(PR_UNIT_TYPE type, ObjectIDType id);
|
---|
| 127 | static void trace_resume_context(void);
|
---|
| 128 | static void trace_print(const TRACE *p_trace, void (*outputc)(char8 c));
|
---|
| 129 | static const char8 *trace_print_iocleave(const TRACE *trace, uintptr info[]);
|
---|
| 130 | static const char8 *trace_print_iocenter(const TRACE *trace, uintptr info[]);
|
---|
| 131 |
|
---|
| 132 | /*
|
---|
| 133 | * プロテクションフックの返り値を文字列変換
|
---|
| 134 | */
|
---|
| 135 | static const char8 *
|
---|
| 136 | trace_proret_str(ProtectionReturnType ret)
|
---|
| 137 | {
|
---|
| 138 | const char8 *proretstr;
|
---|
| 139 |
|
---|
| 140 | switch (ret) {
|
---|
| 141 | case PRO_IGNORE:
|
---|
| 142 | proretstr = "IGNORE";
|
---|
| 143 | break;
|
---|
| 144 | case PRO_SHUTDOWN:
|
---|
| 145 | proretstr = "SHUTDOWN";
|
---|
| 146 | break;
|
---|
| 147 | default:
|
---|
| 148 | proretstr = "";
|
---|
| 149 | break;
|
---|
| 150 | }
|
---|
| 151 | return(proretstr);
|
---|
| 152 | }
|
---|
| 153 |
|
---|
| 154 | /*
|
---|
| 155 | * スケジュールテーブルの状態を文字列変換
|
---|
| 156 | */
|
---|
| 157 | static const char8 *
|
---|
| 158 | trace_schtblstatus_str(ScheduleTableStatusType status)
|
---|
| 159 | {
|
---|
| 160 | const char8 *schtblstr;
|
---|
| 161 |
|
---|
| 162 | switch (status) {
|
---|
| 163 | case SCHEDULETABLE_STOPPED:
|
---|
| 164 | schtblstr = "STOPPED";
|
---|
| 165 | break;
|
---|
| 166 | case SCHEDULETABLE_NEXT:
|
---|
| 167 | schtblstr = "NEXT";
|
---|
| 168 | break;
|
---|
| 169 | case SCHEDULETABLE_WAITING:
|
---|
| 170 | schtblstr = "WAITING";
|
---|
| 171 | break;
|
---|
| 172 | case SCHEDULETABLE_RUNNING:
|
---|
| 173 | schtblstr = "RUNNING";
|
---|
| 174 | break;
|
---|
| 175 | case SCHEDULETABLE_RUNNING_AND_SYNCHRONOUS:
|
---|
| 176 | schtblstr = "RUNNING_AND_SYNCHRONOUS";
|
---|
| 177 | break;
|
---|
| 178 | default:
|
---|
| 179 | schtblstr = "";
|
---|
| 180 | break;
|
---|
| 181 | }
|
---|
| 182 | return(schtblstr);
|
---|
| 183 | }
|
---|
| 184 |
|
---|
| 185 | /*
|
---|
| 186 | * タスク状態を文字列変換
|
---|
| 187 | */
|
---|
| 188 | static const char8 *
|
---|
| 189 | atk2_task_state_str(TaskStateType state)
|
---|
| 190 | {
|
---|
| 191 | const char8 *taskstatstr;
|
---|
| 192 |
|
---|
| 193 | switch (state) {
|
---|
| 194 | case SUSPENDED:
|
---|
| 195 | taskstatstr = "SUSPENDED";
|
---|
| 196 | break;
|
---|
| 197 | case RUNNING:
|
---|
| 198 | taskstatstr = "RUNNING";
|
---|
| 199 | break;
|
---|
| 200 | case READY:
|
---|
| 201 | taskstatstr = "READY";
|
---|
| 202 | break;
|
---|
| 203 | case WAITING:
|
---|
| 204 | taskstatstr = "WAITING";
|
---|
| 205 | break;
|
---|
| 206 | default:
|
---|
| 207 | taskstatstr = "unknown state";
|
---|
| 208 | break;
|
---|
| 209 | }
|
---|
| 210 | return(taskstatstr);
|
---|
| 211 | }
|
---|
| 212 |
|
---|
| 213 | /*
|
---|
| 214 | * OSAP状態を文字列変換
|
---|
| 215 | */
|
---|
| 216 | static const char8 *
|
---|
| 217 | atk2_osap_state_str(ApplicationStateType state)
|
---|
| 218 | {
|
---|
| 219 | const char8 *osapstatstr;
|
---|
| 220 |
|
---|
| 221 | switch (state) {
|
---|
| 222 | case APPLICATION_ACCESSIBLE:
|
---|
| 223 | osapstatstr = "ACCESSIBLE";
|
---|
| 224 | break;
|
---|
| 225 | case APPLICATION_RESTARTING:
|
---|
| 226 | osapstatstr = "RESTARTING";
|
---|
| 227 | break;
|
---|
| 228 | case APPLICATION_TERMINATED:
|
---|
| 229 | osapstatstr = "TERMINATED";
|
---|
| 230 | break;
|
---|
| 231 | default:
|
---|
| 232 | osapstatstr = "unknown state";
|
---|
| 233 | break;
|
---|
| 234 | }
|
---|
| 235 | return(osapstatstr);
|
---|
| 236 | }
|
---|
| 237 |
|
---|
| 238 | /*
|
---|
| 239 | * ObjectAccessTypeを文字列変換
|
---|
| 240 | */
|
---|
| 241 | static const char8 *
|
---|
| 242 | atk2_access_str(ObjectAccessType access)
|
---|
| 243 | {
|
---|
| 244 | const char8 *accessstr;
|
---|
| 245 |
|
---|
| 246 | switch (access) {
|
---|
| 247 | case ACCESS:
|
---|
| 248 | accessstr = "ACCESS";
|
---|
| 249 | break;
|
---|
| 250 | case NO_ACCESS:
|
---|
| 251 | accessstr = "NO_ACCESS";
|
---|
| 252 | break;
|
---|
| 253 | default:
|
---|
| 254 | accessstr = "";
|
---|
| 255 | break;
|
---|
| 256 | }
|
---|
| 257 | return(accessstr);
|
---|
| 258 | }
|
---|
| 259 |
|
---|
| 260 | /*
|
---|
| 261 | * PR_UNIT_TYPEの処理単位種別に対応する文字列
|
---|
| 262 | */
|
---|
| 263 | static const char8 *obj_type_to_str[] = {
|
---|
| 264 | "task",
|
---|
| 265 | "alarm",
|
---|
| 266 | "isr",
|
---|
| 267 | "schtbl",
|
---|
| 268 | "sta",
|
---|
| 269 | "err",
|
---|
| 270 | "pro",
|
---|
| 271 | "shut",
|
---|
| 272 | "tfn",
|
---|
| 273 | "staosap",
|
---|
| 274 | "errosap",
|
---|
| 275 | "shutosap"
|
---|
| 276 | };
|
---|
| 277 |
|
---|
| 278 | /*
|
---|
| 279 | * 2つの引数の大きい方を返す
|
---|
| 280 | */
|
---|
| 281 | #define MAX(a, b) ((a) < (b) ? (b) : (a))
|
---|
| 282 |
|
---|
| 283 | /*
|
---|
| 284 | * 処理単位のネストを管理するスタック
|
---|
| 285 | */
|
---|
| 286 | static OBJ_ID context_stack[MAX(4U, 1U + TNUM_ISR2)];
|
---|
| 287 |
|
---|
| 288 | /*
|
---|
| 289 | * タスクが実行しているアラーム満了処理,スケジュールテーブル満了処理,
|
---|
| 290 | * 信頼関数を管理する
|
---|
| 291 | * アラーム満了処理はIncrementCounterによりネストする場合がある
|
---|
| 292 | * スケジュールテーブル満了処理のネストはない
|
---|
| 293 | */
|
---|
| 294 | static OBJ_ID task_exec[TNUM_TASK][TNUM_ALARM + TNUM_TFN + 1U];
|
---|
| 295 |
|
---|
| 296 | /*
|
---|
| 297 | * タスクがアラーム満了処理,スケジュールテーブル満了処理,信頼関数を
|
---|
| 298 | * 実行している場合の,task_exec[task_id][index]のindexを示す
|
---|
| 299 | * 満了処理を実行していない場合は-1にする
|
---|
| 300 | */
|
---|
| 301 | static sint32 task_context_index[TNUM_TASK];
|
---|
| 302 |
|
---|
| 303 | /*
|
---|
| 304 | * task_execのC2ISR版
|
---|
| 305 | */
|
---|
| 306 | static OBJ_ID isr_exec[TNUM_ISR2][TNUM_ALARM + TNUM_TFN + 1U];
|
---|
| 307 |
|
---|
| 308 | /*
|
---|
| 309 | * task_context_indexのC2ISR版
|
---|
| 310 | */
|
---|
| 311 | static sint32 isr_context_index[TNUM_ISR2];
|
---|
| 312 |
|
---|
| 313 | /*
|
---|
| 314 | * context_stackの現在のインデックス(ネスト数)を示す
|
---|
| 315 | */
|
---|
| 316 | static uint32 context_index;
|
---|
| 317 |
|
---|
| 318 | /*
|
---|
| 319 | * tcbからタスクIDを取得
|
---|
| 320 | */
|
---|
| 321 | static uintptr
|
---|
| 322 | trace_get_tskid(uintptr info)
|
---|
| 323 | {
|
---|
| 324 | TCB *p_tcb;
|
---|
| 325 | TaskType tskid;
|
---|
| 326 |
|
---|
| 327 | p_tcb = (TCB *) info;
|
---|
| 328 | if (p_tcb == NULL) {
|
---|
| 329 | tskid = 0U;
|
---|
| 330 | }
|
---|
| 331 | else {
|
---|
| 332 | tskid = TSKID(p_tcb);
|
---|
| 333 | }
|
---|
| 334 | return((uintptr) tskid);
|
---|
| 335 | }
|
---|
| 336 |
|
---|
| 337 |
|
---|
| 338 | /*
|
---|
| 339 | * タスク管理 - 入口ログ
|
---|
| 340 | */
|
---|
| 341 | static const char8 *
|
---|
| 342 | trace_print_tskenter(const TRACE *trace, uintptr info[])
|
---|
| 343 | {
|
---|
| 344 | uint32 type;
|
---|
| 345 | const char8 *tracemsg;
|
---|
| 346 |
|
---|
| 347 | type = (const uint32) trace->loginfo[0];
|
---|
| 348 |
|
---|
| 349 | switch (type) {
|
---|
| 350 |
|
---|
| 351 | case TFN_ACTIVATETASK:
|
---|
| 352 | info[0] = (uintptr) atk2_tskid_str((TaskType) trace->loginfo[1]);
|
---|
| 353 | info[1] = trace->loginfo[1];
|
---|
| 354 | tracemsg = "enter to ActivateTask TaskID=%s(%d).";
|
---|
| 355 | break;
|
---|
| 356 |
|
---|
| 357 | case TFN_TERMINATETASK:
|
---|
| 358 | tracemsg = "enter to TerminateTask.";
|
---|
| 359 | break;
|
---|
| 360 |
|
---|
| 361 | case TFN_CHAINTASK:
|
---|
| 362 | info[0] = (uintptr) atk2_tskid_str((TaskType) trace->loginfo[1]);
|
---|
| 363 | info[1] = trace->loginfo[1];
|
---|
| 364 | tracemsg = "enter to ChainTask TaskID=%s(%d).";
|
---|
| 365 | break;
|
---|
| 366 |
|
---|
| 367 | case TFN_SCHEDULE:
|
---|
| 368 | tracemsg = "enter to Schedule.";
|
---|
| 369 | break;
|
---|
| 370 |
|
---|
| 371 | default:
|
---|
| 372 | tracemsg = "unknown service call";
|
---|
| 373 | break;
|
---|
| 374 | }
|
---|
| 375 |
|
---|
| 376 | return(tracemsg);
|
---|
| 377 | }
|
---|
| 378 |
|
---|
| 379 |
|
---|
| 380 | /*
|
---|
| 381 | * タスク管理 - 出口ログ
|
---|
| 382 | */
|
---|
| 383 | static const char8 *
|
---|
| 384 | trace_print_tskleave(const TRACE *trace, uintptr info[])
|
---|
| 385 | {
|
---|
| 386 | uint32 type;
|
---|
| 387 | const char8 *tracemsg;
|
---|
| 388 |
|
---|
| 389 | type = (const uint32) trace->loginfo[0];
|
---|
| 390 |
|
---|
| 391 | switch (type) {
|
---|
| 392 |
|
---|
| 393 | case TFN_ACTIVATETASK:
|
---|
| 394 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 395 | tracemsg = "leave from ActivateTask %s.";
|
---|
| 396 | break;
|
---|
| 397 |
|
---|
| 398 | case TFN_TERMINATETASK:
|
---|
| 399 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 400 | tracemsg = "leave from TerminateTask %s.";
|
---|
| 401 | break;
|
---|
| 402 |
|
---|
| 403 | case TFN_CHAINTASK:
|
---|
| 404 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 405 | tracemsg = "leave from ChainTask %s.";
|
---|
| 406 | break;
|
---|
| 407 |
|
---|
| 408 | case TFN_SCHEDULE:
|
---|
| 409 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 410 | tracemsg = "leave from Schedule %s.";
|
---|
| 411 | break;
|
---|
| 412 |
|
---|
| 413 | default:
|
---|
| 414 | tracemsg = "unknown tsk service call";
|
---|
| 415 | break;
|
---|
| 416 | }
|
---|
| 417 |
|
---|
| 418 | return(tracemsg);
|
---|
| 419 | }
|
---|
| 420 |
|
---|
| 421 |
|
---|
| 422 | /*
|
---|
| 423 | * イベント機能 - 入口ログ
|
---|
| 424 | */
|
---|
| 425 | static const char8 *
|
---|
| 426 | trace_print_evententer(const TRACE *trace, uintptr info[])
|
---|
| 427 | {
|
---|
| 428 | uint32 type;
|
---|
| 429 | const char8 *tracemsg;
|
---|
| 430 |
|
---|
| 431 | type = (const uint32) trace->loginfo[0];
|
---|
| 432 |
|
---|
| 433 | switch (type) {
|
---|
| 434 | case TFN_SETEVENT:
|
---|
| 435 | info[0] = (uintptr) atk2_tskid_str((TaskType) trace->loginfo[1]);
|
---|
| 436 | info[1] = trace->loginfo[1];
|
---|
| 437 | info[2] = (uintptr) atk2_evtid_str((TaskType) trace->loginfo[1], (EventMaskType) trace->loginfo[2]);
|
---|
| 438 | info[3] = trace->loginfo[2];
|
---|
| 439 | tracemsg = "enter to SetEvent TaskID=%s(%d)/Mask=%s(0x%x).";
|
---|
| 440 | break;
|
---|
| 441 |
|
---|
| 442 | case TFN_CLEAREVENT:
|
---|
| 443 | info[0] = (uintptr) atk2_evtid_str((TaskType) trace_get_tskid(trace->loginfo[1]), (EventMaskType) trace->loginfo[2]);
|
---|
| 444 | info[1] = trace->loginfo[2];
|
---|
| 445 | tracemsg = "enter to ClearEvent Mask=%s(0x%x).";
|
---|
| 446 | break;
|
---|
| 447 |
|
---|
| 448 | case TFN_GETEVENT:
|
---|
| 449 | info[0] = (uintptr) atk2_tskid_str((TaskType) trace->loginfo[1]);
|
---|
| 450 | info[1] = trace->loginfo[1];
|
---|
| 451 | tracemsg = "enter to GetEvent TaskID=%s(%d).";
|
---|
| 452 | break;
|
---|
| 453 |
|
---|
| 454 | case TFN_WAITEVENT:
|
---|
| 455 | info[0] = (uintptr) atk2_evtid_str((TaskType) trace_get_tskid(trace->loginfo[1]), (EventMaskType) trace->loginfo[2]);
|
---|
| 456 | info[1] = trace->loginfo[2];
|
---|
| 457 | tracemsg = "enter to WaitEvent Mask=%s(0x%x).";
|
---|
| 458 | break;
|
---|
| 459 |
|
---|
| 460 | default:
|
---|
| 461 | tracemsg = "unknown service call";
|
---|
| 462 | break;
|
---|
| 463 | }
|
---|
| 464 |
|
---|
| 465 | return(tracemsg);
|
---|
| 466 | }
|
---|
| 467 |
|
---|
| 468 |
|
---|
| 469 | /*
|
---|
| 470 | * イベント機能 - 出口ログ
|
---|
| 471 | */
|
---|
| 472 | static const char8 *
|
---|
| 473 | trace_print_eventleave(const TRACE *trace, uintptr info[])
|
---|
| 474 | {
|
---|
| 475 | uint32 type;
|
---|
| 476 | const char8 *tracemsg;
|
---|
| 477 |
|
---|
| 478 | type = (const uint32) trace->loginfo[0];
|
---|
| 479 |
|
---|
| 480 | switch (type) {
|
---|
| 481 | case TFN_SETEVENT:
|
---|
| 482 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 483 | tracemsg = "leave from SetEvent %s.";
|
---|
| 484 | break;
|
---|
| 485 |
|
---|
| 486 | case TFN_CLEAREVENT:
|
---|
| 487 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 488 | tracemsg = "leave from ClearEvent %s.";
|
---|
| 489 | break;
|
---|
| 490 |
|
---|
| 491 | case TFN_GETEVENT:
|
---|
| 492 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 493 | /* 返り値がE_OKの場合のみ,有効値が入る */
|
---|
| 494 | if (trace->loginfo[1] == E_OK) {
|
---|
| 495 | info[1] = (uintptr) atk2_evtid_str((TaskType) trace->loginfo[2], (EventMaskType) trace->loginfo[3]);
|
---|
| 496 | info[2] = trace->loginfo[3];
|
---|
| 497 | tracemsg = "leave from GetEvent %s/Mask=%s(0x%x).";
|
---|
| 498 | }
|
---|
| 499 | else {
|
---|
| 500 | tracemsg = "leave from GetEvent %s.";
|
---|
| 501 | }
|
---|
| 502 | break;
|
---|
| 503 |
|
---|
| 504 | case TFN_WAITEVENT:
|
---|
| 505 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 506 | tracemsg = "leave from WaitEvent %s.";
|
---|
| 507 | break;
|
---|
| 508 |
|
---|
| 509 | default:
|
---|
| 510 | tracemsg = "unknown servic call";
|
---|
| 511 | break;
|
---|
| 512 | }
|
---|
| 513 |
|
---|
| 514 | return(tracemsg);
|
---|
| 515 | }
|
---|
| 516 |
|
---|
| 517 |
|
---|
| 518 | /*
|
---|
| 519 | * リソース機能 - 入口ログ
|
---|
| 520 | */
|
---|
| 521 | static const char8 *
|
---|
| 522 | trace_print_resenter(const TRACE *trace, uintptr info[])
|
---|
| 523 | {
|
---|
| 524 | uint32 type;
|
---|
| 525 | const char8 *tracemsg;
|
---|
| 526 |
|
---|
| 527 | type = (const uint32) trace->loginfo[0];
|
---|
| 528 |
|
---|
| 529 | switch (type) {
|
---|
| 530 | case TFN_GETRESOURCE:
|
---|
| 531 | info[0] = (uintptr) atk2_resid_str((ResourceType) trace->loginfo[1]);
|
---|
| 532 | info[1] = trace->loginfo[1];
|
---|
| 533 | tracemsg = "enter to GetResource ResID=%s(%d).";
|
---|
| 534 | break;
|
---|
| 535 |
|
---|
| 536 | case TFN_RELEASERESOURCE:
|
---|
| 537 | info[0] = (uintptr) atk2_resid_str((ResourceType) trace->loginfo[1]);
|
---|
| 538 | info[1] = trace->loginfo[1];
|
---|
| 539 | tracemsg = "enter to ReleaseResource ResID=%s(%d).";
|
---|
| 540 | break;
|
---|
| 541 |
|
---|
| 542 | default:
|
---|
| 543 | tracemsg = "unknown service call";
|
---|
| 544 | break;
|
---|
| 545 | }
|
---|
| 546 |
|
---|
| 547 | return(tracemsg);
|
---|
| 548 | }
|
---|
| 549 |
|
---|
| 550 |
|
---|
| 551 | /*
|
---|
| 552 | * リソース機能 - 出口ログ
|
---|
| 553 | */
|
---|
| 554 | static const char8 *
|
---|
| 555 | trace_print_resleave(const TRACE *trace, uintptr info[])
|
---|
| 556 | {
|
---|
| 557 | uint32 type;
|
---|
| 558 | const char8 *tracemsg;
|
---|
| 559 |
|
---|
| 560 | type = (const uint32) trace->loginfo[0];
|
---|
| 561 |
|
---|
| 562 | switch (type) {
|
---|
| 563 | case TFN_GETRESOURCE:
|
---|
| 564 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 565 | tracemsg = "leave from GetResource %s.";
|
---|
| 566 | break;
|
---|
| 567 |
|
---|
| 568 | case TFN_RELEASERESOURCE:
|
---|
| 569 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 570 | tracemsg = "leave from ReleaseResource %s.";
|
---|
| 571 | break;
|
---|
| 572 |
|
---|
| 573 | default:
|
---|
| 574 | tracemsg = "unknown servic call";
|
---|
| 575 | break;
|
---|
| 576 | }
|
---|
| 577 |
|
---|
| 578 | return(tracemsg);
|
---|
| 579 | }
|
---|
| 580 |
|
---|
| 581 | /*
|
---|
| 582 | * アラーム機能 - 入口ログ
|
---|
| 583 | */
|
---|
| 584 | static const char8 *
|
---|
| 585 | trace_print_almenter(const TRACE *trace, uintptr info[])
|
---|
| 586 | {
|
---|
| 587 | uint32 type;
|
---|
| 588 | const char8 *tracemsg;
|
---|
| 589 |
|
---|
| 590 | type = (const uint32) trace->loginfo[0];
|
---|
| 591 |
|
---|
| 592 | switch (type) {
|
---|
| 593 | case TFN_GETALARMBASE:
|
---|
| 594 | info[0] = (uintptr) atk2_almid_str((AlarmType) trace->loginfo[1]);
|
---|
| 595 | info[1] = trace->loginfo[1];
|
---|
| 596 | tracemsg = "enter to GetAlarmBase AlarmID=%s(%d).";
|
---|
| 597 | break;
|
---|
| 598 |
|
---|
| 599 | case TFN_GETALARM:
|
---|
| 600 | info[0] = (uintptr) atk2_almid_str((AlarmType) trace->loginfo[1]);
|
---|
| 601 | info[1] = trace->loginfo[1];
|
---|
| 602 | tracemsg = "enter to GetAlarm AlarmID=%s(%d).";
|
---|
| 603 | break;
|
---|
| 604 |
|
---|
| 605 | case TFN_SETRELALARM:
|
---|
| 606 | info[0] = (uintptr) atk2_almid_str((AlarmType) trace->loginfo[1]);
|
---|
| 607 | info[1] = trace->loginfo[1];
|
---|
| 608 | info[2] = trace->loginfo[2];
|
---|
| 609 | info[3] = trace->loginfo[3];
|
---|
| 610 | tracemsg = "enter to SetRelAlarm AlarmID=%s(%d)/increment=%d/cycle=%d.";
|
---|
| 611 | break;
|
---|
| 612 |
|
---|
| 613 | case TFN_SETABSALARM:
|
---|
| 614 | info[0] = (uintptr) atk2_almid_str((AlarmType) trace->loginfo[1]);
|
---|
| 615 | info[1] = trace->loginfo[1];
|
---|
| 616 | info[2] = trace->loginfo[2];
|
---|
| 617 | info[3] = trace->loginfo[3];
|
---|
| 618 | tracemsg = "enter to SetAbsAlarm AlarmID=%s(%d)/start=%d/cycle=%d.";
|
---|
| 619 | break;
|
---|
| 620 |
|
---|
| 621 | case TFN_CANCELALARM:
|
---|
| 622 | info[0] = (uintptr) atk2_almid_str((AlarmType) trace->loginfo[1]);
|
---|
| 623 | info[1] = trace->loginfo[1];
|
---|
| 624 | tracemsg = "enter to CancelAlarm AlarmID=%s(%d).";
|
---|
| 625 | break;
|
---|
| 626 |
|
---|
| 627 | case TFN_INCREMENTCOUNTER:
|
---|
| 628 | info[0] = (uintptr) atk2_cntid_str((CounterType) trace->loginfo[1]);
|
---|
| 629 | info[1] = trace->loginfo[1];
|
---|
| 630 | tracemsg = "enter to IncrementCounter CounterID=%s(%d).";
|
---|
| 631 | break;
|
---|
| 632 |
|
---|
| 633 | case TFN_GETCOUNTERVALUE:
|
---|
| 634 | info[0] = (uintptr) atk2_cntid_str((CounterType) trace->loginfo[1]);
|
---|
| 635 | info[1] = trace->loginfo[1];
|
---|
| 636 | tracemsg = "enter to GetCounterValue CounterID=%s(%d).";
|
---|
| 637 | break;
|
---|
| 638 |
|
---|
| 639 | case TFN_GETELAPSEDVALUE:
|
---|
| 640 | info[0] = (uintptr) atk2_cntid_str((CounterType) trace->loginfo[1]);
|
---|
| 641 | info[1] = trace->loginfo[1];
|
---|
| 642 | info[2] = trace->loginfo[2];
|
---|
| 643 | tracemsg = "enter to GetElapsedValue CounterID=%s(%d) Value=%d.";
|
---|
| 644 | break;
|
---|
| 645 |
|
---|
| 646 | default:
|
---|
| 647 | tracemsg = "unknown service call";
|
---|
| 648 | break;
|
---|
| 649 | }
|
---|
| 650 |
|
---|
| 651 | return(tracemsg);
|
---|
| 652 | }
|
---|
| 653 |
|
---|
| 654 |
|
---|
| 655 | /*
|
---|
| 656 | * アラーム機能 - 出口ログ
|
---|
| 657 | */
|
---|
| 658 | static const char8 *
|
---|
| 659 | trace_print_almleave(const TRACE *trace, uintptr info[])
|
---|
| 660 | {
|
---|
| 661 | uint32 type;
|
---|
| 662 | const char8 *tracemsg;
|
---|
| 663 |
|
---|
| 664 | type = (const uint32) trace->loginfo[0];
|
---|
| 665 |
|
---|
| 666 | switch (type) {
|
---|
| 667 | case TFN_GETALARMBASE:
|
---|
| 668 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 669 | /* 返り値がE_OKの場合のみ,有効値が入る */
|
---|
| 670 | if (trace->loginfo[1] == E_OK) {
|
---|
| 671 | info[1] = trace->loginfo[2];
|
---|
| 672 | info[2] = trace->loginfo[3];
|
---|
| 673 | info[3] = trace->loginfo[4];
|
---|
| 674 | tracemsg = "leave from GetAlarmBase %s/maxval=%d/tickbase=%d/mincyc=%d.";
|
---|
| 675 | }
|
---|
| 676 | else {
|
---|
| 677 | tracemsg = "leave from GetAlarmBase %s.";
|
---|
| 678 | }
|
---|
| 679 | break;
|
---|
| 680 |
|
---|
| 681 | case TFN_GETALARM:
|
---|
| 682 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 683 | /* 返り値がE_OKの場合のみ,有効値が入る */
|
---|
| 684 | if (trace->loginfo[1] == E_OK) {
|
---|
| 685 | info[1] = trace->loginfo[2];
|
---|
| 686 | tracemsg = "leave from GetAlarm %s/Tick=%d.";
|
---|
| 687 | }
|
---|
| 688 | else {
|
---|
| 689 | tracemsg = "leave from GetAlarm %s.";
|
---|
| 690 | }
|
---|
| 691 | break;
|
---|
| 692 |
|
---|
| 693 | case TFN_SETRELALARM:
|
---|
| 694 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 695 | tracemsg = "leave from SetRelAlarm %s.";
|
---|
| 696 | break;
|
---|
| 697 |
|
---|
| 698 | case TFN_SETABSALARM:
|
---|
| 699 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 700 | tracemsg = "leave from SetAbsAlarm %s.";
|
---|
| 701 | break;
|
---|
| 702 |
|
---|
| 703 | case TFN_CANCELALARM:
|
---|
| 704 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 705 | tracemsg = "leave from CancelAlarm %s.";
|
---|
| 706 | break;
|
---|
| 707 |
|
---|
| 708 | case TFN_INCREMENTCOUNTER:
|
---|
| 709 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 710 | tracemsg = "leave from IncrementCounter %s.";
|
---|
| 711 | break;
|
---|
| 712 |
|
---|
| 713 | case TFN_GETCOUNTERVALUE:
|
---|
| 714 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 715 | /* 返り値がE_OKの場合のみ,有効値が入る */
|
---|
| 716 | if (trace->loginfo[1] == E_OK) {
|
---|
| 717 | info[1] = trace->loginfo[2];
|
---|
| 718 | tracemsg = "leave from GetCounterValue %s/Value=%d.";
|
---|
| 719 | }
|
---|
| 720 | else {
|
---|
| 721 | tracemsg = "leave from GetCounterValue %s.";
|
---|
| 722 | }
|
---|
| 723 | break;
|
---|
| 724 |
|
---|
| 725 | case TFN_GETELAPSEDVALUE:
|
---|
| 726 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 727 | /* 返り値がE_OKの場合のみ,有効値が入る */
|
---|
| 728 | if (trace->loginfo[1] == E_OK) {
|
---|
| 729 | info[1] = trace->loginfo[2];
|
---|
| 730 | info[2] = trace->loginfo[3];
|
---|
| 731 | tracemsg = "leave from GetElapsedValue %s/Value=%d/ElapsedValue=%d.";
|
---|
| 732 | }
|
---|
| 733 | else {
|
---|
| 734 | tracemsg = "leave from GetElapsedValue %s.";
|
---|
| 735 | }
|
---|
| 736 | break;
|
---|
| 737 |
|
---|
| 738 | default:
|
---|
| 739 | tracemsg = "unknown servic call";
|
---|
| 740 | break;
|
---|
| 741 | }
|
---|
| 742 |
|
---|
| 743 | return(tracemsg);
|
---|
| 744 | }
|
---|
| 745 |
|
---|
| 746 | /*
|
---|
| 747 | * スケジュールテーブル機能 - 入口ログ
|
---|
| 748 | */
|
---|
| 749 | static const char8 *
|
---|
| 750 | trace_print_schtblenter(const TRACE *trace, uintptr info[])
|
---|
| 751 | {
|
---|
| 752 | uint32 type;
|
---|
| 753 | const char8 *tracemsg;
|
---|
| 754 |
|
---|
| 755 | type = (const uint32) trace->loginfo[0];
|
---|
| 756 |
|
---|
| 757 | switch (type) {
|
---|
| 758 | case TFN_STARTSCHEDULETABLEREL:
|
---|
| 759 | info[0] = (uintptr) atk2_schtblid_str((ScheduleTableType) trace->loginfo[1]);
|
---|
| 760 | info[1] = trace->loginfo[1];
|
---|
| 761 | info[2] = trace->loginfo[2];
|
---|
| 762 | tracemsg = "enter to StartScheduleTableRel SchtblID=%s(%d)/offset=%d.";
|
---|
| 763 | break;
|
---|
| 764 |
|
---|
| 765 | case TFN_STARTSCHEDULETABLEABS:
|
---|
| 766 | info[0] = (uintptr) atk2_schtblid_str((ScheduleTableType) trace->loginfo[1]);
|
---|
| 767 | info[1] = trace->loginfo[1];
|
---|
| 768 | info[2] = trace->loginfo[2];
|
---|
| 769 | tracemsg = "enter to StartScheduleTableAbs SchtblID=%s(%d)/start=%d.";
|
---|
| 770 | break;
|
---|
| 771 |
|
---|
| 772 | case TFN_STOPSCHEDULETABLE:
|
---|
| 773 | info[0] = (uintptr) atk2_schtblid_str((ScheduleTableType) trace->loginfo[1]);
|
---|
| 774 | info[1] = trace->loginfo[1];
|
---|
| 775 | tracemsg = "enter to StopScheduleTable SchtblID=%s(%d).";
|
---|
| 776 | break;
|
---|
| 777 |
|
---|
| 778 | case TFN_NEXTSCHEDULETABLE:
|
---|
| 779 | info[0] = (uintptr) atk2_schtblid_str((ScheduleTableType) trace->loginfo[1]);
|
---|
| 780 | info[1] = trace->loginfo[1];
|
---|
| 781 | info[2] = (uintptr) atk2_schtblid_str((ScheduleTableType) trace->loginfo[2]);
|
---|
| 782 | info[3] = trace->loginfo[2];
|
---|
| 783 | tracemsg = "enter to NextScheduleTable From_ID=%s(%d)/To_ID=%s(%d).";
|
---|
| 784 | break;
|
---|
| 785 |
|
---|
| 786 | case TFN_GETSCHEDULETABLESTATUS:
|
---|
| 787 | info[0] = (uintptr) atk2_schtblid_str((ScheduleTableType) trace->loginfo[1]);
|
---|
| 788 | info[1] = trace->loginfo[1];
|
---|
| 789 | tracemsg = "enter to GetScheduleTableStatus SchtblID=%s(%d).";
|
---|
| 790 | break;
|
---|
| 791 |
|
---|
| 792 | default:
|
---|
| 793 | tracemsg = "unknown service call";
|
---|
| 794 | break;
|
---|
| 795 | }
|
---|
| 796 |
|
---|
| 797 | return(tracemsg);
|
---|
| 798 | }
|
---|
| 799 |
|
---|
| 800 | /*
|
---|
| 801 | * スケジュールテーブル - 出口ログ
|
---|
| 802 | */
|
---|
| 803 | static const char8 *
|
---|
| 804 | trace_print_schtblleave(const TRACE *trace, uintptr info[])
|
---|
| 805 | {
|
---|
| 806 | uint32 type;
|
---|
| 807 | const char8 *tracemsg;
|
---|
| 808 |
|
---|
| 809 | type = (const uint32) trace->loginfo[0];
|
---|
| 810 |
|
---|
| 811 | switch (type) {
|
---|
| 812 | case TFN_STARTSCHEDULETABLEREL:
|
---|
| 813 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 814 | tracemsg = "leave from StartScheduleTableRel %s.";
|
---|
| 815 | break;
|
---|
| 816 |
|
---|
| 817 | case TFN_STARTSCHEDULETABLEABS:
|
---|
| 818 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 819 | tracemsg = "leave from StartScheduleTableAbs %s.";
|
---|
| 820 | break;
|
---|
| 821 |
|
---|
| 822 | case TFN_STOPSCHEDULETABLE:
|
---|
| 823 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 824 | tracemsg = "leave from StopScheduleTable %s.";
|
---|
| 825 | break;
|
---|
| 826 |
|
---|
| 827 | case TFN_NEXTSCHEDULETABLE:
|
---|
| 828 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 829 | tracemsg = "leave from NextScheduleTable %s.";
|
---|
| 830 | break;
|
---|
| 831 |
|
---|
| 832 | case TFN_GETSCHEDULETABLESTATUS:
|
---|
| 833 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 834 | /* 返り値がE_OKの場合のみ,有効値が入る */
|
---|
| 835 | if (trace->loginfo[1] == E_OK) {
|
---|
| 836 | info[1] = (uintptr) trace_schtblstatus_str((ScheduleTableStatusType) trace->loginfo[2]);
|
---|
| 837 | tracemsg = "leave from GetScheduleTableStatus %s/status=%s.";
|
---|
| 838 | }
|
---|
| 839 | else {
|
---|
| 840 | tracemsg = "leave from GetScheduleTableStatus %s.";
|
---|
| 841 | }
|
---|
| 842 | break;
|
---|
| 843 |
|
---|
| 844 | default:
|
---|
| 845 | tracemsg = "unknown servic call";
|
---|
| 846 | break;
|
---|
| 847 | }
|
---|
| 848 |
|
---|
| 849 | return(tracemsg);
|
---|
| 850 | }
|
---|
| 851 |
|
---|
| 852 | /*
|
---|
| 853 | * 割込み管理機能 - 入口ログ
|
---|
| 854 | */
|
---|
| 855 | static const char8 *
|
---|
| 856 | trace_print_intenter(const TRACE *trace, uintptr info[])
|
---|
| 857 | {
|
---|
| 858 | uint32 type;
|
---|
| 859 | const char8 *tracemsg;
|
---|
| 860 |
|
---|
| 861 | type = (const uint32) trace->loginfo[0];
|
---|
| 862 |
|
---|
| 863 | switch (type) {
|
---|
| 864 | case TFN_DISABLEALLINTERRUPTS:
|
---|
| 865 | tracemsg = "enter to DisableAllInterrupts.";
|
---|
| 866 | break;
|
---|
| 867 |
|
---|
| 868 | case TFN_SUSPENDALLINTERRUPTS:
|
---|
| 869 | tracemsg = "enter to SuspendAllInterrupts.";
|
---|
| 870 | break;
|
---|
| 871 |
|
---|
| 872 | case TFN_SUSPENDOSINTERRUPTS:
|
---|
| 873 | tracemsg = "enter to SuspendOSInterrupts.";
|
---|
| 874 | break;
|
---|
| 875 |
|
---|
| 876 | case TFN_ENABLEALLINTERRUPTS:
|
---|
| 877 | tracemsg = "enter to EnableAllInterrupts.";
|
---|
| 878 | break;
|
---|
| 879 |
|
---|
| 880 | case TFN_RESUMEALLINTERRUPTS:
|
---|
| 881 | tracemsg = "enter to ResumeAllInterrupts.";
|
---|
| 882 | break;
|
---|
| 883 |
|
---|
| 884 | case TFN_RESUMEOSINTERRUPTS:
|
---|
| 885 | tracemsg = "enter to ResumeOSInterrupts.";
|
---|
| 886 | break;
|
---|
| 887 |
|
---|
| 888 | case TFN_GETISRID:
|
---|
| 889 | tracemsg = "enter to GetISRID.";
|
---|
| 890 | break;
|
---|
| 891 |
|
---|
| 892 | case TFN_DISABLEINTERRUPTSOURCE:
|
---|
| 893 | info[0] = (uintptr) atk2_isrid_str((ISRType) trace->loginfo[1]);
|
---|
| 894 | info[1] = trace->loginfo[1];
|
---|
| 895 | tracemsg = "enter to DisableInterruptSource ISRID=%s(%d).";
|
---|
| 896 | break;
|
---|
| 897 |
|
---|
| 898 | case TFN_ENABLEINTERRUPTSOURCE:
|
---|
| 899 | info[0] = (uintptr) atk2_isrid_str((ISRType) trace->loginfo[1]);
|
---|
| 900 | info[1] = trace->loginfo[1];
|
---|
| 901 | tracemsg = "enter to EnableInterruptSource ISRID=%s(%d).";
|
---|
| 902 | break;
|
---|
| 903 |
|
---|
| 904 | default:
|
---|
| 905 | tracemsg = "unknown service call";
|
---|
| 906 | break;
|
---|
| 907 | }
|
---|
| 908 |
|
---|
| 909 | return(tracemsg);
|
---|
| 910 | }
|
---|
| 911 |
|
---|
| 912 |
|
---|
| 913 | /*
|
---|
| 914 | * 割込み管理機能 - 出口ログ
|
---|
| 915 | */
|
---|
| 916 | static const char8 *
|
---|
| 917 | trace_print_intleave(const TRACE *trace, uintptr info[])
|
---|
| 918 | {
|
---|
| 919 | uint32 type;
|
---|
| 920 | const char8 *tracemsg;
|
---|
| 921 |
|
---|
| 922 | type = (const uint32) trace->loginfo[0];
|
---|
| 923 |
|
---|
| 924 | switch (type) {
|
---|
| 925 | case TFN_DISABLEALLINTERRUPTS:
|
---|
| 926 | tracemsg = "leave from DisableAllInterrupts.";
|
---|
| 927 | break;
|
---|
| 928 |
|
---|
| 929 | case TFN_SUSPENDALLINTERRUPTS:
|
---|
| 930 | tracemsg = "leave from SuspendAllInterrupts.";
|
---|
| 931 | break;
|
---|
| 932 |
|
---|
| 933 | case TFN_SUSPENDOSINTERRUPTS:
|
---|
| 934 | tracemsg = "leave from SuspendOSInterrupts.";
|
---|
| 935 | break;
|
---|
| 936 |
|
---|
| 937 | case TFN_ENABLEALLINTERRUPTS:
|
---|
| 938 | tracemsg = "leave from EnableAllInterrupts.";
|
---|
| 939 | break;
|
---|
| 940 |
|
---|
| 941 | case TFN_RESUMEALLINTERRUPTS:
|
---|
| 942 | tracemsg = "leave from ResumeAllInterrupts.";
|
---|
| 943 | break;
|
---|
| 944 |
|
---|
| 945 | case TFN_RESUMEOSINTERRUPTS:
|
---|
| 946 | tracemsg = "leave from ResumeOSInterrupts.";
|
---|
| 947 | break;
|
---|
| 948 |
|
---|
| 949 | case TFN_GETISRID:
|
---|
| 950 | info[0] = (uintptr) atk2_isrid_str((ISRType) trace->loginfo[1]);
|
---|
| 951 | info[1] = (const uintptr) trace->loginfo[1];
|
---|
| 952 | tracemsg = "leave from GetISRID id=%s(%d).";
|
---|
| 953 | break;
|
---|
| 954 |
|
---|
| 955 | case TFN_DISABLEINTERRUPTSOURCE:
|
---|
| 956 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 957 | tracemsg = "leave from DisableInterruptSource %s.";
|
---|
| 958 | break;
|
---|
| 959 |
|
---|
| 960 | case TFN_ENABLEINTERRUPTSOURCE:
|
---|
| 961 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 962 | tracemsg = "leave from EnableInterruptSource %s.";
|
---|
| 963 | break;
|
---|
| 964 |
|
---|
| 965 | default:
|
---|
| 966 | tracemsg = "unknown servic call";
|
---|
| 967 | break;
|
---|
| 968 | }
|
---|
| 969 |
|
---|
| 970 | return(tracemsg);
|
---|
| 971 | }
|
---|
| 972 |
|
---|
| 973 |
|
---|
| 974 | /*
|
---|
| 975 | * システム状態管理機能 - 入口ログ
|
---|
| 976 | */
|
---|
| 977 | static const char8 *
|
---|
| 978 | trace_print_sysenter(const TRACE *trace, uintptr info[])
|
---|
| 979 | {
|
---|
| 980 | uint32 type;
|
---|
| 981 | const char8 *tracemsg;
|
---|
| 982 |
|
---|
| 983 | type = (const uint32) trace->loginfo[0];
|
---|
| 984 |
|
---|
| 985 | switch (type) {
|
---|
| 986 | case TFN_GETTASKID:
|
---|
| 987 | tracemsg = "enter to GetTaskID.";
|
---|
| 988 | break;
|
---|
| 989 |
|
---|
| 990 | case TFN_GETTASKSTATE:
|
---|
| 991 | info[0] = (uintptr) atk2_tskid_str((TaskType) trace->loginfo[1]);
|
---|
| 992 | info[1] = trace->loginfo[1];
|
---|
| 993 | tracemsg = "enter to GetTaskState TaskID=%s(%d).";
|
---|
| 994 | break;
|
---|
| 995 |
|
---|
| 996 | case TFN_GETACTIVEAPPLICATIONMODE:
|
---|
| 997 | tracemsg = "enter to GetActiveApplicationMode.";
|
---|
| 998 | break;
|
---|
| 999 |
|
---|
| 1000 | default:
|
---|
| 1001 | tracemsg = "unknown servic call";
|
---|
| 1002 | break;
|
---|
| 1003 | }
|
---|
| 1004 |
|
---|
| 1005 | return(tracemsg);
|
---|
| 1006 | }
|
---|
| 1007 |
|
---|
| 1008 |
|
---|
| 1009 | /*
|
---|
| 1010 | * システム状態管理機能 - 出口ログ
|
---|
| 1011 | */
|
---|
| 1012 | static const char8 *
|
---|
| 1013 | trace_print_sysleave(const TRACE *trace, uintptr info[])
|
---|
| 1014 | {
|
---|
| 1015 | uint32 type;
|
---|
| 1016 | const char8 *tracemsg;
|
---|
| 1017 |
|
---|
| 1018 | type = (const uint32) trace->loginfo[0];
|
---|
| 1019 |
|
---|
| 1020 | switch (type) {
|
---|
| 1021 | case TFN_GETTASKID:
|
---|
| 1022 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 1023 | /* 返り値がE_OKの場合のみ,有効値が入る */
|
---|
| 1024 | if (trace->loginfo[1] == E_OK) {
|
---|
| 1025 | info[1] = (uintptr) atk2_tskid_str(trace->loginfo[2]);
|
---|
| 1026 | tracemsg = "leave from GetTaskID %s/TaskID=%s.";
|
---|
| 1027 | }
|
---|
| 1028 | else {
|
---|
| 1029 | tracemsg = "leave from GetTaskID %s.";
|
---|
| 1030 | }
|
---|
| 1031 | break;
|
---|
| 1032 |
|
---|
| 1033 | case TFN_GETTASKSTATE:
|
---|
| 1034 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 1035 | /* 返り値がE_OKの場合のみ,有効値が入る */
|
---|
| 1036 | if (trace->loginfo[1] == E_OK) {
|
---|
| 1037 | info[1] = (uintptr) atk2_task_state_str((TaskStateType) trace->loginfo[2]);
|
---|
| 1038 | tracemsg = "leave from GetTaskState %s/State=%s.";
|
---|
| 1039 | }
|
---|
| 1040 | else {
|
---|
| 1041 | tracemsg = "leave from GetTaskState %s.";
|
---|
| 1042 | }
|
---|
| 1043 | break;
|
---|
| 1044 |
|
---|
| 1045 | case TFN_GETACTIVEAPPLICATIONMODE:
|
---|
| 1046 | info[0] = (uintptr) atk2_appid_str((AppModeType) trace->loginfo[1]);
|
---|
| 1047 | info[1] = trace->loginfo[1];
|
---|
| 1048 | tracemsg = "leave from GetActiveApplicationMode mode=%s(%d).";
|
---|
| 1049 | break;
|
---|
| 1050 |
|
---|
| 1051 | default:
|
---|
| 1052 | tracemsg = "unknown servic call";
|
---|
| 1053 | break;
|
---|
| 1054 | }
|
---|
| 1055 |
|
---|
| 1056 | return(tracemsg);
|
---|
| 1057 | }
|
---|
| 1058 |
|
---|
| 1059 |
|
---|
| 1060 | /*
|
---|
| 1061 | * カーネルの初期化と終了処理
|
---|
| 1062 | */
|
---|
| 1063 | static const char8 *
|
---|
| 1064 | trace_print_kerenter(const TRACE *trace, uintptr info[], void (*outputc)(char8 c))
|
---|
| 1065 | {
|
---|
| 1066 | uint32 type;
|
---|
| 1067 | const char8 *tracemsg;
|
---|
| 1068 | uintptr traceinfo[TMAX_LOGINFO + 1U];
|
---|
| 1069 | uint32 i;
|
---|
| 1070 |
|
---|
| 1071 | type = (const uint32) trace->loginfo[0];
|
---|
| 1072 |
|
---|
| 1073 | /* シャットダウン時にすべてのタスクがSUSPENDED状態となるようにする */
|
---|
| 1074 | for (i = 0U; i < TNUM_TASK; i++) {
|
---|
| 1075 | traceinfo[0] = (uintptr) i;
|
---|
| 1076 | syslog_printf("task %d becomes SUSPENDED.\n", traceinfo, outputc);
|
---|
| 1077 | traceinfo[0] = (uintptr) (trace->logtim);
|
---|
| 1078 | syslog_printf("[%d] ", traceinfo, outputc);
|
---|
| 1079 | }
|
---|
| 1080 |
|
---|
| 1081 | if (type == TFN_SHUTDOWNOS) {
|
---|
| 1082 | info[0] = trace->loginfo[1];
|
---|
| 1083 | tracemsg = "enter to ShutdownOS Error=%d.";
|
---|
| 1084 | }
|
---|
| 1085 | else {
|
---|
| 1086 | tracemsg = "unknown service call";
|
---|
| 1087 | }
|
---|
| 1088 |
|
---|
| 1089 | return(tracemsg);
|
---|
| 1090 | }
|
---|
| 1091 |
|
---|
| 1092 | /*
|
---|
| 1093 | * OSAP機能 - 入口ログ
|
---|
| 1094 | */
|
---|
| 1095 | static const char8 *
|
---|
| 1096 | trace_print_osapenter(const TRACE *trace, uintptr info[])
|
---|
| 1097 | {
|
---|
| 1098 | uint32 type;
|
---|
| 1099 | const char8 *tracemsg;
|
---|
| 1100 |
|
---|
| 1101 | type = (const uint32) trace->loginfo[0];
|
---|
| 1102 |
|
---|
| 1103 | switch (type) {
|
---|
| 1104 | case TFN_GETAPPLICATIONID:
|
---|
| 1105 | tracemsg = "enter to GetApplicationID.";
|
---|
| 1106 | break;
|
---|
| 1107 |
|
---|
| 1108 | case TFN_GETAPPLICATIONSTATE:
|
---|
| 1109 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1110 | info[1] = trace->loginfo[1];
|
---|
| 1111 | tracemsg = "enter to GetApplicationState OsapID=%s(%d).";
|
---|
| 1112 | break;
|
---|
| 1113 |
|
---|
| 1114 | case TFN_CALLTRUSTEDFUNCTION:
|
---|
| 1115 | info[0] = (uintptr) atk2_tfnid_str((TrustedFunctionIndexType) trace->loginfo[1]);
|
---|
| 1116 | info[1] = trace->loginfo[1];
|
---|
| 1117 | tracemsg = "enter to CallTrustedFunction FunctionID=%s(%d).";
|
---|
| 1118 | break;
|
---|
| 1119 |
|
---|
| 1120 | case TFN_CHECKTASKACCESS:
|
---|
| 1121 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1122 | info[1] = trace->loginfo[1];
|
---|
| 1123 | info[2] = (uintptr) atk2_tskid_str((TaskType) trace->loginfo[2]);
|
---|
| 1124 | info[3] = trace->loginfo[2];
|
---|
| 1125 | tracemsg = "enter to CheckTaskAccess ApplID=%s(%d)/TaskID=%s(%d).";
|
---|
| 1126 | break;
|
---|
| 1127 |
|
---|
| 1128 | case TFN_CHECKISRACCESS:
|
---|
| 1129 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1130 | info[1] = trace->loginfo[1];
|
---|
| 1131 | info[2] = (uintptr) atk2_isrid_str((ISRType) trace->loginfo[2]);
|
---|
| 1132 | info[3] = trace->loginfo[2];
|
---|
| 1133 | tracemsg = "enter to CheckISRAccess ApplID=%s(%d)/ISRID=%s(%d).";
|
---|
| 1134 | break;
|
---|
| 1135 |
|
---|
| 1136 | case TFN_CHECKALARMACCESS:
|
---|
| 1137 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1138 | info[1] = trace->loginfo[1];
|
---|
| 1139 | info[2] = (uintptr) atk2_almid_str((AlarmType) trace->loginfo[2]);
|
---|
| 1140 | info[3] = trace->loginfo[2];
|
---|
| 1141 | tracemsg = "enter to CheckAlarmAccess ApplID=%s(%d)/AlarmID=%s(%d).";
|
---|
| 1142 | break;
|
---|
| 1143 |
|
---|
| 1144 | case TFN_CHECKRESOURCEACCESS:
|
---|
| 1145 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1146 | info[1] = trace->loginfo[1];
|
---|
| 1147 | info[2] = (uintptr) atk2_resid_str((ResourceType) trace->loginfo[2]);
|
---|
| 1148 | info[3] = trace->loginfo[2];
|
---|
| 1149 | tracemsg = "enter to CheckResourceAccess ApplID=%s(%d)/ResID=%s(%d).";
|
---|
| 1150 | break;
|
---|
| 1151 |
|
---|
| 1152 | case TFN_CHECKCOUNTERACCESS:
|
---|
| 1153 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1154 | info[1] = trace->loginfo[1];
|
---|
| 1155 | info[2] = (uintptr) atk2_cntid_str((CounterType) trace->loginfo[2]);
|
---|
| 1156 | info[3] = trace->loginfo[2];
|
---|
| 1157 | tracemsg = "enter to CheckCounterAccess ApplID=%s(%d)/CounterID=%s(%d).";
|
---|
| 1158 | break;
|
---|
| 1159 |
|
---|
| 1160 | case TFN_CHECKSCHEDULETABLEACCESS:
|
---|
| 1161 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1162 | info[1] = trace->loginfo[1];
|
---|
| 1163 | info[2] = (uintptr) atk2_schtblid_str((ScheduleTableType) trace->loginfo[2]);
|
---|
| 1164 | info[3] = trace->loginfo[2];
|
---|
| 1165 | tracemsg = "enter to CheckScheduleTableAccess ApplID=%s(%d)/ScheduleTableID=%s(%d).";
|
---|
| 1166 | break;
|
---|
| 1167 |
|
---|
| 1168 | case TFN_CHECKTASKOWNERSHIP:
|
---|
| 1169 | info[0] = (uintptr) atk2_tskid_str((TaskType) trace->loginfo[1]);
|
---|
| 1170 | info[1] = trace->loginfo[1];
|
---|
| 1171 | tracemsg = "enter to CheckTaskOwnership TaskID=%s(%d).";
|
---|
| 1172 | break;
|
---|
| 1173 |
|
---|
| 1174 | case TFN_CHECKISROWNERSHIP:
|
---|
| 1175 | info[0] = (uintptr) atk2_isrid_str((ISRType) trace->loginfo[1]);
|
---|
| 1176 | info[1] = trace->loginfo[1];
|
---|
| 1177 | tracemsg = "enter to CheckISROwnership ISRID=%s(%d).";
|
---|
| 1178 | break;
|
---|
| 1179 |
|
---|
| 1180 | case TFN_CHECKALARMOWNERSHIP:
|
---|
| 1181 | info[0] = (uintptr) atk2_almid_str((AlarmType) trace->loginfo[1]);
|
---|
| 1182 | info[1] = trace->loginfo[1];
|
---|
| 1183 | tracemsg = "enter to CheckAlarmOwnership AlarmID=%s(%d).";
|
---|
| 1184 | break;
|
---|
| 1185 |
|
---|
| 1186 | case TFN_CHECKCOUNTEROWNERSHIP:
|
---|
| 1187 | info[0] = (uintptr) atk2_cntid_str((CounterType) trace->loginfo[1]);
|
---|
| 1188 | info[1] = trace->loginfo[1];
|
---|
| 1189 | tracemsg = "enter to CheckCounterOwnership CounterID=%s(%d).";
|
---|
| 1190 | break;
|
---|
| 1191 |
|
---|
| 1192 | case TFN_CHECKSCHEDULETABLEOWNERSHIP:
|
---|
| 1193 | info[0] = (uintptr) atk2_schtblid_str((ScheduleTableType) trace->loginfo[1]);
|
---|
| 1194 | info[1] = trace->loginfo[1];
|
---|
| 1195 | tracemsg = "enter to CheckScheduleTableOwnership ScheduleTableID=%s(%d).";
|
---|
| 1196 | break;
|
---|
| 1197 |
|
---|
| 1198 | default:
|
---|
| 1199 | tracemsg = "unknown service call";
|
---|
| 1200 | break;
|
---|
| 1201 | }
|
---|
| 1202 |
|
---|
| 1203 | return(tracemsg);
|
---|
| 1204 | }
|
---|
| 1205 |
|
---|
| 1206 |
|
---|
| 1207 | /*
|
---|
| 1208 | * OSAP機能 - 出口ログ
|
---|
| 1209 | */
|
---|
| 1210 | static const char8 *
|
---|
| 1211 | trace_print_osapleave(const TRACE *trace, uintptr info[])
|
---|
| 1212 | {
|
---|
| 1213 | uint32 type;
|
---|
| 1214 | const char8 *tracemsg;
|
---|
| 1215 |
|
---|
| 1216 | type = (const uint32) trace->loginfo[0];
|
---|
| 1217 |
|
---|
| 1218 | switch (type) {
|
---|
| 1219 | case TFN_GETAPPLICATIONID:
|
---|
| 1220 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1221 | info[1] = trace->loginfo[1];
|
---|
| 1222 | tracemsg = "leave from GetApplicationID id=%s.";
|
---|
| 1223 | break;
|
---|
| 1224 |
|
---|
| 1225 | case TFN_GETAPPLICATIONSTATE:
|
---|
| 1226 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 1227 | /* 返り値がE_OKの場合のみ,有効値が入る */
|
---|
| 1228 | if (trace->loginfo[1] == E_OK) {
|
---|
| 1229 | info[1] = (uintptr) atk2_osap_state_str((ApplicationStateType) trace->loginfo[2]);
|
---|
| 1230 | tracemsg = "leave from GetApplicationState %s/state=%s.";
|
---|
| 1231 | }
|
---|
| 1232 | else {
|
---|
| 1233 | tracemsg = "leave from GetApplicationState %s.";
|
---|
| 1234 | }
|
---|
| 1235 | break;
|
---|
| 1236 |
|
---|
| 1237 | case TFN_CALLTRUSTEDFUNCTION:
|
---|
| 1238 | info[0] = (uintptr) atk2_strerror((StatusType) trace->loginfo[1]);
|
---|
| 1239 | info[1] = trace->loginfo[1];
|
---|
| 1240 | tracemsg = "leave from CallTrustedFunction %s(%d).";
|
---|
| 1241 | break;
|
---|
| 1242 |
|
---|
| 1243 | case TFN_CHECKTASKACCESS:
|
---|
| 1244 | info[0] = (uintptr) atk2_access_str((ObjectAccessType) trace->loginfo[1]);
|
---|
| 1245 | tracemsg = "leave from CheckTaskAccess %s.";
|
---|
| 1246 | break;
|
---|
| 1247 |
|
---|
| 1248 | case TFN_CHECKISRACCESS:
|
---|
| 1249 | info[0] = (uintptr) atk2_access_str((ObjectAccessType) trace->loginfo[1]);
|
---|
| 1250 | tracemsg = "leave from CheckISRAccess %s.";
|
---|
| 1251 | break;
|
---|
| 1252 |
|
---|
| 1253 | case TFN_CHECKALARMACCESS:
|
---|
| 1254 | info[0] = (uintptr) atk2_access_str((ObjectAccessType) trace->loginfo[1]);
|
---|
| 1255 | tracemsg = "leave from CheckAlarmAccess %s.";
|
---|
| 1256 | break;
|
---|
| 1257 |
|
---|
| 1258 | case TFN_CHECKRESOURCEACCESS:
|
---|
| 1259 | info[0] = (uintptr) atk2_access_str((ObjectAccessType) trace->loginfo[1]);
|
---|
| 1260 | tracemsg = "leave from CheckResourceAccess %s.";
|
---|
| 1261 | break;
|
---|
| 1262 |
|
---|
| 1263 | case TFN_CHECKCOUNTERACCESS:
|
---|
| 1264 | info[0] = (uintptr) atk2_access_str((ObjectAccessType) trace->loginfo[1]);
|
---|
| 1265 | tracemsg = "leave from CheckCounterAccess %s.";
|
---|
| 1266 | break;
|
---|
| 1267 |
|
---|
| 1268 | case TFN_CHECKSCHEDULETABLEACCESS:
|
---|
| 1269 | info[0] = (uintptr) atk2_access_str((ObjectAccessType) trace->loginfo[1]);
|
---|
| 1270 | tracemsg = "leave from CheckScheduleTableAccess %s.";
|
---|
| 1271 | break;
|
---|
| 1272 |
|
---|
| 1273 | case TFN_CHECKTASKOWNERSHIP:
|
---|
| 1274 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1275 | tracemsg = "leave from CheckTaskOwnership %s.";
|
---|
| 1276 | break;
|
---|
| 1277 |
|
---|
| 1278 | case TFN_CHECKISROWNERSHIP:
|
---|
| 1279 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1280 | tracemsg = "leave from CheckISROwnership %s.";
|
---|
| 1281 | break;
|
---|
| 1282 |
|
---|
| 1283 | case TFN_CHECKALARMOWNERSHIP:
|
---|
| 1284 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1285 | tracemsg = "leave from CheckAlarmOwnership %s.";
|
---|
| 1286 | break;
|
---|
| 1287 |
|
---|
| 1288 | case TFN_CHECKCOUNTEROWNERSHIP:
|
---|
| 1289 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1290 | tracemsg = "leave from CheckCounterOwnership %s.";
|
---|
| 1291 | break;
|
---|
| 1292 |
|
---|
| 1293 | case TFN_CHECKSCHEDULETABLEOWNERSHIP:
|
---|
| 1294 | info[0] = (uintptr) atk2_osapid_str((ApplicationType) trace->loginfo[1]);
|
---|
| 1295 | tracemsg = "leave from CheckScheduleTableOwnership %s.";
|
---|
| 1296 | break;
|
---|
| 1297 |
|
---|
| 1298 | default:
|
---|
| 1299 | tracemsg = "unknown servic call";
|
---|
| 1300 | break;
|
---|
| 1301 | }
|
---|
| 1302 |
|
---|
| 1303 | return(tracemsg);
|
---|
| 1304 | }
|
---|
| 1305 |
|
---|
| 1306 |
|
---|
| 1307 | /*
|
---|
| 1308 | * IOC - 入口ログ
|
---|
| 1309 | */
|
---|
| 1310 | static const char8 *
|
---|
| 1311 | trace_print_iocenter(const TRACE *trace, uintptr info[])
|
---|
| 1312 | {
|
---|
| 1313 | uint32 type;
|
---|
| 1314 | const char8 *tracemsg;
|
---|
| 1315 |
|
---|
| 1316 | type = (const uint32) trace->loginfo[0];
|
---|
| 1317 |
|
---|
| 1318 | switch (type) {
|
---|
| 1319 |
|
---|
| 1320 | case TFN_IOC_SEND_GENERIC:
|
---|
| 1321 | info[0] = trace->loginfo[1];
|
---|
| 1322 | tracemsg = "enter to IocSend Sender ID=%d.";
|
---|
| 1323 | break;
|
---|
| 1324 |
|
---|
| 1325 | case TFN_IOC_WRITE_GENERIC:
|
---|
| 1326 | info[0] = trace->loginfo[1];
|
---|
| 1327 | tracemsg = "enter to IocWrite Sender ID=%d.";
|
---|
| 1328 | break;
|
---|
| 1329 |
|
---|
| 1330 | case TFN_IOC_RECEIVE_GENERIC:
|
---|
| 1331 | info[0] = (uintptr) atk2_iocid_str((IocType) trace->loginfo[1]);
|
---|
| 1332 | info[1] = trace->loginfo[1];
|
---|
| 1333 | tracemsg = "enter to IocReceive IOC ID=%s(%d).";
|
---|
| 1334 | break;
|
---|
| 1335 |
|
---|
| 1336 | case TFN_IOC_READ_GENERIC:
|
---|
| 1337 | info[0] = (uintptr) atk2_iocid_str((IocType) trace->loginfo[1]);
|
---|
| 1338 | info[1] = trace->loginfo[1];
|
---|
| 1339 | tracemsg = "enter to IocRead IOC ID=%s(%d).";
|
---|
| 1340 | break;
|
---|
| 1341 |
|
---|
| 1342 | case TFN_IOC_EMPTY_QUEUE_GENERIC:
|
---|
| 1343 | info[0] = (uintptr) atk2_iocid_str((IocType) trace->loginfo[1]);
|
---|
| 1344 | info[1] = trace->loginfo[1];
|
---|
| 1345 | tracemsg = "enter to IocEmptyQueue IOC ID=%s(%d).";
|
---|
| 1346 | break;
|
---|
| 1347 |
|
---|
| 1348 | default:
|
---|
| 1349 | tracemsg = "unknown service call";
|
---|
| 1350 | break;
|
---|
| 1351 | }
|
---|
| 1352 |
|
---|
| 1353 | return(tracemsg);
|
---|
| 1354 | }
|
---|
| 1355 |
|
---|
| 1356 |
|
---|
| 1357 | /*
|
---|
| 1358 | * IOC - 出口ログ
|
---|
| 1359 | */
|
---|
| 1360 | static const char8 *
|
---|
| 1361 | trace_print_iocleave(const TRACE *trace, uintptr info[])
|
---|
| 1362 | {
|
---|
| 1363 | uint32 type;
|
---|
| 1364 | const char8 *tracemsg;
|
---|
| 1365 |
|
---|
| 1366 | type = (const uint32) trace->loginfo[0];
|
---|
| 1367 |
|
---|
| 1368 | switch (type) {
|
---|
| 1369 |
|
---|
| 1370 | case TFN_IOC_SEND_GENERIC:
|
---|
| 1371 | info[0] = (uintptr) atk2_ioc_strerror((StatusType) trace->loginfo[1]);
|
---|
| 1372 | tracemsg = "leave from IocSend %s.";
|
---|
| 1373 | break;
|
---|
| 1374 |
|
---|
| 1375 | case TFN_IOC_WRITE_GENERIC:
|
---|
| 1376 | info[0] = (uintptr) atk2_ioc_strerror((StatusType) trace->loginfo[1]);
|
---|
| 1377 | tracemsg = "leave from IocWrite %s.";
|
---|
| 1378 | break;
|
---|
| 1379 |
|
---|
| 1380 | case TFN_IOC_RECEIVE_GENERIC:
|
---|
| 1381 | info[0] = (uintptr) atk2_ioc_strerror((StatusType) trace->loginfo[1]);
|
---|
| 1382 | tracemsg = "leave from IocReceive %s.";
|
---|
| 1383 | break;
|
---|
| 1384 |
|
---|
| 1385 | case TFN_IOC_READ_GENERIC:
|
---|
| 1386 | info[0] = (uintptr) atk2_ioc_strerror((StatusType) trace->loginfo[1]);
|
---|
| 1387 | tracemsg = "leave from IocRead %s.";
|
---|
| 1388 | break;
|
---|
| 1389 |
|
---|
| 1390 | case TFN_IOC_EMPTY_QUEUE_GENERIC:
|
---|
| 1391 | info[0] = (uintptr) atk2_ioc_strerror((StatusType) trace->loginfo[1]);
|
---|
| 1392 | tracemsg = "leave from IocEmptyQueue %s.";
|
---|
| 1393 | break;
|
---|
| 1394 |
|
---|
| 1395 | default:
|
---|
| 1396 | tracemsg = "unknown tsk service call";
|
---|
| 1397 | break;
|
---|
| 1398 | }
|
---|
| 1399 |
|
---|
| 1400 | return(tracemsg);
|
---|
| 1401 | }
|
---|
| 1402 |
|
---|
| 1403 | /*
|
---|
| 1404 | * メモリアクセス関連機能 - 入口ログ
|
---|
| 1405 | */
|
---|
| 1406 | static const char8 *
|
---|
| 1407 | trace_print_memoryenter(const TRACE *trace, uintptr info[])
|
---|
| 1408 | {
|
---|
| 1409 | uint32 type;
|
---|
| 1410 | const char8 *tracemsg;
|
---|
| 1411 |
|
---|
| 1412 | type = (const uint32) trace->loginfo[0];
|
---|
| 1413 |
|
---|
| 1414 | switch (type) {
|
---|
| 1415 | case TFN_CHECKISRMEMORYACCESS:
|
---|
| 1416 | info[0] = (uintptr) atk2_isrid_str((ISRType) trace->loginfo[1]);
|
---|
| 1417 | info[1] = trace->loginfo[1];
|
---|
| 1418 | info[2] = trace->loginfo[2];
|
---|
| 1419 | info[3] = trace->loginfo[3];
|
---|
| 1420 | tracemsg = "enter to CheckISRMemoryAccess ISRID=%s(%d)/Address=0x%x/Size=0x%x.";
|
---|
| 1421 | break;
|
---|
| 1422 |
|
---|
| 1423 | case TFN_CHECKTASKMEMORYACCESS:
|
---|
| 1424 | info[0] = (uintptr) atk2_isrid_str((ISRType) trace->loginfo[1]);
|
---|
| 1425 | info[1] = trace->loginfo[1];
|
---|
| 1426 | info[2] = trace->loginfo[2];
|
---|
| 1427 | info[3] = trace->loginfo[3];
|
---|
| 1428 | tracemsg = "enter to CheckTaskMemoryAccess TaskID=%s(%d)/Address=0x%x/Size=0x%x.";
|
---|
| 1429 | break;
|
---|
| 1430 |
|
---|
| 1431 | default:
|
---|
| 1432 | tracemsg = "unknown servic call";
|
---|
| 1433 | break;
|
---|
| 1434 | }
|
---|
| 1435 |
|
---|
| 1436 | return(tracemsg);
|
---|
| 1437 | }
|
---|
| 1438 |
|
---|
| 1439 | /*
|
---|
| 1440 | * AccessTypeを文字列変換
|
---|
| 1441 | */
|
---|
| 1442 | static void
|
---|
| 1443 | trace_get_memory_access(AccessType access, uintptr info[])
|
---|
| 1444 | {
|
---|
| 1445 | boolean add_slash = FALSE;
|
---|
| 1446 |
|
---|
| 1447 | info[0] = (uintptr) "";
|
---|
| 1448 | info[1] = (uintptr) "";
|
---|
| 1449 | info[2] = (uintptr) "";
|
---|
| 1450 | info[3] = (uintptr) "";
|
---|
| 1451 |
|
---|
| 1452 | if (OSMEMORY_IS_STACKSPACE(access) != AP_NoAccess) {
|
---|
| 1453 | info[3] = (uintptr) "Stack";
|
---|
| 1454 | add_slash = TRUE;
|
---|
| 1455 | }
|
---|
| 1456 | if (OSMEMORY_IS_EXECUTABLE(access) != AP_NoAccess) {
|
---|
| 1457 | if (add_slash != FALSE) {
|
---|
| 1458 | info[2] = (uintptr) "Exec/";
|
---|
| 1459 | }
|
---|
| 1460 | else {
|
---|
| 1461 | info[2] = (uintptr) "Exec";
|
---|
| 1462 | }
|
---|
| 1463 | add_slash = TRUE;
|
---|
| 1464 | }
|
---|
| 1465 | if (OSMEMORY_IS_WRITEABLE(access) != AP_NoAccess) {
|
---|
| 1466 | if (add_slash != FALSE) {
|
---|
| 1467 | info[1] = (uintptr) "Write/";
|
---|
| 1468 | }
|
---|
| 1469 | else {
|
---|
| 1470 | info[1] = (uintptr) "Write";
|
---|
| 1471 | }
|
---|
| 1472 | add_slash = TRUE;
|
---|
| 1473 | }
|
---|
| 1474 | if (OSMEMORY_IS_READABLE(access) != AP_NoAccess) {
|
---|
| 1475 | if (add_slash != FALSE) {
|
---|
| 1476 | info[0] = (uintptr) "Read/";
|
---|
| 1477 | }
|
---|
| 1478 | else {
|
---|
| 1479 | info[0] = (uintptr) "Read";
|
---|
| 1480 | }
|
---|
| 1481 | add_slash = TRUE;
|
---|
| 1482 | }
|
---|
| 1483 | if (add_slash == FALSE) {
|
---|
| 1484 | info[0] = (uintptr) "NoAccess";
|
---|
| 1485 | }
|
---|
| 1486 | }
|
---|
| 1487 |
|
---|
| 1488 | /*
|
---|
| 1489 | * メモリアクセス関連機能 - 出口ログ
|
---|
| 1490 | */
|
---|
| 1491 | static const char8 *
|
---|
| 1492 | trace_print_memoryleave(const TRACE *trace, uintptr info[])
|
---|
| 1493 | {
|
---|
| 1494 | uint32 type;
|
---|
| 1495 | const char8 *tracemsg;
|
---|
| 1496 |
|
---|
| 1497 | type = (const uint32) trace->loginfo[0];
|
---|
| 1498 |
|
---|
| 1499 | switch (type) {
|
---|
| 1500 | case TFN_CHECKISRMEMORYACCESS:
|
---|
| 1501 | trace_get_memory_access((AccessType) trace->loginfo[1], info);
|
---|
| 1502 | tracemsg = "leave from CheckISRMemoryAccess %s%s%s%s.";
|
---|
| 1503 | break;
|
---|
| 1504 |
|
---|
| 1505 | case TFN_CHECKTASKMEMORYACCESS:
|
---|
| 1506 | trace_get_memory_access((AccessType) trace->loginfo[1], info);
|
---|
| 1507 | tracemsg = "leave from CheckTaskMemoryAccess %s%s%s%s.";
|
---|
| 1508 | break;
|
---|
| 1509 |
|
---|
| 1510 | default:
|
---|
| 1511 | tracemsg = "unknown servic call";
|
---|
| 1512 | break;
|
---|
| 1513 | }
|
---|
| 1514 |
|
---|
| 1515 | return(tracemsg);
|
---|
| 1516 | }
|
---|
| 1517 |
|
---|
| 1518 |
|
---|
| 1519 | /*
|
---|
| 1520 | * システムコールの入口ログ(LOG_TYPE_SVC|ENTER)
|
---|
| 1521 | */
|
---|
| 1522 | static const char8 *
|
---|
| 1523 | trace_print_svcenter(const TRACE *trace, uintptr info[], void (*outputc)(char8 c))
|
---|
| 1524 | {
|
---|
| 1525 | uint32 type;
|
---|
| 1526 | const char8 *tracemsg;
|
---|
| 1527 |
|
---|
| 1528 | type = (const uint32) trace->loginfo[0];
|
---|
| 1529 |
|
---|
| 1530 | switch (type) {
|
---|
| 1531 |
|
---|
| 1532 | /* タスク管理 */
|
---|
| 1533 | case TFN_ACTIVATETASK:
|
---|
| 1534 | case TFN_TERMINATETASK:
|
---|
| 1535 | case TFN_CHAINTASK:
|
---|
| 1536 | case TFN_SCHEDULE:
|
---|
| 1537 | tracemsg = trace_print_tskenter(trace, info);
|
---|
| 1538 | break;
|
---|
| 1539 |
|
---|
| 1540 | /* イベント機能 */
|
---|
| 1541 | case TFN_SETEVENT:
|
---|
| 1542 | case TFN_CLEAREVENT:
|
---|
| 1543 | case TFN_GETEVENT:
|
---|
| 1544 | case TFN_WAITEVENT:
|
---|
| 1545 | tracemsg = trace_print_evententer(trace, info);
|
---|
| 1546 | break;
|
---|
| 1547 |
|
---|
| 1548 | /* リソース機能 */
|
---|
| 1549 | case TFN_RELEASERESOURCE:
|
---|
| 1550 | case TFN_GETRESOURCE:
|
---|
| 1551 | tracemsg = trace_print_resenter(trace, info);
|
---|
| 1552 | break;
|
---|
| 1553 |
|
---|
| 1554 | /* アラーム機能 */
|
---|
| 1555 | case TFN_GETALARMBASE:
|
---|
| 1556 | case TFN_GETALARM:
|
---|
| 1557 | case TFN_SETRELALARM:
|
---|
| 1558 | case TFN_SETABSALARM:
|
---|
| 1559 | case TFN_CANCELALARM:
|
---|
| 1560 | case TFN_INCREMENTCOUNTER:
|
---|
| 1561 | case TFN_GETCOUNTERVALUE:
|
---|
| 1562 | case TFN_GETELAPSEDVALUE:
|
---|
| 1563 | tracemsg = trace_print_almenter(trace, info);
|
---|
| 1564 | break;
|
---|
| 1565 |
|
---|
| 1566 | /* スケジュールテーブル機能 */
|
---|
| 1567 | case TFN_STARTSCHEDULETABLEREL:
|
---|
| 1568 | case TFN_STARTSCHEDULETABLEABS:
|
---|
| 1569 | case TFN_STOPSCHEDULETABLE:
|
---|
| 1570 | case TFN_NEXTSCHEDULETABLE:
|
---|
| 1571 | case TFN_GETSCHEDULETABLESTATUS:
|
---|
| 1572 | tracemsg = trace_print_schtblenter(trace, info);
|
---|
| 1573 | break;
|
---|
| 1574 |
|
---|
| 1575 | /* 割込み管理機能 */
|
---|
| 1576 | case TFN_DISABLEALLINTERRUPTS:
|
---|
| 1577 | case TFN_SUSPENDALLINTERRUPTS:
|
---|
| 1578 | case TFN_SUSPENDOSINTERRUPTS:
|
---|
| 1579 | case TFN_ENABLEALLINTERRUPTS:
|
---|
| 1580 | case TFN_RESUMEALLINTERRUPTS:
|
---|
| 1581 | case TFN_RESUMEOSINTERRUPTS:
|
---|
| 1582 | case TFN_GETISRID:
|
---|
| 1583 | case TFN_DISABLEINTERRUPTSOURCE:
|
---|
| 1584 | case TFN_ENABLEINTERRUPTSOURCE:
|
---|
| 1585 | tracemsg = trace_print_intenter(trace, info);
|
---|
| 1586 | break;
|
---|
| 1587 |
|
---|
| 1588 | /* システム状態管理機能 */
|
---|
| 1589 | case TFN_GETTASKID:
|
---|
| 1590 | case TFN_GETTASKSTATE:
|
---|
| 1591 | case TFN_GETACTIVEAPPLICATIONMODE:
|
---|
| 1592 | tracemsg = trace_print_sysenter(trace, info);
|
---|
| 1593 | break;
|
---|
| 1594 |
|
---|
| 1595 | /* カーネルの初期化と終了処理 */
|
---|
| 1596 | case TFN_SHUTDOWNOS:
|
---|
| 1597 | tracemsg = trace_print_kerenter(trace, info, outputc);
|
---|
| 1598 | break;
|
---|
| 1599 |
|
---|
| 1600 | /* OSAP機能 */
|
---|
| 1601 | case TFN_GETAPPLICATIONID:
|
---|
| 1602 | case TFN_GETAPPLICATIONSTATE:
|
---|
| 1603 | case TFN_CALLTRUSTEDFUNCTION:
|
---|
| 1604 | case TFN_CHECKTASKACCESS:
|
---|
| 1605 | case TFN_CHECKISRACCESS:
|
---|
| 1606 | case TFN_CHECKALARMACCESS:
|
---|
| 1607 | case TFN_CHECKRESOURCEACCESS:
|
---|
| 1608 | case TFN_CHECKCOUNTERACCESS:
|
---|
| 1609 | case TFN_CHECKSCHEDULETABLEACCESS:
|
---|
| 1610 | case TFN_CHECKTASKOWNERSHIP:
|
---|
| 1611 | case TFN_CHECKISROWNERSHIP:
|
---|
| 1612 | case TFN_CHECKALARMOWNERSHIP:
|
---|
| 1613 | case TFN_CHECKCOUNTEROWNERSHIP:
|
---|
| 1614 | case TFN_CHECKSCHEDULETABLEOWNERSHIP:
|
---|
| 1615 | tracemsg = trace_print_osapenter(trace, info);
|
---|
| 1616 | break;
|
---|
| 1617 |
|
---|
| 1618 | /* IOC機能 */
|
---|
| 1619 | case TFN_IOC_SEND_GENERIC:
|
---|
| 1620 | case TFN_IOC_WRITE_GENERIC:
|
---|
| 1621 | case TFN_IOC_RECEIVE_GENERIC:
|
---|
| 1622 | case TFN_IOC_READ_GENERIC:
|
---|
| 1623 | case TFN_IOC_EMPTY_QUEUE_GENERIC:
|
---|
| 1624 | tracemsg = trace_print_iocenter(trace, info);
|
---|
| 1625 | break;
|
---|
| 1626 |
|
---|
| 1627 | /* メモリアクセス関連機能 */
|
---|
| 1628 | case TFN_CHECKISRMEMORYACCESS:
|
---|
| 1629 | case TFN_CHECKTASKMEMORYACCESS:
|
---|
| 1630 | tracemsg = trace_print_memoryenter(trace, info);
|
---|
| 1631 | break;
|
---|
| 1632 |
|
---|
| 1633 | default:
|
---|
| 1634 | tracemsg = "unknown LOG_TYPE_SVC|ENTER service call";
|
---|
| 1635 | break;
|
---|
| 1636 | }
|
---|
| 1637 | return(tracemsg);
|
---|
| 1638 | }
|
---|
| 1639 |
|
---|
| 1640 |
|
---|
| 1641 | /*
|
---|
| 1642 | * システムコールの出口ログ(LOG_TYPE_SVC|LEAVE)
|
---|
| 1643 | */
|
---|
| 1644 | static const char8 *
|
---|
| 1645 | trace_print_svcleave(const TRACE *trace, uintptr info[])
|
---|
| 1646 | {
|
---|
| 1647 | uint32 type;
|
---|
| 1648 | const char8 *tracemsg;
|
---|
| 1649 |
|
---|
| 1650 | type = (const uint32) trace->loginfo[0];
|
---|
| 1651 |
|
---|
| 1652 | switch (type) {
|
---|
| 1653 | case TFN_ACTIVATETASK:
|
---|
| 1654 | case TFN_TERMINATETASK:
|
---|
| 1655 | case TFN_CHAINTASK:
|
---|
| 1656 | case TFN_SCHEDULE:
|
---|
| 1657 | /* タスク管理 */
|
---|
| 1658 | tracemsg = trace_print_tskleave(trace, info);
|
---|
| 1659 | break;
|
---|
| 1660 |
|
---|
| 1661 | /* イベント機能 */
|
---|
| 1662 | case TFN_SETEVENT:
|
---|
| 1663 | case TFN_CLEAREVENT:
|
---|
| 1664 | case TFN_GETEVENT:
|
---|
| 1665 | case TFN_WAITEVENT:
|
---|
| 1666 | tracemsg = trace_print_eventleave(trace, info);
|
---|
| 1667 | break;
|
---|
| 1668 |
|
---|
| 1669 | /* リソース機能 */
|
---|
| 1670 | case TFN_RELEASERESOURCE:
|
---|
| 1671 | case TFN_GETRESOURCE:
|
---|
| 1672 | tracemsg = trace_print_resleave(trace, info);
|
---|
| 1673 | break;
|
---|
| 1674 |
|
---|
| 1675 | /* アラーム機能 */
|
---|
| 1676 | case TFN_GETALARMBASE:
|
---|
| 1677 | case TFN_GETALARM:
|
---|
| 1678 | case TFN_SETRELALARM:
|
---|
| 1679 | case TFN_SETABSALARM:
|
---|
| 1680 | case TFN_CANCELALARM:
|
---|
| 1681 | case TFN_INCREMENTCOUNTER:
|
---|
| 1682 | case TFN_GETCOUNTERVALUE:
|
---|
| 1683 | case TFN_GETELAPSEDVALUE:
|
---|
| 1684 | tracemsg = trace_print_almleave(trace, info);
|
---|
| 1685 | break;
|
---|
| 1686 |
|
---|
| 1687 | /* スケジュールテーブル機能 */
|
---|
| 1688 | case TFN_STARTSCHEDULETABLEREL:
|
---|
| 1689 | case TFN_STARTSCHEDULETABLEABS:
|
---|
| 1690 | case TFN_STOPSCHEDULETABLE:
|
---|
| 1691 | case TFN_NEXTSCHEDULETABLE:
|
---|
| 1692 | case TFN_GETSCHEDULETABLESTATUS:
|
---|
| 1693 | tracemsg = trace_print_schtblleave(trace, info);
|
---|
| 1694 | break;
|
---|
| 1695 |
|
---|
| 1696 | /* 割込み管理機能 */
|
---|
| 1697 | case TFN_DISABLEALLINTERRUPTS:
|
---|
| 1698 | case TFN_SUSPENDALLINTERRUPTS:
|
---|
| 1699 | case TFN_SUSPENDOSINTERRUPTS:
|
---|
| 1700 | case TFN_ENABLEALLINTERRUPTS:
|
---|
| 1701 | case TFN_RESUMEALLINTERRUPTS:
|
---|
| 1702 | case TFN_RESUMEOSINTERRUPTS:
|
---|
| 1703 | case TFN_GETISRID:
|
---|
| 1704 | case TFN_DISABLEINTERRUPTSOURCE:
|
---|
| 1705 | case TFN_ENABLEINTERRUPTSOURCE:
|
---|
| 1706 | tracemsg = trace_print_intleave(trace, info);
|
---|
| 1707 | break;
|
---|
| 1708 |
|
---|
| 1709 | /* システム状態管理機能 */
|
---|
| 1710 | case TFN_GETTASKID:
|
---|
| 1711 | case TFN_GETTASKSTATE:
|
---|
| 1712 | case TFN_GETACTIVEAPPLICATIONMODE:
|
---|
| 1713 | tracemsg = trace_print_sysleave(trace, info);
|
---|
| 1714 | break;
|
---|
| 1715 |
|
---|
| 1716 | /* OSAP機能 */
|
---|
| 1717 | case TFN_GETAPPLICATIONID:
|
---|
| 1718 | case TFN_GETAPPLICATIONSTATE:
|
---|
| 1719 | case TFN_CALLTRUSTEDFUNCTION:
|
---|
| 1720 | case TFN_CHECKTASKACCESS:
|
---|
| 1721 | case TFN_CHECKISRACCESS:
|
---|
| 1722 | case TFN_CHECKALARMACCESS:
|
---|
| 1723 | case TFN_CHECKRESOURCEACCESS:
|
---|
| 1724 | case TFN_CHECKCOUNTERACCESS:
|
---|
| 1725 | case TFN_CHECKSCHEDULETABLEACCESS:
|
---|
| 1726 | case TFN_CHECKTASKOWNERSHIP:
|
---|
| 1727 | case TFN_CHECKISROWNERSHIP:
|
---|
| 1728 | case TFN_CHECKALARMOWNERSHIP:
|
---|
| 1729 | case TFN_CHECKCOUNTEROWNERSHIP:
|
---|
| 1730 | case TFN_CHECKSCHEDULETABLEOWNERSHIP:
|
---|
| 1731 | tracemsg = trace_print_osapleave(trace, info);
|
---|
| 1732 | break;
|
---|
| 1733 |
|
---|
| 1734 | /* IOC機能 */
|
---|
| 1735 | case TFN_IOC_SEND_GENERIC:
|
---|
| 1736 | case TFN_IOC_WRITE_GENERIC:
|
---|
| 1737 | case TFN_IOC_RECEIVE_GENERIC:
|
---|
| 1738 | case TFN_IOC_READ_GENERIC:
|
---|
| 1739 | case TFN_IOC_EMPTY_QUEUE_GENERIC:
|
---|
| 1740 | tracemsg = trace_print_iocleave(trace, info);
|
---|
| 1741 | break;
|
---|
| 1742 |
|
---|
| 1743 | /* メモリアクセス関連機能 */
|
---|
| 1744 | case TFN_CHECKISRMEMORYACCESS:
|
---|
| 1745 | case TFN_CHECKTASKMEMORYACCESS:
|
---|
| 1746 | tracemsg = trace_print_memoryleave(trace, info);
|
---|
| 1747 | break;
|
---|
| 1748 |
|
---|
| 1749 |
|
---|
| 1750 | default:
|
---|
| 1751 | tracemsg = "unknown LOG_TYPE_SVC|LEAVE servic call";
|
---|
| 1752 | break;
|
---|
| 1753 | }
|
---|
| 1754 |
|
---|
| 1755 | return(tracemsg);
|
---|
| 1756 | }
|
---|
| 1757 |
|
---|
| 1758 | /*
|
---|
| 1759 | * 処理単位を切り替える
|
---|
| 1760 | * 通常はtrace_push_contextから呼ばれるが,
|
---|
| 1761 | * trace_push_contextを経由しない場合もある(タスク,スタートアップフック)
|
---|
| 1762 | */
|
---|
| 1763 | static void
|
---|
| 1764 | trace_set_context(PR_UNIT_TYPE type, ObjectIDType id)
|
---|
| 1765 | {
|
---|
| 1766 | context_stack[context_index].type = type;
|
---|
| 1767 | context_stack[context_index].id = id;
|
---|
| 1768 | }
|
---|
| 1769 |
|
---|
| 1770 | /*
|
---|
| 1771 | * 処理単位スタックにtype, idで指定される処理単位をプッシュする
|
---|
| 1772 | */
|
---|
| 1773 | static void
|
---|
| 1774 | trace_push_context(PR_UNIT_TYPE type, ObjectIDType id)
|
---|
| 1775 | {
|
---|
| 1776 | context_index++;
|
---|
| 1777 | trace_set_context(type, id);
|
---|
| 1778 | }
|
---|
| 1779 |
|
---|
| 1780 | /*
|
---|
| 1781 | * 現在の処理単位を返す
|
---|
| 1782 | * p_obj_type_strには処理単位種別の文字列を入れる
|
---|
| 1783 | * p_idには処理単位のIDを入れる
|
---|
| 1784 | * タスク,C2ISR実行中の場合で,アラーム満了処理,
|
---|
| 1785 | * スケジュールテーブル満了処理,信頼関数を行なっている場合は,それらを
|
---|
| 1786 | * 現在の処理単位として返す
|
---|
| 1787 | */
|
---|
| 1788 | static void
|
---|
| 1789 | trace_get_context(uintptr *p_obj_type_str, uintptr *p_id)
|
---|
| 1790 | {
|
---|
| 1791 | PR_UNIT_TYPE type;
|
---|
| 1792 | ObjectIDType id;
|
---|
| 1793 | sint32 index;
|
---|
| 1794 |
|
---|
| 1795 | type = context_stack[context_index].type;
|
---|
| 1796 | id = context_stack[context_index].id;
|
---|
| 1797 | if (type == PR_UNIT_TASK) {
|
---|
| 1798 | index = task_context_index[id];
|
---|
| 1799 | if (index >= 0) {
|
---|
| 1800 | id = task_exec[id][index].id;
|
---|
| 1801 | type = task_exec[id][index].type;
|
---|
| 1802 | }
|
---|
| 1803 | }
|
---|
| 1804 | else if (type == PR_UNIT_ISR) {
|
---|
| 1805 | index = isr_context_index[id];
|
---|
| 1806 | if (index >= 0) {
|
---|
| 1807 | id = isr_exec[id][index].id;
|
---|
| 1808 | type = isr_exec[id][index].type;
|
---|
| 1809 | }
|
---|
| 1810 | }
|
---|
| 1811 | else {
|
---|
| 1812 | /* typeが上記以外の場合,処理は行わない */
|
---|
| 1813 | }
|
---|
| 1814 | *p_obj_type_str = (const uintptr) obj_type_to_str[type];
|
---|
| 1815 | *p_id = (uintptr) id;
|
---|
| 1816 | }
|
---|
| 1817 |
|
---|
| 1818 | /*
|
---|
| 1819 | * trace_push_contextでプッシュした処理単位をポップ(取り除く)する
|
---|
| 1820 | * 1つ前の処理単位を返す
|
---|
| 1821 | */
|
---|
| 1822 | static void
|
---|
| 1823 | trace_pop_context(uintptr *p_obj_type_str, uintptr *p_id)
|
---|
| 1824 | {
|
---|
| 1825 | context_index--;
|
---|
| 1826 | trace_get_context(p_obj_type_str, p_id);
|
---|
| 1827 | }
|
---|
| 1828 |
|
---|
| 1829 | /*
|
---|
| 1830 | * タスク,C2ISR実行中にアラーム満了処理,スケジュールテーブ
|
---|
| 1831 | * ル満了処理,信頼関数が発生した場合に,現在の処理単位をそれらの満了処理にする
|
---|
| 1832 | */
|
---|
| 1833 | static void
|
---|
| 1834 | trace_change_context(PR_UNIT_TYPE type, ObjectIDType id)
|
---|
| 1835 | {
|
---|
| 1836 | sint32 index;
|
---|
| 1837 | TaskType tskid;
|
---|
| 1838 | ISRType isrid;
|
---|
| 1839 | if (context_stack[context_index].type == PR_UNIT_TASK) {
|
---|
| 1840 | tskid = context_stack[context_index].id;
|
---|
| 1841 | task_context_index[tskid]++;
|
---|
| 1842 | index = task_context_index[tskid];
|
---|
| 1843 | task_exec[tskid][index].id = id;
|
---|
| 1844 | task_exec[tskid][index].type = type;
|
---|
| 1845 | }
|
---|
| 1846 | else if (context_stack[context_index].type == PR_UNIT_ISR) {
|
---|
| 1847 | isrid = context_stack[context_index].id;
|
---|
| 1848 | isr_context_index[isrid]++;
|
---|
| 1849 | index = isr_context_index[isrid];
|
---|
| 1850 | isr_exec[isrid][index].id = id;
|
---|
| 1851 | isr_exec[isrid][index].type = type;
|
---|
| 1852 | }
|
---|
| 1853 | else {
|
---|
| 1854 | /* ここには来ない.万が一来た場合,以降のログ内容が未保証となる */
|
---|
| 1855 | }
|
---|
| 1856 | }
|
---|
| 1857 |
|
---|
| 1858 | /*
|
---|
| 1859 | * タスク,C2ISR実行中のアラーム満了処理,スケジュールテーブ
|
---|
| 1860 | * ル満了処理,信頼関数の終了時に呼び出し,処理単位を戻す
|
---|
| 1861 | */
|
---|
| 1862 | static void
|
---|
| 1863 | trace_resume_context(void)
|
---|
| 1864 | {
|
---|
| 1865 | TaskType tskid;
|
---|
| 1866 | ISRType isrid;
|
---|
| 1867 | if (context_stack[context_index].type == PR_UNIT_TASK) {
|
---|
| 1868 | tskid = context_stack[context_index].id;
|
---|
| 1869 | task_context_index[tskid]--;
|
---|
| 1870 | }
|
---|
| 1871 | else if (context_stack[context_index].type == PR_UNIT_ISR) {
|
---|
| 1872 | isrid = context_stack[context_index].id;
|
---|
| 1873 | isr_context_index[isrid]--;
|
---|
| 1874 | }
|
---|
| 1875 | else {
|
---|
| 1876 | /* ここには来ない.万が一来た場合,以降のログ内容が未保証となる */
|
---|
| 1877 | }
|
---|
| 1878 | }
|
---|
| 1879 |
|
---|
| 1880 | /*
|
---|
| 1881 | * トレースログの表示
|
---|
| 1882 | */
|
---|
| 1883 | static void
|
---|
| 1884 | trace_print(const TRACE *p_trace, void (*outputc)(char8 c))
|
---|
| 1885 | {
|
---|
| 1886 | uintptr traceinfo[TMAX_LOGINFO + 1U];
|
---|
| 1887 | const char8 *tracemsg;
|
---|
| 1888 | uint32 i;
|
---|
| 1889 | TaskType tskid;
|
---|
| 1890 | AlarmType almid;
|
---|
| 1891 | ISRType isrid;
|
---|
| 1892 | ScheduleTableType schtblid;
|
---|
| 1893 | ApplicationType osapid;
|
---|
| 1894 |
|
---|
| 1895 | traceinfo[0] = (uintptr) (p_trace->logtim);
|
---|
| 1896 | syslog_printf("[%d] ", traceinfo, outputc);
|
---|
| 1897 |
|
---|
| 1898 | switch (p_trace->logtype) {
|
---|
| 1899 | /* C2ISRの開始 */
|
---|
| 1900 | case LOG_TYPE_ISR | LOG_ENTER:
|
---|
| 1901 | isrid = p_trace->loginfo[0];
|
---|
| 1902 | trace_push_context(PR_UNIT_ISR, isrid);
|
---|
| 1903 |
|
---|
| 1904 | traceinfo[0] = (uintptr) isrid;
|
---|
| 1905 | tracemsg = "enter to isr %d.";
|
---|
| 1906 | break;
|
---|
| 1907 |
|
---|
| 1908 | /* C2ISRの終了 */
|
---|
| 1909 | case LOG_TYPE_ISR | LOG_LEAVE:
|
---|
| 1910 | isrid = p_trace->loginfo[0];
|
---|
| 1911 |
|
---|
| 1912 | traceinfo[0] = (uintptr) isrid;
|
---|
| 1913 | trace_pop_context(&(traceinfo[1]), &(traceinfo[2]));
|
---|
| 1914 | tracemsg = "leave from isr %d, context is %s %d.";
|
---|
| 1915 | break;
|
---|
| 1916 |
|
---|
| 1917 | /* アラーム満了処理の開始 */
|
---|
| 1918 | case LOG_TYPE_ALM | LOG_ENTER:
|
---|
| 1919 | almid = (uintptr) (((ALMCB *) (p_trace->loginfo[0])) - almcb_table);
|
---|
| 1920 | trace_change_context(PR_UNIT_ALARM, almid);
|
---|
| 1921 |
|
---|
| 1922 | traceinfo[0] = (uintptr) almid;
|
---|
| 1923 | tracemsg = "enter to alarm %d.";
|
---|
| 1924 | break;
|
---|
| 1925 |
|
---|
| 1926 | /* アラーム満了処理の終了 */
|
---|
| 1927 | case LOG_TYPE_ALM | LOG_LEAVE:
|
---|
| 1928 | almid = (uintptr) (((ALMCB *) (p_trace->loginfo[0])) - almcb_table);
|
---|
| 1929 | trace_resume_context();
|
---|
| 1930 |
|
---|
| 1931 | traceinfo[0] = (uintptr) almid;
|
---|
| 1932 | trace_get_context(&(traceinfo[1]), &(traceinfo[2]));
|
---|
| 1933 | tracemsg = "leave from alarm %d, context is %s %d.";
|
---|
| 1934 | break;
|
---|
| 1935 |
|
---|
| 1936 | /* スケジュールテーブル満了処理の開始 */
|
---|
| 1937 | case LOG_TYPE_SCHTBL | LOG_ENTER:
|
---|
| 1938 | schtblid = (uintptr) (((SCHTBLCB *) (p_trace->loginfo[0])) - schtblcb_table);
|
---|
| 1939 | trace_change_context(PR_UNIT_SCHTBL, schtblid);
|
---|
| 1940 |
|
---|
| 1941 | traceinfo[0] = (uintptr) schtblid;
|
---|
| 1942 | tracemsg = "enter to scheduletable %d.";
|
---|
| 1943 | break;
|
---|
| 1944 |
|
---|
| 1945 | /* スケジュールテーブル満了処理の終了 */
|
---|
| 1946 | case LOG_TYPE_SCHTBL | LOG_LEAVE:
|
---|
| 1947 | schtblid = (uintptr) (((SCHTBLCB *) (p_trace->loginfo[0])) - schtblcb_table);
|
---|
| 1948 | trace_resume_context();
|
---|
| 1949 |
|
---|
| 1950 | traceinfo[0] = (uintptr) schtblid;
|
---|
| 1951 | trace_get_context(&(traceinfo[1]), &(traceinfo[2]));
|
---|
| 1952 | tracemsg = "leave from scheduletable %d, context is %s %d.";
|
---|
| 1953 | break;
|
---|
| 1954 |
|
---|
| 1955 | /* スタートアップフックの開始 */
|
---|
| 1956 | case LOG_TYPE_STAHOOK | LOG_ENTER:
|
---|
| 1957 | trace_set_context(PR_UNIT_STA, 0U);
|
---|
| 1958 | tracemsg = "enter to startup hook.";
|
---|
| 1959 | break;
|
---|
| 1960 |
|
---|
| 1961 | /* スタートアップフックの終了 */
|
---|
| 1962 | case LOG_TYPE_STAHOOK | LOG_LEAVE:
|
---|
| 1963 | tracemsg = "leave from startup hook.";
|
---|
| 1964 | break;
|
---|
| 1965 |
|
---|
| 1966 | /* エラーフックの開始 */
|
---|
| 1967 | case LOG_TYPE_ERRHOOK | LOG_ENTER:
|
---|
| 1968 | trace_push_context(PR_UNIT_ERR, 0U);
|
---|
| 1969 |
|
---|
| 1970 | traceinfo[0] = (uintptr) atk2_strerror((StatusType) p_trace->loginfo[0]);
|
---|
| 1971 | tracemsg = "enter to error hook ercd=%s.";
|
---|
| 1972 | break;
|
---|
| 1973 |
|
---|
| 1974 | /* エラーフックの終了 */
|
---|
| 1975 | case LOG_TYPE_ERRHOOK | LOG_LEAVE:
|
---|
| 1976 | trace_pop_context(&(traceinfo[0]), &(traceinfo[1]));
|
---|
| 1977 | tracemsg = "leave from error hook, context is %s %d.";
|
---|
| 1978 | break;
|
---|
| 1979 |
|
---|
| 1980 | /* プロテクションフックの開始 */
|
---|
| 1981 | case LOG_TYPE_PROHOOK | LOG_ENTER:
|
---|
| 1982 | trace_push_context(PR_UNIT_PRO, 0U);
|
---|
| 1983 |
|
---|
| 1984 | traceinfo[0] = (uintptr) atk2_strerror((StatusType) p_trace->loginfo[0]);
|
---|
| 1985 | tracemsg = "enter to protection hook ercd=%s.";
|
---|
| 1986 | break;
|
---|
| 1987 |
|
---|
| 1988 | /* プロテクションフックの終了 */
|
---|
| 1989 | case LOG_TYPE_PROHOOK | LOG_LEAVE:
|
---|
| 1990 | traceinfo[0] = (uintptr) trace_proret_str((ProtectionReturnType) p_trace->loginfo[0]);
|
---|
| 1991 | trace_pop_context(&(traceinfo[1]), &(traceinfo[2]));
|
---|
| 1992 | tracemsg = "leave from protection hook ercd=%s, context is %s %d.";
|
---|
| 1993 | break;
|
---|
| 1994 |
|
---|
| 1995 | /* シャットダウンフックの開始 */
|
---|
| 1996 | case LOG_TYPE_SHUTHOOK | LOG_ENTER:
|
---|
| 1997 | trace_push_context(PR_UNIT_SHUT, 0U);
|
---|
| 1998 |
|
---|
| 1999 | traceinfo[0] = (uintptr) atk2_strerror((StatusType) p_trace->loginfo[0]);
|
---|
| 2000 | tracemsg = "enter to shutdown hook ercd=%s.";
|
---|
| 2001 | break;
|
---|
| 2002 |
|
---|
| 2003 | /* シャットダウンフックの終了 */
|
---|
| 2004 | case LOG_TYPE_SHUTHOOK | LOG_LEAVE:
|
---|
| 2005 | trace_pop_context(&(traceinfo[0]), &(traceinfo[1]));
|
---|
| 2006 | tracemsg = "leave from shutdown hook.";
|
---|
| 2007 | break;
|
---|
| 2008 |
|
---|
| 2009 | /* 信頼関数の開始 */
|
---|
| 2010 | case LOG_TYPE_TFN | LOG_ENTER:
|
---|
| 2011 | trace_change_context(PR_UNIT_TFN, p_trace->loginfo[0]);
|
---|
| 2012 |
|
---|
| 2013 | traceinfo[0] = (const uintptr) p_trace->loginfo[0];
|
---|
| 2014 | tracemsg = "enter to trusted function %d.";
|
---|
| 2015 | break;
|
---|
| 2016 |
|
---|
| 2017 | /* 信頼関数の終了 */
|
---|
| 2018 | case LOG_TYPE_TFN | LOG_LEAVE:
|
---|
| 2019 | trace_resume_context();
|
---|
| 2020 |
|
---|
| 2021 | traceinfo[0] = (const uintptr) p_trace->loginfo[0];
|
---|
| 2022 | traceinfo[1] = (uintptr) atk2_strerror((StatusType) p_trace->loginfo[1]);
|
---|
| 2023 | traceinfo[2] = p_trace->loginfo[1];
|
---|
| 2024 | trace_get_context(&(traceinfo[3]), &(traceinfo[4]));
|
---|
| 2025 | tracemsg = "leave from trusted function %d ercd=%s(%d), context is %s %d.";
|
---|
| 2026 | break;
|
---|
| 2027 |
|
---|
| 2028 | /* OSAP固有スタートアップフックの開始 */
|
---|
| 2029 | case LOG_TYPE_STAHOOKOSAP | LOG_ENTER:
|
---|
| 2030 | trace_set_context(PR_UNIT_STAOSAP, p_trace->loginfo[0]);
|
---|
| 2031 |
|
---|
| 2032 | traceinfo[0] = (const uintptr) p_trace->loginfo[0];
|
---|
| 2033 | tracemsg = "enter to startup hook OSAP %d.";
|
---|
| 2034 | break;
|
---|
| 2035 |
|
---|
| 2036 | /* OSAP固有スタートアップフックの終了 */
|
---|
| 2037 | case LOG_TYPE_STAHOOKOSAP | LOG_LEAVE:
|
---|
| 2038 | traceinfo[0] = (const uintptr) p_trace->loginfo[0];
|
---|
| 2039 | tracemsg = "leave from startup hook OSAP %d.";
|
---|
| 2040 | break;
|
---|
| 2041 |
|
---|
| 2042 | /* OSAP固有エラーフックの開始 */
|
---|
| 2043 | case LOG_TYPE_ERRHOOKOSAP | LOG_ENTER:
|
---|
| 2044 | osapid = OSAPID((const OSAPCB *) p_trace->loginfo[0]);
|
---|
| 2045 | trace_push_context(PR_UNIT_ERROSAP, (ObjectIDType) osapid);
|
---|
| 2046 |
|
---|
| 2047 | traceinfo[0] = (uintptr) osapid;
|
---|
| 2048 | traceinfo[1] = (uintptr) atk2_strerror((StatusType) p_trace->loginfo[1]);
|
---|
| 2049 | tracemsg = "enter to error hook OSAP %d ercd=%s.";
|
---|
| 2050 | break;
|
---|
| 2051 |
|
---|
| 2052 | /* OSAP固有エラーフックの終了 */
|
---|
| 2053 | case LOG_TYPE_ERRHOOKOSAP | LOG_LEAVE:
|
---|
| 2054 | osapid = OSAPID((const OSAPCB *) p_trace->loginfo[0]);
|
---|
| 2055 |
|
---|
| 2056 | traceinfo[0] = (uintptr) osapid;
|
---|
| 2057 | trace_pop_context(&(traceinfo[1]), &(traceinfo[2]));
|
---|
| 2058 | tracemsg = "leave from error hook OSAP %d, context is %s %d.";
|
---|
| 2059 | break;
|
---|
| 2060 |
|
---|
| 2061 | /* OSAP固有シャットダウンフックの開始 */
|
---|
| 2062 | case LOG_TYPE_SHUTHOOKOSAP | LOG_ENTER:
|
---|
| 2063 | trace_push_context(PR_UNIT_SHUTOSAP, p_trace->loginfo[0]);
|
---|
| 2064 |
|
---|
| 2065 | traceinfo[0] = (const uintptr) p_trace->loginfo[0];
|
---|
| 2066 | traceinfo[1] = (uintptr) atk2_strerror((StatusType) p_trace->loginfo[1]);
|
---|
| 2067 | tracemsg = "enter to shutdown hook OSAP %d ercd=%s.";
|
---|
| 2068 | break;
|
---|
| 2069 |
|
---|
| 2070 | /* OSAP固有シャットダウンフックの終了 */
|
---|
| 2071 | case LOG_TYPE_SHUTHOOKOSAP | LOG_LEAVE:
|
---|
| 2072 | traceinfo[0] = (const uintptr) p_trace->loginfo[0];
|
---|
| 2073 | trace_pop_context(&(traceinfo[1]), &(traceinfo[2]));
|
---|
| 2074 | tracemsg = "leave from shutdown hook OSAP %d.";
|
---|
| 2075 | break;
|
---|
| 2076 |
|
---|
| 2077 | /* タスク状態の変化 */
|
---|
| 2078 | case LOG_TYPE_TSKSTAT:
|
---|
| 2079 | traceinfo[0] = trace_get_tskid(p_trace->loginfo[0]);
|
---|
| 2080 | traceinfo[1] = (uintptr) atk2_task_state_str((TaskStateType) p_trace->loginfo[1]);
|
---|
| 2081 | tracemsg = "task %d becomes %s.";
|
---|
| 2082 | break;
|
---|
| 2083 |
|
---|
| 2084 | /* ディスパッチャの入口 */
|
---|
| 2085 | case LOG_TYPE_DSP | LOG_ENTER:
|
---|
| 2086 | traceinfo[0] = trace_get_tskid(p_trace->loginfo[0]);
|
---|
| 2087 | tracemsg = "dispatch from task %d.";
|
---|
| 2088 | break;
|
---|
| 2089 |
|
---|
| 2090 | /* ディスパッチャの出口 */
|
---|
| 2091 | case LOG_TYPE_DSP | LOG_LEAVE:
|
---|
| 2092 | tskid = (TaskType) trace_get_tskid(p_trace->loginfo[0]);
|
---|
| 2093 | traceinfo[0] = (uintptr) tskid;
|
---|
| 2094 | trace_set_context(PR_UNIT_TASK, tskid);
|
---|
| 2095 | /* 満了処理をしているかもしれないので,現在の処理単位を取得する */
|
---|
| 2096 | trace_get_context(&(traceinfo[1]), &(traceinfo[2]));
|
---|
| 2097 |
|
---|
| 2098 | if (traceinfo[1] != (const uintptr) obj_type_to_str[PR_UNIT_TASK]) {
|
---|
| 2099 | tracemsg = "dispatch to task %d, executing %s %d.";
|
---|
| 2100 | }
|
---|
| 2101 | else {
|
---|
| 2102 | tracemsg = "dispatch to task %d.";
|
---|
| 2103 | }
|
---|
| 2104 | break;
|
---|
| 2105 |
|
---|
| 2106 | /* システムサービスの入口 */
|
---|
| 2107 | case LOG_TYPE_SVC | LOG_ENTER:
|
---|
| 2108 | tracemsg = trace_print_svcenter(p_trace, traceinfo, outputc);
|
---|
| 2109 | break;
|
---|
| 2110 |
|
---|
| 2111 | /* システムサービスの出口 */
|
---|
| 2112 | case LOG_TYPE_SVC | LOG_LEAVE:
|
---|
| 2113 | tracemsg = trace_print_svcleave(p_trace, traceinfo);
|
---|
| 2114 | break;
|
---|
| 2115 |
|
---|
| 2116 | case LOG_TYPE_COMMENT:
|
---|
| 2117 | for (i = 1U; i < TMAX_LOGINFO; i++) {
|
---|
| 2118 | traceinfo[i - 1U] = p_trace->loginfo[i];
|
---|
| 2119 | }
|
---|
| 2120 | tracemsg = (const char8 *) (p_trace->loginfo[0]);
|
---|
| 2121 | break;
|
---|
| 2122 |
|
---|
| 2123 | case LOG_TYPE_ASSERT:
|
---|
| 2124 | traceinfo[0] = p_trace->loginfo[0];
|
---|
| 2125 | traceinfo[1] = p_trace->loginfo[1];
|
---|
| 2126 | traceinfo[2] = p_trace->loginfo[2];
|
---|
| 2127 | tracemsg = "%s:%u: Assertion '%s' failed.";
|
---|
| 2128 | break;
|
---|
| 2129 |
|
---|
| 2130 | case LOG_TYPE_USER_MARK:
|
---|
| 2131 | traceinfo[0] = p_trace->loginfo[0];
|
---|
| 2132 | tracemsg = "user mark=%s.";
|
---|
| 2133 | break;
|
---|
| 2134 |
|
---|
| 2135 | default:
|
---|
| 2136 | traceinfo[0] = p_trace->logtype;
|
---|
| 2137 | tracemsg = "unknown trace log type: %d.";
|
---|
| 2138 | break;
|
---|
| 2139 | }
|
---|
| 2140 | syslog_printf(tracemsg, traceinfo, outputc);
|
---|
| 2141 | (*outputc)('\n');
|
---|
| 2142 | }
|
---|
| 2143 |
|
---|
| 2144 | /*
|
---|
| 2145 | * トレースログのダンプ
|
---|
| 2146 | */
|
---|
| 2147 | void
|
---|
| 2148 | trace_dump(void (*exinf)(char8 c))
|
---|
| 2149 | {
|
---|
| 2150 | TRACE trace;
|
---|
| 2151 | void (*outputc)(char8 c);
|
---|
| 2152 | uint32 i;
|
---|
| 2153 |
|
---|
| 2154 | for (i = 0U; i < TNUM_TASK; i++) {
|
---|
| 2155 | task_context_index[i] = -1;
|
---|
| 2156 | }
|
---|
| 2157 | for (i = 0U; i < TNUM_ISR2; i++) {
|
---|
| 2158 | isr_context_index[i] = -1;
|
---|
| 2159 | }
|
---|
| 2160 |
|
---|
| 2161 | outputc = exinf;
|
---|
| 2162 | while (trace_rea_log(&trace) == E_OK) {
|
---|
| 2163 | trace_print(&trace, outputc);
|
---|
| 2164 | }
|
---|
| 2165 | syslog(LOG_NOTICE, "sizeof TRACE=%d", sizeof(TRACE));
|
---|
| 2166 |
|
---|
| 2167 | }
|
---|