1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AUTOSAR CountdownAdvent Calendar 2022

Day 12

calloutとcallback, OSEK/VDX OS and AUTOSAR, OSEK(4)

Last updated at Posted at 2022-07-15

AUTOSARの文書を読んでいると、callout, callbackという言葉が出てくる。

callは、関数を呼び出すこと。

直感的にはcalloutは、呼び出して戻って来ない感じ。
callbackは、呼び出したところに戻ってくる感じ。

OSEK/VDX

OSEKの文書を見たら、規定があった。
https://www.osek-vdx.org/mirror/com301.pdf

<この項は書きかけです。順次追記します。>
This article is not completed. I will add some words in order.

Glossary

Glossary AUTOSAR R22-11 FO, No.55,
https://qiita.com/kaizen_nagoya/items/ae8ee1c14ef386ba5e4c

AUTOSAR Glossary の課題は、ISOであるOSEK/VDX OSと違う決めをした根拠を示しているようには読めない。 
WTO/TBT協定違反にAUTOSARが問われる可能性を秘めているかもしれない。

Callout

OSEK/VDX OS

Appendix C Callouts
This section describes some suggested uses for callouts.
OSEK Communication Specification 3.0.1
Callouts provide a general mechanism to customise and enhance the behaviour of the IL. Callouts are configured statically, are invoked in response to the passage of a message or I- PDU and cannot be changed at run-time. The prototype for a callout allows it to return a value. This value is treated as a Boolean that can either prevent or allow further processing of the message or I-PDU.
Three uses of callouts are now described: custom filtering, gatewaying and replication. Each of these uses can apply equally well to I-PDUs or messages.
Declaration
A callout is declared in the application code as follows:
COMCallout(co1) {
...
}
This declares a callout called “co1”. As callouts have no parameters it is best to have a callout for each separate use. This means that the callout implicitly knows which I-PDU or message it is dealing with.
Custom filtering
The CPU-order message callouts can be used to implement custom filtering. When the callout is invoked the message can be checked against some arbitrary criterion and the callout's return value used to indicate whether or not the message passes the filter. Depending upon the callout's return value, the IL either discards the message or continues processing it.
For example, a custom filter might be implemented as follows:
COMCallout(filter1) {
if(test criterion) {
return COM_TRUE;
} else {
return COM_FALSE:
}
}
so that the message is either discarded or passed based upon the test criterion.

AUTOSAR

4.55 Callout

item description
Definition Function stubs that the system designer can replace with code to add functionality to a module which could not be specified by AUTOSAR.
Initiator Software and Architecture
Further Explanations A module calls callouts to execute functionality that could not be specified by AUTOSAR, i.e. integration code while the module provides Callbacks (“Callback”) so that other modules can initiate its processing.Callouts can be separated into two classes:1) callouts that provide mandatory functionality and thus serve as a hardware abstraction layer 2) callouts that provide optional functionality
Comment
Example In the EcuM: For class 1): EcuM_EnableWakeupSources For class 2): The Init Lists (EcuM_AL_DriverInitZero)
Reference

Callback

Call back, OSEK(62)
https://qiita.com/kaizen_nagoya/items/8c76f5e05cbd9125f86d

OSEK/VDX OS

2.6.2 Notification mechanisms
The following notification mechanisms are provided2:
OSEK Communication Specification 3.0.1
1. Callback routine
The IL calls a callback routine provided by the application.
Except for StartCOM and StopCOM, the use of all OSEK COM API functions is allowed in callback routines. The user must take care of problems which may arise because of nesting of callbacks (stack size etc.).

2.6.3 Interface for callback routines
Within the application, a callback routine is defined according to the following template:
COMCallback(CallbackRoutineName)
{
}
No parameters are passed to a callback routine and they do not have a return value.
A callback routine runs either on interrupt level or on task level. Thus, the OS restrictions of usage of system functions for interrupt service routines as well as for tasks apply.

2.9.1 Interface to OSEK Indirect NM
OSEK Communication Specification 3.0.1
The following services are provided by OSEK Indirect NM as callback functions for OSEK COM to inform OSEK Indirect NM of deadline monitoring results. They provide a fifth notification mechanism, NMCallback. This notification mechanism is identical to the COMCallback mechanism described in section 2.6.2 except that the interface complies to the definition of I_MessageTransfer.ind and I_MessageTimeOut.ind, that is:
• NMCallback routines have no return value, and
• NMCallback routines pass a 16-bit unsigned integer value as parameter.
Both the name of the NMCallback routine and the value of the parameter passed to it are statically defined in OIL.

Appendix B Application notes
Use of callbacks:
A callback is one of the notification mechanisms that can be invoked in response to an event in the IL. A callback with the name “cb1” would be declared in the application source as follows:
COMCallback(cb1) {
...
}
When the declared event in the IL occurs the IL calls the callback. This means that the context in which the callback is called (such as task priority if the IL is part of a task, or interrupt priority if the IL is part of an ISR) is determined by the implementation.
Because a callback is called as part of the IL when the appropriate event occurs it gives the fastest response time to the arrival of a new message. However, because it runs as part of the IL a callback may prevent the IL from being re-entered depending upon the implementation. Therefore it may be necessary to ensure that the callback exits rapidly in order to prevent message loss.

Interface to OSEK Indirect NM:
The IL needs to call Indirect NM in order to indicate that a message has been transferred or that a message timeout has occurred (see section 2.9.1). This is achieved by defining an NMCallback for a message in a monitored I-PDU. The message can be one that already exists in that I-PDU or a zero-length message used explicitly to cause an NMCallback.
Each implementation of Indirect NM might define different names for its I_MessageTransfer.ind and I_MessageTimeOut.ind routines. Therefore the names used are configured as an NMCallback attribute of a message in the OIL file. Additionally, Indirect NM also needs to know which message caused the NMCallback. For this purpose the NMCallback parameter called MonitoredIPDU uniquely identifies the message that caused the NMCallback. As a message can only appear in one I-PDU, and an I-PDU can only appear on one bus, this parameter is sufficient to identify the I-PDU and bus that caused the NMCallback. Therefore, the NMCallback indicates the condition of an I-PDU.
The values passed in the MonitoredIPDU parameter are defined per message in the OIL file. Therefore a unique value can be chosen for each message.

AUTOSAR

4.54 Callback

item description
Definition Functionality that is defined by an AUTOSAR module so that lower-level modules (i.e. lower in the Layered Software Architecture) can provide notification as required (e.g. when certain events occur or asynchronous processing completes).
Initiator Software and Architecture
Further Explanations In AUTOSAR, modules usually provide a register mechanism for callback functions which is set through configuration.A module provides callbacks so that other modules can initiate its processing while the module calls callbacks to execute functionality that could not be specified by AUTOSAR, i.e. “Integration Code”
Comment
Example (from the viewpoint of a particular SWS):The module being specified (Msws) should be informed about an Event in another module (Mexternal). In this example, Msws calls Mexternal to perform some processing and can only resume when Mexternal completes. Upon completion, Mexternal calls Msws’s callback function. That is, the called module (Mexternal) CALLS the calling module (Msws) BACK when complete ==> a callback.
Reference -

参考資料(Reference)

aspberry Pi 3 Model B+ 向けにリアルタイムOSを実装してみた話
https://qiita.com/tenkoh2/items/baa8e0b6c09669793b4f

[メモ] TrampolineRTOSでLチカ (OSEK/VDX & AUTOSAR APIにあわせたRTOS)
https://qiita.com/mt08/items/65f2ac9bbdae09a34470

MacでLego Mindstorms NXT環境構築 in 2018
https://qiita.com/vivid344/items/2f23f846cd3b135c5a74

ETロボコン開発環境構築 for Mac
https://qiita.com/tac0x2a/items/b1d82050c660935765ef

自己参照(self reference)

OSEKはもう流行らないのでしょうか。AUTOSAR(64)OSEK(1)
https://qiita.com/kaizen_nagoya/items/b87687254b11f30cc2ee
OSEKを図から理解 OSEK(2)
https://qiita.com/kaizen_nagoya/items/f87a7ff5aeb63803a022
OSEK OS(AUTOSAR OS)をざっくり理解するには OSEK(3)
https://qiita.com/kaizen_nagoya/items/c68c0b86b97d4a90e6e2
calloutとcallback, OSEK/VDX OS and AUTOSAR OSEK(4)
https://qiita.com/kaizen_nagoya/items/b95b81354d07b9172a56
OSEK/VDX ISO and 2.23 OSEK(5)
https://qiita.com/kaizen_nagoya/items/4d6bcec01e0132f9c41c
OSEK/VDX OSEK(6)
https://qiita.com/kaizen_nagoya/items/a7720994f2178a15be81
ISO OSEK/VDX and ISO Linux OS 同梱ソースをC++またはRUSTで書く企画 OSEK(7)
https://qiita.com/kaizen_nagoya/items/27899e936c90b415d700
OSEK 記事で views 100,000を目指して OSEK(8)
https://qiita.com/kaizen_nagoya/items/ff45ee55566eeff5f62e
自動車用OSを網羅する OSEK(9)
https://qiita.com/kaizen_nagoya/items/a61144daf500a3f2b4f4
Smallest Set Profile and Automotive Profile, OSEK(10)
https://qiita.com/kaizen_nagoya/items/0c5484f6562cc259e7f0
Exclusive Area, OSEK(11) 
https://qiita.com/kaizen_nagoya/items/d87ff4e08378dbcf68a7
自動車のソフトウェア、例えばAUTOSAR の仕事を始めてする方に, OSEK(12)
https://qiita.com/kaizen_nagoya/items/1832634788c23498e054
名古屋で自動車関係のソフトウェア設計する際にあるといいかもしれない知識, OSEK(13)
https://qiita.com/kaizen_nagoya/items/9f01d55e4bd0bd931c96
single task os and data, OSEK(14)
https://qiita.com/kaizen_nagoya/items/6acbd5d2cfd3ed8bca60
AUTOSARといえば O で始まる用語は? OSEK(15)
https://qiita.com/kaizen_nagoya/items/06c969fe5c4b3e7319e0
Automotive Software Expert Examination Exercise, Examples or Extract. OSEK(16)
https://qiita.com/kaizen_nagoya/items/1762e0612ef01e036efb
自動運転資料集(1) OSEK(17)
https://qiita.com/kaizen_nagoya/items/42eb2129e281f25eaab8
TOPPERS of the YearとAUTOSAR, AUTOSAR(39), OSEK(18)
https://qiita.com/kaizen_nagoya/items/f241bb4a819733110b7a
Autosar 2.0を読む, AUTOSAR(25), OSEK(19)
https://qiita.com/kaizen_nagoya/items/b44a1047c2c517d522fe
IT関連技術でお世話になった方々, OSEK(20)
https://qiita.com/kaizen_nagoya/items/8a5bf487594cd106e8b8
AUTOSARの4つの入力, OSEK(21)
https://qiita.com/kaizen_nagoya/items/72cef6028b9697f7968e
AUTOSAR これだけ知っていればなんとかなる。OSEK(22)
https://qiita.com/kaizen_nagoya/items/7a63e706bfb8f331cfe4
AUTOSAR based on ISO, OSEK(23)
https://qiita.com/kaizen_nagoya/items/867a709cdf6f4dbdecc6
AUTOSARと国際規格。AUTOSAR(65), OSEK(24)
https://qiita.com/kaizen_nagoya/items/4ddba03efb942969b125
AUTOSAR入門, AUTOSAR(16), OSEK(25)
https://qiita.com/kaizen_nagoya/items/5e43b8ef0935c32ee11d
AUTOSAR 記事1000までの道, OSEK(26)
https://qiita.com/kaizen_nagoya/items/785473512f5f7f85a6bf
Autosarの課題, OSEK(27)
https://qiita.com/kaizen_nagoya/items/617d10b0e34143030600
AUTOSAR: The past 20 years and he next 10 years, OSEK(28)
https://qiita.com/kaizen_nagoya/items/2dab0707c01059c152c4
Autosar文書を読む(準備), OSEK(29) 
https://qiita.com/kaizen_nagoya/items/5f547173544703d267aa
AUTOSARが手に取るように分かるようになる。AUTOSAR(29), OSEK(30)
https://qiita.com/kaizen_nagoya/items/ae092ea6aef89cdc15df
posixとethernet, osekとTCP/IP, osek(31)
https://qiita.com/kaizen_nagoya/items/73b79a4a56f433bd53c0
斉藤直希「組み込み向けリアルタイムOSの基礎知識を整理する」を整理する, OSEK(32)
https://qiita.com/kaizen_nagoya/items/d305e83b37d0c57dceb3
TOPPERS活用アイデア・アプリケーション開発コンテスト受賞作品紹介 まとめ作成中, OSEK(33)
https://qiita.com/kaizen_nagoya/items/72b882d96b2841f25faf
はじめてのAUTOSAR(classic platform) <エンジニア夏休み企画>【読書感想文】, OSEK(34)
https://qiita.com/kaizen_nagoya/items/696ad320f76f284664d7
AUTOSARとSimulink: Adaptive Platform, Classic Platformとマルチコア・共通化, OSEK(35)
https://qiita.com/kaizen_nagoya/items/d613b0b14bfd91989a13
AUTOSAR Abstract Platformへの道(詳細編), OSEK(36)
https://qiita.com/kaizen_nagoya/items/cb217133884fa0a2c704
building block:AUTOSAR Abstruct Platform , OSEK(37),
https://qiita.com/kaizen_nagoya/items/bf7c17624f648fb9f392
系建築家(system architect)になるには, OSEK(38)
https://qiita.com/kaizen_nagoya/items/8c341e69233cb32f6275
自己紹介 OSEK(39)
https://qiita.com/kaizen_nagoya/items/90aa368f296613ec93b5
AUTOSAR 「完全に理解した」, OSEK(40)
https://qiita.com/kaizen_nagoya/items/51983798ad7902b33cb1

一覧

物理記事 上位100
https://qiita.com/kaizen_nagoya/items/66e90fe31fbe3facc6ff

量子(0) 計算機, 量子力学
https://qiita.com/kaizen_nagoya/items/1cd954cb0eed92879fd4

数学関連記事100
https://qiita.com/kaizen_nagoya/items/d8dadb49a6397e854c6d

統計(0)一覧
https://qiita.com/kaizen_nagoya/items/80d3b221807e53e88aba

品質一覧
https://qiita.com/kaizen_nagoya/items/2b99b8e9db6d94b2e971

言語・文学記事 100
https://qiita.com/kaizen_nagoya/items/42d58d5ef7fb53c407d6

医工連携関連記事一覧
https://qiita.com/kaizen_nagoya/items/6ab51c12ba51bc260a82

自動車 記事 100
https://qiita.com/kaizen_nagoya/items/f7f0b9ab36569ad409c5

通信記事100
https://qiita.com/kaizen_nagoya/items/1d67de5e1cd207b05ef7

日本語(0)一欄
https://qiita.com/kaizen_nagoya/items/7498dcfa3a9ba7fd1e68

英語(0) 一覧
https://qiita.com/kaizen_nagoya/items/680e3f5cbf9430486c7d

転職(0)一覧
https://qiita.com/kaizen_nagoya/items/f77520d378d33451d6fe

仮説(0)一覧(目標100現在40)
https://qiita.com/kaizen_nagoya/items/f000506fe1837b3590df

音楽 一覧(0)
https://qiita.com/kaizen_nagoya/items/b6e5f42bbfe3bbe40f5d

@kazuo_reve 新人の方によく展開している有益な情報」確認一覧
https://qiita.com/kaizen_nagoya/items/b9380888d1e5a042646b

Qiita(0)Qiita関連記事一覧(自分)
https://qiita.com/kaizen_nagoya/items/58db5fbf036b28e9dfa6

鉄道(0)鉄道のシステム考察はてっちゃんがてつだってくれる
https://qiita.com/kaizen_nagoya/items/26bda595f341a27901a0

安全(0)安全工学シンポジウムに向けて: 21
https://qiita.com/kaizen_nagoya/items/c5d78f3def8195cb2409

一覧の一覧( The directory of directories of mine.) Qiita(100)
https://qiita.com/kaizen_nagoya/items/7eb0e006543886138f39

Ethernet 記事一覧 Ethernet(0)
https://qiita.com/kaizen_nagoya/items/88d35e99f74aefc98794

Wireshark 一覧 wireshark(0)、Ethernet(48)
https://qiita.com/kaizen_nagoya/items/fbed841f61875c4731d0

線網(Wi-Fi)空中線(antenna)(0) 記事一覧(118/300目標)
https://qiita.com/kaizen_nagoya/items/5e5464ac2b24bd4cd001

OSEK OS設計の基礎 OSEK(100)
https://qiita.com/kaizen_nagoya/items/7528a22a14242d2d58a3

Error一覧 error(0)
https://qiita.com/kaizen_nagoya/items/48b6cbc8d68eae2c42b8

++ Support(0) 
https://qiita.com/kaizen_nagoya/items/8720d26f762369a80514

Coding(0) Rules, C, Secure, MISRA and so on
https://qiita.com/kaizen_nagoya/items/400725644a8a0e90fbb0

プログラマによる、プログラマのための、統計(0)と確率のプログラミングとその後
https://qiita.com/kaizen_nagoya/items/6e9897eb641268766909

なぜdockerで機械学習するか 書籍・ソース一覧作成中 (目標100)
https://qiita.com/kaizen_nagoya/items/ddd12477544bf5ba85e2

言語処理100本ノックをdockerで。python覚えるのに最適。:10+12
https://qiita.com/kaizen_nagoya/items/7e7eb7c543e0c18438c4

プログラムちょい替え(0)一覧:4件
https://qiita.com/kaizen_nagoya/items/296d87ef4bfd516bc394

Python(0)記事をまとめたい。
https://qiita.com/kaizen_nagoya/items/088c57d70ab6904ebb53

官公庁・学校・公的団体(NPOを含む)システムの課題、官(0)
https://qiita.com/kaizen_nagoya/items/04ee6eaf7ec13d3af4c3

「はじめての」シリーズ  ベクタージャパン 
https://qiita.com/kaizen_nagoya/items/2e41634f6e21a3cf74eb

AUTOSAR(0)Qiita記事一覧, OSEK(75)
https://qiita.com/kaizen_nagoya/items/89c07961b59a8754c869

プログラマが知っていると良い「公序良俗」
https://qiita.com/kaizen_nagoya/items/9fe7c0dfac2fbd77a945

LaTeX(0) 一覧 
https://qiita.com/kaizen_nagoya/items/e3f7dafacab58c499792

自動制御、制御工学一覧(0)
https://qiita.com/kaizen_nagoya/items/7767a4e19a6ae1479e6b

Rust(0) 一覧 
https://qiita.com/kaizen_nagoya/items/5e8bb080ba6ca0281927

小川清最終講義、最終講義(再)計画, Ethernet(100) 英語(100) 安全(100)
https://qiita.com/kaizen_nagoya/items/e2df642e3951e35e6a53

<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
This article is an individual impression based on my individual experience. It has nothing to do with the organization or business to which I currently belong.

文書履歴(document history)

ver. 0.01 初稿  20220715

最後までおよみいただきありがとうございました。

いいね 💚、フォローをお願いします。

Thank you very much for reading to the last sentence.

Please press the like icon 💚 and follow me for your happy life.

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?