AutoSAR Series Explanation (Introduction) 3.3-RTE's Support for Ports (Part 1)

Table of contents

1. Features

1. Act as a communication channel between SWCs and BSW

2. Other features

2. Different ways of S/R interface

1. Direct call (Direct)

2. Buffered call (Buffered)

3. Queue call (Queued)

3. The way of cross-ECU


1. Features

1. Act as a communication channel between SWCs and BSW

A few more commonplaces:

  • As a concrete realization of VFB
  • Communication implementation as S/R interface
  • Communication implementation as C/S interface
  • ECU intercom/cross-ECU (via COM)
  • Realize the callback function of AR-COM, the specific implementation is completed in SWC, RTE is responsible for completing this callback mechanism

2. Other features

  • Provides a mechanism to achieve data consistency (the so-called data consistency is simple: when multiple SWCs operate the same data at the same time, some unexpected problems may occur, and data consistency requires that these problems cannot occur)
  • Support for simple and complex data types
  • The instantiation of the SWC type (SWC type, which is different from SWC, SWC type refers to a type of SWC, and a SWC can be instantiated with this type, just like instantiating a count with the int type)

2. Different ways of S/R interface

The following calls, after configuring Davinci, will be automatically generated above the runnable and can be copied directly. For example, I copied a piece of code in SWC generated by DaVinci, and you can see that the functions of Rte_ are listed above the runnable

/********************************************************************************************************************** 
 * 
 * Runnable Entity Name: RAB_Core0_100us 
 * 
 *--------------------------------------------------------------------------------------------------------------------- 
 * 
 * Executed if at least one of the following trigger conditions occurred: 
 * - triggered on TimingEvent every 100us 
 * 
 ********************************************************************************************************************** 
 * 
 * Input Interfaces: 
 * ================= 
 * Explicit S/R API: 
 * ----------------- 
 * Std_ReturnType Rte_Read_AppPI_Can_ReceiverCore0_DEP_Can_Receiver(Idt_Can_Receiver *data) 
 * 
 * Output Interfaces: 
 * ================== 
 * Explicit S/R API: 
 * ----------------- 
 * Std_ReturnType Rte_Write_AppPI_Can_SenderCore0_DEP_Can_Sender(Idt_Can_Sender data, Rte_TransformerError *transformerError) 
 * 
 * Service Calls: 
 * ============== 
 * Service Invocation: 
 * ------------------- 
 * Std_ReturnType Rte_Call_ComM_UserRequest_GetCurrentComMode(ComM_ModeType *ComMode) 
 * Synchronous Service Invocation. Timeout: None 
 * Returned Application Errors: RTE_E_ComM_UserRequest_E_NOT_OK 
 * Std_ReturnType Rte_Call_ComM_UserRequest_GetMaxComMode(ComM_ModeType *ComMode) 
 * Synchronous Service Invocation. Timeout: None 
 * Returned Application Errors: RTE_E_ComM_UserRequest_E_NOT_OK 
 * Std_ReturnType Rte_Call_ComM_UserRequest_GetRequestedComMode(ComM_ModeType *ComMode) 
 * Synchronous Service Invocation. Timeout: None 
 * Returned Application Errors: RTE_E_ComM_UserRequest_E_NOT_OK 
 * Std_ReturnType Rte_Call_ComM_UserRequest_RequestComMode(ComM_ModeType ComMode) 
 * Synchronous Service Invocation. Timeout: None 
 * Returned Application Errors: RTE_E_ComM_UserRequest_E_MODE_LIMITATION, RTE_E_ComM_UserRequest_E_NOT_OK 
 * 
 *********************************************************************************************************************/ 
 /********************************************************************************************************************** 
 * DO NOT CHANGE THIS COMMENT! << Start of documentation area >> DO NOT CHANGE THIS COMMENT! 
 * Symbol: RAB_Core0_100us_doc 
 *********************************************************************************************************************/ 
 
 
 /********************************************************************************************************************** 
 * DO NOT CHANGE THIS COMMENT! << End of documentation area >> DO NOT CHANGE THIS COMMENT! 
 *********************************************************************************************************************/ 
 
 FUNC(void, SWCCore0Basic_Type_CODE) RAB_Core0_100us(void) /* PRQA S 0850 */ /* MD_MSR_19.8 */ 
 { 
 /********************************************************************************************************************** 
 * DO NOT CHANGE THIS COMMENT! << Start of runnable implementation >> DO NOT CHANGE THIS COMMENT! 
 * Symbol: RAB_Core0_100us 
 *********************************************************************************************************************/ 
 
 
 /********************************************************************************************************************** 
 * DO NOT CHANGE THIS COMMENT! << End of runnable implementation >> DO NOT CHANGE THIS COMMENT! 
 *********************************************************************************************************************/ 
 }

1. Direct call (Direct)

Equivalent to having a global variable, runnable can directly read and write this variable using the following syntax:

 

(Pay attention to the difference with data, the one with <> refers to the name of the global data, and the data without <> is the name of the local variable. The pointer is used here, which means that the same address is operated, and no copy is used; at the same time, these Functions are used in runnable, don't look at Rte, just think it is the code in RTE, because the mechanism of RTE is called, so here is Rte)

Std_ReturnType Rte_Read_port>_data> (DataType> *data)

Std_ReturnType Rte_Write_port>_data> (DataType> data)

2. Buffered call (Buffered)

It is equivalent to copying the global variable to a runnable local variable first, then operating the local variable, and finally assigning the local variable to the global variable. During the operation of this local variable by runnable, the global variable will not change.

 

The method of use is as follows: (all are managed by RTE, the user only needs to call the function correctly)

DataType> Rte_IRead_r>_port>_data> (void)

void Rte_IWrite_r>_port>_data> (DataType> data)

3. Queue call (Queued)

Because there is more than one data, it is the data of a group of queues, just like our commonly used serial port FIFO. Therefore, you can set cyclic reception or wait for reception. If you wait, there is timeout management.

 

The calling code is as follows:

Std_ReturnType Rte_Receive_port>_data> (DataType> *data)

Std_ReturnType Rte_Send_port>_data> (DataType> data)

3. The way of cross-ECU

If it is data transmission across ECUs. Then, after I use a function like Rte_Write_<port>_<Data>() in runnable, I will need to go through runnable

(ECU1) ->RTE (ECU1) ->BSW (ECU1) ->External bus ->BSW (ECU2)

->RTE (ECU2) ->runnable (ECU2)

, and the two function names used for COM transmission are also listed here:

Com_SendSignal()

Com_ReceiveSignal()

Guess you like

Origin blog.csdn.net/qq_42700289/article/details/131404548