Read AUTOSAR: DiagnosticLogAndTrace DLT (4) -- API analysis

1. The function called periodically: Dlt_TxFunction

According to the parameter DltGeneralTrafficShapingSupport, decide how to send DLT messages. If it is TRUE, then you need to refer to the parameter DltLogChannelTrafficShapingBandwidth to set the sending bandwidth for each Log channel; if it is FALSE, then all cached DLT messages will be sent immediately.

    /* traffic shaping */
#if (DLT_ENABLE_TRAFFIC_SHAPING == STD_ON)
    txChannel->trafficShapingTimer += txChannel->transmitCycleTime;
    if (txChannel->trafficShapingTimer >= DLT_TIME_1S) {
        txChannel->trafficShapingTimer = 0u;
        txChannel->trafficShapingCount = 0u;
    }

    if (txChannel->trafficShapingCount >= txChannel->trafficShapingBandwidth) {
        Dlt_OverflowHandle(txChannel); /* avoid overflowTimer stop updating */
        return;
    }
#endif

The Dlt_TxFunction function checks for the "buffer overflow" flag. If an overflow occurs, the DLT command "BufferOverflowNotification" will be issued immediately until the "overflow" flag is cleared ( the flag will be automatically cleared after the time configured by the DltLogChannelBufferOverflowTimer parameter)

If a DLT message cannot be sent, it will try to send the message every time Dlt_TxFunction is called, until the number of times configured by the DltLogChannelMaxNumOfRetries parameter is tried.

Second, the upper layer call function

2.1. Dlt_Init

2.2.  Dlt_RegisterContext

 Enter:

1. sessionId -- For BSW, the module ID should be passed in; for SWC, the port defined argument value should be passed in

2. appId -- Application ID to be registered

3. contextId -- Context ID to be registered

4. appDescription -- app description, up to 255 characters ( what is the description here? )

5. lenAppDescription -- the character length of the app description

6. contextDescription -- context description, up to 255 characters

7. lenContextDescription -- the character length of the context description

2.3. Dlt_SendLogMessage

This is the interface used by BSW module or SWC module to send LOG message

 There are the following input parameters.

sessionId - For BSW only, this is actually the module number. For example Det module number 15.

logInfo--The structure of related information for filtering messages.

logData--the buffer of the recorded parameters, this pointer indicates the payload of the Log message.

logDataLength--the length of the data buffer

Guess you like

Origin blog.csdn.net/weixin_46481662/article/details/128410716