AutoSAR PduR - Common usage of AutoSAR PDU

AutoSAR PduR - Common usage of AutoSAR PDU

PduR (Protocol Data Unit Router) is a module in the AutoSAR architecture, which is used for data routing and forwarding between different communication networks. In this article, we will introduce the common usage of the AutoSAR PduR module and provide corresponding source code examples.

1. Introduction to PduR module
PduR module is mainly used for data transmission and processing between different communication networks. It receives data from upper layer protocol modules (such as Diag, CanTp, LinTp, etc.) and routes it to lower layer protocol modules (such as CanIf, LinIf, etc.). The core functions of the PduR module include: receiving data, routing data, splitting data, and merging data, etc.

2. How to use the PduR module

  1. Configure the PduR module
    First, we need to configure the relevant parameters of the PduR module in the AutoSAR configuration file. These parameters include PDU routing tables, routing paths, and mapping relationships between target PDUs. After the configuration is complete, we can configure the corresponding routing path for each PDU according to specific needs.

  2. Receive data
    When the upper layer protocol module receives data, it will pass the data to the PduR module for processing. The PduR module finds the target PDU according to the configured routing path, and transfers the data to the corresponding lower layer protocol module. Here is a sample code:

void PduR_ReceivePdu(PduIdType id, const PduInfoType* info) {
    // 根据id查找目标PDU的路由路径
    PduR_RoutingPathType routingPath = PduR_GetRoutingPath(id);
    
    // 根据路由路径找到下层协议模块
    PduR_LowerLayerType lowerLayer = PduR_GetLowerLayer(routingPath);
    
    // 将数据传递给下层协议模块
    if 

Guess you like

Origin blog.csdn.net/wellcoder/article/details/132285760
Recommended