1. Ref
Ref.1 AUTOSAR_RS_Main.pdf
Ref.1 AUTOSAR_RS_Features.pdf
Ref.2 AUTOSAR_SRS_COM.pdf
Ref.3 AUTOSAR_SWS_COM.pdf
2. 为什么要使用Signal Group?
2.1 Traceabilty
[RS_PO_00004] AUTOSAR shall define an open architecture for automotive software. (Ref.1)
[RS_Main_00430] AUTOSAR shall support established automotive communication standards (Ref.2)
[RS_BRF_01632] AUTOSAR communication shall support data consistency of groups of signals (Ref.3)
[SRS_Com_02041] The AUTOSAR module shall handle complex data types as a consistent set of data (Ref.4)
[SWS_Com_00050] If Com_SendSignalGroup is called for the signal group, the AUTOSAR COM module shall copy the shadow buffer atomically to the I-PDU buffer.
[SWS_Com_00051] If Com_ReceiveSignalGroup is called for a signal group, the AUTOSAR COM module shall copy the data atomically from the I-PDU buffer to the shadow buffer.
2.2 分析
为什么要使用Signal Group呢?
我们从需求追溯关系入手,按图索骥,搞明白Signal Group相关需求的上游需求来源。
从需求[SRS_Com_02041], [RS_BRF_01632]来看,Signal Group机制主要用于发送,接收复杂数据类型的信号,并保持其一致性。换言之,若一个应用数据比较富足,有多个子数据类型组成,如结构体,若仍旧使用Signal机制,就需要分开进行发送,很难保证一个信号中的子数据类型的一致性。故而绑定各个子数据类型,一起更新,从而保证一致性。
2.3 如何使用 SignalGroup?
假设信号signal_a, signal_b 属于Signal Group group_x, 那么如何发送和接收信号呢?示例如下:
- 如何发送Signal Group
* copy a to shadow buffer */
Com_SendSignal (signal_a, &a);
/* copy b to shadow buffer */
Com_SendSignal (signal_b, &b);
/* copy shadow buffer to I-PDU */
Com_SendSignalGroup (group_x);
- 如何接收Signal Group
/* copy I-PDU to shadow buffer */
Com_ReceiveSignalGroup (group_x);
/* copy a from shadow buffer */
Com_ReceiveSignal (signal_a, &a);
/* copy b from shadow buffer */
Com_ReceiveSignal (signal_b, &b);