Autosar OS IOC

IOC是一种操作系统内的通信方式,用于同一ECU上的跨应用通信。它支持1:1、N:1和N:M的无队列或有队列通信,确保数据一致性。RTE利用IOC服务进行通信,接收方可以通过回调函数被通知。IOC接口类似于RTE与软件组件之间的接口,每个通信操作具有独特的API。在多核系统中,IOC需要处理内存保护和非重入性问题。
摘要由CSDN通过智能技术生成

背景和基本原理

The IOC implementation shall be part of the Operating System

IOC和操作系统紧密相关,是操作系统实现的一部分

The IOC is a third type of communication, in addition to
Intra OS-Application communication: Always handled within the RTE
Inter ECU communication: Already available via well defined interfaces to the
communication stack (COM)

IOC 是除了Intra OS-Application communication,Inter ECU communication之外的第三种通信方式

In systems with only one core, the IOC can be omitted completely, if just one OSApplication is available, or if no OS-Application uses memory protection
mechanisms

在单核系统中,如果只有一个OsApplicationn或者没有使用内存保护,那么可以把IOC模块去除。

General purpose

The IOC provides communication services which can be accessed by clients which
need to communicate across OS-Application boundaries on the same ECU

IOC提供同一个ECU上跨OSApplicatiion的通信服务。

The RTE uses IOC services to communicate across such boundaries. All
communication must be routed through the RTE on sender (or client) and on receiver
(or server) side

Direct access to IOC services by clients other than the RTE is currently not
supported, but possible, if the client (e.g. a CDD) provides a hand written or
generated IOC Configuration Description as specified and specific callback functions
if necessary. Only sender/receiver communication is supported however by the IOC

IOC通过RTE的sender/receiver来实现。

Software Components and/or BSW modules located in the same OS-Application
(and hence on the same core) should not communicate by invoking IOC services.
This would be less efficient than communication via RTE only. However, in case of
IOC supported N:1 communication, if not all of the senders and the receiver are in
the same OS-Application the IOC must be used

同一个OSApplication的模块不要通过IOC通信,效率较低。当然,如果不是所有的senders和receiver在同一个OSApplication内的情况除外。

The IOC has to guarantee data consistency in inter OS-Application and inter core
(Multi-Core systems) communication,

IOC要负责数据一致性。

IOC functionality

Communication

1:1, N:1 and N:M (unqueued only) communication are supported by the IOC

The IOC allows the transfer of one data item per atomic communication operation. A
data item can either be a value for atomic basic data types or a reference for
complex data structures. The data structure must be implemented as a single
memory block, however. This way the data item can be transmitted in one piece. The
IOC does not need to know the internal data structure. The basic memory address
and length (which can be calculated from the type of the data item) is sufficient. The
IOC does, e.g., not support a conversion of endianness between cores.

IOC 允许每一次原子通信操作传输一个数据,这个数据可以是原子数据类型,或者一个复杂数据结构的引用,这个数据结构必须是一个单独的内存块,每次传输的时候只需要知道内存块的地址和长度就行了。

Transferring more than one data item in one operation is also supported for 1:1
communication only. In this case several types and memory addresses have to be
used by the IOC function. The advantage compared to sequential IOC calls is that
mechanisms to open memory protection boundaries and to notify the receiver have
to be executed just once. Additionally, all data items are guaranteed to be consistent,
because they are transferred in one atomic operation

IOC只有在1:1的通信中才允许一个传输多个数据。这种通信方式可以降低额外的通信开销,也可以保证数据的一致性。

The IOC provides both, unqueued (Last-is-Best, data semantics) or queued (First-InFirst-Out, event semantics) communication operations. If present, the IOC internal
queue has a configurable length.

IOC提供了unqueued和queued两种通信操作。

Each atomic communication operation gets specified individually by its own
description block in a Configuration Description with regard to sender, receiver, data
type(s), notification, and queuing

每一个原子通信操作都有自己的配置。

Notification

The IOC optionally notifies the receiver as soon as the transferred data is available
for access on the receiver side, by calling a configured callback function which gets
provided by the user of the communication.

当传输的数据可用时,IOC调用配置的callback function来通知receciver。

A possible implementation is to trigger an interrupt (Cat. 2) mechanism to invoke the
callback function from the ISR on receiver side, or to use a microcontroller supplied
trap. The callback function shall be efficient and compact, because it is called from
within the ISR.

Notification 的实现方式可以在receiver侧通过二类中断触发callback function,或者通过微控制器提供的trap来实现方式。callback function应该是高效的,因为它是通过中断调用的。

IOC interface

The interface between RTE and IOC shall be similar to the interface between
Software Components and the RTE, i.e. by generating specific interfaces for each
communication operation instead of providing a generic API.

RTE和IOC的接口和RTE和SWC的接口类型。

There is a unique set of IOC service APIs (at least to send and receive data) for each
data communication specified in the IOC Configuration Description. Each service API
gets generated and can be identified by a unique Id for each data communication. In
case of N:1 communication, each sender must use its own API.

每组通信都必须要有自己的唯一的API。

The same IOC service API and hence the same 1:1 communication can get used by
more than one runnable inside the same SWC both on sender and on receiver side.
However, the IOC functions are not reentrant, because otherwise e.g. spinlock errors
could occur in case the IOC uses spinlocks in Multi-Core systems. The same IOC
API must therefore only be called sequentially. This is no problem, if all runnable
entities are scheduled within the same TASK, otherwise the caller is responsible to
guarantee that the same IOC API is not called again before it returns from a different
invocation

由于IOC函数是不可重入的,所以在多核系统中有可能会出现自旋锁错误。

Software Components may access the IOC only via RTE. Only the RTE decides
which communication services to use to support the communication needs of
Software Components.

SWC可能通过RTE来访问IOC。RTE决定为SWC使用哪种通信方式。

Direct access to IOC services by BSW modules is not supported, but allowed for
CDDs and other modules, if unavoidable. The clients have to provides a hand written
or generated IOC Configuration Description as specified

BSW直接访问IOC服务是不支持的,CDD和其他的模块是允许的,但是要手写IOC配置描述。

  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
这里的NM主要是针对Can协议的网路管理。 AUTOSAR CanNM的核心思想主要归纳为以下两条: 1.  如果节点需要保持通信,则节点需要周期的发送NMPDUs,否则停止发送NMPDUs 2.     如果总线上的所有节点不需要使用总线,那么总线上过了一段时间没有NMPDUs时,则会进入Bus-Sleep Mode。   工作模式和状态   CanNm一共有三个工作模式 1.  Network Mode 2.  PrepareBus-Sleep Mode 3.  Bus-Sleep Mode 模式的改变应该通过回调函数通知上层。 下面单独说每种模式   (1)Network Mode Network Mode又包括三个内部状态 1. Repeat Message State 2. Normal Operation State 3. Ready Sleep State ①Repeat Message State 这个模式被用来确保从Bus-Sleep or Prepare Bus-Sleep到Network Mode的节点被总线上面其他节点发现。这个状态可以用来检测总线上的节点。 当进入Repeat Message State时,节点应该开始传送NMPDUs。 在Repeat Message State时,当NM-Timeout Timer溢出,CanNm模块应该重载Timer。 CanNm模块应该在Repeat Message State 下保持一段时间,这段时间可以通过CANNM_REPEAT_MESSAGE_TIME来进行配置。 当离开Repeat Message State的时候,如果节点需要通信,则进入Normal Operation State;如果节点不需要通信,则进入Ready Sleep State。并且清空Repeat Message Bit。   ②Normal Operation State 这个状态可以保持总线处于唤醒状态。从Ready sleep state进入这个状态的时候应该发送NMPDUs。 在Normal Operation State当NM-Timeout Timer溢出,CanNm模块应该重载Timer。 如果节点不需要使用通信,则网络应该被释放,节点应该进入Ready Sleep State。 如果节点接收到Repeat Message Request Bit,则节点进入Repeat Message State。如果节点自身需要进入Repeat Message State,则该节点进入Repeat Message State并且设置Repeat Message Request Bit。   ③ReadySleep State 这个状态是为了如果本节点已经准备释放总线,而其他节点还需要使用总线的时候,在这个状态下等待其他总线上的节点进入Perpere Bus-Sleep Mode。进入这个状态之后,CanNm模块应该停止NMPDUs的传送。 如果NM-Timeout Timer溢出,节点将会进入Prepare Bus-Sleep Mode。 如果该节点需要使用总线,则节点进入Nomal Operation State。 如果节点接收到Repeat Message Request Bit,则节点进入Repeat Message State。如果节点自身需要进入Repeat Message State,则该节点进入Repeat Message State并且设置Repeat Message Request Bit。 (2)PrepareBus-Sleep Mode   这个状态是为了等待总线上的所有节点能够在进入Bus-Sleep Mode之前,有时间停止节点的active状态如清空队列中为发送的报文。在Prepare Bus –Sleep Mode下,所有节点都静默下来。 当节点进入PrepareBus Mode时,应该通知上层应用。通过配置CANNM_WAIT_BUS_SLEEP_TIME参数,可以改变节点在PrepareBus-Sleep Mode停留的时间,在这段时间之后节点将会进入其他状态。 在Prepare Bus-Sleep Mode下面接收到NMPDU或者被上层应用请求通信时,节点将进入Network Mode中的Normal operation State。   (3)Bus-SleepMode   Bus-Sleep Mode的目的是当没有消息被传送的时候可以减少能量的消耗。在Bus-Sleep Mode下面,节点可以被唤醒(如本地唤醒源和CAN线唤醒源)。CANNM_TIMEOUT_TIME+CANNM_WAIT_BUS_SLEEP_TIME两个参数在整个总线上面的节点都应该时一样的配置,保证了总线上的节点能够统一的进行休眠。 当进入Bus-Sleep Mode时候,应该通知上层应用。 在Bus-Sleep Mode下,如果成功接收到NMPDU,CAN NM模块应该调用Nm_NetworkStartIndication。 如果CanNm_PassiveStartUp被调用,则CAN NM模块进入Network Mode 中的Repeat Message State。 ———————————————— 版权声明:本文为CSDN博主「cococenstar」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/cococenstar/article/details/84096689
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值