BswM

文档信息(Document Information)

版本历史(Version History)

日期(Date)

作者(Author)

版本(Version)

状态(Status)

说明(Description)

2024/11/20

Jian.Jiang

V0.1

发布(Release)

首次发布(First release)

2025/04/04

Jian.Jiang

V1.0

发布(Release)

正式发布(Official release)

参考文档(References)

编号(Number)

分类(Classification)

标题(Title)

版本(Version)

1

Autosar

AUTOSAR_CP_EXP_ModeManagementGuide.pdf

R23-11

2

Autosar

AUTOSAR_CP_SRS_ModeManagement.pdf

R23-11

3

Autosar

AUTOSAR_CP_SWS_BswModeManager.pdf

R23-11

4

Autosar

AUTOSAR_CP_SWS_ECUStateManager.pdf

R23-11

术语与简写(Terms and Abbreviations)

术语(Terms)

术语(Term)

解释(Explanation)

BSW Mode

BSW 模式是一种由 BSW 中的模式管理器控制和标准化的模式。BSW 模式始终是某个 ECU 的本地模式。(The BSW mode is a mode controlled and standardized by the mode manager in BSW. It is always a local mode of an ECU.)

Mode Manager

模式管理器是一个可以由 BSW 模块(也可以由 SW-C)担任的角色。(The mode manager is a role that can be assumed by a BSW module (or by a SW-C).)

Mode Request

模式请求是传达给模式管理器的一些信息,请求模式管理器切换到某种模式。(A mode request is information conveyed to the mode manager, requesting the mode manager to switch to a certain mode.)

Mode User

模式用户是对模式变化做出反应的实体。(A mode user is an entity that responds to mode changes.)

简写(Abbreviations)

简写(Abbreviation)

全称(Full name)

解释(Explanation)

BSW

Basic Software

基础软件

BswM

BSW Mode Manager

BSW 模式管理器

ECU

Electrical Control Unit

电子控制单元

RTE

Real Time Environment

运行时环境

简介(Introduction)

BSW 模式管理器是实现车辆模式管理和应用模式管理概念中驻留在 BSW 中的部分的模块。其职责是根据简单规则仲裁来自应用层 SW-C 或其他 BSW 模块的模式请求,并根据仲裁结果执行操作。

The BSW Mode Manager is the module that implements the BSW-level aspects of the vehicle mode management and application mode management concepts. Its responsibility is to arbitrate mode requests from application layer SW-Cs or other BSW modules according to simple rules and perform operations based on the arbitration results.

BSW 模式管理器基本功能的操作可描述为两个不同的任务:模式仲裁和模式控制。

The operation of its basic functions can be described as two distinct tasks: Mode Arbitration and Mode Control.

模式仲裁部分根据从 SW-C 或其他 BSW 模块收到的模式请求和模式指示的规则仲裁结果启动模式切换。

Mode Arbitration: initiates mode switching based on the arbitration results of rules for mode requests and mode indications received from SW-Cs or other BSW modules.

模式控制部分通过执行包含其他BSW模块的模式切换操作的动作列表来执行模式切换。

Mode Control: executes the mode switch by performing an action list that include mode switching operations of other BSW modules.

BswM模块层次图(BswM Module Hierarchy Diagram)

BswM架构图

BswM Architecture Diagram

如图 BswM架构图 所示,BswM模块处于AUTOSAR架构中的系统服务层,主要服务于其他基础软件模块以及上层RTE。

As shown in :ref:fig_BswMarch, the BswM module resides in the System Services layer of the AUTOSAR architecture, where it primarily serves other Basic Software Modules (BSW) and the upper-layer RTE.

功能描述(Functional Description)

BswM模块主要有如下两个功能:

The BswM module mainly has the following two functions:

  1. 模式仲裁:模式仲裁部分根据从 SW-C 或其他 BSW 模块收到的模式请求和模式指示的规则仲裁结果启动模式切换。

    Mode Arbitration: initiates mode switching based on the arbitration results of rules for mode requests and mode indications received from SW-Cs or other BSW modules.

  2. 模式管理:模式控制部分通过执行包含其他BSW模块的模式切换操作的动作列表来执行模式切换。

    Mode Control: executes mode switching by performing an action list that include mode switching operations of other BSW modules.

特性(Features)

模式仲裁(Mode Arbitration)

BswM 执行的模式仲裁简单且基于规则。用于模式仲裁的规则在 BSW 模式管理器模块的配置中指定。规则由简单的布尔表达式组成,因此模式仲裁预计对运行时的影响较小。

The mode arbitration performed by BswM is simple and rule-based. The rules for mode arbitration,specified in the module’s configuration, consist of simple Boolean expressions. Therefore, mode arbitration is expected to have little impact on runtime performance.

Bsw或SW-C通知BswM进入模式仲裁,可以配置不同的Bsw模块给BswM的通知端口匹配的输入值;这些输入值可以根据具体需求组合成逻辑表达式;逻辑表达式决定了BswM执行的动作列表,动作列表是一系列Bsw或RTE模块操作接口。

The BswM enters mode arbitration upon notification from a BSW module or an SW-C. These notifications provide input values from various BSW modules, which are mapped to BswM’s notification ports during configuration. These values can then be combined into logical expressions as required. These expressions, in turn, determine the action list to be executed by BswM, which consists of a sequence of operations targeting interfaces of BSW or RTE modules.

仲裁规则(Arbitration Rules)

规则是由一组模式请求条件组成的逻辑表达式。当输入模式请求和模式指示发生变化时,或在执行 BswM主函数期间,将评估规则。评估结果(True 或 False)用于决定是否执行相应的模式控制操作列表。

A rule is a logical expression composed of a set of mode request conditions. It is evaluated upon changes to input mode requests and mode indications, or during the execution of the BswM main function. The evaluation result (True or False) determines whether to execute the corresponding list of mode control operations.

仲裁规则的组成(Composition of Arbitration Rules)

组成模式仲裁规则的逻辑表达式可以使用不同的运算符(AND、OR、XOR、NOT 和 NAND)。表达式中的每个项都对应于一个模式请求条件。如果模式条件引用 BswMModeRequestPort ,则该条件将验证请求或指示的模式是否与某个模式相等或不相等。

The logical expressions comprising the mode arbitration rules can utilize different operators (AND, OR, XOR, NOT, and NAND). Each term within an expression corresponds to a mode request condition.If a condition references a BswMModeRequestPort, it validates whether a requested or indicated mode is equal (or unequal) to a specified mode.

如果条件引用 BswMEventRequestPort,则该条件将验证请求端口是 SET 还是 CLEAR。BswMEventRequestPort 事件请求与模式请求的不同之处在于,请求者不向 BswM 发送请求的模式/值,因此,BswM 没有模式条件需要评估。相反,只有事件的接收需要 BswM 进行评估。

If a condition references a BswMEventRequestPort, it checks whether the request port is SET or CLEAR. An event request differs from a mode request in that the requester does not send a specific mode or value to the BswM for evaluation. Instead, the BswM evaluates only the fact of the event’s occurrence.

当请求者发送/调用事件时,BswMEventRequestPort 将处于 SET 状态。然后,BswM 可以通过执行 BswMClearEventRequest 操作将 BswMEventRequestPort 置于 CLEAR 状态。如图 仲裁规则 所示具有两个条件的示例。

The BswMEventRequestPort enters the SET state upon the requester sending or invoking an event. The BswM can then place the port into the CLEAR state by executing the BswMClearEventRequest operation. An example comprising two conditions is shown in Figure :ref:fig_BswM01.

BswM仲裁示例图(BswM Arbitration Example Diagram)

仲裁规则

Arbitration Rules

模式控制(Mode Control)

BswM 的模式控制部分根据模式仲裁的结果执行所有必要的操作。这是使用操作列表完成的。操作列表是 BswM 在模式仲裁触发时执行的操作的 有序列表

The mode control component of the BswM executes all requisite actions based on the outcome of the mode arbitration. This is accomplished through action lists. An action list constitutes an ordered sequence of operations that the BswM performs when a mode arbitration rule is triggered.

动作列表中的动作可分为三种类型:

The actions in the action list can be divided into three types:

  1. 调用其他 BSW 模块或 RTE;

    Call other BSW modules or RTE;

  2. 链接到要包含在执行中的其他动作列表。

    Link to aother action list to be included in the execution.

  3. 模式仲裁规则。执行相应的动作列表时,将评估这些规则。

    Mode arbitration rules. These rules are evaluated when the corresponding action list is executed.

如下图 动作列表 所示典型用例:

Typical use cases are shown in 动作列表 below:

BswM动作列表示例图(BswM Action List Example Diagram)

动作列表

Action list

偏差(Deviation)

  1. BswMModeInitValue变更 Change of BswMModeInitValue

    因为设计需要,将每个ModeRequestPort都需要配置,提取成按照类别配置,减少参数配置, 所以将配置简化,只需要在BswMModeInitValue中配置。

    To reduce design complexity and minimize parameters, the configuration of ModeRequestPorts has been streamlined. Instead of individual port configuration, settings are now managed by category. Consequently, the simplified configuration is centralized within BswMModeInitValue.

  2. 动作列表优先级失效 Invalidation of action list priority

    因为目前设计的值同步执行,不适用于优先级处理, 配置BswMActionListPriority无效。

    The current design employs synchronous execution of values, which does not accommodate priority-based processing. Consequently, configuring BswMActionListPriority is ineffective.

集成(Integration)

文件列表(File List)

静态文件(Static Files)

文件(File)

描述(Description)

BswM.h

LC配置数据类型,以及通用API的声明(LC configuration data types and declarations of general APIs)

BswM_Bsw.h

内部与SchM交互的API声明(API declarations for internal interaction with SchM)

BswM_CanSM.h

BswM与CanSM模块交互API声明(API declarations for interaction between BswM and CanSM modules)

BswM_ComM.h

BswM与ComM模块交互API声明(API declarations for interaction between BswM and ComM modules)

BswM_Dcm.h

BswM与Dcm模块交互API声明(API declarations for interaction between BswM and Dcm modules)

BswM_EcuM.h

BswM与EcuM模块交互API声明(API declarations for interaction between BswM and EcuM modules)

BswM_EthIf.h

BswM与EthIf模块交互API声明(API declarations for interaction between BswM and EthIf modules)

BswM_EthSM.h

BswM与EthSM模块交互API声明(API declarations for interaction between BswM and EthSM modules)

BswM_FrSM.h

BswM与FrSM模块交互API声明(API declarations for interaction between BswM and FrSM modules)

BswM_Internal.h

BswM中PC配置数据结构类型定义以及内部函数声明(Type definition of PC configuration data structure and declaration of internal functions in BswM)

BswM_J1939Dcm.h

BswM与J1939Dcm模块交互API声明(API declarations for interaction between BswM and J1939Dcm modules)

BswM_J1939Nm.h

BswM与J1939Nm模块交互API声明(API declarations for interaction between BswM and J1939Nm modules)

BswM_LinSM.h

BswM与LinSM模块交互API声明(API declarations for interaction between BswM and LinSM modules)

BswM_LinTp.h

BswM与LinTp模块交互API声明(API declarations for interaction between BswM and LinTp modules)

BswM_MemMap.h

BswM所有变量、函数用到的MemMap机制包含头文件 (The MemMap mechanism used by all variables and functions in BswM, including header files)

BswM_Nm.h

BswM与Nm模块交互API声明(API declarations for interaction between BswM and Nm modules)

BswM_NvM.h

BswM与NvM模块交互API声明(API declarations for interaction between BswM and NvM modules)

BswM_Sd.h

BswM与Sd模块交互API声明(API declarations for interaction between BswM and Sd modules)

BswM_SoAd.h

BswM与SoAd模块交互API声明(API declarations for interaction between BswM and SoAd modules)

BswM_Swc.h

BswM与Rte交互的API声明(API declarations for interaction between BswM and Rte)

BswM_Types.h

BswM定义的通用数据类型(Common data types defined by BswM)

BswM.c

BswM模块提供的API(不与其他模块交互),以及内部函数等(APIs provided by the BswM module (that do not interact with other modules), as well as internal functions, etc.)

BswM_Bsw.c

与基础软件的模式通知的API实现(API implementation for mode notification with basic software)

BswM_CanSM.c

BswM与CanSM模块交互的API实现(Implementation of API for interaction between BswM and CanSM modules)

BswM_ComM.c

BswM与ComM模块交互的API实现(Implementation of API for interaction between BswM and ComM modules)

BswM_Dcm.c

BswM与Dcm模块交互的API实现(Implementation of API for interaction between BswM and Dcm modules)

BswM_DetCheck.c

BswM内部的Det函数实现(Implementation of the Det function inside BswM)

BswM_EcuM.c

BswM与EcuM模块交互的API实现(Implementation of API for interaction between BswM and EcuM modules)

BswM_EthIf.c

BswM与EthIf模块交互的API实现(Implementation of API for interaction between BswM and EthIf modules)

BswM_EthSM.c

BswM与EthSM模块交互的API实现(Implementation of API for interaction between BswM and EthSM modules)

BswM_FrSM.c

BswM与FrSM模块交互API实现(Implementation of API for interaction between BswM and FrSM modules)

BswM_J1939Dcm.c

BswM与J1939Dcm模块交互API实现(Implementation of API for interaction between BswM and J1939Dcm modules)

BswM_J1939Nm.c

BswM与J1939Nm模块交互API实现(Implementation of API for interaction between BswM and J1939Nm modules)

BswM_LinSM.c

BswM与LinSM模块交互API实现(Implementation of API for interaction between BswM and LinSM modules)

BswM_LinTp.c

BswM与LinTp模块交互API实现(Implementation of API for interaction between BswM and LinTp modules)

BswM_Nm.c

BswM与Nm模块交互API实现(Implementation of API for interaction between BswM and Nm modules)

BswM_NvM.c

BswM与NvM模块交互API实现(Implementation of API for interaction between BswM and NvM modules)

BswM_Sd.c

BswM与Sd模块交互API实现(Implementation of API for interaction between BswM and Sd modules)

BswM_SoAd.c

BswM与SoAd模块交互API实现(Implementation of API for interaction between BswM and SoAd modules)

BswM_Swc.c

BSWM与Rte模块交互API实现(Implementation of API for interaction between BSWM and Rte modules)

BswM_TimerControl.c

BswM中timer control相关API实现(Implementation of timer control related APIs in BswM)

动态文件(Dynamic Files)

文件(File)

描述(Description)

BswM_Cfg.c

BswM中所有PC配置数据 (All PC configuration data in BswM)

BswM_Cfg.h

BswM中所有PC配置宏定义以及包含的头文件(Macro definitions of all PC configuration and included header files in BswM)

BswM_LCfg.c

BswM中所有Link time配置内部Api实现(Implementations of internal APIs for Link-Time configuration in BswM)

BswM_Lcfg.h

BswM中所有Link time配置数据声明以及宏定义(Declarations and macro definitions for Link-Time configuration data in BswM)

BswM_Lcfg_{name}.c

BswM中所有Link time配置数据(All Link-Time configuration data in BswM)

SchM_BswM.h

定义BswM_MainFunction函数声明,以及某些关键区域保护机制(Defines the function declaration of BswM_MainFunction and some critical region protection mechanisms)

错误处理(Error Handling)

开发错误(Development Errors)

Error code

Value[hex]

Description

BSWM_E_UNINIT

0x01

A service was called prior to initialization

BSWM_E_NULL_POINTER

0x02

A null pointer was passed as an argument

BSWM_E_PARAM_INVALID

0x03

A parameter was invalid (unspecific)

BSWM_E_REQ_USER_OUT_OF_RANGE

0x04

A requesting user was out of range

BSWM_E_REQ_MODE_OUT_OF_RANGE

0x05

A requested mode was out of range

BSWM_E_PARAM_CONFIG

0x06

The provided configuration is inconsistent

BSWM_E_PARAM_POINTER

0x07

A parameter pointer was invalid

BSWM_E_INIT_FAILED

0x08

Invalid configuration set selection

运行时错误(Runtime Errors)

Error code

Value[hex]

Description

BSWM_API_ID_DO_ACTION_LIST(服务函数ID)(Service function ID)

通过配置BswMReportFailRuntimeErrorId决定(Determined by configuring BswMReportFailRuntimeErrorId)

Invalid configuration set selection

接口描述(Interface Description)

类型定义(Type Definitions)

Type Name

Type

Description

BswM_ModeType

uint16

This type identifies the modes that can be requested by BswM Users.

BswM_UserType

uint16

This type identifies a BswM User that makes mode requests to the BswM.

BswM_ConfigType

BswM_PbConfigType

Manager. A pointer to this structure is passed to the BSW Mode Manager initialization function for configuration. This container exists once per partition.

提供的服务 (Services)

BswM_Init

void BswM_Init(const BswM_ConfigType *ConfigPtr)

Initializes the BSW Mode Manager.

Sync/Async

TRUE

Reentrancy

Conditionally Reentrant

Parameters

Dir

Name

Description

[in]

ConfigPtr

Pointer to post-build configuration data.

Return type

void

BswM_Deinit

void BswM_Deinit(void)

Deinitializes the BSW Mode Manager. 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.

Sync/Async

TRUE

Reentrancy

Non Reentrant

Return type

void

BswM_GetVersionInfo

void BswM_GetVersionInfo(Std_VersionInfoType *VersionInfo)

Returns the version information of this module.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[out]

VersionInfo

Pointer to where to store the version information of the module.

Return type

void

BswM_BswMPartitionRestarted

void BswM_BswMPartitionRestarted(void)

Function called by Restart Task if the partition containing the BswM has been restarted.

Sync/Async

TRUE

Reentrancy

Reentrant

Return type

void

BswM_RequestMode

void BswM_RequestMode(BswM_UserType requesting_user, BswM_ModeType requested_mode)

Generic function call to request modes. This function shall only be used by other BSW modules that do not have a specific mode request interface.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

requesting_user

The user that requests the mode.

[in]

requested_mode

The requested mode.

Return type

void

BswM_CanSM_CurrentState

void BswM_CanSM_CurrentState(NetworkHandleType Network, CanSM_BswMCurrentStateType CurrentState)

Function called by CanSM to indicate its current state.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Network

The CAN channel the indicated state corresponds to.

[in]

CurrentState

The current state of the CAN channel.

Return type

void

BswM_ComM_InitiateReset

void BswM_ComM_InitiateReset(void)

Function called by ComM to signal a shutdown.

Sync/Async

TRUE

Reentrancy

Non Reentrant

Return type

void

BswM_ComM_CurrentMode

void BswM_ComM_CurrentMode(NetworkHandleType Network, ComM_ModeType RequestedMode)

Function called by ComM to indicate the current communication mode of a ComM channel.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Network

The ComM communication channel that the indicated state corresponds to.

[in]

RequestedMode

The current state of the ComM communication channel.

Return type

void

BswM_ComM_CurrentPNCMode

void BswM_ComM_CurrentPNCMode(PNCHandleType PNC, ComM_PncModeType CurrentPncMode)

Function called by ComM to indicate the current mode of the PNC.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

PNC

The handle of the PNC for which the current state is reported.

[in]

CurrentPncMode

The current mode of the PNC.

Return type

void

BswM_Dcm_ApplicationUpdated

void BswM_Dcm_ApplicationUpdated(void)

This function is called by the DCM to report an updated application.

Sync/Async

TRUE

Reentrancy

Reentrant

Return type

void

BswM_Dcm_CommunicationMode_CurrentState

void BswM_Dcm_CommunicationMode_CurrentState(NetworkHandleType Network, Dcm_CommunicationModeType RequestedMode)

Function called by DCM to inform the BswM about the current state of the communication mode.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Network

The communication channel that the diagnostic mode corresponds to.

[in]

RequestedMode

The requested diagnostic communication mode.

Return type

void

BswM_EcuM_CurrentWakeup

void BswM_EcuM_CurrentWakeup(EcuM_WakeupSourceType source, EcuM_WakeupStatusType state)

Function called by EcuM to indicate the current state of a wakeup source.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

source

Wakeup source(s) that changed state.

[in]

state

The new state of the wakeup source(s).

Return type

void

BswM_EcuM_RequestedState

void BswM_EcuM_RequestedState(EcuM_StateType State, EcuM_RunStatusType CurrentState)

Function called by EcuM to notify about the current status of the Run Request Protocol.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

State

The requested state by EcuMFlex.

CurrentState

Return type

void

BswM_EcuM_CurrentState

void BswM_EcuM_CurrentState(EcuM_StateType CurrentState)

Function called by EcuM to indicate the current ECU Operation Mode.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

CurrentState

The requested ECU Operation Mode.

Return type

void

BswM_EthIf_PortGroupLinkStateChg

void BswM_EthIf_PortGroupLinkStateChg(EthIf_SwitchPortGroupIdxType PortGroupIdx, EthTrcv_LinkStateType PortGroupState)

Function called by EthIf to indicate the link state change of a certain Ethernet switch port group.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

PortGroupIdx

The port group index in the context of the Ethernet Interface.

[in]

PortGroupState

The state of the port group. State is derived from the physical link of the Ethernet Transceiver

Return type

void

BswM_EthSM_CurrentState

void BswM_EthSM_CurrentState(NetworkHandleType Network, EthSM_NetworkModeStateType CurrentState)

Function called by EthSM to indicate its current state.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Network

The Ethernet channel that the indicated state corresponds to.

[in]

CurrentState

The current state of the Ethernet channel.

Return type

void

BswM_FrSM_CurrentState

void BswM_FrSM_CurrentState(NetworkHandleType Network, FrSM_BswM_StateType CurrentState)

Function called by FrSM to indicate its current state.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Network

The FlexRay cluster that the indicated state corresponds to.

[in]

CurrentState

The current state of the FlexRay cluster.

Return type

void

BswM_J1939DcmBroadcastStatus

void BswM_J1939DcmBroadcastStatus(uint16 NetworkMask)

This API tells the BswM the desired communication status of the available networks. The status will typically be activated via COM I-PDU group switches.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

NetworkMask

Mask containing one bit for each available network.

Return type

void

BswM_J1939Nm_StateChangeNotification

void BswM_J1939Nm_StateChangeNotification(NetworkHandleType Network, uint8 Node, Nm_StateType NmState)

Notification of the current J1939Nm state after state changes.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Network

Identification of the J1939 channel.

[in]

Node

Identification of the J1939 node.

[in]

NmState

Current (new) state of the J1939 node.

Return type

void

BswM_LinSM_CurrentSchedule

void BswM_LinSM_CurrentSchedule(NetworkHandleType Network, LinIf_SchHandleType CurrentSchedule)

Function called by LinSM to indicate the currently active schedule table for a specific LIN channel.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Network

The LIN channel that the schedule table switch has occurred on.

[in]

CurrentSchedule

The currently active schedule table of the LIN channel.

Return type

void

BswM_LinSM_CurrentState

void BswM_LinSM_CurrentState(NetworkHandleType Network, LinSM_ModeType CurrentState)

Function called by LinSM to indicate its current state.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Network

The LIN channel that the indicated state corresponds to.

[in]

CurrentState

The current state of the LIN channel.

Return type

void

BswM_LinTp_RequestMode

void BswM_LinTp_RequestMode(NetworkHandleType Network, LinTp_Mode LinTpRequestedMode)

Function called by LinTP to request a mode for the corresponding LIN channel. The LinTp_Mode correlates to the LIN schedule table that should be used.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Network

The LIN channel that the LinTp mode request relates to.

[in]

LinTpRequestedMode

The requested LIN TP mode.

Return type

void

BswM_Nm_CarWakeUpIndication

void BswM_Nm_CarWakeUpIndication(NetworkHandleType Network)

Function called by NmIf to indicate a CarWakeup.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Network

Identification of the Nm-Channel.

Return type

void

BswM_Nm_StateChangeNotification

void BswM_Nm_StateChangeNotification(NetworkHandleType Network, Nm_StateType currentState)

Notification of current Nm state after state changes.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Network

Identification of the Nm-channel

[in]

currentState

Current (new) state of the Nm-channel

Return type

void

BswM_NvM_CurrentJobMode

void BswM_NvM_CurrentJobMode(NvM_MultiBlockRequestType MultiBlockRequest, NvM_RequestResultType CurrentJobMode)

Function called by NvM to inform the BswM about the current state of a multi block job.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

MultiBlockRequest

Indicates which multi block service this callback refers to.

[in]

CurrentJobMode

Current state of the multi block job indicated by parameter ServiceId.

Return type

void

BswM_NvM_CurrentBlockMode

void BswM_NvM_CurrentBlockMode(NvM_BlockIdType Block, NvM_RequestResultType CurrentBlockMode)

Function called by NvM to indicate the current block mode of an NvM block. To use this function, integration code will be needed.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

Block

The block that the new NvM mode corresponds to.

[in]

CurrentBlockMode

The current block mode of the NvM block.

Return type

void

BswM_Sd_ClientServiceCurrentState

void BswM_Sd_ClientServiceCurrentState(uint16 SdClientServiceHandleId, Sd_ClientServiceCurrentStateType CurrentClientState)

Function called by Service Discovery to indicate the current state of the Client Service (available/down).

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

SdClientServiceHandleId

HandleId to identify the ClientService.

[in]

CurrentClientState

Current state of the ClientService.

Return type

void

BswM_Sd_ConsumedEventGroupCurrentState

void BswM_Sd_ConsumedEventGroupCurrentState(uint16 SdConsumedEventGroupHandleId, Sd_ConsumedEventGroupCurrentStateType ConsumedEventGroupState)

Function called by Service Discovery to indicate the current status of the Consumed Eventgroup (available/down).

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

SdConsumedEventGroupHandleId

HandleId to identify the Consumed Eventgroup.

[in]

ConsumedEventGroupState

Status of the Consumed Eventgroup.

Return type

void

BswM_Sd_EventHandlerCurrentState

void BswM_Sd_EventHandlerCurrentState(uint16 SdEventHandlerHandleId, Sd_EventHandlerCurrentStateType EventHandlerStatus)

Function called by Service Discovery to indicate the current status of the EventHandler (requested/released).

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

SdEventHandlerHandleId

HandleId to identify the EventHandler.

[in]

EventHandlerStatus

Status of the EventHandler.

Return type

void

BswM_SoAd_SoConModeChg

void BswM_SoAd_SoConModeChg(SoAd_SoConIdType SoConId, SoAd_SoConModeType State)

Function called by SoAd to notify state changes of a socket connection.

Sync/Async

TRUE

Reentrancy

Reentrant

Parameters

Dir

Name

Description

[in]

SoConId

The socket connection index.

[in]

State

The state of the SoAd socket connection.

Return type

void

配置(Configuration)

基础配置说明(Basic Configuration Instructions)

仲裁规则配置(Arbitration Rule Configuration)

首先要明确要做什么,比如:控制灯,我们知道了要控制灯,那么需要知道灯的逻辑状态(打开,关闭), 还需要知道在什么状态下打开,什么状态下关闭。我们知道这些条件后我们就能够组成一套规则。在BswM 中通过配置来完成这一套规则的构建。基本步骤如下:

The first step is to define the operational logic. For instance, to control a light, its logical states (ON/OFF) and the predefined conditions for each state transition must be specified. Once these conditions are established, they form a complete rule set. In BswM, this rule set is constructed through configuration. The basic procedure is as follows:

  1. 创建一个Rule,Rule名称为:BswM_Rule_XXX,其中Rule为规则名称,比如:BswM_Rule_LedOnOff。

    Create a Rule with the name: BswM_Rule_XXX, where “Rule” is the rule name, for example: BswM_Rule_LedOnOff.

  2. 在该Rule中配置选择仲裁条件以及执行的动作, 条件为真是执行什么动作,条件为假时执行什么动作。

    In this Rule, configure the arbitration conditions and corresponding actions. Specify the action to be executed for both the TRUE and FALSE cases of the condition.

    • 通过配置BswMRuleInitState来设置Rule的初始值,

      Set the initial value of the Rule by configuring BswMRuleInitState;

    • 通过配置BswMRuleExpressionRef选择Rule的仲裁条件,

      Select the arbitration condition of the Rule by configuring BswMRuleExpressionRef;

    • 通过配置BswMRuleFalseActionList选择Rule的仲裁结果为假时执行的动作,

      Select the actions to be executed when the arbitration result of the Rule is false by configuring BswMRuleFalseActionList;

    • 通过配置BswMRuleTrueActionList选择Rule的仲裁结果为真时执行的动作。

      Select the actions to be executed when the arbitration result of the Rule is true by configuring BswMRuleTrueActionList.

Rule configuration

RuleConfig

  • 1: 名称(Name)

  • 2: 规则初始状态(Initial status of the rule)

  • 3: 仲裁条件(Arbitration rule)

  • 4: 条件为假执行的动作(Actions to be executed when the condition is FALSE)

  • 5: 条件为真执行的动作(Actions to be executed when the condition is TRUE)

  1. 然后在BswMLogicalExpression配置相应的逻辑表达式。

    Then configure the corresponding logical expression in BswMLogicalExpression.

    • 通过配置BswMLogicalOperator决定逻辑表达式的运算符,

      Determine the operator of the logical expression by configuring BswMLogicalOperator;

    • 通过配置BswMArgumentRef选择逻辑表达式的运算对象。

      Select the operand of the logical expression by configuring BswMArgumentRef.

LogicalExpression configuration

LogicalExpression

  • 1: 逻辑表达式的名称(Logical expression name)

  • 2: 逻辑运算符(Logical operator)

  • 3: 等式或者其他逻辑表达式,由运算符决定可配置的数量(An equation or other logical expression, where the operator determines the number of configurable operands.)

  1. 在BswMModeCondition为BswMLogicalExpression配置等式:

    In BswMModeCondition, configure the equation for BswMLogicalExpression:

    • 通过配置BswMConditionType选择等式两边比较类型,(对于 BSWM_EQUALS 和 BSWM_EQUALS_NOT,通过 BswMConditionMode 引用的 BswMModeRequestPort端口与在BswMConditionValue中配置的值进行相等或不相等的比较。对于 BSWM_EVENT_IS_SET 和 BSWM_EVENT_IS_CLEARED,通过 BswMConditionMode 引用的 BswMEventRequestPort 端口被检查是否已设置或清除(未设置)。

      Configure BswMConditionType to select the comparison type: for BSWM_EQUALS and BSWM_EQUALS_NOT, this means comparing the BswMModeRequestPort referenced by BswMConditionMode for equality or inequality with the value in BswMConditionValue; whereas for BSWM_EVENT_IS_SET and BSWM_EVENT_IS_CLEARED, it means checking whether the BswMEventRequestPort referenced by BswMConditionMode is set or cleared (not set).

    • 通过配置BswMConditionMode选择等式左边的对象,

      Select the object on the left side of the equation by configuring BswMConditionMode,

    condition configuration

    ModeConditionLeft

  • 1: 等式两边比较类型(Comparison type)

  • 2: 等式左边的对象,引用BswMModeRequestPort或BswMEventRequest(Object on the left side of the equation, referencing BswMModeRequestPort or BswMEventRequest)

    • 通过配置BswMBswMode下的BswMBswRequestedMode或BswModeCompareValue选择等式右边的值。

      Select right-side value of the equation by configuring BswMBswRequestedMode or BswModeCompareValue under BswMBswMode.

    比较模式配置(Comparison type configuration)

    ModeConditionRight

  • 1: 条件等式右值(Right-side value of the equation)

    Caution

    注意(Caution)

    BswMConditionModey引用的 BswMModeRequestPort的 BswMModeRequestSource为BswMBswModeNotification 或 BswMSwcModeNotification 或 BswMSwcModeRequest时,BswMConditionValue配置为BswMModeDeclaration;

    When the BswMModeRequestSource of the BswMModeRequestPort referenced by BswMConditionModey is BswMBswModeNotification, BswMSwcModeNotification, or BswMSwcModeRequest, BswMConditionValue is configured as BswMModeDeclaration;

    BswMConditionModey引用的 BswMModeRequestPort的 BswMModeRequestSource为BswMGenericRequest 或 BswMJ1939DcmBroadcastStatus时, BswMConditionValue配置为BswMBswMode下的BswMBswRequestedMode,由用户自定义;

    When the BswMModeRequestSource of the BswMModeRequestPort referenced by BswMConditionModey is BswMGenericRequest or BswMJ1939DcmBroadcastStatus, BswMConditionValue is configured as BswMBswRequestedMode under BswMBswMode, which is customized by the user;

    BswMConditionModey引用的 BswMModeRequestPort的 BswMModeRequestSource为其他类型时,BswMConditionValue配置为BswMBswMode下BswModeCompareValue 下拉框来选择。

    When the BswMModeRequestSource of the BswMModeRequestPort referenced by BswMConditionModey is of other types, BswMConditionValue is configured as the BswModeCompareValue drop-down box under BswMBswMode for selection.

  1. 配置条件的等式的左值,可以是BswMEventRequestPort或者BswMModeRequestPort

    Configure the left-side value of the equation, which can be BswMEventRequestPort or BswMModeRequestPort.

    • 通过配置BswMRequestProcessing决定模式请求的处理方式(延迟或立即)。

      Determine the processing method of mode requests (delayed or immediate) by configuring BswMRequestProcessing.

    • 通过配置BswMRequestSource选择模式请求的来源。BswMEventRequestPort如图 BswMEventRequestSource 所示,BswMModeRequestPort如图 ModeRequestSource 所示。

      Select the source of the mode request by configuring BswMRequestSource. The BswMEventRequestPort is shown in Figure BswMEventRequestSource, and the BswMModeRequestPort is shown in Figure ModeRequestSource.

      Event request source configuration

      BswMEventRequestSource

      Mode request source configuration

      ModeRequestSource

      Important

      当使用非标准请求的条件时,可以通过配置BswMGenericRequest实现一些非标条件。

      To accommodate non-standard request conditions, configure the BswMGenericRequest.

  2. 配置执行的动作列表,在工具中配置BswMModeControl->BswMActionList(被BswMRule使用)

    Configure the action list to be executed. In the tool, configure BswMModeControl->BswMActionList (used by BswMRule)

    • 通过配置BswMActionListExecution选择动作类型(触发执行或条件执行)。

      Select the action type (trigger execution or conditional execution) by configuring BswMActionListExecution.

      Action List configuration

      ActionList

  • 1: actionList的执行类型(Execution type of ActionList)

  • 2: 优先级(Priority)

  • 通过配置BswMActionListItem选择动作列表中执行的动作。

    Select the actions to be executed in the action list by configuring BswMActionListItem

    Action List Item configuration

    ActionListItem

  • 1: 中断执行(Terminate execution)

  • 2: 执行顺序(Execution order)

  • 3: 执行过程中报Detld(Report DET error during execution)

  • 4: 执行的动作,可以是action、其他actionList、Rule(Actions to be executed, which can be action, another action list or Rule)

  1. 配置执行动作(Configure actions)

    • 通过配置BswMAction->BswMAvailableActions选择执行的动作。

      Select the action to be executed by configuring BswMAction->BswMAvailableActions

      Action configuration

      Action

    Important

    当非标准提供的功能需要被执行时,可以通过配置BswMUserCallout(只支持无参数函数)来执行用户非标代码。

    For executing non-standard functions, configure BswMUserCallout to run custom user code (only parameterless functions are supported).

多核多分区配置说明(Multi-Core and Multi-Partition Configuration Instructions)

BswM存在于每个分区中,每个分区有单独的BswMConfig实例,在多分区系统中,用户需要配置多个BswMConfig实例。 每个BswM实例是相互隔离的,需要通过Rte或者用户自定义的全局变量将BswM实例的配置信息传递给其他BswM实例。 如下图配置多分区:

BswM resides in each partition, with a dedicated BswMConfig instance per partition. In a multi-partition system, users need to configure multiple BswMConfig instances. As these BswM instances operate in isolation, their configuration data must be shared via the RTE or user-defined global variables. The following figure illustrates the multi-partition configuration:

MultiPartition

MultiPartition

  • 1: 为每一个分区创建一个BswMConfig(Create a BswMConfig for each partition)

  • 2: 为对应的BswMConfig分配分区信息(Assign partition information to the corresponding BswMConfig)

与SWC交互配置说明(Configuration Instructions for Interaction with SWC)

BswM提供模式管理和模式请求两种方式来与SWC或其他基础软件模块进行交互,BswM既可以作为模式用户也可以作为模式提供者。

BswM provides two ways, namely mode management and mode request, to interact with SWC or other basic software modules. BswM can act as both a mode user and a mode provider.

Mode Control

ModeCtrl

如下图所示应用程序 SW-C 的端口如何连接到 BSW 模式管理器的服务端口。应用程序模式管理器 SW-C 具有模式 请求端口和模式切换 R 端口(名为 modeNotificationPort,以区别于模式切换 P 端口)。第一个端口用于请求其 应用程序模式的更改,后者用于在 BswM 执行模式更改时接收通知。应用程序模式管理器的模式请求端口(modeRequest Port0)连接到 BSW 模式管理器的相应模式请求端口。

The following figure illustrates the port connections between an Application SW-C and the BSW Mode Manager. The Application Mode Manager SW-C is equipped with a Mode Request Port and a Mode Switch R-Port (named modeNotificationPort to distinguish it from the Mode Switch P-Port). The former is used to request changes to its application mode, while the latter is used to receive notifications when BswM executes a mode change. The Mode Request Port (modeRequestPort0) of the Application Mode Manager is connected to the corresponding Mode Request Port of the BSW Mode Manager.

Mode Management

ModeManager

模式切换与模式通知(Mode Switching and Mode Notification)

  1. 模式通知 Mode Notification

    • 通过配置BswMConfig->BswMArbitration->BswMModeRequestPort->BswMModeRequestSource-> BswMBswModeNotification 来与其他基础软件模块进行模式管理,BswMBswModeNotification引用其他模块描述文件中的模式声明组原型。

      Mode management with other basic software modules is enabled by configuring BswMConfig->BswMArbitration-> BswMModeRequestPort->BswMModeRequestSource-> BswMBswModeNotification. BswMBswModeNotification references the mode declaration group prototype defined in the description files of other modules.

    • 通过配置BswMConfig->BswMArbitration->BswMModeRequestPort->BswMModeRequestSource-> BswMSwcModeNotification 来接收来自SWC的模式切换通知, BswMSwcModeNotificationModeDeclarationGroupPrototypeRef引用萃取文件中的模式声明组原型。

      Mode switching notifications from SWC are received by configuring BswMConfig->BswMArbitration->BswMModeRequestPort-> BswMModeRequestSource-> BswMSwcModeNotification. BswMSwcModeNotificationModeDeclarationGroupPrototypeRef references the mode declaration group prototype defined in the extraction file.

  2. 模式切换 Mode Switching

    • 首先配置BswMSwitchPort(BswMModeControl->BswMSwitchPort)创建模式切换P端口

      First, configure BswMSwitchPort (BswMModeControl->BswMSwitchPort) to create a mode switch P port.

    • 与SWC交互需要配置BswMRteSwitch(BswMModeControl->BswMAction->BswMAvailableActions-> BswMRteSwitch )来执行模式切换

      To interact with SWCs, configure BswMRteSwitch (BswMModeControl->BswMAction->BswMAvailableActions-> BswMRteSwitch ) to perform mode switching.

    • 与基础软件交互需要配置BswMSchMSwitch(BswMModeControl->BswMAction->BswMAvailableActions-> BswMSchMSwitch )来执行模式切换

      To interact with basic software, configure BswMSchMSwitch (BswMModeControl->BswMAction->BswMAvailableActions-> BswMSchMSwitch ) to perform mode switching.

模式请求(Mode Request)

模式请求基于Sender-Receiver通信进行模式控制的。

Mode requests are based on Sender-Receiver communication for mode control.

  1. BswM作为请求方(BswM acts as the requester)

    • 首先配置BswMRteModeRequestPort(BswMModeControl->BswMRteModeRequestPort)创建SR通信P端口

      First, configure BswMRteModeRequestPort (BswMModeControl->BswMRteModeRequestPort) to create an SR communication P port

    • 然后配置BswMRteModeRequest(BswMModeControl->BswMAction->BswMAvailableActions->BswMRteModeRequest)发出模式切换请求

      Then configure BswMRteModeRequest (BswMModeControl->BswMAction->BswMAvailableActions->BswMRteModeRequest) to send a mode switch request

  2. BswM作为被请求方(BswM acts as the requested party)

    • 通过配置BswMSwcModeRequest (BswMConfig->BswMArbitration->BswMModeRequestPort->BswMModeRequestSource-> BswMSwcModeRequest)接收模式切换请求

      Configure BswMSwcModeRequest (BswMConfig->BswMArbitration->BswMModeRequestPort->BswMModeRequestSource->BswMSwcModeRequest) to receive mode switch requests.