AUTOSAR_SWS_BSWModeManager
Specification of Basic Software Mode Manager
简介和功能概述
该规范指定了 AUTOSAR 基础软件模块 BSW 模式管理器 (BswM) 的功能、API 和配置。
BSW 模式管理器是实现了车辆模式管理概念和应用模式管理概念在 BSW 中驻留的部分的模块。其职责是依据简单的规则来仲裁来自应用层软件组件或其他 BSW 模块的模式请求,并根据仲裁结果来执行操作。
首字母缩略词和缩写
约束和假设
限制
每个分区内最多可使用一个 BswM 实例。
对其他模块的依赖
BswM 为 AUTOSAR 架构中的许多 BSW 模块都提供了接口。但这些接口大部分都是可选的,并根据每个 ECU 的需求来使用。
本章列出的依赖关系旨在概述 BswM 与其他模块之间的一些可能的交互。此处列出的交互和模块不应被视为所有可能性的详尽列表。
RTE
BswM 通过 RTE 接收来自软件组件的模式请求。模式切换通知也通过 RTE 被传播给软件组件。
EcuM - Flex
EcuM - Flex 可以向 BswM 指示其唤醒源的状态。当使用 ECU 模式处理时,BswM 可以设置 EcuM - Flex 的状态并接收某些以 RUN 请求协议为基础的模式的状态。
ComM
来自 ComM 的模式切换指示经过 BswM 被进一步传播给软件组件。BswM 可以通过 ComMUsers 向 ComM 请求通信模式。
COM
COM 中的 I-PDU 组的处理由 BswM 执行。作为 I-PDU 组启动/停止的一部分,使包含的信号值被重置为其相应的初始化值是可能的。
BswM 处理 COM 中信号的截止时间监控的启用和禁用。
BswM 还可以触发 I-PDU 的传输。
PduR
BswM 可以启用和禁用 PDU 路由器中的 I-PDU 组的路由。
CanSM
来自 CanSM 的模式切换指示经过 BswM 被进一步传播给软件组件。
LinSM
通过 COM 中相应 I-PDU 组的启动和停止,BswM 协调 LinSM 中的 LIN 调度表的切换。
来自 LinSM 的模式切换指示经过 BswM 被进一步传播给软件组件。
LinTp
作为 LinIf 一部分的 LIN 传输协议向 BswM 发出模式请求,以确保在 LinTp 操作期间 LIN 调度表正确地处于活动状态。
FrSM
来自 FrSM 的模式切换指示经过 BswM 被进一步传播给软件组件。
FlexRay 上的“单槽模式”的使用由 FrSM 根据 BswM 的请求进行控制。FlexRay 栈的发送能力可由 BswM 通过 FrSM 调用 API FrSM_SetEcuPassive 进行控制。
EthSM
来自 EthSM 的模式切换指示经过 BswM 被进一步传播给软件组件。
DCM
DCM 根据收到的诊断请求向 BswM 发出模式请求。
例如:DCM 可以请求“禁用正常通信”。在此模式下,BswM 将关闭相应的 I-PDU 组和 Nm PDU。
J1939Dcm
J1939Dcm 通信状态的改变经过 BswM 被进一步传播给软件组件。BswM 通过 API J1939Dcm_SetState 更改 J1939Dcm 的状态。
J1939Nm
J1939Nm 通过 API BswM_J1939Nm_StateChangeNotification 提供状态指示。
J1939Rm
BswM 通过 J1939Rm_SetState 改变 J1939Rm 的状态。
NM 接口
根据当前的模式,BswM 将使用 Nm_EnableCommunication 和 Nm_DisableCommunication 来控制 NM 通信。
例如:在“禁用正常通信”模式下,BswM 需要禁用相应 NM 通道上的 NM 通信。
NM 使用 BswM_Nm_CarWakeUpIndication 来指示 CarWakeUp。
NvM
NvM 模块通过被注册为 NvM 回调的“集成代码”向 BswM 报告其块的状态。BswM 的某些操作会导致 NvM 在 Startup 和 Shutdown 期间读取和写入所有块。
OS
BswM 所需的 OS 的特性是特定于实现的。
Sd
BswM 通过几个给出的 API 从 Sd 接收状态指示(请参阅第 8.3 章的示例)。这些来自 Sd 的状态指示可以被配置为 BswMModeRequestSource。
文件结构
BswM 可能会使用 AUTOSAR BSW 模块中未被本规范明确定义的接口。
需求可追溯性
本章详细说明了 BswM 的功能行为。
BswM 基础功能的操作可被描述为两个不同的任务:
- 模式仲裁
- 模式控制(切换)
基于规则,以及对从软件组件或其他 BSW 模块接收到的模式请求和模式指示的仲裁结果,模式仲裁部分将发起模式切换。
模式控制部分通过执行包含其他 BSW 模块的模式切换操作的行动列表来执行模式切换。
BswM 应该被看作是一个模式管理框架模块,其行为完全由其配置所定义。
实现 BswM 的方法可能有很多种,比如基于配置生成完整的 BswM,或者作为在运行时解析被编码的配置的规则解释器。
但是,本规范并不旨在指定 BswM 的任何实现细节。因此,本文档中所述的任何描述设计细节的示例都应被视为解释性文字,而不是要求。
模式仲裁
BswM 执行的模式仲裁是简单且基于规则的。用于模式仲裁的规则在 BswM 模块的配置中被指定。
这些规则由简单的布尔表达式组成,因此模式仲裁对 RTE 的预计运行干扰较小。
为了知道要执行哪些行动列表,BswM 需要检测先前规则评估中模式仲裁结果中的变化。如何做到这一点以及存储结果所需的内存的申请是特定于实现的,本文档未对此进行描述。
仲裁规则
规则是由一组模式请求的条件组成的逻辑表达式。
当输入的模式请求和模式指示发生变化时,或在执行 BswM 主函数时,将评估规则。
评估结果(True 或 False)用于决定是否执行相应的模式控制行动列表。
模式条件和逻辑表达式
组成模式仲裁规则的逻辑表达式可以使用不同的运算符,例如 AND,OR,XOR,NOT 和NAND。
表达式中的每个部分都对应一个模式请求的条件。
如果模式条件引用了一个 BswMModeRequestPort,则该条件将验证请求或指示的模式是否与某个模式相等或不相等。
如果模式条件引用了一个 BswMEventRequestPort,则该条件将验证请求的端口是否为 SET 或 CLEAR。
BswMEventRequestPort 的事件请求与模式请求的不同之处在于,请求者不会向 BswM 发送请求的模式/值,因此没有 BswM 需要评估的模式条件。相反,BswM 只需评估事件的接收情况。
当请求者发送/调用事件时,BswMEventRequestPort 将处于 SET 状态。然后,BswM 可以通过执行 BswMClearEventRequest 操作将 BswMEventRequestPort 置于 CLEAR 状态。
图 7.1 显示了具有两个条件的示例规则。规则和可用的逻辑操作集被定义为第 10.2 章描述的 ECU 配置的一部分。
[SRS_ModeMgm_09180]
[SRS_ModeMgm_09177]
- 当在 BswMModeCondition 中 BswMConditionType = BSWM_EVENT_IS_SET,并且 BswMModeCondition 引用了 BswMEventRequestPort 时:
- 如果 BswMEventRequestPort 处于 SET 状态,则 BswMModeCondition 应被评估为 TRUE。
- 如果 BswMEventRequestPort 处于 CLEAR 状态,则 BswMModeCondition 应被评估为 FALSE。
[SWS_BswM_00253]
[SRS_ModeMgm_09180]
[SRS_ModeMgm_09177]
- 当在 BswMModeCondition 中 BswMConditionType = BSWM_EVENT_IS_CLEARED,并且 BswMModeCondition 引用了 BswMEventRequestPort 时:
- 如果 BswMEventRequestPort 处于 SET 状态,则 BswMModeCondition 应被评估为 FALSE。
- 如果 BswMEventRequestPort 处于 CLEAR 状态,则 BswMModeCondition 应被评估为 TRUE。
[SWS_BswM_00254]
[SRS_ModeMgm_09180]
- 当 BswM 在已配置的 BswMEventRequestPort 上接收到事件(例如,ComM 调用BswM_ComM_InitiateReset)时,BswMEventRequestPort 应处于 SET 状态。
[SWS_BswM_00255]
[SRS_ModeMgm_09180]
- 当在 BswMEventRequestPort 上执行 BswMClearEventRequest 操作时,BswMEventRequestPort 应处于 CLEAR 状态。
模式仲裁的要求
如上所述,BswM 接受将模式请求和模式指示作为模式仲裁的输入。
模式请求通常由应用程序软件组件生成,但也可能源自其他 BSW 模块,例如 DCM。
模式指示总是由其他 BSW 模块发出,例如不同总线的特定的状态管理器和 EcuM。
在本文档中,通用术语“模式仲裁请求”对应于“模式指示”或“模式请求”。
[SWS_BswM_00009]
[SRS_ModeMgm_09180]
- BswM 应根据传入的模式请求来执行模式仲裁。
[SWS_BswM_00035]
[SRS_ModeMgm_09180]
- BswM 应根据传入的模式指示执行模式仲裁。
[SWS_BswM_00278]
[ ]
- BswM 应根据事件请求进行模式仲裁以及事件请求的清除。
注意:所有模式仲裁的请求(请求和指示)都由 BswM 以相同的方式处理。它们通过在BswMModeRequestSource 配置容器中选择相应的模式条件类型来配置。
[SWS_BswM_00010]
[SRS_ModeMgm_09177]
- BswM 应使用配置的规则来执行模式仲裁。
[SWS_BswM_00012]
[SRS_ModeMgm_09177]
- 模式仲裁规则应可使用模块配置参数进行配置。
[SWS_BswM_00117]
[SRS_ModeMgm_09180]
- BswM 不允许使用先前仲裁规则评估的结果作为逻辑表达式的输入。
注意:要求 [SWS_BswM_00117] 禁止将规则评估的结果用作其他规则评估的输入。BswM 配置容器的现有结构在很大程度上满足了这一要求,因为逻辑表达式的可配置输入排除了先前规则评估的结果。
[SWS_BswM_00147]
[SRS_ModeMgm_09178]
- 作为对 BswM 仲裁规则的评估结果而被调用的操作只能在行动列表的上下文中被调用。
[SWS_BswM_00189]
[SRS_ModeMgm_09180]
- BswM 应根据传入的模式切换通知执行模式仲裁。
立即和延迟操作
有两种不同的方法来调度模式仲裁的处理:
- 要么在模式请求/指示的上下文中立即完成。
- 要么(循环地)推迟到 BswM 的主要功能函数中。
“立即”请求在调用者的上下文中被执行。系统集成商有责任确保行动列表的执行不会危及系统的性能或一致性。
特别是,如果调用者在中断上下文中运行(或可能运行),则有关在中断上下文中使用系统函数的限制将适用。
立即操作和延迟操作之间的区别如第 9.1 节和 9.2 节中的序列图所示。
[SWS_BswM_00061]
[SRS_ModeMgm_09180]
- 模式仲裁规则可以包含立即模式仲裁请求和延迟模式仲裁请求的任意组合。
[SWS_BswM_00013]
[SRS_ModeMgm_09180]
- 应能够配置 BswM 在收到模式仲裁请求后立即执行模式仲裁。这可以通过将 BswMRequestProcessing 配置参数(在 BswMModeRequestPort 容器内)设置为 BSWM_IMMEDIATE 来实现。
[SWS_BswM_00059]
[SRS_ModeMgm_09180]
- 只有使用了特定的立即模式条件的模式仲裁规则才应由 BswM 在该特定模式的请求/指示上下文中评估。
[SWS_BswM_00014]
[SRS_ModeMgm_09180]
- 还应能够将模式仲裁推迟直到 BswM 的主函数执行时。这可以通过将 BswMRequestProcessing 配置参数(在 BswMModeRequestPort 容器内)设置为 BSWM_DEFERRED 来实现。
[SWS_BswM_00257]
[SRS_ModeMgm_09180]
- 应能够配置 BswM 在事件被设置时立即执行模式仲裁。这通过将 BswMEventRequestProcessing 配置参数(在 BswMEventRequestPort 容器内)设置为 BSWM_IMMEDIATE 来实现。
[SWS_BswM_00258]
[SRS_ModeMgm_09180]
- 还应能够将模式仲裁推迟直到 BswM 的主函数执行时。这可以通过将 BswMEventRequestProcessing 配置参数(在 BswMEventRequestPort 容器内)设置为 BSWM_DEFERRED 来实现。
[SWS_BswM_00060]
[SRS_ModeMgm_09180]
- 所有使用了至少一个延迟模式条件的规则都应在每次执行 BswM 的主函数时被评估。
[SWS_BswM_00068]
[SRS_ModeMgm_09180]
- BswM 应推迟在其主函数处理期间收到的模式仲裁请求,直到主函数完成。
- 任何此类推迟的 IMMEDIATE 请求应在 BswM 主函数退出之前被直接处理。
- 任何此类推迟的 DEFERRED 请求应在下一个后续的 BswM 主函数运行中被处理。
[SWS_BswM_00069]
[SRS_ModeMgm_09180]
- BswM 应推迟在处理 IMMEDIATE 请求期间收到的模式仲裁请求,直到处理完成。
- 任何此类推迟的 IMMEDIATE 请求应在原始 IMMEDIATE 请求处理完成后被直接处理。
- 任何此类推迟的 DEFERRED 请求应在下一个后续的 BswM 主函数运行中被处理。
BswM 实现可以选择使用保护机制(例如临界区)以保证操作或 BswM 主功能的执行不会被任何其他任务(例如更高优先级的任务)打断。
端口“更新”术语说明:任何模式请求端口都有一个与之关联的值\状态。更新端口意味着更改其值\状态。
[SWS_BswM_00281]
[ ]
- BswM 应在仲裁实际发生之前直接更新 IMMEDIATE 模式请求端口的值,而不是在模式请求端口被触发时更新。
[SWS_BswM_00282]
[ ]
- 当模式请求端口被触发时,BswM 应更新 DEFERRED 模式请求端口的值。
初始化后的仲裁行为
初始化后的 BswM 的模式仲裁行为由配置容器 BswMModeInitValue 控制,该参数可以在配置中为每个 BswMModeRequestPort 配置一次。
[SWS_BswM_00064]
[SRS_ModeMgm_09179]
[SRS_ModeMgm_09228]
[SRS_ModeMgm_09180]
- 如果容器 BswMModeInitValue 不存在或者模式仲裁请求还没有初始值,则 BswM 应当将对应的模式条件视为未定义,并且不将其用于模式仲裁,直到对应的模式仲裁请求已被第一次更新(任何模式请求端口都有一个与之关联的值\状态。更新端口意味着更改其值\状态)。
[SWS_BswM_00241]
[SRS_ModeMgm_09180]
- BswM 仅仲裁其逻辑表达式中不包含任何未定义的模式条件的规则。
每个 BswMModeRequestPort 初始化后的初始值可以由配置容器 BswMModeInitValue 控制。
[SWS_BswM_00203]
[SRS_ModeMgm_09179]
[SRS_ModeMgm_09228]
[SRS_ModeMgm_09180]
- 如果定义了 BswMModeInitValue,则 BswM 应在 BswM 被初始化时使用 BswMBswModeInitValue 或 BswMCompuScaleModeValue 来初始化相应的 BswMModeRequestSource。
- 对于单个 BswMModeInitValue,BswM 应拒绝同时包含 BswMBswModeInitValue 和 BswMCompuScaleModeValue 的配置。
- 此初始化值应被用于仲裁规则,直到相应的模式仲裁请求被更新,例如,每次调用 BswM_RequestMode 都应更新 GenericRequest 模式。
注意:Rte 和 SchM 模式始终有一个初始值(参见 [SRS_Rte_00116])
[SWS_BswM_00251]
[SRS_ModeMgm_09183]
- 在 BswM 初始化时,所有 BswMEventRequestPort 都应被初始化为 CLEAR 状态。
模式控制
BswM 的模式控制部分根据模式仲裁的结果执行所有必要的操作。这是使用行动列表完成的。行动列表是 BswM 在被模式仲裁触发时需要执行的操作的有序列表。
行动列表中的动作可分为三种类型:
- 调用其他 BSW 模块或 RTE。7.2.4 中列出了一组预定义的操作。
- 链接到要包含在执行中的其他行动列表。
- 模式仲裁规则。当执行相应的行动列表时,将评估这些规则。这样就得到了规则的层次结构。
在其执行操作过程中,BswM 无需对任何 BSW 模块的特定返回值进行存储或反应。
因此,BSW 中的不同状态管理器将其当前状态指示给 BswM,以用作模式仲裁的输入。
但是,如果返回错误(E_NOT_OK),BswM 可以发出 Det 运行时错误和/或取消当前正在执行的行动列表。
如图 7.2 所示,BswM 可能包含多个行动列表,一个行动列表又可以容纳多个操作。
为了减少行动列表的总数,应该可以将它们级联。
行动列表的元素可以是:
- 具体的操作
- 另一个行动列表的引用
- 模式仲裁要执行的规则
每个行动列表条目都应有一个标志,表明其类型(操作/引用/规则)。
带有具体操作的行动列表和带有引用的行动列表或甚至混合的行动列表的激活方式应没有区别。
模式处理周期
图 7.3 显示了模式请求的最小处理周期:
- 模式请求者软件组件通过其 Sender 端口请求模式 A。RTE 分发该请求,BswM 通过其 Receiver 端口接收该请求。
- BswM 要么根据收到的模式仲裁请求来评估其规则,要么在执行 BswM 主函数期间循环评估其规则。
- 根据所选的执行方法执行相应的行动列表(参见“触发和条件行动列表”部分)。
- 在执行行动列表时,BswM 可能会向 RTE 模式切换 API 发出一个或多个调用,作为通知受影响的软件组件有关仲裁结果的动作。任何软件组件,尤其是模式请求者,都可以注册以接收模式切换指示。
请注意,模式请求者只能接收来自本地 BswM 的模式切换指示。对于由本地代理软件组件发出的来自不同 ECU 的请求也是如此。
[SWS_BswM_00016]
[SRS_ModeMgm_09177]
- BswM 应通过依据模式仲裁中的规则评估结果执行的行动列表来执行模式控制。
[SWS_BswM_00015]
[SRS_ModeMgm_09177]
- 对于模式仲裁的每条规则,BswM 应该能够根据规则被评估为 True 或 False 来执行不同的行动列表。
[SWS_BswM_00017]
[SRS_ModeMgm_09178]
- 行动列表包含 BswM 应有序地执行的一组操作。
[SWS_BswM_00018]
[SRS_ModeMgm_09178]
- 行动列表可能包含 BswM 应在执行中包括的其他行动列表的链接。
[SWS_BswM_00019]
[SRS_ModeMgm_09178]
- 行动列表还可以包括模式仲裁规则的链接,BswM 应在当前行动列表的执行范围内评估这些规则。
[SWS_BswM_00067]
[SRS_ModeMgm_09177]
[SRS_ModeMgm_09178]
- 如果规则被包含在 [SWS_BswM_00019] 中指定的行动列表中,则 BswM 应先完成由该规则的评估结果导致的任何其他行动列表的执行,然后再继续执行原始的行动列表。
[SWS_BswM_00037]
[SRS_ModeMgm_09178]
- 如果使用级联行动列表(即使用对其他规则或行动列表的引用),行动列表结构可能包含最多七 (7) 个层次结构。
- 注意:此限制的目的是使对 BswM 的实现和生成器工具的测试成为可能。此限制必须由生成器工具检查。
[SWS_BswM_00062]
[SRS_ModeMgm_09177]
[SRS_ModeMgm_09178]
- 与在模式仲裁请求上下文中被评估的规则相关的行动列表应由 BswM 在其被模式仲裁触发时立即执行,而不是被推迟到在主函数中执行。理由:这允许在必要时对模式请求造成非常短的延迟。
[SWS_BswM_00223]
[SRS_ModeMgm_09177]
[SRS_ModeMgm_09178]
- 如果在模式仲裁期间,顶级行动列表由多个规则触发,则这将导致在模式控制期间只有一个触发器会执行该行动列表。
顶级行动列表是由顶级规则(即未嵌套在行动列表中的规则)直接触发并执行的行动列表,并且不嵌套在另一个行动列表中。[SWS_BswM_00223] 仅适用于顶级行动列表。
[SWS_BswM_00223] 不适用于嵌套规则和嵌套行动列表,因为它们在父行动列表内的顺序是用户定义的,应该被遵守。
[SWS_BswM_00275]
[ ]
- 如果在模式控制期间要执行多个顶级行动列表,则执行顺序应从最高的 BswMActionListPriority 开始,然后继续到最低的。在 BswMActionListPriority 相同的情况下,执行顺序是任意的。
[SWS_BswM_00276]
[ ]
- 对于非顶级行动列表的行动列表,应忽略 BswMActionListPriority。
[SWS_BswM_00277]
[ ]
- 没有 BswMActionListPriority 的行动列表应被解释为具有等于 0 的 BswMActionListPriority。
[SWS_BswM_CONSTR_00001]
[SRS_ModeMgm_09178]
[SRS_BSW_00167]
- BswM 应拒绝包含具有值相同的 BswMActionListItemIndex 的 BswMActionListItem 的 BswMActionList 配置。
[SWS_BswM_00260]
[SRS_ModeMgm_09230]
- 执行 BswMActionList 时:BswM 应从 BswMActionListItemIndex 的值为最小的 BswMActionListItem 开始。后续 BswMActionListItem 应按照其 BswMActionListItemIndex 的递增顺序执行。
在行动列表中,配置的 BswMActionListItemIndex 不一定需要连续或从零开始。BswM 将从具有最低索引值的行动列表项开始执行,然后继续执行直到具有最高索引值的行动列表项。如果索引有“间隙”(即不连续),则这些间隙将被忽略。
因为行动列表是一个有序列表,所以不允许在行动列表上下文中配置值相同的BswMActionListItemIndex。
可触发的和有条件限制的行动列表
基于规则评估,行动列表的执行有两种方式。要么在每次评估规则并得出相应结果时被执行,要么仅当当前评估结果与上次评估不同时被执行。
使用 BswMActionListExecution 参数(在 BswMActionList 容器内)配置行动列表的执行方式。
但是,对于没有被规则直接引用的嵌套行动列表,BswMActionListExecution 参数(例如 BSWM_CONDITION 或 BSWM_TRIGGER)没有意义,并且不会对嵌套行动列表的执行方式产生任何影响。
在其父行动列表被执行时,这样的嵌套行动列表(即未被规则直接引用)也会被执行。
[SWS_BswM_00011]
[SRS_ModeMgm_09180]
[SRS_ModeMgm_09230]
- 如果将以 True 为运行触发条件的行动列表配置为以触发方式执行,则 BswM 仅当相应规则的评估结果从 False 变为 True 时才执行它。
[SWS_BswM_00023]
[SRS_ModeMgm_09180]
[SRS_ModeMgm_09230]
- 如果将以 False 为运行触发条件的行动列表配置为以触发方式执行,则 BswM 仅当相应规则的评估结果从 True 变为 False 时才执行它。
[SWS_BswM_00115]
[SRS_ModeMgm_09180]
- 如果将以 True 为运行触发条件的行动列表配置为以条件限制方式执行,则每当相应规则被评估为 True 时,BswM 都应执行该行动列表。
[SWS_BswM_00116]
[SRS_ModeMgm_09180]
- 如果将以 False 为运行触发条件的行动列表配置为以条件限制方式执行,则每当相应规则被评估为 False 时,BswM 都应执行该行动列表。
[SWS_BswM_00055]
[SRS_ModeMgm_09178]
- 如果某个操作的返回结果为 E_NOT_OK 并且相应的 BswMAbortOnFail 配置参数被设置为 True,则 BswM 将中止该行动列表的执行。
(行动列表)可用的操作
行动列表中可用的操作集是预定义的。这样做的原因是为了简化 ECU 配置和 BswM 配置代码的生成。
[SWS_BswM_00038]
[SRS_ModeMgm_09175]
[SRS_ModeMgm_09174]
[SRS_ModeMgm_09182]
[SRS_ModeMgm_09184]
- BswM 应该能够执行配置容器 BswMAvailableActions 定义的预定义操作。
[SWS_BswM_00039]
[SRS_ModeMgm_09229]
- BswM 应该能够调用 AUTOSAR BSW 中的任何函数,即使它不属于在 BswMAvailableActions 中定义的标准化操作。
[SWS_BswM_00040]
[SRS_ModeMgm_09229]
- BswM 应该能够调用用户定义的函数。
[SWS_BswM_00054]
[SRS_ModeMgm_09178]
- 用户定义的函数的参数及其值应在 ECU 配置时使用 BswMUserCallout 配置容器进行定义。
初始化后的模式控制行为
BswM 初始化后的模式控制行为由 BswMRuleInitState 参数(在 BswMRule 容器内)配置。
它定义了“先前的评估结果”,在初始化后的第一次规则评估时,这将被用在决定什么行动列表应该被执行。
配置参数 BswMActionListExecution(在 BswMActionList 容器内)也会影响初始化后的行动列表的执行。
[SWS_BswM_00066]
[SRS_ModeMgm_09180]
[SRS_ModeMgm_09230]
等待功能
有时需要使特定的操作延迟特定的时间或等待进一步的模式控制。为此,在 BswM 中添加了计时器处理。
计时器始终由作为 BswMModeRequestSource 的 BswMTimer 和控制此 BswMTimer 的相应操作(参见 BswMTimerControl)组成,即计时器只能在操作
BswMTimerControl -> BswMModeRequestSource/BswMTimer 的上下文中被控制。
BswMTimer 的值(例如 BSWM_TIMER_STOPPED、BSWM_TIMER_STARTED、BSWM_TIMER_EXPIRED)可以通过在 BswM 中被配置的其他规则进行评估,以触发行动列表。
没有外部接口来控制或操作该计时器。
[SWS_BswM_00261]
[SRS_BSW_00101]
- 每个 BswMTimer 在初始化期间都应被停止(BSWM_TIMER_STOPPED)。
[SWS_BswM_00262]
[SRS_ModeMgm_09180]
- 操作 BswMTimerAction BSWM_TIMER_START 将使用相应的计时器值(参考 BswMTimerValue)重新装载引用的 BswMTimer(通过 BswMTimerRef),并将计时器的模式更改为 BSWM_TIMER_STARTED。
注意:计时器只能通过 BswMTimerAction 操作重新装载(无法自动重新装载)。
[SWS_BswM_00263]
[SRS_ModeMgm_09180]
- 每个处于 BSWM_TIMER_STARTED 模式的 BswMTimer 应在 BswM_MainFunction 运行期间(按 BswM_MainFunction 的周期时间)减少计时器的计数值。
注意:BswMTimer 的缩放率是 BswM_MainFunction 周期的倍数。此外,BswMTimer 的精度取决于 BswM_MainFunction 的精度。
[SWS_BswM_00264]
[SRS_ModeMgm_09180]
- 如果处于 BSWM_TIMER_STARTED 模式的 BswMTimer 到期,则其模式应被更改为 BSWM_TIMER_EXPIRED,然后应在同一个 BswM_MainFunction 周期内对 BswMTimer 进行模式仲裁。
[SWS_BswM_00265]
[SRS_ModeMgm_09180]
- 动作 BswMTimerAction BSWM_TIMER_STOP 将立即停止引用的 BswMTimer(通过 BswMTimerRef)并将其模式更改为 BSWM_TIMER_STOPPED。
[SWS_BswM_00220]
[SRS_ModeMgm_09180]
- BswM 应忽略与 BswMTimer 关联的 BswMRequestProcessing(例如 IMMEDIATE、DEFERRED)配置。BswM 应始终将 BswMTimer 的处理视为 DEFERRED,BswMTimer 在 BswM 主函数运行期间被仲裁。
注意:
处于 BSWM_TIMER_EXPIRED 模式的 BswMTimer 不会被 BswM 自动设置为 BSWM_TIMER_STOPPED。
用户需要配置一个操作以便使 BswMTimer 从 BSWM_TIMER_EXPIRED 转换到另一种模式。
如果没有配置任何操作使 BswMTimer 从 BSWM_TIMER_EXPIRED 模式转换到另一种模式,那么 BswMTimer 将在接下来的 BswM 主功能周期中继续被仲裁为 BSWM_TIMER_EXPIRED。
多分区支持
对于多个 BswM 实例,每个 BswM 实例会根据自己的配置集生成自己独立的服务组件描述,集成商需要将这些独立的服务组件分配到相应的分区上。
BswM 存在于每个分区中,且具有特定于分区的配置(每个分区有单独的 BswMConfig 实例)。所包含的行动列表在本地分区执行。
错误分类
《General Specification of Basic Software Modules》文档 7.2 节“错误处理”详细描述了基础软件的错误处理。首先,它构成了 BSW 模块中可能出现的五种错误类型的分类方案。
开发错误
[SWS_BswM_00230]
[SRS_BSW_00385]
运行时错误
[SWS_BswM_00238]
[SRS_BSW_00452]
[SWS_BswM_00239]
[SRS_BSW_00452]
- 如果为 BswMActionListItem 配置了 BswMReportFailRuntimeErrorId,则如果操作返回 E_NOT_OK,BswM 应向 Det 报告 BSWM_E_ACTION_FAILED 运行时错误。BSWM_E_ACTION_FAILED 运行时错误中被报告的 ErrorId 由 BswMReportFailRuntimeErrorId 中配置的值给出。
由于操作的调用上下文取决于配置(例如 DEFERRED 或 IMMEDIATE),BSWM_E_ACTION_FAILED 运行时错误中被报告的 ApiId 未在此规范中被定义,并且可能特定于实现。
BSWM_E_ACTION_FAILED 运行时错误表示 ErrorId 值的范围。值的范围仅限于运行时错误类型表中给出的值(0x80 .... 0xFF)。
[SWS_BswM_00240]
[SRS_BSW_00167]
- 当 BswMReportFailRuntimeErrorId 的值不在运行时错误类型表中为 BSWM_E_ACTION_FAILED 给出的值的范围内时,BswM 应拒绝配置。
BswM 的接口和端口
本章指定了 BswM 提供的 AUTOSAR 接口和端口。
注意,RTE 两侧的端口都是必需的:
BswM 服务的软件组件描述将定义 RTE 下方的端口。
每个使用服务的 AUTOSAR 软件组件都必须在自己的软件组件描述中包含服务端口。
这些端口具有相同的接口类型,并且必须被连接到 BswM 的端口,以便 RTE 可以生成适当的 ID 和所需的符号。
软件组件向 BswM 发出模式请求。
为此,它们提供了一个 Sender 端口,该端口具有一个特殊的 Sender/Receiver 接口(模式请求接口),其中包含一个数据元素。BswM 上的相应 Receiver 端口在第 7.6.1 章中被描述。
数据元素的类型与相应模式的模式声明组中的模式声明具有相同的值(因为数据元素的 ImplementationDataType 被映射到了 ModeDeclarationGroup)。
发出模式请求的软件组件也可能是模式的用户,因为它可能也需要知道 BswM 的仲裁结果。
软件组件有一个模式切换端口,它是一个带有模式切换接口的 Receiver 端口,模式切换接口带有一个数据元素。
那么这个数据元素的类型就是模式声明组本身。此外,其他不请求模式但依赖模式的软件组件也具有这样的模式切换端口。
有关连接到模式用户的接口的详细描述,请参阅第 7.6.3 章。
请注意,如果 BswM 在决策时除了需要了解请求的模式之外还需要了解当前模式,那么它还需要一个模式切换 Receiver 端口。
当模式管理器切换相应模式时,RTE 会发送模式通知。
为此,BswM 有一个 Provide 类型的模式切换端口,软件组件可以连接到该端口。
有关模式切换端口的详细描述,请参阅第 7.6.2 章。
在模式请求的软件组件的上下文中,模式请求端口(Sender/Receiver)被定义。BswM 的配置引用了该端口定义。
我们假设软件组件定义了一个应用模式 AppModeType、一个对应的 AppModeRequestType 和一个将两种类型相互映射的 AppModeTypeMap:
ModeDeclarationGroup AppModeType {
{
APP_MODE_A,
APP_MODE_B,
APP_MODE_C
}
initialMode = APP_MODE_A;
};
ImplementationDataType AppModeRequestType {
lowerLimit = 0;
upperLimit = 2;
};
ModeRequestTypeMap AppModeTypeMap {
modeGroup = AppModeType;
implementationDataType = AppModeRequestType;
};
在软件组件上下文中,定义了两个接口:
- Sender/Receiver 类型的 AppModeRequestInterface,其中软件组件是 Sender。
- 模式切换类型的 AppModeInterface,其中软件组件可以根据用途具有 Provide 端口和 Require 端口。
图 7.4 显示了应用程序软件组件的端口如何连接到 BswM 的服务端口。
应用模式管理器软件组件具有一个模式请求端口和一个模式切换 Require 端口(名为 modeNotificationPort,以区别于模式切换 Provide 端口)。
前者是请求其应用模式切换,后者是在 BswM 执行模式切换时接收通知。
应用模式管理器的模式请求端口(modeRequestPort0)连接到 BswM 相应的模式请求端口。
由于这是正常的 Sender/Receiver 通信,应用模式管理器甚至可以连接到远程 ECU 上的多个 BswM。
为了切换应用模式,BswM 有一个由本地 RTE 实现的模式切换端口(modeSwitchPort_{Name})。
当 RTE 执行模式切换时,它会通知所有通过模式切换 Require 端口连接到 Provide 端口的连接实体(BSW 模块或软件组件)。
以下示例展示了
- 应用模式管理器
- 其他与模式相关的应用部分
- BswM 本身
所有这些连接也都是本地的。
图 7.5 显示基于软件组件的应用模式管理器(如 AUTOSAR R3.1 及更早版本中使用)直接切换应用模式,而不是向 BswM 请求。
因此,它们将模式切换端口直接连接到本地 RTE。
- 这意味着应用模式对于该 ECU 来说需要是本地的,并且在 BswM 中可能没有仲裁。
尽管如此,BswM 可以将当前应用模式作为其规则的输入。
- 因为对于此应用模式,BswM 有一个模式切换 Require 端口(图中名为 modeNotificationPort0)。
注意:
要配置 BswM,需要了解对于特定 ECU 来说什么模式请求端口和 ECU 资源是其需要的或可用的。因此,BswM 的软件组件描述只能在 ECU 配置期间被完成。
从现在开始,所有以下接口定义都将被解释为:
ARPackage AUTOSAR_BswM/BswModuleDescription
请注意,本章中提供的伪代码并不精确,但提供了如何定义相应模型元素的提示。
模式请求端口
BswM 必须声明一个 Receiver 端口,该接口在软件组件上下文中被定义:
RequirePort AppModeRequestInterface modeRequestPort_{ArbName}_{ReqName};
要读取当前请求的模式,BswM 的实现必须调用:
Rte_Read_modeRequestPort_{ArbName}_{ReqName}_requestedMode( &<variable> );
模式切换端口
与模式请求一样,BswM 在其模式切换的 Provide 端口中仅引用在相应的软件组件描述上下文中定义的模式切换接口。对于上述示例,模式切换的声明为:
ProvidePort AppModeInterface modeSwitchPort_{ModConName}_{SwitchName};
配置参数 BswMModeSwitchInterfaceRef 引用此模式切换接口。
要切换当前活动模式,BswM 的实现必须将以下调用之一插入其行动列表中:
Rte_Switch_modeSwitchPort_{ModConName}_{SwitchName}_currentMode( <new_mode> );
SchM_Switch_modeSwitchPort_{ModConName}_{SwitchName}_currentMode( <new_mode> );
模式切换的通知
除了模式请求之外,当前活动的模式也可以用作模式仲裁的输入。对于应用和车辆模式,BswM 需要被注册为模式用户。然后,它通过模式切换端口接收有关变更的模式的通知。
对于上述示例,模式通知的声明为:
注意:
为了更容易区分 ModeSwitchPort 类型的 Require 端口和 Provide 端口,以下示例中将 Require 端口命名为模式通知端口。
RequirePort AppModeInterface modeNotificationPort_{ArbName}_{ModeName};
要读取当前活动模式,BswM 的实现必须调用以下函数之一:
Rte_Mode_modeNotificationPort_{ArbName}_{ModeName}_currentMode( &<variable> );
SchM_Mode_modeNotificationPort_{ArbName}_{ModeName}_currentMode
( &<variable> );
如果配置了增强型 Rte_Mode 或 SchM_Mode,BswM 的实现必须调用以下函数之一:
Rte_Mode_modeNotificationPort_{ArbName}_{ModeName}_currentMode( &<variable>, &<previousmode>, &<nextmode> );
SchM_Mode_modeNotificationPort_{ArbName}_{ModeName}_currentMode( &<variable>, &<previosmode>, &<nextmode> );
组件类型和内部行为
BswM 是一个服务组件,为 ECU 本地的模式请求提供服务。
BswM 的 ServiceComponentType 声明了所有上述端口和一些内部行为。
ServiceComponentType BswM {
...
InternalBehavior {
...
};
};
The internal behavior depends on the parameter BswMRequestProcessing for the
corresponding Mode Request Port. For BSWM_DEFERRED, the RTE must not perform
any special actions, as the BSWM Mode Manager reads the request cyclically in
its BswM_MainFunction.
内部行为取决于相应模式请求端口的参数 BswMRequestProcessing。对于 BSWM_DEFERRED,RTE 不得执行任何特殊操作,因为 BSWM 模式管理器在其 BswM_MainFunction 中循环读取请求。
By contrast, for BSWM_IMMEDIATE the RTE must trigger mode arbitration immediately. Therefore, the BSW Mode Manager needs to register a trigger function that triggers mode arbitration.
For the above example, an immediate processing of the mode request would need the following declaration in the Internal Behavior of the BSW Mode Manager:
RunnableEntity ModeArbitrationRunnable {
symbol = <mode_arbitration_function>;
canBeInvokedConcurrently = TRUE;
};
DataReceiveEvent AppModeRequestEvent {
port = modeRequestPort0;
dataElement = requestedMode;
startOnEvent = ModeArbitrationRunnable;
};
Note: To deal with Mode Requests that originate from other ECUs, another kind of
service component is needed.
On the VFB level it looks like one global Service Component, but actually it is instantiated as one Service Component that resides above the RTE for each ECU.
To support that, the SW-C Template offers the ServiceProxy ComponentType instead of the normal ServiceComponentType.
The specification of the Mode Management Service Proxy Component is not described
within this document since it is user specific.
Ethernet switch port group switching
The current version of the SWS BswM supports Ethernet switch port group switching.
Based on the current requested PNC, BswM maps the PNC request to a configured EthIfSwitchPortGroup and calls EthIf_SwitchPortGroupRequestMode.
The BswM is indicated by the EthIf, if the accumulated link state has changed.
The accumulated link state could be used to inform an application.
This could be used to cover error scenarios where the requested and the current accumulated link state of EthIfSwitch PortGroups are contradicting and error handling needs to be initiated.
The AUTOSAR_EXP_ModemanagementGuide document contains guidelines for the
BswM configuration regarding Ethernet switch port group switching.
API specification
Imported types
[SWS_BswM_00237]
[SRS_BSW_00301]
- The BSW Mode Manager shall use only the imported types which are listed in SWS_BswM_00001.
[SWS_BswM_00001]
[SRS_BSW_00301]
Type definitions
[SWS_BswM_00041]
[SRS_BSW_00305]
- The following Data Types shall be used for the functions defined in this specification.
BswM_ConfigType
[SWS_BswM_00213]
[SRS_BSW_00404]
[SRS_BSW_00441]
[SWS_BswM_00042]
[SRS_BSW_00404]
- The structure BswM_ConfigType shall contain all post-build configurable parameters of the BSW Mode Manager. The exact content of this structure depends on the selected configuration variant.
BswM_ModeType
[SWS_BswM_00214]
[SRS_ModeMgm_09228]
[SRS_BSW_00441]
BswM_UserType
[SWS_BswM_00216]
[SRS_ModeMgm_09228]
[SRS_BSW_00441]
Function definitions
BswM_BswMPartitionRestarted
[SWS_BswM_00193]
[SRS_ModeMgm_09228]
BswM_CanSM_CurrentState
[SWS_BswM_00049]
[SRS_ModeMgm_09228]
[SWS_BswM_00080]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the state indication and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00095]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter CurrentState shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the state indication and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_ComM_CurrentMode
[SWS_BswM_00047]
[SRS_ModeMgm_09228]
[SWS_BswM_00078]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00091]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter RequestedMode shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_ComM_CurrentPNCMode
[SWS_BswM_00148]
[SRS_ModeMgm_09228]
[SRS_ModeMgm_09240]
[SWS_BswM_00149]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00150]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter CurrentPncMode shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_ComM_InitiateReset
[SWS_BswM_00217]
[SRS_ModeMgm_09228]
BswM_Dcm_ApplicationUpdated
[SWS_BswM_00158]
[SRS_ModeMgm_09228]
[SWS_BswM_00159]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
BswM_Dcm_CommunicationMode_CurrentState
[SWS_BswM_00048]
[SRS_ModeMgm_09228]
The behavior of this function shall be configured using the configuration container
BswMDcmComModeRequest, wherein the configuration parameter BswMDcmComMChannelRef correlates to the argument Network of this function.
[SWS_BswM_00079]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00093]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter RequestedMode shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
CDD Implementation Hint:
All AUTOSAR BSW modules that may trigger transmission of PDUs provide an API to enable/disable it.
To e.g. disable the whole communication in a corresponding diagnostic request, it makes sense if CDD modules (which use communication protocols) provides such an API as well.
These functions may be called in the configured action list which is linked to this function.
BswM_Deinit
[SWS_BswM_00119]
[SRS_BSW_00336]
[SWS_BswM_00120]
[SRS_BSW_00336]
- After a call of BswM_Deinit no mode processing shall be performed by BswM even if any mode requests are made or the BswM main function is called.
BswM_EcuM_CurrentState
[SWS_BswM_91003]
[SRS_ModeMgm_09228]
[SWS_BswM_00084]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00103]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter CurrentState shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_EcuM_CurrentWakeup
[SWS_BswM_00131]
[SRS_ModeMgm_09228]
[SWS_BswM_00132]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00133]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter state shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_EcuM_RequestedState
[SWS_BswM_91004]
[SRS_ModeMgm_09116]
[SRS_ModeMgm_09228]
[SWS_BswM_00227]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00228]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter State shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
[SWS_BswM_00229]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter CurrentStatus shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_EthIf_PortGroupLinkStateChg
[SWS_BswM_91001]
[SRS_ModeMgm_09228]
[SWS_BswM_00267]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the BswM_EthIf_PortGroupLinkStateChg routine shall check if the BSW Mode Manager is initialized. In case the BswM is not initialized, the BswM shall ignore the mode request and report to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00268]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the BswM_EthIf_PortGroupLinkStateChg parameters shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the mode request and report to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_EthSM_CurrentState
[SWS_BswM_00050]
[SRS_ModeMgm_09228]
[SWS_BswM_00081]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the state indication and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00097]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter CurrentState shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the state indication and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_FrSM_CurrentState
[SWS_BswM_00051]
[SRS_ModeMgm_09228]
[SWS_BswM_00082]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the state indication and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00099]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter CurrentState shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the state indication and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_GetVersionInfo
[SWS_BswM_00003]
[SRS_BSW_00407]
[SRS_BSW_00003]
BswM_Init
[SWS_BswM_00002]
[SRS_BSW_00344]
[SRS_BSW_00404]
[SRS_BSW_00405]
[SRS_BSW_00101]
[SRS_BSW_00358]
[SRS_BSW_00414]
The Reentrancy for the BswM_Init API is set to "Conditionally reentrant" for support
of implementations where the BswM is instantiated in multiple partitions (e.g. in single
core systems using multiple BSW partitions OR in multi-core systems.
[SWS_BswM_00043]
[SRS_BSW_00101]
- This routine initializes the BSW Mode Manager. After execution of this routine the BSW Mode Manager is ready to arbitrate incoming mode requests.
[SWS_BswM_00044]
[SRS_BSW_00101]
- This routine shall initialize all module global variables of the BSW Mode Manager.
[SWS_BswM_00118]
[SRS_BSW_00467]
- BswM_Init shall only require the OS and the SchM to be initialized before it can be called.
[SWS_BswM_00045]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the contents of the given configuration set shall be checked for being within the allowed boundaries. If an error is detected the initialization of the BSW Mode Manager shall not be executed and the error shall be reported to the Default Error Tracer with the value BSWM_E_PARAM_CONFIG.
BswM_J1939DcmBroadcastStatus
[SWS_BswM_00165]
[SRS_ModeMgm_09228]
[SWS_BswM_00249]
[SRS_ModeMgm_09228]
- The BswM_J1939DcmBroadcastStatus parameter NetworkMask is a bitmask where the bit position corresponds to the ComMChannel. ComMChannelId which is referenced by the BswMJ1939DcmBroadcastStatus. BswMJ1939DcmChannelRef parameter. For rule processing, the BswM shall use the value in NetworkMask of the bit (0 or 1) which lies in the position configured by the referenced ComMChannel.ComMChannelId.
BswM_J1939Nm_StateChangeNotification
[SWS_BswM_00194]
[SRS_ModeMgm_09228]
BswM_LinSM_CurrentSchedule
[SWS_BswM_00058]
[SRS_ModeMgm_09228]
[SWS_BswM_00086]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error the BswM shall ignore the schedule indication and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
BswM_LinSM_CurrentState
[SWS_BswM_00052]
[SRS_ModeMgm_09228]
[SWS_BswM_00083]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the state indication and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00101]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter CurrentState shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the state indication and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_LinTp_RequestMode
[SWS_BswM_00156]
[SRS_ModeMgm_09228]
[SWS_BswM_00112]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00113]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter LinTpRequestedMode shall be checked for being in the allowed range. In case of an error the BswM shall ignore the mode request and report the error, to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_Nm_CarWakeUpIndication
[SWS_BswM_00235]
[SRS_ModeMgm_09228]
BswM_Nm_StateChangeNotification
[SWS_BswM_91002]
[ ]
BswM_NvM_CurrentBlockMode
[SWS_BswM_00104]
[SRS_ModeMgm_09228]
[SWS_BswM_00109]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the block mode indication and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00110]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter CurrentBlockMode shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the block mode indication and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_NvM_CurrentJobMode
[SWS_BswM_00152]
[SRS_ModeMgm_09228]
[SWS_BswM_00153]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the job mode indication and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00154]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter MultiBlockRequest shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the job mode indication and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_RequestMode
[SWS_BswM_00046]
[SRS_ModeMgm_09179]
[SRS_ModeMgm_09228]
[SWS_BswM_00077]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00089]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter requested_mode shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
[SWS_BswM_00090]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter requesting_user shall be checked for being in the allowed range. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the value BSWM_E_REQ_USER_OUT_OF_RANGE.
BswM_Sd_ClientServiceCurrentState
[SWS_BswM_00204]
[SRS_ModeMgm_09228]
[SWS_BswM_00205]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00206]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter CurrentClientState shall be checked for being in the allowed range. In case of an error the BswM shall ignore the mode request and report the error, to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_Sd_ConsumedEventGroupCurrentState
[SWS_BswM_00207]
[SRS_ModeMgm_09228]
[SWS_BswM_00208]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00209]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter ConsumedEventGroupState shall be checked for being in the allowed range. In case of an error the BswM shall ignore the mode request and report the error, to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_Sd_EventHandlerCurrentState
[SWS_BswM_00210]
[SRS_ModeMgm_09228]
[SWS_BswM_00211]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, the routine shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the mode request and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
[SWS_BswM_00212]
[SRS_BSW_00323]
- If the BswMDevErrorDetect switch is enabled, the parameter EventHandlerStatus shall be checked for being in the allowed range. In case of an error the BswM shall ignore the mode request and report the error, to the Default Error Tracer with the value BSWM_E_REQ_MODE_OUT_OF_RANGE.
BswM_SoAd_SoConModeChg
[SWS_BswM_91005]
[ ]
Scheduled functions
BswM_MainFunction
[SWS_BswM_00053]
[SRS_BSW_00425]
[SWS_BswM_00075]
[SRS_ModeMgm_09180]
- The BswM_MainFunction shall perform evaluation of all rules that uses at least one mode request with configuration parameter BswMRequestProcessing set to BSWM_DEFERRED as input.
Expected Interfaces
Mandatory Interfaces
[SWS_BswM_00007]
[SRS_BSW_00384]
Optional Interfaces
According to [SWS_BswM_00039], the BswM can call any function in the AUTOSAR
BSW. The following table contains a list of specific functions which may be useful in
implementing BswM functionality.
[SWS_BswM_00008]
[SRS_BSW_00384]
Service Interfaces
Ports
BswM_modeNotificationPort
[SWS_BswM_00200]
[SRS_ModeMgm_09180]
[SWS_BswM_00266]
[SRS_BSW_00406]
- If the BswMDevErrorDetect switch is enabled, BswM_modeNotificationPort shall check if the BSW Mode Manager is initialized. In case of an error, the BswM shall ignore the notification and report the error to the Default Error Tracer with the error code BSWM_E_UNINIT.
BswM_modeRequestPort
[SWS_BswM_00201]
[SRS_ModeMgm_09179]
BswM_modeSwitchPort
[SWS_BswM_00202]
[SRS_ModeMgm_09182]
API to Request Port Mappings
[SWS_BswM_00283]
[SRS_ModeMgm_09228]
Sequence diagrams
Deferred operation of BswM
Containers and configuration parameters
The following chapters summarize all configuration parameters. The detailed meanings
of the parameters describe Chapter 7 and Chapter 8.
Note for implementers: For some BswMModeRequestSources and BswMAvailableActions, a naming convention is used to map certain configuration parameter enumeration values with the underlying function parameter value used in the implementation.
In this naming convention, the configuration parameter enumeration label
is the same as the mapped function parameter enumeration label, but prefixed with
"BSWM_". For example: the BswMEthIfSwitchPortGroupRequestMode value
BSWM_ETH_MODE_ACTIVE corresponds to the value of ETH_MODE_ACTIVE of the
respective type.
BswM
[SWS_BswM_00242]
[SRS_BSW_00167]
- The BswM shall reject configurations where a BswMLogicalExpression has a BswMLogicalOperator equal to BSWM_NAND and its number of BswMArgumentRefs is not two.
[SWS_BswM_00243]
[SRS_BSW_00167]
- The BswM shall reject configurations where a BswMLogicalExpression has a BswMLogicalOperator equal to BSWM_NOT and its number of BswMArgumentRefs is not one.c(SRS_BSW_00167)
[SWS_BswM_00244]
[SRS_ModeMgm_09180]
- The BswM shall implement BSWM_XOR to evaluate to TRUE if an odd number of its arguments is TRUE, and evaluate to FALSE if an even number of its arguments is TRUE.
[SWS_BswM_00245]
[SRS_ModeMgm_09180]
- The BswM shall implement BSWM_AND to evaluate to TRUE if all of its arguments are TRUE, and evaluate to FALSE if at least one of its arguments is FALSE.
[SWS_BswM_00246]
[SRS_ModeMgm_09180]
- The BswM shall implement BSWM_NAND to evaluate to FALSE if all of its arguments are TRUE, and evaluate to TRUE if at least one of its arguments is FALSE.
[SWS_BswM_00247]
[SRS_ModeMgm_09180]
- The BswM shall implement BSWM_OR to evaluate to FALSE if all of its arguments are FALSE, and evaluate to TRUE if at least one of its arguments is TRUE.
[SWS_BswM_00248]
[SRS_ModeMgm_09180]
- The BswM shall implement BSWM_NOT to evaluate to FALSE if its argument is TRUE, and evaluate to TRUE if its argument is FALSE.
BswMModeCondition
[SWS_BswM_00256]
[SRS_BSW_00167]
[SRS_ModeMgm_09177]
- Configuration constraint for mode request comparisons and event request checking. The BswM shall reject configurations where BswMConditionType BSWM_EQUALS or BSWM_EQUALS_NOT are configured in conjunction with a BswMEventRequestPort port referenced by the BswMConditionMode. The BswM shall reject configurations where BswMConditionType BSWM_EVENT_IS_SET or BSWM_EVENT_IS_CLEARED are configured in conjunction with a BswMModeRequestPort port referenced by the BswMConditionMode.
BswMConditionValue
[SWS_BswM_CONSTR_00002]
[SRS_BSW_00167]
- The value of CompuMethod.category referenced by the foreign reference of BswMCompuMethodRef shall be TEXTTABLE.
BswMEventRequestSource
BswMJ1939DcmBroadcastStatus
[SWS_BswM_00250]
[SRS_ModeMgm_09228]
- Since NetworkMask (in the BswM_J1939DcmBroadcastStatus API) is 16 bits wide, the BswM shall reject configurations where the ComMChannel.ComMChannelId referenced by a BswMJ1939DcmBroadcastStatus.BswMJ1939DcmChannelRef parameter is greater than 15.
BswMJ1939NmIndication
[SWS_BswM_00259]
[SRS_ModeMgm_09182]
- BswMModeSwitchErrorEvent specifies a SwcModeManagerErrorEvent, which the BswM shall create in its SWCD. The ModeDeclarationGroupPrototype which is referenced by the SwcModeManagerErrorEvent.modeGroup shall correspond to the one used by the ModeSwitchInterface which is referenced by the BswMSwitchPort that is configured by the BswMRteSwitchPortRef in BswMModeSwitchErrorEvent. The BswM shall create an associated runnable which will arbitrate the SwcModeManagerErrorEvent.
BswMNmCarWakeUpIndication
[SWS_BswM_00236]
[SRS_ModeMgm_09179]
- The BswM shall only accept configurations where the VariableDataPrototype, which is referenced by a BswMSwcModeRequest, belongs to a SenderReceiverInterface.
BswMSwitchAckNotification
[SWS_BswM_00284]
[ ]
- For BswMSwitchAckNotification, if the referenced BswMSwitchPort is configured with BswMModeSwitchInterfaceRef without a BswMSchMModeDeclarationGroupRef: This specifies a ModeSwitchedAckEvent, which the BswM shall create in its SWCD. The BswM shall create an associated runnable; the C definition of this runnable/schedulable entity shall arbitrate the ModeSwitchedAckEvent.
[SWS_BswM_00285]
[ ]
- For BswMSwitchAckNotification, if the referenced BswMSwitchPort is configured with BswMSchMModeDeclarationGroupRef: This specifies a BswModeSwitchedAckEvent, which the BswM shall create in its BSWMD. The BswM shall create an associated runnable; the C definition of this runnable/schedulable entity shall arbitrate the BswModeSwitchedAckEvent.
BswMTimer
[SWS_BswM_CONSTR_00003]
[ ]
- The BswM shall reject configurations where a BswMDeadlineMonitoringControl container has a BswMDisabledDMPduGroupRef and a BswMEnabledDMPduGroupRef which reference the same PDU Group.
[SWS_BswM_00274]
[ ]
- When a BswMDeadlineMonitoringControl action is executed, the BswM shall call Com_EnableReceptionDM for each BswMEnabledDMPduGroupRef, and call Com_DisableReceptionDM for each BswMDisabledDMPduGroupRef. The ordering of these calls to Com is undefined.
Note: If a strict ordering of the calls to Com_EnableReceptionDM, or Com_-
DisableReceptionDM is required, then this can be achieved by configuring individual
actions (BswMDeadlineMonitoringControl, each with just a single
BswM*PduGroupRef) within an ordered action list.
BswMEcuMDriverInitListBswM
The EcuM (flex) can be configured with driver initialization lists (EcuMDriverInitListBswM) which may then be called by the BswM.
[SWS_BswM_00269]
[SRS_ModeMgm_09180]
- When a BswMEcuMDriverInitListBswM action is executed, the BswM shall call the EcuM_AL_DriverInitBswM_<EcuMDriverInitListBswM. shortName>(void) function which is provided by the EcuM.
BswMEcuMGoDownHaltPoll
[SWS_BswM_00286]
[ ]
- If the action BswMEthIfStartAllPorts is configured, the function EthIf_StartAllPorts(void) shall be called by the BswM when the action is executed.
BswMEthIfSwitchPortGroupRequestMode
[SWS_BswM_CONSTR_00004]
[ ]
- The BswM shall reject configurations where a BswMPduGroupSwitch container has a BswMDisabledPduGroupRef and a BswMEnabledPduGroupRef which reference the same PDU Group.
[SWS_BswM_00273]
[ ]
- When a BswMPduGroupSwitch action is executed, the BswM shall call Com_IpduGroupStart for each BswMEnabledPduGroupRef, and call Com_IpduGroupStop for each BswMDisabledPduGroupRef. The ordering of these calls to Com is undefined.
Note: If a strict ordering of the calls to Com_IpduGroupStart, or Com_IpduGroupStop is required, then this can be achieved by configuring individual actions (BswMPduGroupSwitch, each with just a single BswM*PduGroupRef) within an ordered
action list.
BswMPduRouterControl
[SWS_BswM_00271]
[SRS_ModeMgm_09178]
- If the action BswMRteStart is configured, the function Rte_Start(void) shall be called by the BswM when the action is executed.
BswMRteStop
[SWS_BswM_00272]
[SRS_ModeMgm_09178]
- If the action BswMRteStop is configured, the function Rte_Stop(void) shall be called by the BswM when the action is executed.
BswMRteSwitch
[SWS_BswM_CONSTR_00005]
[ ]
- The BswM shall reject configurations where a BswMSdServiceGroupSwitch container has a BswMDisabledSdServiceGroupRef and a BswMEnabledSdServiceGroupRef which reference the same SdServiceGroup.
[SWS_BswM_00280]
[ ]
- When a BswMSdServiceGroupSwitch action is executed, the BswM shall call Sd_ServiceGroupStart for each BswMEnabledSdServiceGroupRef, and call Sd_ServiceGroupStop for each BswMDisabledSdServiceGroupRef. The ordering of these calls to Sd is undefined.
- Note: If a strict ordering of the calls to Sd_ServiceGroupStart or Sd_ServiceGroupStop is required, then this can be achieved by configuring individual actions (BswMSdServiceGroupSwitch, each with just a single BswM*ServiceGroupRef) within an ordered action list.
BswMSwitchIPduMode
BswMSwitchPort
[SWS_BswM_CONSTR_00006]
[ ]
- If the BswMSwitchPort is referred by any BswMRteSwitch actions or BswMModeSwitchErrorEvents then BswMModeSwitchInterfaceRef shall be configured. If the BswMSwitchPort is referred by any BswMSchMSwitch actions then BswMSchMModeDeclarationGroupRef shall be configured. At least one of the contained references shall be configured.
BswMGeneral
[SWS_BswM_00279]
[SRS_BSW_00301]
- The availability of private header files (e.g. BswM_ComM.h) between the BswM and other basic software modules depend on the configuration parameters (BswM<BSWModule>Enabled). If the configuration parameter is set to false, then no private header shall be provided by BswM for that BSWModule.
BswMUserIncludeFiles
SWS_BswM
SRS_BSW
SRS_ModeMgm
SWS_BswM_CONSTR
评论
发表评论