source: atk2-sc3-1.4.0-ntisr/include/Os.h@ 172

Last change on this file since 172 was 172, checked in by ertl-ishikawa, 8 years ago

ATK2-SC3 1.4.0 RH850依存部 非信頼C2ISR対応を追加

  • Property svn:executable set to *
File size: 28.1 KB
Line 
1/*
2 * TOPPERS ATK2
3 * Toyohashi Open Platform for Embedded Real-Time Systems
4 * Automotive Kernel Version 2
5 *
6 * Copyright (C) 2011-2015 by Center for Embedded Computing Systems
7 * Graduate School of Information Science, Nagoya Univ., JAPAN
8 * Copyright (C) 2011-2015 by FUJI SOFT INCORPORATED, JAPAN
9 * Copyright (C) 2011-2013 by Spansion LLC, USA
10 * Copyright (C) 2011-2015 by NEC Communication Systems, Ltd., JAPAN
11 * Copyright (C) 2011-2015 by Panasonic Advanced Technology Development Co., Ltd., JAPAN
12 * Copyright (C) 2011-2014 by Renesas Electronics Corporation, JAPAN
13 * Copyright (C) 2011-2015 by Sunny Giken Inc., JAPAN
14 * Copyright (C) 2011-2015 by TOSHIBA CORPORATION, JAPAN
15 * Copyright (C) 2011-2015 by Witz Corporation
16 * Copyright (C) 2014-2015 by AISIN COMCRUISE Co., Ltd., JAPAN
17 * Copyright (C) 2014-2015 by eSOL Co.,Ltd., JAPAN
18 * Copyright (C) 2014-2015 by SCSK Corporation, JAPAN
19 * Copyright (C) 2015 by SUZUKI MOTOR CORPORATION
20 *
21 * 上記著作権者
22は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
23 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
24 * 変・再é…
25å¸ƒï¼ˆä»¥ä¸‹ï¼Œåˆ©ç”¨ã¨å‘¼ã¶ï¼‰ã™ã‚‹ã“とを無償で許諾する.
26 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
27 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
28 * スコード中に含まれていること.
29 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
30 * 用できる形で再é…
31å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
32å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
33 * 者
34マニュアルなど)に,上記の著作権表示,この利用条件および下記
35 * の無保証規定を掲載すること.
36 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
37 * 用できない形で再é…
38å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®ã„ずれかの条件を満たすこ
39 * と.
40 * (a) 再é…
41å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
42マニュアルなど)に,上記の著
43 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
44 * (b) 再é…
45å¸ƒã®å½¢æ…
46‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに
47 * 報告すること.
48 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
49 * 害からも,上記著作権者
50およびTOPPERSプロジェクトをå…
51è²¬ã™ã‚‹ã“と.
52 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
53 * 由に基づく請求からも,上記著作権者
54およびTOPPERSプロジェクトを
55 * å…
56è²¬ã™ã‚‹ã“と.
57 *
58 * 本ソフトウェアは,AUTOSAR(AUTomotive Open System ARchitecture)仕
59 * 様に基づいている.上記の許諾は,AUTOSARの知的財産権を許諾するもので
60 * はない.AUTOSARは,AUTOSAR仕様に基づいたソフトウェアを商用目的で利
61 * 用する者
62に対して,AUTOSARパートナーになることを求めている.
63 *
64 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
65お
66 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
67 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
68 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
69 * の責任を負わない.
70 *
71 * $Id: Os.h 500 2015-12-23 07:10:02Z ertl-ishikawa $
72 */
73
74/*
75 * ATK2 OSヘッダファイル
76 *
77 * ATK2がサポートするシステムサービスの宣言と,必
78要なデー
79 * タ型,定数,マクロの定義を含むヘッダファイル
80 *
81 * アセンブリ言語のソースファイルからこのファイルをインクルードする時
82 * は,TOPPERS_MACRO_ONLYを定義しておく
83 * これにより,マクロ定義以外を除くようになっている
84 *
85 * このファイルをインクルードする前にインクルードしておくべきファイル
86 * はない
87 */
88
89#ifndef TOPPERS_OS_H
90#define TOPPERS_OS_H
91
92#ifdef TOPPERS_TRUSTED
93#define TOPPERS_SVC_FUNCCALL
94#endif
95
96#if defined(TOPPERS_TRUSTED) && defined(TOPPERS_NON_TRUSTED)
97#error "both TOPPERS_TRUSTED and TOPPERS_NON_TRUSTED are defined!"
98#endif
99
100/*
101 * å…
102±é€šã®ãƒ‡ãƒ¼ã‚¿åž‹ãƒ»å®šæ•°ãƒ»ãƒžã‚¯ãƒ­
103 */
104#include "Std_Types.h"
105#include "MemMap.h"
106#include "Rte_Os_Type.h"
107
108#if !defined(TOPPERS_CFG1_OUT) && !defined(OMIT_INCLUDE_OS_CFG)
109#include "Os_Cfg.h"
110#endif
111
112/*
113 * ターゲット依存部
114 */
115#include "target_kernel.h"
116
117#ifndef TOPPERS_MACRO_ONLY
118
119/*
120 * データ型の定義
121 */
122
123/*
124 * オブジェクト番号の型定義
125 */
126typedef uint8 TaskStateType; /* タスク状æ…
127‹ */
128typedef uint32 EventMaskType; /* イベントマスク */
129typedef uint32 TickType; /* カウンタ値(ティック)*/
130typedef uint32 AppModeType; /* アプリケーションモード */
131typedef uint8 OSServiceIdType; /* システムサービスID */
132typedef uint8 ScheduleTableStatusType; /* スケジュールテーブル状æ…
133‹ */
134typedef uint8 ProtectionReturnType; /* プロテクションフックからの返り値 */
135typedef uintptr MemorySizeType; /* メモリ領域サイズ */
136typedef uint8 ApplicationType; /* OSアプリケーションID */
137typedef uint8 ObjectTypeType; /* OSオブジェクト種別 */
138typedef uint8 ApplicationStateType; /* OSアプリケーション状æ…
139‹ */
140typedef uint8 AccessType; /* メモリ領域アクセス権 */
141typedef boolean ObjectAccessType; /* OSオブジェクトアクセス権 */
142typedef uint8 RestartType; /* OSAPリスタート属性 */
143
144typedef struct {
145 TickType maxallowedvalue; /* カウンタ指定の最大値 */
146 TickType ticksperbase; /* OSでは使用せず,ユーザが自由に使用する値 */
147 TickType mincycle; /* サイクル指定の最小値 */
148} AlarmBaseType;
149
150/*
151 * 最適化するため,依存部再定義できる型
152 */
153#ifndef OMIT_DATA_TYPE
154typedef uint32 TimeType; /* 時間 */
155typedef uint32 AlarmType; /* アラームID */
156typedef uint32 ResourceType; /* リソースID */
157typedef uint32 TaskType; /* タスクID */
158typedef uint32 ISRType; /* ISR ID */
159typedef uint32 CounterType; /* カウンタID */
160typedef uint32 ScheduleTableType; /* スケジュールテーブルID */
161typedef float32 PhysicalTimeType; /* (ティックから時間に換算用)時間 */
162typedef uint32 IocType; /* IOC ID */
163typedef uint8 SenderIdType; /* Sender ID */
164typedef uint32 TrustedFunctionIndexType; /* Trusted Function Index */
165#endif /* OMIT_DATA_TYPE */
166
167typedef AlarmBaseType * AlarmBaseRefType;
168typedef TaskType * TaskRefType;
169typedef TaskStateType * TaskStateRefType;
170typedef EventMaskType * EventMaskRefType;
171typedef TickType * TickRefType;
172typedef ScheduleTableStatusType * ScheduleTableStatusRefType;
173typedef ApplicationStateType * ApplicationStateRefType;
174typedef void * MemoryStartAddressType; /* メモリ領域å…
175ˆé ­ */
176typedef void * TrustedFunctionParameterRefType; /* Trusted Function Parameter */
177
178/*
179 * 保護違反を起こした処理単位の型
180 */
181typedef uint8 FaultyContextType;
182
183/*
184 * OSオブジェクト宣言用のマクロ
185 */
186#define DeclareTask(TaskIdentifier)
187#define DeclareResource(ResourceIdentifier)
188#define DeclareEvent(EventIdentifier)
189#define DeclareAlarm(AlarmIdentifier)
190
191/*
192 * メインルーチン定義用のマクロ
193 */
194#define TASK(TaskName) void TaskMain ## TaskName(void)
195#define ISR(ISRName) void ISRMain ## ISRName(void)
196#ifndef C1ISR
197#define C1ISR(ISRName) void C1ISRMain ## ISRName(void)
198#endif /* C1ISR */
199
200#define TRUSTEDFUNCTION(TrustedFunctionName, FunctionIndex, FunctionParams) \
201 StatusType TrustedFunctionName( \
202 TrustedFunctionIndexType FunctionIndex, \
203 TrustedFunctionParameterRefType FunctionParams \
204 )
205
206/*
207 * メモリ領域確保のための型定義
208 */
209#ifndef TOPPERS_STK_T
210#define TOPPERS_STK_T sintptr
211#endif /* TOPPERS_STK_T */
212typedef TOPPERS_STK_T StackType; /* スタック領域を確保するための型 */
213
214/*
215 * システムサービスパラメータ取得のための定義
216 */
217typedef union {
218 TaskType tskid;
219 TaskRefType p_tskid;
220 TaskStateRefType p_stat;
221 ResourceType resid;
222 EventMaskType mask;
223 EventMaskRefType p_mask;
224 AlarmType almid;
225 AlarmBaseRefType p_info;
226 TickRefType p_tick;
227 TickRefType p_val;
228 TickRefType p_eval;
229 TickType incr;
230 TickType cycle;
231 TickType start;
232 AppModeType mode;
233 CounterType cntid;
234 ScheduleTableType schtblid;
235 TickType offset;
236 ScheduleTableType schtblid_from;
237 ScheduleTableType schtblid_to;
238 ScheduleTableStatusRefType p_schtblstate;
239 StatusType error;
240 ISRType isrid;
241 IocType iocid;
242 SenderIdType senderid;
243 TrustedFunctionIndexType tfnid;
244 TrustedFunctionParameterRefType tfnpr;
245 MemoryStartAddressType adr;
246 MemorySizeType sz;
247 ApplicationType applid;
248 ApplicationStateRefType p_appstat;
249 RestartType restartoption;
250} _ErrorHook_Par;
251
252
253/*
254 * メモリ領域確保のためのマクロ
255 *
256 * 以下のTOPPERS_COUNT_SZとTOPPERS_ROUND_SZの定義は,unitが2の巾乗であ
257 * ることを仮定している.
258 */
259#ifndef TOPPERS_COUNT_SZ
260#define TOPPERS_COUNT_SZ(sz, unit) ((((sz) + (unit)) - (1U)) / (unit))
261#endif /* TOPPERS_COUNT_SZ */
262#ifndef TOPPERS_ROUND_SZ
263#define TOPPERS_ROUND_SZ(sz, unit) ((((sz) + (unit)) - (1U)) & (~((unit) - (1U))))
264#endif /* TOPPERS_ROUND_SZ */
265
266#define COUNT_STK_T(sz) (TOPPERS_COUNT_SZ((sz), sizeof(StackType)))
267#define ROUND_STK_T(sz) (TOPPERS_ROUND_SZ((sz), sizeof(StackType)))
268
269/*
270 * フックルーチン
271 */
272#ifdef CFG_USE_ERRORHOOK
273extern void ErrorHook(StatusType Error);
274#endif /* CFG_USE_ERRORHOOK */
275
276#ifdef CFG_USE_PRETASKHOOK
277extern void PreTaskHook(void);
278#endif /* CFG_USE_PRETASKHOOK */
279
280#ifdef CFG_USE_POSTTASKHOOK
281extern void PostTaskHook(void);
282#endif /* CFG_USE_POSTTASKHOOK */
283
284#ifdef CFG_USE_STARTUPHOOK
285extern void StartupHook(void);
286#endif /* CFG_USE_STARTUPHOOK */
287
288#ifdef CFG_USE_SHUTDOWNHOOK
289extern void ShutdownHook(StatusType Error);
290#endif /* CFG_USE_SHUTDOWNHOOK */
291
292#ifdef CFG_USE_PROTECTIONHOOK
293extern ProtectionReturnType ProtectionHook(StatusType FatalError);
294#endif /* CFG_USE_PROTECTIONHOOK */
295
296/*
297 * ライブラリで提供するシステムサービス
298 */
299extern ObjectAccessType CheckObjectAccess(ApplicationType ApplID, ObjectTypeType ObjectType, ...);
300extern ApplicationType CheckObjectOwnership(ObjectTypeType ObjectType, ...);
301
302/*
303 * ファイル名,行番号の参ç…
304§ç”¨ã®å¤‰æ•°
305 */
306extern const char8 *fatal_file_name; /* ファイル名 */
307extern sint32 fatal_line_num; /* 行番号 */
308
309#endif /* TOPPERS_MACRO_ONLY */
310
311/*
312 * システムサービス呼出しのための定義と宣言
313 */
314#include "kernel_fncode.h" /* 機能コードの定義 */
315#include "svc_funccall.h" /* 関数呼出しによる呼出し */
316#include "target_svc.h" /* ソフトウェア割込みによる呼出し */
317
318#if !defined(TOPPERS_CFG1_OUT) && !defined(OMIT_INCLUDE_OS_CFG) && !defined(OMIT_INCLUDE_OS_LCFG)
319#include "Os_Lcfg.h"
320#endif
321
322/*
323 * OSのエラーコード
324 */
325#define E_OS_ACCESS UINT_C(1)
326#define E_OS_CALLEVEL UINT_C(2)
327#define E_OS_ID UINT_C(3)
328#define E_OS_LIMIT UINT_C(4)
329#define E_OS_NOFUNC UINT_C(5)
330#define E_OS_RESOURCE UINT_C(6)
331#define E_OS_STATE UINT_C(7)
332#define E_OS_VALUE UINT_C(8)
333#define E_OS_SERVICEID UINT_C(9)
334#define E_OS_ILLEGAL_ADDRESS UINT_C(10)
335#define E_OS_MISSINGEND UINT_C(11)
336#define E_OS_DISABLEDINT UINT_C(12)
337#define E_OS_STACKFAULT UINT_C(13)
338#define E_OS_PROTECTION_MEMORY UINT_C(14)
339#define E_OS_PROTECTION_TIME_TASK UINT_C(15)
340#define E_OS_PROTECTION_TIME_ISR UINT_C(16)
341#define E_OS_PROTECTION_ARRIVAL_TASK UINT_C(17)
342#define E_OS_PROTECTION_ARRIVAL_ISR UINT_C(18)
343#define E_OS_PROTECTION_LOCKED_RESOURCE UINT_C(19)
344#define E_OS_PROTECTION_LOCKED_OSINT UINT_C(20)
345#define E_OS_PROTECTION_LOCKED_ALLINT UINT_C(21)
346#define E_OS_PROTECTION_EXCEPTION UINT_C(22)
347#define E_OS_PROTECTION_FATAL UINT_C(23)
348#define E_OS_MODE UINT_C(24)
349#define E_OS_SHUTDOWN_FATAL UINT_C(25)
350#define E_OS_PARAM_POINTER UINT_C(26)
351#define E_OS_SYS_ASSERT_FATAL UINT_C(27)
352#define E_OS_STACKINSUFFICIENT UINT_C(28)
353#define E_OS_CORE UINT_C(29)
354#define E_OS_SPINLOCK UINT_C(30)
355#define E_OS_INTERFERENCE_DEADLOCK UINT_C(31)
356#define E_OS_NESTING_DEADLOCK UINT_C(32)
357#define E_OS_SHUTDOWN_OTHER_CORE UINT_C(33)
358#define E_OS_TIMEINSUFFICIENT UINT_C(34)
359#define E_OS_PROTECTION_TIMEWINDOW UINT_C(35)
360#define E_OS_PROTECTION_COUNT_ISR UINT_C(36)
361
362/* AUTOSAR仕様R4.0.3との互換性考æ…
363® */
364#define OS_E_PARAM_POINTER E_OS_PARAM_POINTER
365
366#define ERRCODE_NUM UINT_C(36) /* エラーコード数 */
367/*
368 * IOCのエラーコード
369 */
370#define IOC_E_OK UINT_C(0)
371#define IOC_E_NOK UINT_C(1)
372#define IOC_E_LIMIT UINT_C(130)
373#define IOC_E_LOST_DATA UINT_C(64)
374#define IOC_E_NO_DATA UINT_C(131)
375
376/*
377 * その他の定数値
378 */
379#define UINT32_INVALID UINT_C(0xffffffff)
380#define UINT8_INVALID UINT_C(0xff)
381
382#define SUSPENDED ((TaskStateType) 0) /* 休止状æ…
383‹ */
384#define RUNNING ((TaskStateType) 1) /* 実行状æ…
385‹ */
386#define READY ((TaskStateType) 2) /* 実行可能状æ…
387‹ */
388#define WAITING ((TaskStateType) 3) /* 待
389ち状æ…
390‹ */
391
392/*
393 * 最適化するため,依存部での再定義が必
394要
395 */
396#ifndef OMIT_DATA_TYPE
397#define INVALID_TASK ((TaskType) UINT32_INVALID)
398#define INVALID_ISR ((ISRType) UINT32_INVALID)
399#endif /* OMIT_DATA_TYPE */
400#define INVALID_APPMODETYPE ((AppModeType) UINT32_INVALID)
401#define INVALID_OSAPPLICATION ((ApplicationType) UINT8_INVALID)
402
403/*
404 * スケジュールテーブルのステータス定義
405 */
406#define SCHEDULETABLE_STOPPED ((ScheduleTableStatusType) 0x01)
407#define SCHEDULETABLE_NEXT ((ScheduleTableStatusType) 0x02)
408#define SCHEDULETABLE_WAITING ((ScheduleTableStatusType) 0x04)
409#define SCHEDULETABLE_RUNNING ((ScheduleTableStatusType) 0x08)
410#define SCHEDULETABLE_RUNNING_AND_SYNCHRONOUS ((ScheduleTableStatusType) 0x10)
411
412/*
413 * OSアプリケーションの状æ…
414‹
415 */
416#define APPLICATION_ACCESSIBLE ((ApplicationStateType) 0) /* 利用可能状æ…
417‹ */
418#define APPLICATION_RESTARTING ((ApplicationStateType) 1) /* 再起動状æ…
419‹ */
420#define APPLICATION_TERMINATED ((ApplicationStateType) 2) /* アプリケーション終了状æ…
421‹ */
422
423/*
424 * アクセス情
425å ±
426 */
427#define ACCESS (TRUE)
428#define NO_ACCESS (FALSE)
429
430/*
431 * システムサービスID
432 */
433#define OSServiceId_GetApplicationID ((OSServiceIdType) 0x00)
434#define OSServiceId_GetISRID ((OSServiceIdType) 0x01)
435#define OSServiceId_CallTrustedFunction ((OSServiceIdType) 0x02)
436#define OSServiceId_CheckISRMemoryAccess ((OSServiceIdType) 0x03)
437#define OSServiceId_CheckTaskMemoryAccess ((OSServiceIdType) 0x04)
438#define OSServiceId_StartScheduleTableRel ((OSServiceIdType) 0x07)
439#define OSServiceId_StartScheduleTableAbs ((OSServiceIdType) 0x08)
440#define OSServiceId_StopScheduleTable ((OSServiceIdType) 0x09)
441#define OSServiceId_NextScheduleTable ((OSServiceIdType) 0x0a)
442#define OSServiceId_GetScheduleTableStatus ((OSServiceIdType) 0x0e)
443#define OSServiceId_IncrementCounter ((OSServiceIdType) 0x0f)
444#define OSServiceId_GetCounterValue ((OSServiceIdType) 0x10)
445#define OSServiceId_GetElapsedValue ((OSServiceIdType) 0x11)
446#define OSServiceId_TerminateApplication ((OSServiceIdType) 0x12)
447#define OSServiceId_AllowAccess ((OSServiceIdType) 0x13)
448#define OSServiceId_GetApplicationState ((OSServiceIdType) 0x14)
449#define IOCServiceId_IOC_Send ((OSServiceIdType) 0x1e)
450#define IOCServiceId_IOC_Write ((OSServiceIdType) 0x1f)
451#define IOCServiceId_IOC_SendGroup ((OSServiceIdType) 0x20)
452#define IOCServiceId_IOC_WriteGroup ((OSServiceIdType) 0x21)
453#define IOCServiceId_IOC_Receive ((OSServiceIdType) 0x22)
454#define IOCServiceId_IOC_Read ((OSServiceIdType) 0x23)
455#define IOCServiceId_IOC_ReceiveGroup ((OSServiceIdType) 0x24)
456#define IOCServiceId_IOC_ReadGroup ((OSServiceIdType) 0x25)
457#define IOCServiceId_IOC_EmptyQueue ((OSServiceIdType) 0x26)
458
459#define OSServiceId_EnableInterruptSource ((OSServiceIdType) 0xa0)
460#define OSServiceId_DisableInterruptSource ((OSServiceIdType) 0xa1)
461#define OSServiceId_CheckTaskAccess ((OSServiceIdType) 0xa2)
462#define OSServiceId_CheckISRAccess ((OSServiceIdType) 0xa3)
463#define OSServiceId_CheckAlarmAccess ((OSServiceIdType) 0xa4)
464#define OSServiceId_CheckResourceAccess ((OSServiceIdType) 0xa5)
465#define OSServiceId_CheckCounterAccess ((OSServiceIdType) 0xa6)
466#define OSServiceId_CheckScheduleTableAccess ((OSServiceIdType) 0xa7)
467#define OSServiceId_CheckTaskOwnership ((OSServiceIdType) 0xa9)
468#define OSServiceId_CheckISROwnership ((OSServiceIdType) 0xaa)
469#define OSServiceId_CheckAlarmOwnership ((OSServiceIdType) 0xab)
470#define OSServiceId_CheckCounterOwnership ((OSServiceIdType) 0xac)
471#define OSServiceId_CheckScheduleTableOwnership ((OSServiceIdType) 0xad)
472#define OSServiceId_TaskMissingEnd ((OSServiceIdType) 0xaf)
473#define OSServiceId_ISRMissingEnd ((OSServiceIdType) 0xb0)
474#define OSServiceId_HookMissingEnd ((OSServiceIdType) 0xb1)
475
476#define OSServiceId_ActivateTask ((OSServiceIdType) 0xe0)
477#define OSServiceId_TerminateTask ((OSServiceIdType) 0xe1)
478#define OSServiceId_ChainTask ((OSServiceIdType) 0xe2)
479#define OSServiceId_Schedule ((OSServiceIdType) 0xe3)
480#define OSServiceId_GetTaskID ((OSServiceIdType) 0xe4)
481#define OSServiceId_GetTaskState ((OSServiceIdType) 0xe5)
482#define OSServiceId_EnableAllInterrupts ((OSServiceIdType) 0xe6)
483#define OSServiceId_DisableAllInterrupts ((OSServiceIdType) 0xe7)
484#define OSServiceId_ResumeAllInterrupts ((OSServiceIdType) 0xe8)
485#define OSServiceId_SuspendAllInterrupts ((OSServiceIdType) 0xe9)
486#define OSServiceId_ResumeOSInterrupts ((OSServiceIdType) 0xea)
487#define OSServiceId_SuspendOSInterrupts ((OSServiceIdType) 0xeb)
488#define OSServiceId_GetResource ((OSServiceIdType) 0xec)
489#define OSServiceId_ReleaseResource ((OSServiceIdType) 0xed)
490#define OSServiceId_SetEvent ((OSServiceIdType) 0xee)
491#define OSServiceId_ClearEvent ((OSServiceIdType) 0xef)
492#define OSServiceId_GetEvent ((OSServiceIdType) 0xf0)
493#define OSServiceId_WaitEvent ((OSServiceIdType) 0xf1)
494#define OSServiceId_GetAlarmBase ((OSServiceIdType) 0xf2)
495#define OSServiceId_GetAlarm ((OSServiceIdType) 0xf3)
496#define OSServiceId_SetRelAlarm ((OSServiceIdType) 0xf4)
497#define OSServiceId_SetAbsAlarm ((OSServiceIdType) 0xf5)
498#define OSServiceId_CancelAlarm ((OSServiceIdType) 0xf6)
499#define OSServiceId_GetActiveApplicationMode ((OSServiceIdType) 0xf7)
500#define OSServiceId_StartOS ((OSServiceIdType) 0xf8)
501#define OSServiceId_ShutdownOS ((OSServiceIdType) 0xf9)
502
503#define OSServiceId_INVALID ((OSServiceIdType) 0xff) /* 無効なシステムサービスID */
504
505/*
506 * 保護違反を起こした処理単位の定義
507 */
508#define FC_INVALID UINT_C(0x00) /* 保護違反を起こした処理単位が特定できない */
509#define FC_TASK UINT_C(0x01) /* 保護違反を起こした処理単位がタスク */
510#define FC_C2ISR UINT_C(0x02) /* 保護違反を起こした処理単位がC2ISR */
511#define FC_SYSTEM_HOOK UINT_C(0x03) /* 保護違反を起こした処理単位がフック */
512#define FC_TRUSTED_FUNC UINT_C(0x04) /* 保護違反を起こした処理単位が信頼関数 */
513
514/*
515 * システムサービスパラメータ取得のための定義
516 */
517#ifndef TOPPERS_MACRO_ONLY
518
519/*
520 * エラーフックOFF時,サービスID取得とパラメータ取得もOFFになる
521 */
522#ifdef CFG_USE_ERRORHOOK
523
524#ifdef CFG_USE_GETSERVICEID
525extern OSServiceIdType _errorhook_svcid;
526#endif /* CFG_USE_GETSERVICEID */
527
528#ifdef CFG_USE_PARAMETERACCESS
529extern _ErrorHook_Par errorhook_par1;
530extern _ErrorHook_Par errorhook_par2;
531extern _ErrorHook_Par errorhook_par3;
532#endif /* CFG_USE_PARAMETERACCESS */
533
534#endif /* CFG_USE_ERRORHOOK */
535
536#endif /* TOPPERS_MACRO_ONLY */
537
538/*
539 * エラーフックOFF時,サービスID取得とパラメータ取得もOFFになる
540 */
541#ifdef CFG_USE_ERRORHOOK
542
543/*
544 * マクロの定義
545 */
546#ifdef CFG_USE_GETSERVICEID
547#define OSErrorGetServiceId() (_errorhook_svcid)
548#endif /* CFG_USE_GETSERVICEID */
549
550/*
551 * エラーを引き起こしたシステムサービスID
552 */
553#ifdef CFG_USE_PARAMETERACCESS
554#define OSError_StartOS_Mode() (errorhook_par1.mode)
555#define OSError_ActivateTask_TaskID() (errorhook_par1.tskid)
556#define OSError_ChainTask_TaskID() (errorhook_par1.tskid)
557#define OSError_GetTaskID_TaskID() (errorhook_par1.p_tskid)
558#define OSError_GetTaskState_TaskID() (errorhook_par1.tskid)
559#define OSError_GetTaskState_State() (errorhook_par2.p_stat)
560#define OSError_GetResource_ResID() (errorhook_par1.resid)
561#define OSError_ReleaseResource_ResID() (errorhook_par1.resid)
562#define OSError_SetEvent_TaskID() (errorhook_par1.tskid)
563#define OSError_SetEvent_Mask() (errorhook_par2.mask)
564#define OSError_ClearEvent_Mask() (errorhook_par1.mask)
565#define OSError_GetEvent_TaskID() (errorhook_par1.tskid)
566#define OSError_GetEvent_Event() (errorhook_par2.p_mask)
567#define OSError_WaitEvent_Mask() (errorhook_par1.mask)
568#define OSError_GetAlarmBase_AlarmID() (errorhook_par1.almid)
569#define OSError_GetAlarmBase_Info() (errorhook_par2.p_info)
570#define OSError_GetAlarm_AlarmID() (errorhook_par1.almid)
571#define OSError_GetAlarm_Tick() (errorhook_par2.p_tick)
572#define OSError_SetRelAlarm_AlarmID() (errorhook_par1.almid)
573#define OSError_SetRelAlarm_increment() (errorhook_par2.incr)
574#define OSError_SetRelAlarm_cycle() (errorhook_par3.cycle)
575#define OSError_SetAbsAlarm_AlarmID() (errorhook_par1.almid)
576#define OSError_SetAbsAlarm_start() (errorhook_par2.start)
577#define OSError_SetAbsAlarm_cycle() (errorhook_par3.cycle)
578#define OSError_CancelAlarm_AlarmID() (errorhook_par1.almid)
579#define OSError_IncrementCounter_CounterID() (errorhook_par1.cntid)
580#define OSError_GetCounterValue_CounterID() (errorhook_par1.cntid)
581#define OSError_GetCounterValue_Value() (errorhook_par2.p_val)
582#define OSError_GetElapsedValue_CounterID() (errorhook_par1.cntid)
583#define OSError_GetElapsedValue_Value() (errorhook_par2.p_val)
584#define OSError_GetElapsedValue_ElapsedValue() (errorhook_par3.p_eval)
585#define OSError_StartScheduleTableRel_ScheduleTableID() (errorhook_par1.schtblid)
586#define OSError_StartScheduleTableRel_Offset() (errorhook_par2.offset)
587#define OSError_StartScheduleTableAbs_ScheduleTableID() (errorhook_par1.schtblid)
588#define OSError_StartScheduleTableAbs_Start() (errorhook_par2.start)
589#define OSError_StopScheduleTable_ScheduleTableID() (errorhook_par1.schtblid)
590#define OSError_NextScheduleTable_ScheduleTableID_From() (errorhook_par1.schtblid_from)
591#define OSError_NextScheduleTable_ScheduleTableID_To() (errorhook_par2.schtblid_to)
592#define OSError_GetScheduleTableStatus_ScheduleTableID() (errorhook_par1.schtblid)
593#define OSError_GetScheduleTableStatus_ScheduleStatus() (errorhook_par2.p_schtblstate)
594#define OSError_ShutdownOS_Error() (errorhook_par1.error)
595#define OSError_DisableInterruptSource_DisableISR() (errorhook_par1.isrid)
596#define OSError_EnableInterruptSource_EnableISR() (errorhook_par1.isrid)
597#define OSError_GetApplicationState_Application() (errorhook_par1.applid)
598#define OSError_GetApplicationState_Value() (errorhook_par2.p_appstat)
599#define OSError_CallTrustedFunction_FunctionIndex() (errorhook_par1.tfnid)
600#define OSError_CallTrustedFunction_FunctionParams() (errorhook_par2.tfnpr)
601#define OSError_CheckISRMemoryAccess_ISRID() (errorhook_par1.isrid)
602#define OSError_CheckISRMemoryAccess_Address() (errorhook_par2.adr)
603#define OSError_CheckISRMemoryAccess_Size() (errorhook_par3.sz)
604#define OSError_CheckTaskMemoryAccess_TaskID() (errorhook_par1.tskid)
605#define OSError_CheckTaskMemoryAccess_Address() (errorhook_par2.adr)
606#define OSError_CheckTaskMemoryAccess_Size() (errorhook_par3.sz)
607#define OSError_CheckTaskAccess_ApplID() (errorhook_par1.applid)
608#define OSError_CheckTaskAccess_TaskID() (errorhook_par2.tskid)
609#define OSError_CheckISRAccess_ApplID() (errorhook_par1.applid)
610#define OSError_CheckISRAccess_ISRID() (errorhook_par2.isrid)
611#define OSError_CheckAlarmAccess_ApplID() (errorhook_par1.applid)
612#define OSError_CheckAlarmAccess_AlarmID() (errorhook_par2.almid)
613#define OSError_CheckResourceAccess_ApplID() (errorhook_par1.applid)
614#define OSError_CheckResourceAccess_ResID() (errorhook_par2.resid)
615#define OSError_CheckCounterAccess_ApplID() (errorhook_par1.applid)
616#define OSError_CheckCounterAccess_CounterID() (errorhook_par2.cntid)
617#define OSError_CheckScheduleTableAccess_ApplID() (errorhook_par1.applid)
618#define OSError_CheckScheduleTableAccess_ScheduleTableID() (errorhook_par2.schtblid)
619#define OSError_CheckTaskOwnership_TaskID() (errorhook_par1.tskid)
620#define OSError_CheckISROwnership_ISRID() (errorhook_par1.isrid)
621#define OSError_CheckAlarmOwnership_AlarmID() (errorhook_par1.almid)
622#define OSError_CheckCounterOwnership_CounterID() (errorhook_par1.cntid)
623#define OSError_CheckScheduleTableOwnership_ScheduleTableID() (errorhook_par1.schtblid)
624#define OSError_IocSend_IocId() (errorhook_par1.iocid)
625#define OSError_IocSend_SenderId() (errorhook_par2.senderid)
626#define OSError_IocWrite_IocId() (errorhook_par1.iocid)
627#define OSError_IocWrite_SenderId() (errorhook_par2.senderid)
628#define OSError_IocReceive_IocId() (errorhook_par1.iocid)
629#define OSError_IocRead_IocId() (errorhook_par1.iocid)
630#define OSError_IocEmptyQueue_IocId() (errorhook_par1.iocid)
631#define OSError_TerminateApplication_Application() (errorhook_par1.applid)
632#define OSError_TerminateApplication_RestartOption() (errorhook_par2.restartoption)
633
634#endif /* CFG_USE_PARAMETERACCESS */
635
636#endif /* CFG_USE_ERRORHOOK */
637
638/*
639 * プロテクションフック関係のマクロ
640 */
641#define PRO_IGNORE UINT_C(0x00)
642#define PRO_SHUTDOWN UINT_C(0x01)
643#define PRO_TERMINATETASKISR UINT_C(0x02)
644#define PRO_TERMINATEAPPL UINT_C(0x03)
645#define PRO_TERMINATEAPPL_RESTART UINT_C(0x04)
646
647/*
648 * OSAP終了/再起動関係のマクロ
649 */
650#define NO_RESTART UINT_C(0x00)
651#define RESTART UINT_C(0x01)
652
653/*
654 * メモリアクセス権限チェックのためのマクロ
655 */
656
657/*
658 * メモリ領域 権限
659 */
660
661#define AP_NoAccess UINT_C(0x0)
662#define AP_Executable UINT_C(0x1)
663#define AP_Readable UINT_C(0x2)
664#define AP_Writable UINT_C(0x4)
665#define AP_StackSpace UINT_C(0x8)
666
667/*
668 * アクセスチェックマクロ
669 */
670#define OSMEMORY_IS_READABLE(AccessType) ((AccessType) & AP_Readable)
671#define OSMEMORY_IS_WRITEABLE(AccessType) ((AccessType) & AP_Writable)
672#define OSMEMORY_IS_EXECUTABLE(AccessType) ((AccessType) & AP_Executable)
673#define OSMEMORY_IS_STACKSPACE(AccessType) ((AccessType) & AP_StackSpace)
674
675/*
676 * オブジェクトタイプ
677 */
678#define OBJECT_TASK UINT_C(0x01)
679#define OBJECT_ISR UINT_C(0x02)
680#define OBJECT_ALARM UINT_C(0x03)
681#define OBJECT_RESOURCE UINT_C(0x04)
682#define OBJECT_COUNTER UINT_C(0x05)
683#define OBJECT_SCHEDULETABLE UINT_C(0x06)
684
685/*
686 * バージョン情
687å ±
688 */
689#define OS_SW_MAJOR_VERSION UINT_C(1) /* サプライヤーバージョン */
690#define OS_SW_MINOR_VERSION UINT_C(4)
691#define OS_SW_PATCH_VERSION UINT_C(0)
692
693#define OS_AR_RELEASE_MAJOR_VERSION UINT_C(4) /* AUTOSARリリースバージョン */
694#define OS_AR_RELEASE_MINOR_VERSION UINT_C(0)
695#define OS_AR_RELEASE_REVISION_VERSION UINT_C(3)
696
697#define TKERNEL_NAME "TOPPERS/ATK2-SC3" /* カーネル名称(独自仕様) */
698
699#endif /* TOPPERS_OS_H */
Note: See TracBrowser for help on using the repository browser.