[388] | 1 | /*
|
---|
| 2 | * TOPPERS/ASP Kernel
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
| 4 | * Advanced Standard Profile Kernel
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2015,2016 by Ushio Laboratory
|
---|
| 7 | * Graduate School of Engineering Science, Osaka Univ., JAPAN
|
---|
| 8 | * Copyright (C) 2015-2017 by Embedded and Real-Time Systems Laboratory
|
---|
| 9 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
| 10 | *
|
---|
| 11 | * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
|
---|
| 12 | * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
---|
| 13 | * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
---|
| 14 | * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
---|
| 15 | * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
---|
| 16 | * スコード中に含まれていること.
|
---|
| 17 | * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
---|
| 18 | * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
---|
| 19 | * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
---|
| 20 | * の無保証規定を掲載すること.
|
---|
| 21 | * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
---|
| 22 | * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
---|
| 23 | * と.
|
---|
| 24 | * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
---|
| 25 | * 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
---|
| 26 | * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
---|
| 27 | * 報告すること.
|
---|
| 28 | * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
---|
| 29 | * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
---|
| 30 | * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
---|
| 31 | * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
---|
| 32 | * 免責すること.
|
---|
| 33 | *
|
---|
| 34 | * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
---|
| 35 | * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
---|
| 36 | * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
---|
| 37 | * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
---|
| 38 | * の責任を負わない.
|
---|
| 39 | *
|
---|
| 40 | * $Id$
|
---|
| 41 | */
|
---|
| 42 |
|
---|
| 43 | /*
|
---|
| 44 | * TOPPERS/ASPカーネルオブジェクト コンポーネント記述ファイル
|
---|
| 45 | */
|
---|
| 46 |
|
---|
| 47 | /*
|
---|
| 48 | * カーネルオブジェクトのコンポーネント化のためのヘッダファイル
|
---|
| 49 | */
|
---|
| 50 | import_C("tecs_kernel.h");
|
---|
| 51 |
|
---|
| 52 | /*
|
---|
| 53 | * カーネル操作のシグニチャ(タスクコンテキスト用)
|
---|
| 54 | */
|
---|
| 55 | signature sKernel {
|
---|
| 56 | ER getExtendedInformation([out] intptr_t *p_exinf);
|
---|
| 57 |
|
---|
| 58 | ER sleep(void);
|
---|
| 59 | ER sleepTimeout([in] TMO timeout);
|
---|
| 60 | ER delay([in] RELTIM delayTime);
|
---|
| 61 |
|
---|
| 62 | ER exit(void);
|
---|
| 63 | ER disableTerminate(void);
|
---|
| 64 | ER enableTerminate(void);
|
---|
| 65 | bool_t senseTerminate(void);
|
---|
| 66 |
|
---|
| 67 | ER setTime([in] SYSTIM systemTime);
|
---|
| 68 | ER getTime([out] SYSTIM *p_systemTime);
|
---|
| 69 | ER adjustTime([in] int32_t adjustTime);
|
---|
| 70 | HRTCNT fetchHighResolutionTimer(void);
|
---|
| 71 |
|
---|
| 72 | ER rotateReadyQueue([in] PRI taskPriority);
|
---|
| 73 | ER getTaskId([out] ID *p_taskId);
|
---|
| 74 | ER getLoad([in] PRI taskPriority, [out] uint_t *p_load);
|
---|
| 75 | ER getNthTask([in] PRI taskPriority, [in] uint_t nth,
|
---|
| 76 | [out] ID *p_taskID);
|
---|
| 77 | ER lockCpu(void);
|
---|
| 78 | ER unlockCpu(void);
|
---|
| 79 | ER disableDispatch(void);
|
---|
| 80 | ER enableDispatch(void);
|
---|
| 81 | bool_t senseContext(void);
|
---|
| 82 | bool_t senseLock(void);
|
---|
| 83 | bool_t senseDispatch(void);
|
---|
| 84 | bool_t senseDispatchPendingState(void);
|
---|
| 85 | bool_t senseKernel(void);
|
---|
| 86 | ER exitKernel(void);
|
---|
| 87 |
|
---|
| 88 | ER changeInterruptPriorityMask([in] PRI interruptPriority);
|
---|
| 89 | ER getInterruptPriorityMask([out] PRI *p_interruptPriority);
|
---|
| 90 | };
|
---|
| 91 |
|
---|
| 92 | /*
|
---|
| 93 | * カーネル操作のシグニチャ(非タスクコンテキスト用)
|
---|
| 94 | */
|
---|
| 95 | [context("non-task")]
|
---|
| 96 | signature siKernel {
|
---|
| 97 | HRTCNT fetchHighResolutionTimer(void);
|
---|
| 98 |
|
---|
| 99 | ER rotateReadyQueue([in] PRI taskPriority);
|
---|
| 100 | ER getTaskId([out]ID *p_taskId);
|
---|
| 101 | ER lockCpu(void);
|
---|
| 102 | ER unlockCpu(void);
|
---|
| 103 | bool_t senseContext(void);
|
---|
| 104 | bool_t senseLock(void);
|
---|
| 105 | bool_t senseDispatch(void);
|
---|
| 106 | bool_t senseDispatchPendingState(void);
|
---|
| 107 | bool_t senseKernel(void);
|
---|
| 108 | ER exitKernel(void);
|
---|
| 109 |
|
---|
| 110 | /* CPU例外ハンドラ中で使用する */
|
---|
| 111 | bool_t exceptionSenseDispatchPendingState
|
---|
| 112 | ([in] const void *p_exceptionInformation);
|
---|
| 113 | };
|
---|
| 114 |
|
---|
| 115 | /*
|
---|
| 116 | * カーネルのセルタイプ
|
---|
| 117 | */
|
---|
| 118 | [singleton]
|
---|
| 119 | celltype tKernel {
|
---|
| 120 | [inline] entry sKernel eKernel;
|
---|
| 121 | [inline] entry siKernel eiKernel;
|
---|
| 122 | };
|
---|
| 123 |
|
---|
| 124 | /*
|
---|
| 125 | * タイムイベント通知を受け取るためのシグネチャ
|
---|
| 126 | */
|
---|
| 127 | [context("non-task")]
|
---|
| 128 | signature siNotificationHandler {
|
---|
| 129 | };
|
---|
| 130 |
|
---|
| 131 | /*
|
---|
| 132 | * タスク本体のシグニチャ
|
---|
| 133 | */
|
---|
| 134 | signature sTaskBody {
|
---|
| 135 | void main(void);
|
---|
| 136 | };
|
---|
| 137 |
|
---|
| 138 | /*
|
---|
| 139 | * タスク操作のシグニチャ(タスクコンテキスト用)
|
---|
| 140 | */
|
---|
| 141 | signature sTask {
|
---|
| 142 | ER activate(void);
|
---|
| 143 | ER_UINT cancelActivate(void);
|
---|
| 144 | ER getTaskState([out] STAT *p_tskstat);
|
---|
| 145 | ER changePriority([in] PRI priority);
|
---|
| 146 | ER getPriority([out] PRI *p_priority);
|
---|
| 147 | ER refer([out] T_RTSK *pk_taskStatus);
|
---|
| 148 |
|
---|
| 149 | ER wakeup(void);
|
---|
| 150 | ER_UINT cancelWakeup(void);
|
---|
| 151 | ER releaseWait(void);
|
---|
| 152 | ER suspend(void);
|
---|
| 153 | ER resume(void);
|
---|
| 154 |
|
---|
| 155 | ER raiseTerminate(void);
|
---|
| 156 | ER terminate(void);
|
---|
| 157 | };
|
---|
| 158 |
|
---|
| 159 | /*
|
---|
| 160 | * タスク操作のシグニチャ(非タスクコンテキスト用)
|
---|
| 161 | */
|
---|
| 162 | [context("non-task")]
|
---|
| 163 | signature siTask {
|
---|
| 164 | ER activate(void);
|
---|
| 165 | ER wakeup(void);
|
---|
| 166 | ER releaseWait(void);
|
---|
| 167 | };
|
---|
| 168 |
|
---|
| 169 | /*
|
---|
| 170 | * タスクのセルタイプ
|
---|
| 171 | */
|
---|
| 172 | [active]
|
---|
| 173 | celltype tTask {
|
---|
| 174 | [inline] entry sTask eTask;
|
---|
| 175 | [inline] entry siTask eiTask;
|
---|
| 176 | call sTaskBody cTaskBody;
|
---|
| 177 |
|
---|
| 178 | [inline] entry siNotificationHandler eiActivateNotificationHandler;
|
---|
| 179 | [inline] entry siNotificationHandler eiWakeUpNotificationHandler;
|
---|
| 180 |
|
---|
| 181 | attr {
|
---|
| 182 | ID id = C_EXP("TSKID_$id$");
|
---|
| 183 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 184 | [omit] PRI priority;
|
---|
| 185 | [omit] size_t stackSize;
|
---|
| 186 | };
|
---|
| 187 |
|
---|
| 188 | factory {
|
---|
| 189 | write("tecsgen.cfg",
|
---|
| 190 | "CRE_TSK(%s, { %s, $cbp$, tTask_start, %s, %s, NULL });",
|
---|
| 191 | id, attribute, priority, stackSize);
|
---|
| 192 | };
|
---|
| 193 | FACTORY {
|
---|
| 194 | write("tecsgen.cfg", "#include \"$ct$_tecsgen.h\"");
|
---|
| 195 | write("$ct$_factory.h", "#include \"kernel_cfg.h\"");
|
---|
| 196 | };
|
---|
| 197 | };
|
---|
| 198 |
|
---|
| 199 | /*
|
---|
| 200 | * セマフォ操作のシグニチャ(タスクコンテキスト用)
|
---|
| 201 | */
|
---|
| 202 | signature sSemaphore {
|
---|
| 203 | ER signal(void);
|
---|
| 204 | ER wait(void);
|
---|
| 205 | ER waitPolling(void);
|
---|
| 206 | ER waitTimeout([in] TMO timeout);
|
---|
| 207 | ER initialize(void);
|
---|
| 208 | ER refer([out] T_RSEM *pk_semaphoreStatus);
|
---|
| 209 | };
|
---|
| 210 |
|
---|
| 211 | /*
|
---|
| 212 | * セマフォ操作のシグニチャ(非タスクコンテキスト用)
|
---|
| 213 | */
|
---|
| 214 | [context("non-task")]
|
---|
| 215 | signature siSemaphore {
|
---|
| 216 | ER signal(void);
|
---|
| 217 | };
|
---|
| 218 |
|
---|
| 219 | /*
|
---|
| 220 | * セマフォのセルタイプ
|
---|
| 221 | */
|
---|
| 222 | celltype tSemaphore {
|
---|
| 223 | [inline] entry sSemaphore eSemaphore;
|
---|
| 224 | [inline] entry siSemaphore eiSemaphore;
|
---|
| 225 |
|
---|
| 226 | [inline] entry siNotificationHandler eiNotificationHandler;
|
---|
| 227 |
|
---|
| 228 | attr {
|
---|
| 229 | ID id = C_EXP("SEMID_$id$");
|
---|
| 230 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 231 | [omit] uint_t initialCount;
|
---|
| 232 | [omit] uint_t maxCount = 1;
|
---|
| 233 | };
|
---|
| 234 |
|
---|
| 235 | factory {
|
---|
| 236 | write("tecsgen.cfg", "CRE_SEM(%s, { %s, %s, %s });",
|
---|
| 237 | id, attribute, initialCount, maxCount);
|
---|
| 238 | };
|
---|
| 239 | FACTORY {
|
---|
| 240 | write("$ct$_factory.h", "#include \"kernel_cfg.h\"");
|
---|
| 241 | };
|
---|
| 242 | };
|
---|
| 243 |
|
---|
| 244 | /*
|
---|
| 245 | * イベントフラグ操作のシグニチャ(タスクコンテキスト用)
|
---|
| 246 | */
|
---|
| 247 | signature sEventflag {
|
---|
| 248 | ER set([in] FLGPTN setPattern);
|
---|
| 249 | ER clear([in] FLGPTN clearPattern);
|
---|
| 250 | ER wait([in] FLGPTN waitPattern, [in] MODE waitMode,
|
---|
| 251 | [out] FLGPTN *p_flagPattern);
|
---|
| 252 | ER waitPolling([in] FLGPTN waitPattern, [in] MODE waitMode,
|
---|
| 253 | [out] FLGPTN *p_flagPattern);
|
---|
| 254 | ER waitTimeout([in] FLGPTN waitPattern, [in] MODE waitMode,
|
---|
| 255 | [out] FLGPTN *p_flagPattern, [in] TMO timeout);
|
---|
| 256 | ER initialize(void);
|
---|
| 257 | ER refer([out] T_RFLG *pk_eventflagStatus);
|
---|
| 258 | };
|
---|
| 259 |
|
---|
| 260 | /*
|
---|
| 261 | * イベントフラグ操作のシグニチャ(非タスクコンテキスト用)
|
---|
| 262 | */
|
---|
| 263 | [context("non-task")]
|
---|
| 264 | signature siEventflag {
|
---|
| 265 | ER set([in] FLGPTN setPattern);
|
---|
| 266 | };
|
---|
| 267 |
|
---|
| 268 | /*
|
---|
| 269 | * イベントフラグのセルタイプ
|
---|
| 270 | */
|
---|
| 271 | celltype tEventflag {
|
---|
| 272 | [inline] entry sEventflag eEventflag;
|
---|
| 273 | [inline] entry siEventflag eiEventflag;
|
---|
| 274 |
|
---|
| 275 | [inline] entry siNotificationHandler eiNotificationHandler;
|
---|
| 276 |
|
---|
| 277 | attr {
|
---|
| 278 | ID id = C_EXP("FLGID_$id$");
|
---|
| 279 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 280 | [omit] FLGPTN flagPattern;
|
---|
| 281 | };
|
---|
| 282 |
|
---|
| 283 | factory {
|
---|
| 284 | write("tecsgen.cfg", "CRE_FLG(%s, { %s, %s });",
|
---|
| 285 | id, attribute, flagPattern);
|
---|
| 286 | };
|
---|
| 287 | FACTORY {
|
---|
| 288 | write("$ct$_factory.h", "#include \"kernel_cfg.h\"");
|
---|
| 289 | };
|
---|
| 290 | };
|
---|
| 291 |
|
---|
| 292 | /*
|
---|
| 293 | * データキュー操作のシグニチャ(タスクコンテキスト用)
|
---|
| 294 | */
|
---|
| 295 | signature sDataqueue {
|
---|
| 296 | ER send([in] intptr_t data);
|
---|
| 297 | ER sendPolling([in] intptr_t data);
|
---|
| 298 | ER sendTimeout([in] intptr_t data, [in] TMO timeout);
|
---|
| 299 | ER sendForce([in] intptr_t data);
|
---|
| 300 | ER receive([out] intptr_t *p_data);
|
---|
| 301 | ER receivePolling([out] intptr_t *p_Data);
|
---|
| 302 | ER receiveTimeout([out] intptr_t *p_data, [in] TMO timeout);
|
---|
| 303 | ER initialize(void);
|
---|
| 304 | ER refer([out] T_RDTQ *pk_dataqueueStatus);
|
---|
| 305 | };
|
---|
| 306 |
|
---|
| 307 | /*
|
---|
| 308 | * データキュー操作のシグニチャ(非タスクコンテキスト用)
|
---|
| 309 | */
|
---|
| 310 | [context("non-task")]
|
---|
| 311 | signature siDataqueue {
|
---|
| 312 | ER sendPolling([in] intptr_t data);
|
---|
| 313 | ER sendForce([in] intptr_t data);
|
---|
| 314 | };
|
---|
| 315 |
|
---|
| 316 | /*
|
---|
| 317 | * データキューのセルタイプ
|
---|
| 318 | */
|
---|
| 319 | celltype tDataqueue {
|
---|
| 320 | [inline] entry sDataqueue eDataqueue;
|
---|
| 321 | [inline] entry siDataqueue eiDataqueue;
|
---|
| 322 |
|
---|
| 323 | [inline] entry siNotificationHandler eiNotificationHandler;
|
---|
| 324 |
|
---|
| 325 | attr {
|
---|
| 326 | ID id = C_EXP("DTQID_$id$");
|
---|
| 327 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 328 | [omit] uint_t dataCount = 1;
|
---|
| 329 | [omit] void *dataqueueManagementBuffer = C_EXP("NULL");
|
---|
| 330 | };
|
---|
| 331 |
|
---|
| 332 | factory {
|
---|
| 333 | write("tecsgen.cfg", "CRE_DTQ(%s, { %s, %s, %s });",
|
---|
| 334 | id, attribute, dataCount, dataqueueManagementBuffer);
|
---|
| 335 | };
|
---|
| 336 | FACTORY {
|
---|
| 337 | write("$ct$_factory.h", "#include \"kernel_cfg.h\"");
|
---|
| 338 | };
|
---|
| 339 | };
|
---|
| 340 |
|
---|
| 341 | /*
|
---|
| 342 | * 優先度データキュー操作のシグニチャ(タスクコンテキスト用)
|
---|
| 343 | */
|
---|
| 344 | signature sPriorityDataqueue {
|
---|
| 345 | ER send([in] intptr_t data, [in] PRI dataPriority);
|
---|
| 346 | ER sendPolling([in] intptr_t data, [in] PRI dataPriority);
|
---|
| 347 | ER sendTimeout([in] intptr_t data, [in] PRI dataPriority,
|
---|
| 348 | [in] TMO timeout);
|
---|
| 349 | ER receive([out] intptr_t *p_data, [out] PRI *p_dataPriority);
|
---|
| 350 | ER receivePolling([out] intptr_t *p_data, [out] PRI *p_dataPriority);
|
---|
| 351 | ER receiveTimeout([out] intptr_t *p_data, [out] PRI *p_dataPriority,
|
---|
| 352 | [in] TMO timeout);
|
---|
| 353 | ER initialize(void);
|
---|
| 354 | ER refer([out] T_RPDQ *pk_priorityDataqueueStatus);
|
---|
| 355 | };
|
---|
| 356 |
|
---|
| 357 | /*
|
---|
| 358 | * 優先度データキュー操作のシグニチャ(非タスクコンテキスト用)
|
---|
| 359 | */
|
---|
| 360 | [context("non-task")]
|
---|
| 361 | signature siPriorityDataqueue {
|
---|
| 362 | ER sendPolling([in] intptr_t data, [in] PRI dataPriority);
|
---|
| 363 | };
|
---|
| 364 |
|
---|
| 365 | /*
|
---|
| 366 | * 優先度データキューのセルタイプ
|
---|
| 367 | */
|
---|
| 368 | celltype tPriorityDataqueue {
|
---|
| 369 | [inline] entry sPriorityDataqueue ePriorityDataqueue;
|
---|
| 370 | [inline] entry siPriorityDataqueue eiPriorityDataqueue;
|
---|
| 371 |
|
---|
| 372 | attr {
|
---|
| 373 | ID id = C_EXP("PDTQID_$id$");
|
---|
| 374 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 375 | [omit] uint_t dataCount = 1;
|
---|
| 376 | [omit] PRI maxDataPriority;
|
---|
| 377 | [omit] void *priorityDataqueueManagementBuffer = C_EXP("NULL");
|
---|
| 378 | };
|
---|
| 379 |
|
---|
| 380 | factory {
|
---|
| 381 | write("tecsgen.cfg", "CRE_PDQ(%s, { %s, %s, %s, %s});",
|
---|
| 382 | id, attribute, dataCount, maxDataPriority,
|
---|
| 383 | priorityDataqueueManagementBuffer);
|
---|
| 384 | };
|
---|
| 385 | FACTORY {
|
---|
| 386 | write("$ct$_factory.h", "#include \"kernel_cfg.h\"");
|
---|
| 387 | };
|
---|
| 388 | };
|
---|
| 389 |
|
---|
| 390 | /*
|
---|
| 391 | * ミューテックス操作のシグニチャ(タスクコンテキスト用)
|
---|
| 392 | */
|
---|
| 393 | signature sMutex {
|
---|
| 394 | ER lock(void);
|
---|
| 395 | ER lockPolling(void);
|
---|
| 396 | ER lockTimeout([in] TMO timeout);
|
---|
| 397 | ER unlock(void);
|
---|
| 398 | ER initialize(void);
|
---|
| 399 | ER refer([out] T_RSEM *pk_mutexStatus);
|
---|
| 400 | };
|
---|
| 401 |
|
---|
| 402 | /*
|
---|
| 403 | * ミューテックスのセルタイプ
|
---|
| 404 | */
|
---|
| 405 | celltype tMutex {
|
---|
| 406 | [inline] entry sMutex eMutex;
|
---|
| 407 |
|
---|
| 408 | attr {
|
---|
| 409 | ID id = C_EXP("MTXID_$id$");
|
---|
| 410 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 411 | [omit] PRI ceilingPriority;
|
---|
| 412 | };
|
---|
| 413 |
|
---|
| 414 | factory {
|
---|
| 415 | write("tecsgen.cfg", "CRE_MTX(%s, { %s, %s });",
|
---|
| 416 | id, attribute, ceilingPriority);
|
---|
| 417 | };
|
---|
| 418 | FACTORY {
|
---|
| 419 | write("$ct$_factory.h", "#include \"kernel_cfg.h\"");
|
---|
| 420 | };
|
---|
| 421 | };
|
---|
| 422 |
|
---|
| 423 | /*
|
---|
| 424 | * 固定長メモリメモリプール操作のシグニチャ(タスクコンテキスト用)
|
---|
| 425 | */
|
---|
| 426 | [deviate]
|
---|
| 427 | signature sFixedSizeMemoryPool {
|
---|
| 428 | ER get([out] void **p_block);
|
---|
| 429 | ER getPolling([out] void **p_block);
|
---|
| 430 | ER getTimeout([out] void **p_block, [in] TMO timeout);
|
---|
| 431 | ER release([in] const void *block);
|
---|
| 432 | ER initialize(void);
|
---|
| 433 | ER refer([out] T_RMPF *pk_fixedSizeMemoryPoolStatus);
|
---|
| 434 | };
|
---|
| 435 |
|
---|
| 436 | /*
|
---|
| 437 | * 固定長メモリプールのセルタイプ
|
---|
| 438 | */
|
---|
| 439 | celltype tFixedSizeMemoryPool {
|
---|
| 440 | [inline] entry sFixedSizeMemoryPool eFixedSizeMemoryPool;
|
---|
| 441 |
|
---|
| 442 | attr {
|
---|
| 443 | ID id = C_EXP("MPFID_$id$");
|
---|
| 444 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 445 | [omit] uint_t blockCount;
|
---|
| 446 | [omit] uint_t blockSize;
|
---|
| 447 | [omit] MPF_T *memoryPool = C_EXP("NULL");
|
---|
| 448 | [omit] void *memoryPoolManagementBuffer = C_EXP("NULL");
|
---|
| 449 | };
|
---|
| 450 |
|
---|
| 451 | factory {
|
---|
| 452 | write("tecsgen.cfg", "CRE_MPF(%s, {%s, %s, %s, %s, %s});",
|
---|
| 453 | id, attribute, blockCount, blockSize,
|
---|
| 454 | memoryPool, memoryPoolManagementBuffer);
|
---|
| 455 | };
|
---|
| 456 | FACTORY {
|
---|
| 457 | write("$ct$_factory.h", "#include \"kernel_cfg.h\"");
|
---|
| 458 | };
|
---|
| 459 | };
|
---|
| 460 |
|
---|
| 461 | /*
|
---|
| 462 | * ハンドラ本体のシグニチャ
|
---|
| 463 | */
|
---|
| 464 | [context("non-task")]
|
---|
| 465 | signature siHandlerBody {
|
---|
| 466 | void main(void);
|
---|
| 467 | };
|
---|
| 468 |
|
---|
| 469 | /*
|
---|
| 470 | * タイムイベントハンドラを指定するためのセルタイプ
|
---|
| 471 | */
|
---|
| 472 | celltype tTimeEventHandler {
|
---|
| 473 | entry siNotificationHandler eiNotificationHandler;
|
---|
| 474 | [omit] call siHandlerBody ciHandlerBody;
|
---|
| 475 |
|
---|
| 476 | FACTORY {
|
---|
| 477 | write("tecsgen.cfg", "#include \"$ct$_tecsgen.h\"");
|
---|
| 478 | };
|
---|
| 479 | };
|
---|
| 480 |
|
---|
| 481 | /*
|
---|
| 482 | * 周期通知を操作するためのシグニチャ(タスクコンテキスト用)
|
---|
| 483 | */
|
---|
| 484 | signature sCyclic {
|
---|
| 485 | ER start(void);
|
---|
| 486 | ER stop(void);
|
---|
| 487 | ER refer([out]T_RCYC *pk_cyclicHandlerStatus);
|
---|
| 488 | };
|
---|
| 489 |
|
---|
| 490 | /*
|
---|
| 491 | * 周期通知のセルタイプ
|
---|
| 492 | */
|
---|
| 493 | [active, generate(NotifierPlugin,
|
---|
| 494 | "factory=\"CRE_CYC({{id}}, { {{attribute}}, { {{_handler_params_}} }, "
|
---|
| 495 | "{{cycleTime}}, {{cyclePhase}} });\", output_file=tecsgen.cfg")]
|
---|
| 496 | celltype tCyclicNotifier {
|
---|
| 497 | [inline] entry sCyclic eCyclic;
|
---|
| 498 |
|
---|
| 499 | call siNotificationHandler ciNotificationHandler;
|
---|
| 500 | [optional] call siNotificationHandler ciErrorNotificationHandler;
|
---|
| 501 |
|
---|
| 502 | attr {
|
---|
| 503 | ID id = C_EXP("ALMID_$id$");
|
---|
| 504 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 505 | [omit] bool_t ignoreErrors = false;
|
---|
| 506 | [omit] RELTIM cycleTime;
|
---|
| 507 | [omit] RELTIM cyclePhase = 0;
|
---|
| 508 |
|
---|
| 509 | /* 変数の設定による通知(TNFY_SETVAR)*/
|
---|
| 510 | [omit] intptr_t *setVariableAddress = 0;
|
---|
| 511 | [omit] intptr_t setVariableValue = 0;
|
---|
| 512 |
|
---|
| 513 | /* 変数のインクリメントによる通知(TNFY_INCVAR)*/
|
---|
| 514 | [omit] intptr_t *incrementedVariableAddress = 0;
|
---|
| 515 |
|
---|
| 516 | /* イベントフラグのセットによる通知(TNFY_SETFLG)*/
|
---|
| 517 | [omit] FLGPTN flagPattern = 0;
|
---|
| 518 |
|
---|
| 519 | /* データキューへの送信による通知(TNFY_SNDDTQ)*/
|
---|
| 520 | [omit] intptr_t dataqueueSentValue = 0;
|
---|
| 521 |
|
---|
| 522 | /* 変数の設定によるエラー通知(TENFY_SETVAR)*/
|
---|
| 523 | [omit] intptr_t *setVariableAddressForError = 0;
|
---|
| 524 |
|
---|
| 525 | /* 変数のインクリメントによるエラー通知(TENFY_INCVAR)*/
|
---|
| 526 | [omit] intptr_t *incrementedVariableAddressForError = 0;
|
---|
| 527 |
|
---|
| 528 | /* イベントフラグのセットによるエラー通知(TENFY_SETFLG)*/
|
---|
| 529 | [omit] FLGPTN flagPatternForError = 0;
|
---|
| 530 | };
|
---|
| 531 |
|
---|
| 532 | FACTORY {
|
---|
| 533 | write("$ct$_factory.h", "#include \"kernel_cfg.h\"");
|
---|
| 534 | };
|
---|
| 535 | };
|
---|
| 536 |
|
---|
| 537 | /*
|
---|
| 538 | * 周期通知にユーザーハンドラを指定するための複合セルタイプ
|
---|
| 539 | */
|
---|
| 540 | [active]
|
---|
| 541 | composite tCyclicHandler {
|
---|
| 542 | entry sCyclic eCyclic;
|
---|
| 543 | [omit] call siHandlerBody ciHandlerBody;
|
---|
| 544 |
|
---|
| 545 | attr {
|
---|
| 546 | ID id = C_EXP("ALMID_$id$");
|
---|
| 547 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 548 | [omit] RELTIM cycleTime;
|
---|
| 549 | [omit] RELTIM cyclePhase = 0;
|
---|
| 550 | };
|
---|
| 551 |
|
---|
| 552 | cell tCyclicNotifier CyclicNotifier {
|
---|
| 553 | id = composite.id;
|
---|
| 554 | attribute = composite.attribute;
|
---|
| 555 | ciNotificationHandler = TimeEventHandler.eiNotificationHandler;
|
---|
| 556 | cycleTime = composite.cycleTime;
|
---|
| 557 | cyclePhase = composite.cyclePhase;
|
---|
| 558 | };
|
---|
| 559 |
|
---|
| 560 | cell tTimeEventHandler TimeEventHandler {
|
---|
| 561 | ciHandlerBody => composite.ciHandlerBody;
|
---|
| 562 | };
|
---|
| 563 |
|
---|
| 564 | eCyclic => CyclicNotifier.eCyclic;
|
---|
| 565 | };
|
---|
| 566 |
|
---|
| 567 | /*
|
---|
| 568 | * アラーム通知を操作するためのシグニチャ(タスクコンテキスト用)
|
---|
| 569 | */
|
---|
| 570 | signature sAlarm {
|
---|
| 571 | ER start([in] RELTIM alarmTime);
|
---|
| 572 | ER stop(void);
|
---|
| 573 | ER refer([out]T_RALM *pk_alarmStatus);
|
---|
| 574 | };
|
---|
| 575 |
|
---|
| 576 | /*
|
---|
| 577 | * アラーム通知を操作するためのシグニチャ(非タスクコンテキスト用)
|
---|
| 578 | */
|
---|
| 579 | [context("non-task")]
|
---|
| 580 | signature siAlarm {
|
---|
| 581 | ER start([in] RELTIM alarmTime);
|
---|
| 582 | ER stop(void);
|
---|
| 583 | };
|
---|
| 584 |
|
---|
| 585 | /*
|
---|
| 586 | * アラーム通知のセルタイプ
|
---|
| 587 | */
|
---|
| 588 | [active, generate(NotifierPlugin,
|
---|
| 589 | "factory=\"CRE_ALM({{id}}, { {{attribute}}, {{{_handler_params_}}} });\", "
|
---|
| 590 | "output_file=tecsgen.cfg")]
|
---|
| 591 | celltype tAlarmNotifier {
|
---|
| 592 | [inline] entry sAlarm eAlarm;
|
---|
| 593 | [inline] entry siAlarm eiAlarm;
|
---|
| 594 |
|
---|
| 595 | call siNotificationHandler ciNotificationHandler;
|
---|
| 596 | [optional] call siNotificationHandler ciErrorNotificationHandler;
|
---|
| 597 |
|
---|
| 598 | attr {
|
---|
| 599 | ID id = C_EXP("ALMID_$id$");
|
---|
| 600 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 601 | [omit] bool_t ignoreErrors = false;
|
---|
| 602 |
|
---|
| 603 | /* 変数の設定による通知(TNFY_SETVAR)*/
|
---|
| 604 | [omit] intptr_t *setVariableAddress = 0;
|
---|
| 605 | [omit] intptr_t setVariableValue = 0;
|
---|
| 606 |
|
---|
| 607 | /* 変数のインクリメントによる通知(TNFY_INCVAR)*/
|
---|
| 608 | [omit] intptr_t *incrementedVariableAddress = 0;
|
---|
| 609 |
|
---|
| 610 | /* イベントフラグのセットによる通知(TNFY_SETFLG)*/
|
---|
| 611 | [omit] FLGPTN flagPattern = 0;
|
---|
| 612 |
|
---|
| 613 | /* データキューへの送信による通知(TNFY_SNDDTQ)*/
|
---|
| 614 | [omit] intptr_t dataqueueSentValue = 0;
|
---|
| 615 |
|
---|
| 616 | /* 変数の設定によるエラー通知(TENFY_SETVAR)*/
|
---|
| 617 | [omit] intptr_t *setVariableAddressForError = 0;
|
---|
| 618 |
|
---|
| 619 | /* 変数のインクリメントによるエラー通知(TENFY_INCVAR)*/
|
---|
| 620 | [omit] intptr_t *incrementedVariableAddressForError = 0;
|
---|
| 621 |
|
---|
| 622 | /* イベントフラグのセットによるエラー通知(TENFY_SETFLG)*/
|
---|
| 623 | [omit] FLGPTN flagPatternForError = 0;
|
---|
| 624 | };
|
---|
| 625 |
|
---|
| 626 | FACTORY {
|
---|
| 627 | write("$ct$_factory.h", "#include \"kernel_cfg.h\"");
|
---|
| 628 | };
|
---|
| 629 | };
|
---|
| 630 |
|
---|
| 631 | /*
|
---|
| 632 | * アラーム通知にユーザーハンドラを指定するための複合セルタイプ
|
---|
| 633 | */
|
---|
| 634 | [active]
|
---|
| 635 | composite tAlarmHandler {
|
---|
| 636 | entry sAlarm eAlarm;
|
---|
| 637 | entry siAlarm eiAlarm;
|
---|
| 638 | [omit] call siHandlerBody ciHandlerBody;
|
---|
| 639 |
|
---|
| 640 | attr {
|
---|
| 641 | ID id = C_EXP("ALMID_$id$");
|
---|
| 642 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 643 | };
|
---|
| 644 |
|
---|
| 645 | cell tAlarmNotifier AlarmNotifier {
|
---|
| 646 | id = composite.id;
|
---|
| 647 | attribute = composite.attribute;
|
---|
| 648 | ciNotificationHandler = TimeEventHandler.eiNotificationHandler;
|
---|
| 649 | };
|
---|
| 650 |
|
---|
| 651 | cell tTimeEventHandler TimeEventHandler {
|
---|
| 652 | ciHandlerBody => composite.ciHandlerBody;
|
---|
| 653 | };
|
---|
| 654 |
|
---|
| 655 | eAlarm => AlarmNotifier.eAlarm;
|
---|
| 656 | eiAlarm => AlarmNotifier.eiAlarm;
|
---|
| 657 | };
|
---|
| 658 |
|
---|
| 659 | /*
|
---|
| 660 | * 割込み要求ライン操作のシグニチャ(タスクコンテキスト用)
|
---|
| 661 | */
|
---|
| 662 | signature sInterruptRequest {
|
---|
| 663 | ER disable(void);
|
---|
| 664 | ER enable(void);
|
---|
| 665 | ER clear(void);
|
---|
| 666 | ER raise(void);
|
---|
| 667 | ER_BOOL probe(void);
|
---|
| 668 | };
|
---|
| 669 |
|
---|
| 670 | /*
|
---|
| 671 | * 割込み要求ラインのセルタイプ
|
---|
| 672 | */
|
---|
| 673 | celltype tInterruptRequest {
|
---|
| 674 | [inline] entry sInterruptRequest eInterruptRequest;
|
---|
| 675 |
|
---|
| 676 | attr {
|
---|
| 677 | INTNO interruptNumber;
|
---|
| 678 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 679 | [omit] PRI interruptPriority;
|
---|
| 680 | };
|
---|
| 681 |
|
---|
| 682 | factory {
|
---|
| 683 | write("tecsgen.cfg", "CFG_INT(%s, { %s, %s });",
|
---|
| 684 | interruptNumber, attribute, interruptPriority);
|
---|
| 685 | };
|
---|
| 686 | };
|
---|
| 687 |
|
---|
| 688 | /*
|
---|
| 689 | * 割込みサービスルーチンのセルタイプ
|
---|
| 690 | */
|
---|
| 691 | [active]
|
---|
| 692 | celltype tISR {
|
---|
| 693 | call siHandlerBody ciISRBody;
|
---|
| 694 |
|
---|
| 695 | attr {
|
---|
| 696 | ID id = C_EXP("ISRID_$id$");
|
---|
| 697 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 698 | [omit] INTNO interruptNumber;
|
---|
| 699 | [omit] PRI isrPriority = 1;
|
---|
| 700 | };
|
---|
| 701 |
|
---|
| 702 | factory {
|
---|
| 703 | write("tecsgen.cfg", "CRE_ISR(%s, { %s, $cbp$, %s, tISR_start, %s });",
|
---|
| 704 | id, attribute, interruptNumber, isrPriority);
|
---|
| 705 | };
|
---|
| 706 | FACTORY {
|
---|
| 707 | write("tecsgen.cfg", "#include \"$ct$_tecsgen.h\"");
|
---|
| 708 | write("$ct$_factory.h", "#include \"kernel_cfg.h\"");
|
---|
| 709 | };
|
---|
| 710 | };
|
---|
| 711 |
|
---|
| 712 | /*
|
---|
| 713 | * 割込みハンドラのセルタイプ
|
---|
| 714 | */
|
---|
| 715 | [active]
|
---|
| 716 | celltype tInterruptHandler {
|
---|
| 717 | call siHandlerBody ciInterruptHandlerBody;
|
---|
| 718 |
|
---|
| 719 | attr {
|
---|
| 720 | INHNO interruptHandlerNumber;
|
---|
| 721 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 722 | };
|
---|
| 723 |
|
---|
| 724 | factory {
|
---|
| 725 | write("tecsgen.cfg",
|
---|
| 726 | "DEF_INH(%s, { %s, tInterruptHandler_start });", attribute);
|
---|
| 727 | };
|
---|
| 728 | FACTORY {
|
---|
| 729 | write("tecsgen.cfg", "#include \"$ct$_tecsgen.h\"");
|
---|
| 730 | };
|
---|
| 731 | };
|
---|
| 732 |
|
---|
| 733 | /*
|
---|
| 734 | * CPU例外ハンドラのセルタイプ
|
---|
| 735 | */
|
---|
| 736 | [active]
|
---|
| 737 | celltype tCpuExceptionHandler {
|
---|
| 738 | call siHandlerBody ciCpuExceptionHandlerBody;
|
---|
| 739 |
|
---|
| 740 | attr {
|
---|
| 741 | EXCNO cpuExceptionHandlerNumber;
|
---|
| 742 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 743 | };
|
---|
| 744 |
|
---|
| 745 | factory {
|
---|
| 746 | write("tecsgen.cfg",
|
---|
| 747 | "DEF_EXC(%s, { %s, tCpuExceptionHandler_start });", attribute);
|
---|
| 748 | };
|
---|
| 749 | FACTORY {
|
---|
| 750 | write("tecsgen.cfg", "#include \"$ct$_tecsgen.h\"");
|
---|
| 751 | };
|
---|
| 752 | };
|
---|
| 753 |
|
---|
| 754 | /*
|
---|
| 755 | * 初期化/終了処理ルーチン本体のシグニチャ
|
---|
| 756 | */
|
---|
| 757 | signature sRoutineBody {
|
---|
| 758 | void main(void);
|
---|
| 759 | };
|
---|
| 760 |
|
---|
| 761 | /*
|
---|
| 762 | * 初期化ルーチンのセルタイプ
|
---|
| 763 | */
|
---|
| 764 | [active]
|
---|
| 765 | celltype tInitializeRoutine {
|
---|
| 766 | call sRoutineBody cInitializeRoutineBody;
|
---|
| 767 |
|
---|
| 768 | attr {
|
---|
| 769 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 770 | };
|
---|
| 771 |
|
---|
| 772 | factory {
|
---|
| 773 | write("tecsgen.cfg",
|
---|
| 774 | "ATT_INI({ %s, $cbp$, tInitializeRoutine_start });",
|
---|
| 775 | attribute);
|
---|
| 776 | };
|
---|
| 777 | FACTORY {
|
---|
| 778 | write("tecsgen.cfg", "#include \"$ct$_tecsgen.h\"");
|
---|
| 779 | };
|
---|
| 780 | };
|
---|
| 781 |
|
---|
| 782 | /*
|
---|
| 783 | * 終了処理ルーチンのセルタイプ
|
---|
| 784 | */
|
---|
| 785 | [active]
|
---|
| 786 | celltype tTerminateRoutine {
|
---|
| 787 | call sRoutineBody cTerminateRoutineBody;
|
---|
| 788 |
|
---|
| 789 | attr {
|
---|
| 790 | [omit] ATR attribute = C_EXP("TA_NULL");
|
---|
| 791 | };
|
---|
| 792 |
|
---|
| 793 | factory {
|
---|
| 794 | write("tecsgen.cfg",
|
---|
| 795 | "ATT_TER({ %s, $cbp$, tTerminateRoutine_start });", attribute);
|
---|
| 796 | };
|
---|
| 797 | FACTORY {
|
---|
| 798 | write("tecsgen.cfg", "#include \"$ct$_tecsgen.h\"");
|
---|
| 799 | };
|
---|
| 800 | };
|
---|