DEENESPTFRRUARHIKOZHNL

Diagnostic Log and Trace (DLT)

ModulDlt (Diagnostic Log and Trace)
BSW-Modul-ID55
Standard-Header#include "Dlt.h"
SWS-SpezifikationAUTOSAR_SWS_DiagnosticLogAndTrace.pdf
ClusterDiagnostic Services

模块指南人工智能生成

收集、过滤并缓冲来自 SW-C 和 BSW 的日志与跟踪消息,并将其发送至外部工具。
AI 生成 未审核 模型: claude-opus-5-5 · 推理强度: high · 温度: 不可控 · 提示词: dfa88865c54d 来源 未决问题(1)
因果锚点:R20-11 自 R20-11 起有效 为此规范版本重新合成。
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

收集、过滤并缓冲来自 SW-C 和 BSW 的日志与跟踪消息,并将其发送至外部工具。

Dlt 模块收集来自 SW-C、BSW 模块、DET 以及 RTE VFB Hook 的日志与跟踪消息。它根据日志级别和跟踪状态对消息进行过滤,将其分配给 LogChannel 并进行缓冲。发送过程通过周期性 Dlt_TxFunction 和 PduR [SWS_Dlt_00241] 解耦进行。外部客户端可以在运行时更改过滤器和通道分配;已注册的 SW-C 会收到相应通知。最重要的约束条件:在 Dlt_Init 之前以及可选的启动延迟结束前,消息仅会被缓冲 [SWS_Dlt_00005]。

Dlt 模块是 ECU 上日志与跟踪消息的中央收集点。SW-C(通过 RTE 端口)和 BSW 模块通过 Dlt_SendLogMessage 和 Dlt_SendTraceMessage 提供消息 [SWS_Dlt_00241] [SWS_Dlt_00243]。DET 错误通过 Dlt_DetForwardErrorTrace 传入 [SWS_Dlt_00430],SW-C 通信则通过生成的 RTE VFB 跟踪 Hook 传入 [SWS_Dlt_00027]。唯一的接收端是带有 PduR_DltTransmit 的 PduR [SWS_Dlt_00762]。每条消息均通过各占 4 字节的 ApplicationId 和 ContextId 元组进行标识;0x00000000 用作通配符 [SWS_Dlt_00226] [SWS_Dlt_00227]。

kontext swc SW-C rte RTE (Ports, VFB-Hooks) swc->rte Dlt_SendLogMessage Dlt_RegisterContext dlt Dlt rte->dlt Port-Aufrufe VFB-Trace-Hooks bsw BSW-Module bsw->dlt Dlt_SendLogMessage Dlt_SendTraceMessage det DET (Fan-out) det->dlt Dlt_DetForwardErrorTrace ecum EcuM ecum->dlt Dlt_Init schm SchM schm->dlt Dlt_TxFunction dlt->rte LogLevelChangedNotification Dlt_InjectCall_<SESSION> nvm NvM dlt->nvm NvM_ReadBlock NvM_WriteBlock zeit Gpt / StbM (Zeitstempel) dlt->zeit Gpt_GetTimeElapsed StbM_GetCurrentTime pdur PduR dlt->pdur PduR_DltTransmit pdur->dlt Dlt_RxIndication Dlt_TxConfirmation client Externer Dlt-Client pdur->client Dlt-Nachrichten client->pdur Steuernachrichten

上下文图:围绕 Dlt 的源、辅助服务(NvM、Gpt/StbM、SchM)以及作为接收端的 PduR。来源:[SWS_Dlt_00762]、[SWS_Dlt_00763]、[SWS_Dlt_91005]。

早在初始化之前,Dlt 就会缓冲传入的消息 [SWS_Dlt_00003]。只有在 Dlt_Init 运行且可选的启动延迟定时器超时后,才会处理这些消息 [SWS_Dlt_00005]。在具备 NvRAM 支持的情况下,Dlt_Init 通过 NvM_ReadBlock 恢复运行时配置 [SWS_Dlt_00453]。仅在通过 Dlt_StoreConfiguration 提出明确请求时才会进行保存 [SWS_Dlt_00078]。

在调用上下文中,Dlt 执行过滤、通道选择、长度检查和缓冲区存储。发送过程从周期性 Dlt_TxFunction 中解耦执行,包括在收到否定确认后的重试 SWS DLT 第92页 [SWS_Dlt_91005]。

通过 LogChannel 发送 Dlt 消息Dlt-Nutzer (SW-C/RTE/Det)DltGptSchMPduRUse Case: 在调用上下文中的接收(同步)Dlt_SendLogMessage / Dlt_SendTraceMessage /Dlt_DetForwardErrorTraceNachrichtenfilterung,LogChannel-Schwelle anwenden选择目标 LogChannels,检查长度Zeitstempel holen (Gpt_GetTimeElapsed)verstrichene Zeitin LogChannel-Puffer ablegenStd_ReturnTypeUse Case: Entkoppelter VersandDlt_TxFunction()loop根据流量整形Dlt-Header zusammensetzen,增加发送计数器PduR_DltTransmit(DltTxPduId, ...)Dlt_TxConfirmation(TxPduId, result)altE_OK 或重试次数耗尽从缓冲区移除消息E_NOT_OK,允许重试保留消息以重新发送

时序图:同步发送调用以存入缓冲区结束。Dlt_TxFunction 负责发送、确认和重试。来源:SWS DLT 第 92 页、[SWS_Dlt_91005]、[SWS_Dlt_00273]。

外部客户端通过经由 Dlt_RxIndication 接收的控制消息来控制日志级别、跟踪状态和 LogChannel 阈值 [SWS_Dlt_00272]。相同的控制变量也可以作为 API 提供,例如 Dlt_SetLogLevel [SWS_Dlt_00252]。为了使 Dlt 能够通过 LogLevelChangedNotification 通知已注册的 SW-C,它们先前需使用 Dlt_RegisterContext 注册其上下文 [SWS_Dlt_00245] [SWS_Dlt_00496]。

发生错误时,发送调用会报告 DLT_E_MSG_TOO_LARGE、DLT_E_NO_BUFFER 或 DLT_E_UNKNOWN_SESSION_ID [SWS_Dlt_00495]。发生缓冲区溢出时,消息将被丢弃,设置溢出标志,并根据配置发送 BufferOverflowNotification SWS DLT 第32页。

角色与系统边界:日志与跟踪数据的中央收集点

Diagnostic Log and Trace (Dlt) 模块接收来自软件组件 (SW-C) 和基础软件 (BSW) 的日志与跟踪消息。它对其进行过滤和缓冲,并作为 Dlt 消息转发给外部工具。两个发送接口 Dlt_SendLogMessage 和 Dlt_SendTraceMessage 明确适用于 BSW 模块以及 SW-C [SWS_Dlt_00241] [SWS_Dlt_00243]。数据路径的源是 SW-C 或 BSW 模块,接收端是 PDU Router SWS DLT 第26页。为此,Dlt 必须需要 PduR_DltTransmit [SWS_Dlt_00762]。与外部客户端的消息格式、命令和协议并非由 SWS 规定,而是由协议规范规定 SWS DLT 第9页。

除显式调用外,还存在固定的提供方:

Dlt 从 Gpt 或 StbM 获取时间戳,持久化由 NvM 负责 [SWS_Dlt_00763]。Dlt_DetForwardErrorTrace 在 R20-11 中属于 API,但在 R25-11 中被移除 SWS DLT 第1页。

kontext swc SW-C rte RTE (Ports, VFB-Hooks) swc->rte Dlt_SendLogMessage Dlt_RegisterContext dlt Dlt rte->dlt Port-Aufrufe VFB-Trace-Hooks bsw BSW-Module bsw->dlt Dlt_SendLogMessage Dlt_SendTraceMessage det DET (Fan-out) det->dlt Dlt_DetForwardErrorTrace ecum EcuM ecum->dlt Dlt_Init schm SchM schm->dlt Dlt_TxFunction dlt->rte LogLevelChangedNotification Dlt_InjectCall_<SESSION> nvm NvM dlt->nvm NvM_ReadBlock NvM_WriteBlock zeit Gpt / StbM (Zeitstempel) dlt->zeit Gpt_GetTimeElapsed StbM_GetCurrentTime pdur PduR dlt->pdur PduR_DltTransmit pdur->dlt Dlt_RxIndication Dlt_TxConfirmation client Externer Dlt-Client pdur->client Dlt-Nachrichten client->pdur Steuernachrichten

上下文图:Dlt 介于消息源(通过 RTE 的 SW-C、BSW、DET)与作为唯一接收端的 PduR 之间。NvM、Gpt/StbM 和 SchM 为辅助服务。来源:[SWS_Dlt_00762]、[SWS_Dlt_00763]、[SWS_Dlt_00430]、[SWS_Dlt_91005],SWS DLT 第 26 页。

从启动到运行:初始化前的缓冲、Dlt_Init 与持久化

SW-C 和 BSW 模块在 Dlt 初始化之前即可进行记录。因此,Dlt 必须在初始化之前就缓冲来自 Dlt_SendLogMessage 和 Dlt_SendTraceMessage 的数据 [SWS_Dlt_00003]。只有在满足两个条件后,才会对缓冲的数据进行常规处理:Dlt_Init 已运行,且可选的定时器 DltGeneralStartUpDelayTimer 已超时 [SWS_Dlt_00005]。若配置了该定时器,则在调用 Dlt_Init 时启动它 SWS DLT 第25页。

lebenszyklus start uninit 未初始化 发送调用被缓冲 start->uninit uninit->uninit Dlt_SendLogMessage / Dlt_SendTraceMessage verzoegerung 已初始化 启动延迟正在运行 (缓冲仍在继续) uninit->verzoegerung Dlt_Init [DltGeneralStartUpDelayTimer konfiguriert] betrieb 运行中 缓冲区内容和新消息 被处理 uninit->betrieb Dlt_Init [无启动延迟定时器] verzoegerung->betrieb Timer abgelaufen

状态图:在初始化之前以及(若适用)在启动延迟结束之前,消息仅被缓冲,此后才进行处理。来源:[SWS_Dlt_00003]、[SWS_Dlt_00005],SWS DLT 第 25 页。

Dlt_Init 是同步且不可重入的。该函数需要一个指向 Dlt_ConfigType 的指针,其内容是特定于实现的 [SWS_Dlt_00239] [SWS_Dlt_00437]。由于 Dlt 使用 NvM,因此初始化应在启动过程的后期且在 NvM 之后进行 [SWS_Dlt_00239]。若 DltGeneralNvRAMSupport = TRUE,则 Dlt 表现如下:

若无 NvRAM 支持,则静态配置生效 SWS DLT 第25页。根据图示,调用方是 EcuM SWS DLT 第159页。

Dlt 模块的初始化EcuMDltNvMGptDlt_Init(config)altDltGeneralNvRAMSupport == TRUENvM_ReadBlock(BlockId, NvM_DstPtr)检查 NV 块的有效性,gespeicherte Werte als StartwerteDltGeneralNvRAMSupport == FALSEstatische Konfiguration ladenoptDltGeneralStartUpDelayTimer konfiguriertGpt_StartTimer(Channel, Value)返回(同步)Init 之后且启动延迟到期后:gepufferte Nachrichten verarbeiten

时序图:EcuM 同步调用 Dlt_Init。Dlt 根据 DltGeneralNvRAMSupport 从 NvM 或静态加载配置,并可选择启动启动延迟定时器。来源:[SWS_Dlt_00239]、[SWS_Dlt_00453]、[SWS_Dlt_00005],SWS DLT 第 159 页,CP SWS DLT 第 90 页。

消息模型:标识符、日志级别和跟踪类型

每条日志消息均带有一个包含五个字段的结构体 Dlt_MessageLogInfoType:argCount、logLevel、options、contextId 和 appId [SWS_Dlt_00236]。跟踪消息使用 Dlt_MessageTraceInfoType,其包含字段 traceInfo 而非日志级别 [SWS_Dlt_00237]。ApplicationId 和 ContextId 是 4 字节数组;0x00000000 用作通配符 [SWS_Dlt_00226] [SWS_Dlt_00227]。Application ID 是 SW-C 的短名称。Context ID 按功能对其消息进行分组 EXP LSA 第159页。位域 Dlt_MessageOptionsType 在第 0 位编码详细模式,在第 1–3 位编码消息类型 [SWS_Dlt_00229]。

类型Werte出处
Dlt_MessageTypeDLT_TYPE_LOG, DLT_TYPE_APP_TRACE, DLT_TYPE_NW_TRACE, DLT_TYPE_CONTROL[SWS_Dlt_00224]
Dlt_MessageLogLevelTypeDLT_LOG_OFF (0x00) 至 DLT_LOG_VERBOSE (0x06)[SWS_Dlt_00230]
Dlt_MessageTraceTypeDLT_TRACE_VARIABLE, DLT_TRACE_FUNCTION_IN, DLT_TRACE_FUNCTION_OUT, DLT_TRACE_STATE, DLT_TRACE_VFB[SWS_Dlt_00231]
Dlt_MessageNetworkTraceInfoTypeDLT_NW_TRACE_IPC 至 DLT_NW_TRACE_SOMEIP[SWS_Dlt_00233]

在非详细模式下,唯一的 Message ID 标识消息的静态部分 [SWS_Dlt_00228]。ID 0x00000001 (DEM)、0x00000002 (DET) 和 0x00000003 (Trace) 是保留的,不能供 SW-C 使用 [SWS_Dlt_00031]。在线路上,Message ID 紧随报头之后,随后是非静态数据 PRS DLT 第23页。报头字段 MTIN 根据消息类型 MSTP 由日志级别或跟踪类型组成 PRS DLT 第24页。

发送路径:过滤器、LogChannel 选择、缓冲和 Dlt_TxFunction

发送调用是同步且可重入的。它们接收 sessionId、信息结构体以及有效载荷连同长度 [SWS_Dlt_00241] [SWS_Dlt_00243]。R20-11 图示展示了调用上下文中的时序:

  1. 消息过滤
  2. 应用 LogChannel 阈值
  3. 选择目标 LogChannel
  4. 检查长度
  5. 将消息存入 LogChannel 缓冲区

稍后才由 Dlt_TxFunction 负责发送 SWS DLT 第92页。以下各个步骤在 R23-11 版本的文档段落中有详细阐述,并与该图示一致。Dlt 仅在配置时才获取时间戳:通过 Gpt_GetTimeElapsed 或通过 StbM_GetCurrentTime [SWS_Dlt_00654] [SWS_Dlt_00655]。

LogChannel 分三个阶段确定 SWS DLT 第32页:

  1. 分配与 ApplicationId/ContextId 元组精确匹配的通道。
  2. 具有匹配 ApplicationId 和通配符 ContextId 的通道。
  3. 如果列表仍为空,则为默认 LogChannel。

分配可以在运行时使用 Dlt_SetLogChannelAssignment 进行更改 [SWS_Dlt_00751]。仅当消息对所有分配的通道均超过 DltLogChannelMaxMessageLength 时,才会被丢弃 SWS DLT 第31页。否则,它将被复制到其长度足够短的所有通道的缓冲区中 SWS DLT 第32页。

kanalwahl start filter Filter bestanden? (Log-Level/Trace-Status, LogChannel-Schwelle) start->filter verworfen 未作进一步处理 filter->verworfen 不 exakt 收集具有完全匹配的 ApplicationId/ContextId 元组的通道 filter->exakt 是 wildcard 补充具有匹配的 ApplicationId 且带通配符 ContextId 的通道 exakt->wildcard leer Liste leer? wildcard->leer default Default-LogChannel (DltDefaultLogChannelRef) leer->default 是 laenge 长度是否 <= DltLogChannelMaxMessageLength (针对至少一个通道)? leer->laenge 不 default->laenge zulang verwerfen, DLT_E_MSG_TOO_LARGE laenge->zulang 不 kopie 复制到长度匹配的 所有通道的缓冲区中 laenge->kopie 是 platz Platz in keinem zugeordneten Puffer? kopie->platz keinpuffer 丢弃,DLT_E_NO_BUFFER, 设置溢出标志 platz->keinpuffer 是 ok gepuffert, Versand durch Dlt_TxFunction platz->ok 不

活动图:一条消息经过过滤器、三级通道选择、长度检查和缓冲区存储。每个分支都可能导致带有独立返回值的丢弃。来源:SWS DLT 第 31 页、SWS DLT 第 32 页、[SWS_Dlt_00495]、[SWS_Dlt_00751]。

通过 PduR 的发送与发送调用解耦,并在 Dlt_TxFunction 的上下文中运行 [SWS_Dlt_91005]。报头在 PduR_DltTransmit 之前组装,并且每条消息都有一个发送计数器进行计数 SWS DLT 第35页。在三种情况下,消息会从缓冲区中移除 SWS DLT 第38页:

  • PduR_DltTransmit 返回 E_NOT_OK。
  • 收到肯定的发送确认。
  • 收到否定确认且已超过 DltLogChannelMaxNumOfRetries。

下层通过以下回调进行报告:

通过 LogChannel 发送 Dlt 消息Dlt-Nutzer (SW-C/RTE/Det)DltGptSchMPduRUse Case: 在调用上下文中的接收(同步)Dlt_SendLogMessage / Dlt_SendTraceMessage /Dlt_DetForwardErrorTraceNachrichtenfilterung,LogChannel-Schwelle anwenden选择目标 LogChannels,检查长度Zeitstempel holen (Gpt_GetTimeElapsed)verstrichene Zeitin LogChannel-Puffer ablegenStd_ReturnTypeUse Case: Entkoppelter VersandDlt_TxFunction()loop根据流量整形Dlt-Header zusammensetzen,增加发送计数器PduR_DltTransmit(DltTxPduId, ...)Dlt_TxConfirmation(TxPduId, result)altE_OK 或重试次数耗尽从缓冲区移除消息E_NOT_OK,允许重试保留消息以重新发送

时序图:同步发送调用以存入缓冲区结束。实际的发送、确认和重试由周期性 Dlt_TxFunction 处理。来源:SWS DLT 第 92 页、[SWS_Dlt_91005]、[SWS_Dlt_00273]、SWS DLT 第 35 页、SWS DLT 第 38 页。

通过生成的 RTE Hook 函数进行 VFB 跟踪

VFB 跟踪意味着:RTE 隐式地将 SW-C 通信转发给 Dlt,而无需 SW-C 本身进行调用 SWS DLT 第23页。为此,Dlt 针对由短名称为 “Rte_Dlt…” 的 BswModuleEntry 所描述的每个已配置事件实现 Hook 函数 [SWS_Dlt_00027]。原型由 RTE 描述提供 [SWS_Dlt_00335]。Dlt_SendTraceMessage 是 SW-C 接口。因此,Hook 会在非详细模式下 [SWS_Dlt_00277] 并将所有参数作为有效载荷 [SWS_Dlt_00278] 调用等效的内部函数 [SWS_Dlt_00285]。

Hook 适用其他规则:

  • 每个 Hook 函数获得一个单独的 ContextId。在信号非常多的情况下,允许对事件进行捆绑 [SWS_Dlt_00279]。
  • 在发送之前,每个 Hook 检查其 ContextId 的跟踪状态 [SWS_Dlt_00281]。
  • 该消息携带带有 DLT_TRACE_VFB [SWS_Dlt_00484] 的 DLT_TYPE_APP_TRACE 以及 ApplicationID “VFBT” SWS DLT 第23页。
  • Hook 的跟踪状态通过一个与 LogTraceSessionControl 保持协调的单独函数进行更改 [SWS_Dlt_00283]。

解释:由于内部函数对应于 Dlt_SendTraceMessage,因此 VFB 消息可能经过与显式跟踪消息相同的缓冲发送路径 [SWS_Dlt_00285]。 问题 Q-cb77a5e7bde21b01 (未决)

通过 RTE 钩子函数的 VFB 跟踪SW-CRTEDltSchMPduR通过 VFB 通信Rte_Dlt...-Hookfunktion(Argumente)optContextId 的跟踪状态处于激活internes Dlt_SendTraceMessage (non-verbose),DLT_TYPE_APP_TRACE / DLT_TRACE_VFBvermutlich: Filter, Kanalwahl, Pufferung返回Dlt_TxFunction()PduR_DltTransmit(...)Interpretation: gleicher gepufferter Sendepfad同显式跟踪消息

时序图:RTE Hook 仅在跟踪状态激活时发送带有 DLT_TRACE_VFB 的非详细跟踪消息。它使用共同的发送路径属于一种解释。来源:[SWS_Dlt_00027]、[SWS_Dlt_00281]、[SWS_Dlt_00285]、[SWS_Dlt_00484],SWS DLT 第 33 页。

会话、注册以及外部客户端的运行时控制

SW-C 根据配置项通过以下端口进行绑定:

端口定义的参数值用作 SessionId [SWS_Dlt_00022]。它们从 0x1000 开始;BSW 模块使用其模块 ID [SWS_Dlt_00023]。每个端口的值是唯一且连续的 [SWS_Dlt_00332]。它们的类型是 Dlt_SessionIDType (uint32) [SWS_Dlt_00225]。如果一个 SW-C 被多次实例化,则每个实例获得一个独立的会话 EXP LSA 第159页。

模块使用 Dlt_RegisterContext 注册其 ApplicationId/ContextId 元组及描述 [SWS_Dlt_00245]。Dlt 记录该元组是通过哪个端口注册的 [SWS_Dlt_00021]。停止时,模块调用 Dlt_UnregisterContext [SWS_Dlt_00769]。注册实现了一个目的:使 Dlt 知道在日志级别或跟踪状态更改时必须通知哪个 SW-C SWS DLT 第20页。为此使用 LogLevelChangedNotification 和 TraceStatusChangedNotification [SWS_Dlt_00496]。

外部客户端的控制消息通过 PduR 到达 Dlt。对于单个 PDU,它们通过 Dlt_RxIndication 到达 [SWS_Dlt_00272]。通过 TP,它们通过 Dlt_StartOfReception、Dlt_CopyRxData 和 Dlt_TpRxIndication 到达 [SWS_Dlt_91006] [SWS_Dlt_91008] [SWS_Dlt_91007]。Dlt 随后更新过滤器,可选地通知已注册的 SW-C,并通过 PduR_DltTransmit 发送响应 SWS DLT 第93页。

注册与外部 SetLogLevel 命令SW-CDltPduRExterner Dlt-ClientUse Case: Registrierungloopje SW-C-KontextDlt_RegisterContext(sessionId, appId, contextId, ...)记录元组和端口E_OKUse Case: Steuerkommando SetLogLevelDlt-SteuernachrichtDlt_RxIndication(RxPduId, PduInfoPtr)Log-Level-Filter aktualisierenoptLogLevelChange-Benachrichtigungregistrierte SW-C nachschlagenLogLevelChangedNotification(appId, contextId, logLevel)PduR_DltTransmit (Antwort)对控制消息的响应

时序图:SW-C 注册其上下文。外部 SetLogLevel 命令更新过滤器,可选地触发通知,并通过 PduR 进行应答。来源:SWS DLT 第 93 页、[SWS_Dlt_00245]、[SWS_Dlt_00272]、[SWS_Dlt_00496]。

相同的控制变量作为 API 提供:

与后续版本相比存在差异:

  • 在 R20-11 中,Dlt_GetDefaultTraceStatus 具有参数 logChannelName。在 R25-11 中缺少该参数 SWS DLT 第56页。
  • Dlt_AssignmentOperation 在 R20-11 中编码 DLT_ASSIGN_ADD = 0x01 和 DLT_ASSIGN_REMOVE = 0x02 [SWS_Dlt_00730]。R25-11 对 REMOVE 使用值 0x00 SWS DLT 第87页。对于 R20-11,该需求有效。

持久化:Dlt_StoreConfiguration 通过 NvM_WriteBlock 复制当前配置 [SWS_Dlt_00736]。仅当 DltGeneralNvRAMSupport 处于激活状态且明确请求保存时才会发生该操作 [SWS_Dlt_00078] [SWS_Dlt_00451]。Dlt_ResetToFactoryDefault 将日志级别和跟踪状态重置为保存的默认值。在具备 NvRAM 支持的情况下,该函数还会删除保存的值 [SWS_Dlt_00739]。通过 Dlt_InjectCall_<SESSION>,Dlt 可以异步向 SW-C 注入特定于应用程序的调用 [SWS_Dlt_00259] [SWS_Dlt_00498]。

发生错误时的行为

SW-C 接口的错误代码在接口 DltSwcMessageService 中定义 [SWS_Dlt_00495]。此外,文档段落描述了发送路径上的行为。

  • 消息过长:当消息对于所有分配的 LogChannels 均过长时,返回 DLT_E_MSG_TOO_LARGE [SWS_Dlt_00495] SWS DLT 第31页。
  • 缓冲区溢出:返回 DLT_E_NO_BUFFER。该消息被丢弃,置位溢出标志,并根据配置发送 BufferOverflowNotification。Dlt_TxFunction 检查标志与去抖时间 SWS DLT 第32页 SWS DLT 第95页。
  • 未知会话或注册错误:DLT_E_UNKNOWN_SESSION_ID、DLT_E_CONTEXT_ALREADY_REG 和 DLT_E_CONTEXT_NOT_YET_REG [SWS_Dlt_00495] [SWS_Dlt_00769]。
  • 时间戳不可用:时间戳被设为 0x00000000 SWS DLT 第30页。
  • 传输错误:负的 Dlt_TxConfirmation 会触发重试,直至达到 DltLogChannelMaxNumOfRetries。若 PduR_DltTransmit 返回 E_NOT_OK,则移除该消息 [SWS_Dlt_00273] SWS DLT 第38页。
  • 控制命令:SetLogLevel 中未知的元组将以 DLT_E_ERROR 响应 SWS DLT 第39页。配置 API 会报告 E_NOT_OK [SWS_Dlt_00252]。
  • 持久性:Dlt_StoreConfiguration 在 R20-11 中已知返回值 E_OK、E_NOT_OK 和 DLT_E_NOT_SUPPORTED [SWS_Dlt_00736]。DLT_E_ERROR 则是直到 R24-11 才新增 SWS DLT 第1页。
  • 开发与运行时错误:
    • 开发错误:DLT_E_PARAM、DLT_E_PARAM_POINTER、DLT_E_INIT_FAILED、DLT_E_REGISTRATION [SWS_Dlt_00727]
    • 运行时错误:DLT_E_SKIPPED_TRANSMISSION、DLT_E_DEPRECATED_PARAMETER、DLT_E_MULTIPLE_REQUESTS [SWS_Dlt_00728]

进一步详细证据

基于 R20-11 需求规范及所分配文档出处的 AI 生成模块指南;个别流程细节源自后续版本的文档出处并已作相应标注。以链接的需求规范为准。

Diagnostic Log and Trace (DLT)

The DLT module collects log messages and trace points and formats them into standardized DLT frames for external tooling.

Funktionen — Übersicht

Typen — Übersicht

Funktionen & Typen — Detailansicht

函数 Dlt_Init [SWS_Dlt_00239] 📄 PDF

void Dlt_Init (const Dlt_ConfigType* config);

Dlt is using the NVRam Manager and is to be initialized very late in the ECU startup phase. The Dlt_ Init() function should be called after the NVRam Manager is initialized.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 7562b88c65ab 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

同步且不可重入的函数Dlt_Init(服务ID 0x01,可通过头文件Dlt.h获取)初始化Classic平台中的Diagnostic Log and Trace(DLT)模块[SWS_Dlt_00239]。它通过参数config接收一个指向类型为Dlt_ConfigType的模块特定配置结构的指针,且不返回任何返回值[SWS_Dlt_00239]。

对于调用上下文以及与其他BSW模块的时间协同,适用特定的边界条件:

  • 初始化顺序:DLT模块使用NVRam Manager,必须在ECU启动阶段的极晚期进行初始化[SWS_Dlt_00239]。函数Dlt_Init的调用必须强制在NVRam Manager完全初始化之后进行[SWS_Dlt_00239]。
  • 持久性数据:当配置参数DltGeneralNvRAMSupport设置为TRUE时,DLT模块在Dlt_Init中使用NVRAM-Manager的接口NvM_ReadBlock来恢复所需变量的持久值[SWS_Dlt_00453]。
  • 缓冲区处理:一旦模块通过Dlt_Init初始化且可选定时器DltGeneralStartUpDelayTimer超时,所有在此期间缓冲的日志和跟踪数据都将被处理并按规范发送[SWS_Dlt_00005]。

由于该函数被指定为不可重入,因此调用上下文必须确保在执行期间不会并行或以中断方式重新进入Dlt_Init[SWS_Dlt_00239]。

该文本由AI系统基于AUTOSAR R20-11规范生成。

实现者指南即将推出(复杂度 I1)

函数 Dlt_SendTraceMessage [SWS_Dlt_00243] 📄 PDF

Std_ReturnType Dlt_SendTraceMessage (Dlt_SessionIDType sessionId, const Dlt_MessageTraceInfoType* traceInfo, const uint8* traceData, uint16 traceDataLength);

The service represents the interface to be used by basic software modules or by software components to trace parameters.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: b4775c790e44 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

同步且可重入的函数 Dlt_SendTraceMessage 用于基础软件模块(BSW)以及软件组件(SW-C)向 Dlt 模块传输跟踪参数 [SWS_Dlt_00243]。

参数与调用上下文

调用时,通过 sessionId 传递模块或端口标识符,通过 traceInfo 传递用于消息过滤的元数据,并通过 traceData 传递有效数据缓冲区连同长度规范 traceDataLength [SWS_Dlt_00243]。即使 Dlt 尚未初始化,该模块也可以预先缓冲跟踪消息 [SWS_Dlt_00003]。

返回值与错误处理

该服务通过特定返回值指示状态 [SWS_Dlt_00243]:

  • E_OK:操作已成功执行。
  • DLT_E_MSG_TOO_LARGE:消息超出了所有已分配日志通道的允许大小。
  • DLT_E_NO_BUFFER:缓冲区空间不足;消息无法针对至少一个日志通道进行暂存。
  • DLT_E_UNKNOWN_SESSION_ID:传递的 sessionId 对模块未知。

与 Hook 函数的交互

由于 Dlt_SendTraceMessage 被指定为用于 SW-C 的接口,因此对于生成的 Hook 函数存在等效的内部实现 [SWS_Dlt_00285],该实现以非详细模式(Non-Verbose 模式)发送跟踪消息 [SWS_Dlt_00277]。

本段文本由人工智能基于 AUTOSAR 规范 R20-11 生成。

实现者指南即将推出(复杂度 I1)

函数 Dlt_SendLogMessage [SWS_Dlt_00241] 📄 PDF

Std_ReturnType Dlt_SendLogMessage (Dlt_SessionIDType sessionId, const Dlt_MessageLogInfoType* logInfo, const uint8* logData, uint16 logDataLength);

The service represents the interface to be used by basic software modules or by software component to send Log Messages.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 1ca903195ba8 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

同步且可重入的函数 Dlt_SendLogMessage(服务 ID 0x03)用作基础软件模块(BSW)以及软件组件(SW-C)发送日志消息的标准化接口 [SWS_Dlt_00241]。该调用通过头文件 Dlt.h 进行,并且由于具有可重入性,该函数设计用于并发场景 [SWS_Dlt_00241]。

调用该函数时需要四个输入参数,且不使用任何输出参数 [SWS_Dlt_00241]:

  • sessionId:代表会话标识符。对于 SW-C,该参数作为端口相关参数值不可见,而 BSW 模块则直接传递其模块编号。
  • logInfo:指向常量结构的指针,该结构包含用于过滤日志消息的相关元数据。
  • logData:指向待记录数据字节数组的指针,该数组构成消息的实际有效负载(Payload)。
  • logDataLength:数据缓冲区的数值长度 logData。

错误处理直接通过类型为 Std_ReturnType 的返回值进行,该返回值指示操作成功或特定错误状态 [SWS_Dlt_00241]:

  • DLT_OK:日志消息已被成功接收并处理。
  • DLT_E_MSG_TOO_LARGE:消息超出了所有已分配日志通道的最大允许缓冲区大小。
  • DLT_E_NO_BUFFER:消息无法在任何已分配的日志通道上进行暂存。
  • DLT_E_UNKNOWN_SESSION_ID:传递的会话 ID 无效或对模块未知。

本使用提示由 AI 基于 AUTOSAR 规范生成。

函数 Dlt_UnregisterContext [SWS_Dlt_00769] 📄 PDF

Std_ReturnType Dlt_UnregisterContext (Dlt_SessionIDType sessionId, Dlt_ApplicationIDType appId, Dlt_ContextIDType contextId);

The service has to be called when a software module is going to be stopped. Available vi a Dlt.h

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 9c17fc452d0b 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

同步函数 Dlt_UnregisterContext(服务 ID 0x16)通过头文件 Dlt.h 提供,且必须在停止软件模块时调用 [SWS_Dlt_00769]。它用于注销应用程序先前注册的上下文。

该函数需要三个输入参数 [SWS_Dlt_00769]:

  • sessionId:模块编号;对应于 BSW 内部的模块 ID 或软件组件(SW-C)内特定于端口定义的实参值 [SWS_Dlt_00769]。
  • appId:上级应用程序的标识符(Application ID)[SWS_Dlt_00769]。
  • contextId:要注销的上下文的标识符(Context ID)[SWS_Dlt_00769]。

返回值与错误处理

类型为 Std_ReturnType 的返回值提供有关执行结果的信息 [SWS_Dlt_00769]:

并发性与限制

该函数被指定为可重入的,且表现为同步 [SWS_Dlt_00769]。调用模块必须确保传入的会话 ID 有效,并且上下文在终止之前确实已注册,以避免注销时出错 [SWS_Dlt_00769]。

此使用说明基于 AUTOSAR CP R20-11 规范自动生成。

函数 Dlt_DetForwardErrorTrace [SWS_Dlt_00432] 📄 PDF

void Dlt_DetForwardErrorTrace (uint16 moduleId, uint8 instanceId, uint8 apiId, uint8 errorId);

Service to fo rward error reports from Det to Dlt.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: ea1faa559ee0 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

用法与调用上下文

具有服务 ID 0x07 的同步接口 Dlt_DetForwardErrorTrace 用于将来自 Default Error Tracer (DET) 的已报告开发错误转发到 Dlt 模块 [SWS_Dlt_00432]。Dlt 模块提供此服务,以确保 DET 针对错误报告所要求的扇出能力 [SWS_Dlt_00430]。此 C 函数的声明通过头文件 Dlt_Det.h 包含 [SWS_Dlt_00432]。

参数与接口规范

该函数接收四个必选输入参数,既未定义返回值也未定义输出参数 [SWS_Dlt_00432]:

  • moduleId:发生错误的调用方软件模块的模块 ID。
  • instanceId:基于索引的模块实例的标识符(计数从 0 开始;单实例模块传递 0)。
  • apiId:受影响 API 服务的标识符(在调用模块的规范中定义)。
  • errorId:检测到的开发错误的标识符(在调用模块的规范中定义)。

并发与错误处理

执行与调用方错误记录同步进行。作为非可重入函数 (Non Reentrant),该接口强制要求调用方避免并发执行 [SWS_Dlt_00432]。规范中未为该服务规定特定的错误代码、错误反馈或单独的 DET 或 DEM 报告 [SWS_Dlt_00432]。

此使用说明基于 AUTOSAR CP R20-11 规范自动生成。

实现者指南即将推出(复杂度 I1)

函数 Dlt_SetLogLevel [SWS_Dlt_00252] 📄 PDF

Std_ReturnType Dlt_SetLogLevel (Dlt_ApplicationIDType appId, Dlt_ContextIDType contextId, Dlt_MessageLogLevelType newLogLevel);

This service is used to change the Log Level for the given tuple of Application ID/ Context ID.

函数 Dlt_SetTraceStatus [SWS_Dlt_00254] 📄 PDF

Std_ReturnType Dlt_SetTraceStatus (Dlt_ApplicationIDType appId, Dlt_ContextIDType contextId, boolean newTraceStatus);

The service Dlt_ Set Trace Status sets the trace status for a specific tuple of Application ID and Context ID.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: aa592860b6dc 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

同步函数 Dlt_SetTraceStatus 用于为特定的 Application-ID 和 Context-ID 元组设置跟踪状态 [SWS_Dlt_00254]。它通过头文件 Dlt.h 定义,且其 Service-ID 为 0x09 [SWS_Dlt_00254]。

使用

调用该函数需要三个输入参数 [SWS_Dlt_00254]:

  • appId:软件组件的 ID(类型为 Dlt_ApplicationIDType)。
  • contextId:上下文的 ID(类型为 Dlt_ContextIDType)。
  • newTraceStatus:要新设置的跟踪状态,表现为布尔值(类型为 boolean)。

错误处理与返回值

该函数同步返回一个类型为 Std_ReturnType 的状态 [SWS_Dlt_00254]:

  • E_OK:未发生错误,且状态已成功应用。
  • E_NOT_OK:无法更改跟踪状态。函数规范中未指明具体的 DET 错误消息(解释:若出现标识符无效或模块状态错误,推测可能导致出错)。 问题 Q-77e190707462c8f1 (未决)

并发性与限制

该接口被指定为不可重入(Non Reentrant)[SWS_Dlt_00254]。因此,未经调用方适当同步,不得对其进行并发或中断式执行。

此使用说明是基于 AUTOSAR Release R20-11 自动生成的。

实现者指南即将推出(复杂度 I1)

函数 Dlt_GetDefaultLogLevel [SWS_Dlt_00733] 📄 PDF

Std_ReturnType Dlt_GetDefaultLogLevel (Dlt_MessageLogLevelType* defaultLogLevel);

Returns the Default Log Level currently used by the Dlt module. The returned Log Level might differ from the one which is stored no n volatile.

函数 Dlt_StoreConfiguration [SWS_Dlt_00736] 📄 PDF

Std_ReturnType Dlt_StoreConfiguration (void);

Copies the current Dlt configuration to Nv RAM by calling Nv M_ Write Block().

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 5604b9adc3ef 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

函数 Dlt_StoreConfiguration([SWS_Dlt_00736])用于将当前 Dlt 配置保存到非易失性存储器(NvRAM)中。存储操作在内部通过同步调用 NVRAM 管理器([SWS_Dlt_00736])的接口 NvM_WriteBlock() 进行。该 API 通过头文件 Dlt.h 提供,其 Service-ID 为 0x1a。

该函数的签名形式为 Std_ReturnType Dlt_StoreConfiguration(void),不处理输入、输出或输入/输出参数([SWS_Dlt_00736])。

错误处理与返回值

作为同步服务,该函数直接向调用方返回一个类型为 Std_ReturnType 的状态码([SWS_Dlt_00736]):

  • E_OK:配置已无差错地传递至 NvRAM([SWS_Dlt_00736])。
  • E_NOT_OK:保存 Dlt 配置时发生错误([SWS_Dlt_00736])。
  • DLT_E_NOT_SUPPORTED:模块不支持用于保存配置的服务([SWS_Dlt_00736])。

并发性与限制

根据 [SWS_Dlt_00736],Dlt_StoreConfiguration 被指定为不可重入(Non Reentrant)。因此,该函数不得从不同任务或上下文中并发执行,调用方必须确保顺序执行。

该使用说明基于 AUTOSAR 规范自动生成。

函数 Dlt_ResetToFactoryDefault [SWS_Dlt_00739] 📄 PDF

Std_ReturnType Dlt_ResetToFactoryDefault (void);

The service Dlt_ Reset To Factory Default sets the Log Level and Trace Status back to the pers istently stored default values. If the feature Nv MRAM support is enabled, all stored Dlt values in the Nv M are deleted.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 9a6e51abb1f8 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

同步函数 Dlt_ResetToFactoryDefault 通过头文件 Dlt.h 提供,并且不接受任何传入参数 [SWS_Dlt_00739]。其主要目的是重置 Dlt 运行时配置:它将日志级别以及跟踪状态重置为持久化存储的默认值 [SWS_Dlt_00739]。若 Dlt 模块中还激活了 NvRAM 支持,则该调用会彻底删除 NvM 中存储的所有 Dlt 值 [SWS_Dlt_00739]。

返回值与错误处理

操作结果通过类型为 Std_ReturnType 的返回值同步指示 [SWS_Dlt_00739]:

在当前的规范范围内,未为该服务定义具体的 DET 或 DEM 错误消息。

并发性与限制

该函数被指定为不可重入(Non Reentrant)(Service-ID 0x06)[SWS_Dlt_00739]。因此,禁止从不同的任务或上下文中进行并发或中断式调用,必须由调用方予以防止。

此使用说明完全基于 AUTOSAR Classic Release R20-11 的规范数据。

实现者指南即将推出(复杂度 I1)

函数 Dlt_SetDefaultLogLevel [SWS_Dlt_00740] 📄 PDF

Std_ReturnType Dlt_SetDefaultLogLevel (Dlt_MessageLogLevelType newLogLevel);

Called to modify the pass through range for Log Messages for all not explicit set Context Ids.

函数 Dlt_GetTraceStatus [SWS_Dlt_00750] 📄 PDF

Std_ReturnType Dlt_GetTraceStatus (Dlt_ApplicationIDType appId, Dlt_ContextIDType contextId, boolean* traceStatus);

Returns the current Trace Status for a given tuple Application Id/ Context Id.

函数 Dlt_RxIndication [SWS_Dlt_00272] 📄 PDF

void Dlt_RxIndication (PduIdType RxPduId, const PduInfoType* PduInfoPtr);

Indication of a received PDU from a lower layer communication interface module.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 8621cb62489c 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

函数 Dlt_RxIndication 用于将来自下层通信接口模块的已接收 PDU 指示给 DLT 模块 [SWS_Dlt_00272]。它可通过头文件 Dlt.h 获取,并具有服务 ID 0x42 [SWS_Dlt_00272]。

调用采用同步语义进行,且不提供返回值 (void) [SWS_Dlt_00272]。向该函数传递两个输入参数:

  • RxPduId:已接收 PDU 的标识符(类型为 PduIdType)[SWS_Dlt_00272]。
  • PduInfoPtr:指向类型为 PduInfoType 的结构的指针。该结构包含已接收 PDU 的长度 (SduLength)、指向包含 PDU 有效负载数据的缓冲区的指针 (SduDataPtr) 以及 PDU 的关联元数据 [SWS_Dlt_00272]。

在并发性和执行上下文方面,该函数对于不同的 PDU-ID 是可重入的,但对于相同的 PDU-ID 是不可重入的 [SWS_Dlt_00272]。因此,调用的下层模块不得并发处理相同的 RxPduId,而允许使用不同 PDU-ID 进行并行调用 [SWS_Dlt_00272]。

本文本由 AI 基于规范生成。

函数 Dlt_TriggerTransmit [SWS_Dlt_00754] 📄 PDF

Std_ReturnType Dlt_TriggerTransmit (PduIdType TxPduId, PduInfoType* PduInfoPtr);

Within this API , the upper layer module (called module) shall check whether the available data fits into the buffer size reported by Pdu Info Ptr - >Sdu Length. If it fits, it shall copy its data into the buffer provided by Pdu Info Ptr - >Sdu Data Ptr and update the length of the actual copied data in Pdu Info Ptr - >Sdu Length. If not, it returns E_ NOT_ OK without changing Pdu Info Ptr.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 2f7ee51c3bb5 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

同步函数 Dlt_TriggerTransmit 根据 [SWS_Dlt_00754] 用于在下层请求时将 SDU 数据复制到提供的缓冲区中。它在 Dlt.h 中声明,服务 ID 为 0x41。

调用时传入以下参数:

  • TxPduId:请求传输的 SDU 的标识符。
  • PduInfoPtr:指向 PduInfoType 类型结构的指针。调用者通过 SduDataPtr 传递目标缓冲区,并通过 SduLength 传递最大可用缓冲区大小。

在函数内部,模块根据 [SWS_Dlt_00754] 检查可用数据是否适合传入的缓冲区大小:

  • 如果数据适合,函数将有效负载数据复制到 SduDataPtr 中,使用实际复制的字节数更新 SduLength,并返回 E_OK。
  • 如果缓冲区不足,函数返回 E_NOT_OK,且不修改 PduInfoPtr。

若返回 E_NOT_OK,则未复制任何 SDU 数据。在这种情况下,调用者不得继续使用 PduInfoPtr,因为它可能指向无效数据或是 NULL 指针 [SWS_Dlt_00754]。

在并发性方面,Dlt_TriggerTransmit 对于不同的 PDU ID 是可重入的,但对于相同的 TxPduId 是不可重入的 [SWS_Dlt_00754]。

本文本由自动生成。所有陈述均基于所引用的 AUTOSAR 规范。

实现者指南即将推出(复杂度 I1)

函数 Dlt_TxConfirmation [SWS_Dlt_00273] 📄 PDF

void Dlt_TxConfirmation (PduIdType TxPduId, Std_ReturnType result);

The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: da9a483662e9 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

用法与调用上下文

函数 Dlt_TxConfirmation 用作底层通信接口模块(lower layer communication interface module)向 Diagnostic Log and Trace (DLT) 模块报告的确认接口 [SWS_Dlt_00273]。它同步通知 DLT 模块先前请求的 PDU 是否已成功传输,或者传输是否失败 [SWS_Dlt_00273]。该函数的 Service-ID 为 0x40,并通过头文件 Dlt.h 提供 [SWS_Dlt_00273]。

该接口没有返回值(void),并需要两个传入参数 [SWS_Dlt_00273]:

  • TxPduId:所传输 PDU 的标识符,类型为 PduIdType。
  • result:传输状态,类型为 Std_ReturnType;其中 E_OK 表示传输成功,E_NOT_OK 表示 PDU 传输失败。

错误处理与并发

该调用未规定包含错误返回值或特定 DET/DEM 消息的显式错误处理;发送过程的失败纯粹通过参数值 result = E_NOT_OK 传递给 DLT 模块 [SWS_Dlt_00273]。

其执行适用有区分的重入条件:Dlt_TxConfirmation 针对不同的 PDU-ID 是可重入的,但针对相同的 PDU-ID 是不可重入的 [SWS_Dlt_00273]。因此,调用驱动程序或接口必须确保排除使用相同 TxPduId 进行的并发调用,而不同 PDU 的确认则允许并发到达。

此使用说明基于 AUTOSAR CP R20-11 规范自动生成。

实现者指南即将推出(复杂度 I1)

函数 Dlt_TpTxConfirmation [SWS_Dlt_00756] 📄 PDF

void Dlt_TpTxConfirmation (PduIdType id, Std_ReturnType result);

This function is called after the I - PDU has been transmitted on its network, the result indicates whether the transmission was succe ssful or not.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: d7c3201ac621 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

函数 Dlt_TpTxConfirmation 用作 Dlt 模块在发送传输 I-PDU 后的同步确认函数 [SWS_Dlt_00756]。它可通过头文件 Dlt.h 获取,服务 ID 为 0x48 [SWS_Dlt_00756]。

用法与语义

该调用在 I-PDU 于相应网络上传输后进行 [SWS_Dlt_00756]。该函数的签名为 void Dlt_TpTxConfirmation (PduIdType id, Std_ReturnType result),且不返回任何返回值 [SWS_Dlt_00756]:

  • id(输入参数,类型 PduIdType):所传输 I-PDU 的唯一标识 [SWS_Dlt_00756]。
  • result(输入参数,类型 Std_ReturnType):指示传输状态,并表明 I-PDU 的发送是成功还是失败 [SWS_Dlt_00756]。

并发与错误处理

规范将 Dlt_TpTxConfirmation 标识为同步且可重入(Reentrant)[SWS_Dlt_00756]。尚未为该服务定义特定的 DET 或 DEM 错误代码;关于发送过程的错误处理基于对参数 result 的评估 [SWS_Dlt_00756]。在系统上下文中,该调用通常应由下层传输层在 PDU 传输完成后发起。 问题 Q-0e5ab7c285316701 (未决)

该文本由AI系统基于AUTOSAR R20-11规范生成。

实现者指南即将推出(复杂度 I1)

函数 Dlt_CopyTxData [SWS_Dlt_00516] 📄 PDF

BufReq_ReturnType Dlt_CopyTxData (PduIdType id, const PduInfoType* info, const RetryInfoType* retry, PduLengthType* availableDataPtr);

Service Dlt_CopyTxData.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 131f9d82c4dd 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

用法与语义

同步且可重入的函数 Dlt_CopyTxData 用于从 Dlt 模块检索 I-PDU 段 (N-PDU) 的发送数据 [SWS_Dlt_00516]。通过 id 指定要发送的 I-PDU,而 info 提供目标缓冲区 (SduDataPtr) 以及所需的字节长度 (SduLength) [SWS_Dlt_00516]。传递 SduLength = 0(其中 SduDataPtr 允许作为 NULL_PTR 传递)允许通过 retry 传输纯状态变更,或查询发送缓冲区中的剩余数据量 [SWS_Dlt_00516]。通过输出参数 availableDataPtr,该函数返回 Tx 缓冲区中仍然可用的数据量,这例如允许具有动态有效负载长度的 TP 模块(如 FrIsoTp)对后续段进行尺寸确定 [SWS_Dlt_00516]。

确认与错误恢复

通过指针 retry 控制确认或重复传输 [SWS_Dlt_00516]:

  • 如果 retry 为 NULL_PTR,则允许在复制过程之后立即从缓冲区中丢弃已复制的数据 [SWS_Dlt_00516]。
  • 如果 TpDataState 指示值 TP_CONFPENDING,则先前复制的数据必须保留在缓冲区中,以便进行可能的错误恢复 [SWS_Dlt_00516]。
  • 在 TP_DATACONF 的情况下,在调用之前传输的所有数据均视为已确认并可被释放 [SWS_Dlt_00516]。
  • 在 TP_DATARETRY 的情况下,模块从 TxTpDataCnt 中传递的字节偏移量处重新开始复制 [SWS_Dlt_00516]。

返回值与边界条件

请求的结果报告为 BufReq_ReturnType [SWS_Dlt_00516]:

  • BUFREQ_OK:数据已按要求完全复制到目标缓冲区 [SWS_Dlt_00516]。
  • BUFREQ_E_BUSY:所需的数据量不可用;未复制任何数据,允许稍后重试 [SWS_Dlt_00516]。
  • BUFREQ_E_NOT_OK:请求失败;未复制任何数据 [SWS_Dlt_00516]。

该接口可通过 Dlt.h 获取,并设计为可重入的 [SWS_Dlt_00516]。调用上下文通常可能位于分段传输期间的下层传输协议模块中。 问题 Q-a81c439e73e0acc0 (未决)

此使用说明基于 AUTOSAR Classic R20-11 规范自动生成。

实现者指南即将推出(复杂度 I1)

函数 Dlt_StartReception [SWS_Dlt_91006] 📄 PDF

BufReq_ReturnType Dlt_StartOfReception (PduIdType id, const PduInfoType* info, PduLengthType TpSduLength, PduLengthType* bufferSizePtr);

This function is called at the start of receiving an N -

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 768ebb494705 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

同步且可重入的函数 Dlt_StartReception 在开始接收 N-SDU 时被调用,N-SDU 可以作为单帧(SF)接收,也可以分段通过多个 N-PDU 接收 [SWS_Dlt_91006]。它用于在 Dlt 模块中启动传输连接并提供可用的接收缓冲区 [SWS_Dlt_91006]。

通过参数 id 标识接收到的 I-PDU,而 info 传输首帧的有效负载数据和元数据,或者在既无数据也无元数据的情况下设置为 NULL_PTR [SWS_Dlt_91006]。通过 TpSduLength 传递 N-SDU 的总长度;如果以长度 0 调用该函数,它将通过 bufferSizePtr 返回当前最大可用缓冲区大小 [SWS_Dlt_91006]。传输协议使用 bufferSizePtr 中的值来计算块大小(BS)[SWS_Dlt_91006]。

若连接被接受,函数返回 BUFREQ_OK;若没有足够的缓冲区可用于所请求的大小,bufferSizePtr 则指示缓冲区大小为 0 以继续接收 [SWS_Dlt_91006]。在连接被拒绝时,BUFREQ_E_NOT_OK 中止接收,而在总内存不足时,将报告 BUFREQ_E_OVFL;在这两种错误情况下,bufferSizePtr 保持不变 [SWS_Dlt_91006]。

本使用说明基于 AUTOSAR Classic R20-11 规范。

实现者指南即将推出(复杂度 I1)

函数 Dlt_TpRxIndication [SWS_Dlt_91007] 📄 PDF

void Dlt_TpRxIndication (PduIdType id, Std_ReturnType result);

Called after an I - PDU has been received via the TP API, the result indicates whether the transmission was successful or not.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 494394e121a7 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

函数 Dlt_TpRxIndication 用作通过 TP-API 接收到 I-PDU 后的同步接收指示 [SWS_Dlt_91007]。它在头文件 Dlt.h 中声明,服务 ID 为 0x45 [SWS_Dlt_91007]。

用法与参数

向 DLT 模块的传递通过两个输入参数进行,该函数不返回任何返回值 [SWS_Dlt_91007]:

  • id(类型 PduIdType):标识接收到的 I-PDU [SWS_Dlt_91007]。
  • result(类型 Std_ReturnType):指示接收结果,并表明传输是否成功 [SWS_Dlt_91007]。

并发性与限制

该接口被定义为同步且可重入 [SWS_Dlt_91007]。既不存在输入/输出参数,也不存在纯输出参数 [SWS_Dlt_91007]。

错误处理与交互

传输结果仅通过实参 result 通知给 DLT 模块;未指定特定的错误代码、DET 或 DEM 消息 [SWS_Dlt_91007]。

解读:一旦 DLT 消息完全到达或传输中断,该调用可能由下层传输协议组件执行 [SWS_Dlt_91007]。 问题 Q-7d9c8564a2404acf (未决)

本使用说明由 AI 基于 AUTOSAR 规范 R20-11 生成。

实现者指南即将推出(复杂度 I1)

函数 Dlt_CopyRxData [SWS_Dlt_91008] 📄 PDF

BufReq_ReturnType Dlt_CopyRxData (PduIdType id, const PduInfoType* info, PduLengthType* bufferSizePtr);

Service Dlt_CopyRxData.

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 50201aae16ae 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

用法与语义

调用同步函数 Dlt_CopyRxData 以将 I-PDU 段(N-PDU)的已接收数据传递给上层 [SWS_Dlt_91008]。每次调用都会提供 I-PDU 数据的相应下一部分,剩余缓冲区大小将写入通过 bufferSizePtr 引用的存储位置 [SWS_Dlt_91008]。该声明可通过头文件 Dlt.h 获取 [SWS_Dlt_91008]。

参数与缓冲区查询

通过输入参数 id 标识接收到的 I-PDU [SWS_Dlt_91008]。指针 info 通过 SduDataPtr 提供源缓冲区,并通过 SduLength 提供要复制的字节数 [SWS_Dlt_91008]。如果传入的 SduLength 值为 0,则该调用仅用于查询上层模块中当前可用的缓冲区;在这种情况下,SduDataPtr 可以是 NULL_PTR [SWS_Dlt_91008]。输出参数 bufferSizePtr 返回复制过程后仍然空闲的接收缓冲区大小 [SWS_Dlt_91008]。

并发性与返回值

该函数设计为可重入的,服务 ID 为 0x44 [SWS_Dlt_91008]。类型为 BufReq_ReturnType 的返回值指示复制过程的结果:在成功接收数据时,该服务返回 BUFREQ_OK,而在出错时报告 BUFREQ_E_NOT_OK [SWS_Dlt_91008]。

注意:此使用说明由 AI 基于 AUTOSAR 规范 R20-11 生成。

实现者指南即将推出(复杂度 I1)

函数 Dlt_TxFunction [SWS_Dlt_91005] 📄 PDF

void Dlt_TxFunction (void);

-

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: ff1088c39156 来源 未决问题(2)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

用法与调用上下文

根据规范 [SWS_Dlt_91005],函数 Dlt_TxFunction 被定义为服务,服务 ID 为 0x80,可通过头文件 SchM_Dlt.h 获取。其接口签名为 void Dlt_TxFunction (void) [SWS_Dlt_91005]。SchM_Dlt.h 中的声明作为一种解读表明,该调用由 BSW 调度器在周期性任务的上下文中执行,而不应直接由应用程序软件组件调用。

参数与返回值

根据 [SWS_Dlt_91005],该函数不接受任何传入参数,并且不返回任何返回值(void)。从名称来看,该函数可能负责周期性处理和传输待发送的 Dlt 发送消息。 问题 (未决)由于未指定返回值,错误处理推测完全在模块或状态内部进行。

限制

由于有效负载不包含有关重入性或特殊开发错误的信息,因此调用间隔和任务分配需通过调度管理器配置进行协调。[SWS_Dlt_91005] 中未列出其他错误代码或 DET 条目。

本文本由 AI 生成;不能替代对官方 AUTOSAR 规范的研读。

类型 Dlt_ConfigType [SWS_Dlt_00437] 📄 PDF

This is the type of the data structure containing the initialization data for Dlt.

类型 Dlt_MessageIDType [SWS_Dlt_00228] 📄 PDF

Contains the unique Message Id for a message. This is only relevant in non - verbose mode.

类型 Dlt_MessageNetworkTraceInfoType [SWS_Dlt_00233] 📄 PDF

This type describes transported type of a Dlt BUSMESSAGE.

类型 Dlt_ApplicationIDType [SWS_Dlt_00226] 📄 PDF

This type describes the Application Id. 0x00000000 means the so - called wildcard.

类型 Dlt_ContextIDType [SWS_Dlt_00227] 📄 PDF

This type describes the Context Id. 0x00000000 means the so - called wildcard.

类型 Dlt_MessageArgumentCount [SWS_Dlt_00235] 📄 PDF

This type describes the count of arguments provided to a message.

类型 Dlt_AssignmentOperation [SWS_Dlt_00730] 📄 PDF

Adding or removing a Log Channel assignment for the given tuple of Application Id/ Context Id.

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/CP_MOD_Dlt
Status
unspecified
Version
AUTOSAR/AP/record/CP_MOD_Dlt@rel:R20-11#3b0fef65
Content hash
3b0fef65
Source
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_DiagnosticLogAndTrace.pdf#nameddest=SWS_Dlt_00239

初始化与状态

Returns the version information of this module.

void Dlt_GetVersionInfo (Std_VersionInfoType* versioninfo);
Dlt_Init 函数

Dlt is using the NVRam Manager and is to be initialized very late in the ECU startup phase. The Dlt_ Init() function should be called after the NVRam Manager is initialized.

void Dlt_Init (const Dlt_ConfigType* config);

服务

Service to fo rward error reports from Det to Dlt.

void Dlt_DetForwardErrorTrace (uint16 moduleId, uint8 instanceId, uint8 apiId, uint8 errorId);

Returns the Default Log Level currently used by the Dlt module. The returned Log Level might differ from the one which is stored no n volatile.

Std_ReturnType Dlt_GetDefaultLogLevel (Dlt_MessageLogLevelType* defaultLogLevel);

Called to request information about registered Application Ids, their Context Ids and the corresponding log level.

Std_ReturnType Dlt_GetLogInfo (uint8 options, Dlt_ApplicationIDType appId, Dlt_ContextIDType contextId, uint8* status, Dlt_LogInfoType* logInfo);

Returns the current Trace Status for a given tuple Application Id/ Context Id.

Std_ReturnType Dlt_GetTraceStatus (Dlt_ApplicationIDType appId, Dlt_ContextIDType contextId, boolean* traceStatus);

The service Dlt_ Reset To Factory Default sets the Log Level and Trace Status back to the pers istently stored default values. If the feature Nv MRAM support is enabled, all stored Dlt values in the Nv M are deleted.

Std_ReturnType Dlt_ResetToFactoryDefault (void);

The service represents the interface to be used by basic software modules or by software component to send Log Messages.

Std_ReturnType Dlt_SendLogMessage (Dlt_SessionIDType sessionId, const Dlt_MessageLogInfoType* logInfo, const uint8* logData, uint16 logDataLength);

The service represents the interface to be used by basic software modules or by software components to trace parameters.

Std_ReturnType Dlt_SendTraceMessage (Dlt_SessionIDType sessionId, const Dlt_MessageTraceInfoType* traceInfo, const uint8* traceData, uint16 traceDataLength);

Called to modify the pass through range for Log Messages for all not explicit set Context Ids.

Std_ReturnType Dlt_SetDefaultLogLevel (Dlt_MessageLogLevelType newLogLevel);

This service is used to change the Log Level for the given tuple of Application ID/ Context ID.

Std_ReturnType Dlt_SetLogLevel (Dlt_ApplicationIDType appId, Dlt_ContextIDType contextId, Dlt_MessageLogLevelType newLogLevel);

Switches on/ off the mes sage filtering functionality of the Dlt module.

Std_ReturnType Dlt_SetMessageFiltering (boolean status);

The service Dlt_ Set Trace Status sets the trace status for a specific tuple of Application ID and Context ID.

Std_ReturnType Dlt_SetTraceStatus (Dlt_ApplicationIDType appId, Dlt_ContextIDType contextId, boolean newTraceStatus);

Copies the current Dlt configuration to Nv RAM by calling Nv M_ Write Block().

Std_ReturnType Dlt_StoreConfiguration (void);

-

void Dlt_TxFunction (void);

The service has to be called when a software module is going to be stopped. Available vi a Dlt.h

Std_ReturnType Dlt_UnregisterContext (Dlt_SessionIDType sessionId, Dlt_ApplicationIDType appId, Dlt_ContextIDType contextId);

回调

Service Dlt_CopyRxData.

BufReq_ReturnType Dlt_CopyRxData (PduIdType id, const PduInfoType* info, PduLengthType* bufferSizePtr);

Service Dlt_CopyTxData.

BufReq_ReturnType Dlt_CopyTxData (PduIdType id, const PduInfoType* info, const RetryInfoType* retry, PduLengthType* availableDataPtr);

Indication of a received PDU from a lower layer communication interface module.

void Dlt_RxIndication (PduIdType RxPduId, const PduInfoType* PduInfoPtr);

This function is called at the start of receiving an N -

BufReq_ReturnType Dlt_StartOfReception (PduIdType id, const PduInfoType* info, PduLengthType TpSduLength, PduLengthType* bufferSizePtr);

Called after an I - PDU has been received via the TP API, the result indicates whether the transmission was successful or not.

void Dlt_TpRxIndication (PduIdType id, Std_ReturnType result);

This function is called after the I - PDU has been transmitted on its network, the result indicates whether the transmission was succe ssful or not.

void Dlt_TpTxConfirmation (PduIdType id, Std_ReturnType result);

Within this API , the upper layer module (called module) shall check whether the available data fits into the buffer size reported by Pdu Info Ptr - >Sdu Length. If it fits, it shall copy its data into the buffer provided by Pdu Info Ptr - >Sdu Data Ptr and update the length of the actual copied data in Pdu Info Ptr - >Sdu Length. If not, it returns E_ NOT_ OK without changing Pdu Info Ptr.

Std_ReturnType Dlt_TriggerTransmit (PduIdType TxPduId, PduInfoType* PduInfoPtr);

The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU.

void Dlt_TxConfirmation (PduIdType TxPduId, Std_ReturnType result);

类型

Information about Applications

This type describes the Application Id. 0x00000000 means the so - called wildcard.

Adding or removing a Log Channel assignment for the given tuple of Application Id/ Context Id.

This is the type of the data structure containing the initialization data for Dlt.

Context Information

This type describes the Context Id. 0x00000000 means the so - called wildcard.

This type describes the count of arguments provided to a message.

Contains the unique Message Id for a message. This is only relevant in non - verbose mode.

This type describes the log lev el for each log message.

This type describes transported type of a Dlt BUSMESSAGE.

Bitfield

This type describes labels for trace messages.

This type describes the type of the message.

This type identifies the session.

Type 类型

This type describes the Log Channel name.