iso14229 0.11.0
ISO14229-1 (UDS) C Library
Loading...
Searching...
No Matches
iso14229.h File Reference

ISO 14229 (UDS) library. More...

#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for iso14229.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  UDSSDU_t
 Service data unit (SDU). More...
struct  UDSTp_t
 UDS Transport layer. More...
struct  UDSClient_t
 UDS client structure. More...
struct  SecurityAccessResponse
 Security access response structure. More...
struct  RequestDownloadResponse
 Request download response structure. More...
struct  RoutineControlResponse
 Routine control response structure. More...
struct  UDSRDBIVar_t
 Read data by identifier variable structure. More...
struct  UDSReq_t
 Server request context. More...
struct  UDSServer_t
 UDS server structure. More...
struct  UDSDiagSessCtrlArgs_t
 Diagnostic session control arguments. More...
struct  UDSECUResetArgs_t
 ECU reset arguments. More...
struct  UDSCDIArgs_t
 Clear diagnostic information arguments. More...
struct  UDSRDTCIArgs_t
 Read DTC information arguments. More...
struct  UDSRDBIArgs_t
 Read data by identifier arguments. More...
struct  UDSReadMemByAddrArgs_t
 Read memory by address arguments. More...
struct  UDSCommCtrlArgs_t
 Communication control arguments. More...
struct  UDSSecAccessRequestSeedArgs_t
 Security access request seed arguments. More...
struct  UDSSecAccessValidateKeyArgs_t
 Security access validate key arguments. More...
struct  UDSWDBIArgs_t
 Write data by identifier arguments. More...
struct  UDSWriteMemByAddrArgs_t
 Write memory by address arguments. More...
struct  UDSDDDIArgs_t
 Dynamically define data identifier arguments. More...
struct  UDSIOCtrlArgs_t
 Input/output control by identifier arguments. More...
struct  UDSRoutineCtrlArgs_t
 Routine control arguments. More...
struct  UDSRequestDownloadArgs_t
 Request download arguments. More...
struct  UDSRequestUploadArgs_t
 Request upload arguments. More...
struct  UDSTransferDataArgs_t
 Transfer data arguments. More...
struct  UDSRequestTransferExitArgs_t
 Request transfer exit arguments. More...
struct  UDSRequestFileTransferArgs_t
 Request file transfer arguments. More...
struct  UDSControlDTCSettingArgs_t
 Control DTC setting arguments. More...
struct  UDSLinkCtrlArgs_t
 Link control arguments. More...
struct  UDSCustomArgs_t
 Custom service arguments. More...
struct  UDSTpISOTpC_t
 isotp-c implementation of UDSTp_t More...
struct  UDSTpISOTpCSocketCAN_t
 isotp-c over SocketCAN implementation of UDSTp_t More...
struct  UDSTpIsoTpSock_t
 linux ISO-TP socket implementation of UDSTp_t More...

Macros

#define static_assert(expr, msg)
#define UDS_SYS_CUSTOM   0
#define UDS_SYS_ZEPHYR   5
#define UDS_SYS   UDS_SYS_CUSTOM
 Selects the host system iso14229 is compiled for.
#define UDS_LOG_LEVEL   0U
 sets the logging level
#define UDS_ISOTP_MTU   (4095U)
 ISO-TP Maximum Transmission Unit (ISO-15764-2-2004 section 5.3.3).
#define UDS_TP_MTU   UDS_ISOTP_MTU
 ISOTP is the only supported tp type, so UDS inherits its MTU.
#define UDS_SERVER_SEND_BUF_SIZE   (UDS_TP_MTU)
 reduce this at your own risk to save RAM. Fuzz testing is done with the default of UDS_TP_MTU.
#define UDS_SERVER_RECV_BUF_SIZE   (UDS_TP_MTU)
 reduce this at your own risk to save RAM. Fuzz testing is done with the default of UDS_TP_MTU.
#define UDS_CLIENT_SEND_BUF_SIZE   (UDS_TP_MTU)
 reduce this at your own risk to save RAM. Fuzz testing is done with the default of UDS_TP_MTU.
#define UDS_CLIENT_RECV_BUF_SIZE   (UDS_TP_MTU)
 reduce this at your own risk to save RAM. Fuzz testing is done with the default of UDS_TP_MTU.
#define UDS_CLIENT_DEFAULT_P2_MS   (150U)
 default P2 timeout
#define UDS_CLIENT_DEFAULT_P2_STAR_MS   (1500U)
 default P2* timeout
#define UDS_SERVER_DEFAULT_P2_MS   (50)
 default P2 duration
#define UDS_SERVER_DEFAULT_P2_STAR_MS   (5000)
 default P2* duration
#define UDS_SERVER_DEFAULT_S3_MS   (5100)
 default S3 duration (ISO14229-2 2013 Table 5: 5000 -0/+200 ms)
#define UDS_SERVER_DEFAULT_POWER_DOWN_TIME_MS   (60)
#define UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_BOOT_DELAY_MS   (1000U)
 Amount of time to wait after boot before accepting 0x27 requests.
#define UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_AUTH_FAIL_DELAY_MS   (1000U)
 Amount of time to wait after an authentication failure before accepting another 0x27 request.
#define UDS_SERVER_DEFAULT_XFER_DATA_MAX_BLOCKLENGTH   (UDS_TP_MTU)
#define UDS_AUTOSELECT_TP   1
#define UDS_CUSTOM_MILLIS
 bring your own UDSMillis implementation
#define ISO_TP_USER_SEND_CAN_ARG   1
#define ISO_TP_NO_FORMATTED_ERRORS   1
#define UDS_LEV_DS_DS   1U
 Default Session.
#define UDS_LEV_DS_PRGS   2U
 Programming Session.
#define UDS_LEV_DS_EXTDS   3U
 Extended Diagnostic Session.
#define UDS_LEV_DS_SSDS   4U
 Safety System Diagnostic Session.
#define UDS_LEV_RT_HR   1U
 Hard Reset.
#define UDS_LEV_RT_KOFFONR   2U
 Key Off On Reset.
#define UDS_LEV_RT_SR   3U
 Soft Reset.
#define UDS_LEV_RT_ERPSD   4U
 Enable Rapid Power Shut Down.
#define UDS_LEV_RT_DRPSD   5U
 Disable Rapid Power Shut Down.
#define UDS_LEV_CTRLTP_ERXTX   0U
 EnableRxAndTx.
#define UDS_LEV_CTRLTP_ERXDTX   1U
 EnableRxAndDisableTx.
#define UDS_LEV_CTRLTP_DRXETX   2U
 DisableRxAndEnableTx.
#define UDS_LEV_CTRLTP_DRXTX   3U
 DisableRxAndTx.
#define UDS_CTP_NCM   1U
 NormalCommunicationMessages.
#define UDS_CTP_NWMCM   2U
 NetworkManagementCommunicationMessages.
#define UDS_CTP_NWMCM_NCM   3U
 NetworkManagementCommunicationMessagesAndNormalCommunicationMessages.
#define UDS_LEV_RCTP_STR   1U
 StartRoutine.
#define UDS_LEV_RCTP_STPR   2U
 StopRoutine.
#define UDS_LEV_RCTP_RRR   3U
 RequestRoutineResults.
#define UDS_MOOP_ADDFILE   1U
 AddFile.
#define UDS_MOOP_DELFILE   2U
 DeleteFile.
#define UDS_MOOP_REPLFILE   3U
 ReplaceFile.
#define UDS_MOOP_RDFILE   4U
 ReadFile.
#define UDS_MOOP_RDDIR   5U
 ReadDirectory.
#define UDS_MOOP_RSFILE   6U
 ResumeFile.
#define UDS_LEV_DTCSTP_ON   1U
 Resume updating DTCs.
#define UDS_LEV_DTCSTP_OFF   2U
 Stop updating DTCs.
#define UDS_LEV_LCTP_VMTWFP   1U
 VerifyModeTransitionWithFixedParameter.
#define UDS_LEV_LCTP_VMTWSP   2U
 VerifyModeTransitionWithSpecificParameter.
#define UDS_LEV_LCTP_TM   3U
 TransitionMode.
#define UDS_A_MTYPE_DIAG   0U
#define UDS_A_MTYPE_REMOTE_DIAG   1U
#define UDS_A_MTYPE_SECURE_DIAG   2U
#define UDS_A_MTYPE_SECURE_REMOTE_DIAG   3U
#define UDS_A_TA_TYPE_PHYSICAL   0U
#define UDS_A_TA_TYPE_FUNCTIONAL   1U
#define UDS_TP_NOOP_ADDR   (0xFFFFFFFFU)
 flags A_SA / A_TA as unused
#define UDS_ASSERT(x)
 used to enforce runtime invariants within iso14229
#define UDS_LOG_NONE   0U
#define UDS_LOG_ERROR   1U
#define UDS_LOG_WARN   2U
#define UDS_LOG_INFO   3U
#define UDS_LOG_DEBUG   4U
#define UDS_LOG_VERBOSE   5U
#define UDS_LOGE(tag, format, ...)
#define UDS_LOGW(tag, format, ...)
#define UDS_LOGI(tag, format, ...)
#define UDS_LOGD(tag, format, ...)
#define UDS_LOGV(tag, format, ...)
#define UDS_LOG_SDU(tag, buffer, buff_len, info)
#define UDS_PRINTF_FORMAT(fmt_index, first_arg)

Typedefs

typedef uint8_t UDS_A_Mtype_t
 private: oneof Uds_a_mtype
typedef uint8_t UDS_A_TA_Type_t
 private: oneof Uds_a_ta_type
typedef unsigned int UDS_LogLevel_t
 one of valid values for UDS_LOG_LEVEL

Enumerations

enum  UDSEvent_t {
  UDS_EVT_Err , UDS_EVT_DiagSessCtrl , UDS_EVT_EcuReset , UDS_EVT_ClearDiagnosticInfo ,
  UDS_EVT_ReadDTCInformation , UDS_EVT_ReadDataByIdent , UDS_EVT_ReadMemByAddr , UDS_EVT_CommCtrl ,
  UDS_EVT_SecAccessRequestSeed , UDS_EVT_SecAccessValidateKey , UDS_EVT_WriteDataByIdent , UDS_EVT_WriteMemByAddr ,
  UDS_EVT_DynamicDefineDataId , UDS_EVT_IOControl , UDS_EVT_RoutineCtrl , UDS_EVT_RequestDownload ,
  UDS_EVT_RequestUpload , UDS_EVT_TransferData , UDS_EVT_RequestTransferExit , UDS_EVT_SessionTimeout ,
  UDS_EVT_DoScheduledReset , UDS_EVT_RequestFileTransfer , UDS_EVT_ControlDTCSetting , UDS_EVT_LinkControl ,
  UDS_EVT_Custom , UDS_EVT_Poll , UDS_EVT_SendComplete , UDS_EVT_ResponseReceived ,
  UDS_EVT_Idle , UDS_EVT_MAX
}
 UDS events. More...
enum  UDSErr_t {
  UDS_FAIL = -1 , UDS_OK = 0 , UDS_PositiveResponse = 0 , UDS_NRC_GeneralReject = 0x10 ,
  UDS_NRC_ServiceNotSupported = 0x11 , UDS_NRC_SubFunctionNotSupported = 0x12 , UDS_NRC_IncorrectMessageLengthOrInvalidFormat = 0x13 , UDS_NRC_ResponseTooLong = 0x14 ,
  UDS_NRC_BusyRepeatRequest = 0x21 , UDS_NRC_ConditionsNotCorrect = 0x22 , UDS_NRC_RequestSequenceError = 0x24 , UDS_NRC_NoResponseFromSubnetComponent = 0x25 ,
  UDS_NRC_FailurePreventsExecutionOfRequestedAction = 0x26 , UDS_NRC_RequestOutOfRange = 0x31 , UDS_NRC_SecurityAccessDenied = 0x33 , UDS_NRC_AuthenticationRequired = 0x34 ,
  UDS_NRC_InvalidKey = 0x35 , UDS_NRC_ExceedNumberOfAttempts = 0x36 , UDS_NRC_RequiredTimeDelayNotExpired = 0x37 , UDS_NRC_SecureDataTransmissionRequired = 0x38 ,
  UDS_NRC_SecureDataTransmissionNotAllowed = 0x39 , UDS_NRC_SecureDataVerificationFailed = 0x3A , UDS_NRC_CertficateVerificationFailedInvalidTimePeriod = 0x50 , UDS_NRC_CertficateVerificationFailedInvalidSignature = 0x51 ,
  UDS_NRC_CertficateVerificationFailedInvalidChainOfTrust = 0x52 , UDS_NRC_CertficateVerificationFailedInvalidType = 0x53 , UDS_NRC_CertficateVerificationFailedInvalidFormat = 0x54 , UDS_NRC_CertficateVerificationFailedInvalidContent = 0x55 ,
  UDS_NRC_CertficateVerificationFailedInvalidScope = 0x56 , UDS_NRC_CertficateVerificationFailedInvalidCertificate = 0x57 , UDS_NRC_OwnershipVerificationFailed = 0x58 , UDS_NRC_ChallengeCalculationFailed = 0x59 ,
  UDS_NRC_SettingAccessRightsFailed = 0x5A , UDS_NRC_SessionKeyCreationOrDerivationFailed = 0x5B , UDS_NRC_ConfigurationDataUsageFailed = 0x5C , UDS_NRC_DeAuthenticationFailed = 0x5D ,
  UDS_NRC_UploadDownloadNotAccepted = 0x70 , UDS_NRC_TransferDataSuspended = 0x71 , UDS_NRC_GeneralProgrammingFailure = 0x72 , UDS_NRC_WrongBlockSequenceCounter = 0x73 ,
  UDS_NRC_RequestCorrectlyReceived_ResponsePending = 0x78 , UDS_NRC_SubFunctionNotSupportedInActiveSession = 0x7E , UDS_NRC_ServiceNotSupportedInActiveSession = 0x7F , UDS_NRC_RpmTooHigh = 0x81 ,
  UDS_NRC_RpmTooLow = 0x82 , UDS_NRC_EngineIsRunning = 0x83 , UDS_NRC_EngineIsNotRunning = 0x84 , UDS_NRC_EngineRunTimeTooLow = 0x85 ,
  UDS_NRC_TemperatureTooHigh = 0x86 , UDS_NRC_TemperatureTooLow = 0x87 , UDS_NRC_VehicleSpeedTooHigh = 0x88 , UDS_NRC_VehicleSpeedTooLow = 0x89 ,
  UDS_NRC_ThrottlePedalTooHigh = 0x8A , UDS_NRC_ThrottlePedalTooLow = 0x8B , UDS_NRC_TransmissionRangeNotInNeutral = 0x8C , UDS_NRC_TransmissionRangeNotInGear = 0x8D ,
  UDS_NRC_BrakeSwitchNotClosed = 0x8F , UDS_NRC_ShifterLeverNotInPark = 0x90 , UDS_NRC_TorqueConverterClutchLocked = 0x91 , UDS_NRC_VoltageTooHigh = 0x92 ,
  UDS_NRC_VoltageTooLow = 0x93 , UDS_NRC_ResourceTemporarilyNotAvailable = 0x94 , UDS_NRC_UNUSED_ISOSAEReserved = 0xFF , UDS_ERR_TIMEOUT = 0x100 ,
  UDS_ERR_DID_MISMATCH = 0x101 , UDS_ERR_SID_MISMATCH = 0x102 , UDS_ERR_SUBFUNCTION_MISMATCH , UDS_ERR_RESP_TOO_SHORT = 0x104 ,
  UDS_ERR_BUFSIZ = 0x105 , UDS_ERR_INVALID_ARG = 0x106 , UDS_ERR_BUSY = 0x107 , UDS_ERR_MISUSE = 0x108 ,
  UDS_ERR_TPORT = 0x200
}
 Error Codes, including NRCs defined by the standard. More...

Functions

UDSErr_t UDSTpSend (UDSTp_t *hdl, const uint8_t *buf, size_t len, const UDSSDU_t *info)
 Send to transport.
UDSErr_t UDSTpRecv (UDSTp_t *hdl, uint8_t *buf, size_t bufsiz, size_t *recvlen, UDSSDU_t *info)
 Receive from transport.
UDSErr_t UDSTpPoll (UDSTp_t *hdl)
 call this at <5ms intervals
uint32_t UDSMillis (void)
 Get time in milliseconds.
UDSErr_t UDSClientInit (UDSClient_t *client)
 Call this once.
UDSErr_t UDSClientPoll (UDSClient_t *client)
 Call at <5ms intervals.
UDSErr_t UDSSendBytes (UDSClient_t *client, const uint8_t *data, uint16_t size)
 Send user-defined bytes to a UDS server.
UDSErr_t UDSSendECUReset (UDSClient_t *client, uint8_t type)
 Request ECUReset.
UDSErr_t UDSSendDiagSessCtrl (UDSClient_t *client, uint8_t mode)
 Change the diagnostic session.
UDSErr_t UDSSendSecurityAccess (UDSClient_t *client, uint8_t level, const uint8_t *data, uint16_t size)
 Get Security Access.
UDSErr_t UDSSendCommCtrl (UDSClient_t *client, uint8_t ctrl, uint8_t comm)
 Change communication settings.
UDSErr_t UDSSendRDBI (UDSClient_t *client, const uint16_t *didList, uint16_t numDataIdentifiers)
 Read Data By Identifier.
UDSErr_t UDSSendWDBI (UDSClient_t *client, uint16_t dataIdentifier, const uint8_t *data, uint16_t size)
 Write Data By Identifier.
UDSErr_t UDSSendTesterPresent (UDSClient_t *client)
 What's up?
UDSErr_t UDSSendRoutineCtrl (UDSClient_t *client, uint8_t type, uint16_t routineIdentifier, const uint8_t *data, uint16_t size)
 Request to Twiddle Routines.
UDSErr_t UDSSendRequestDownload (UDSClient_t *client, uint8_t dataFormatIdentifier, uint8_t addressAndLengthFormatIdentifier, size_t memoryAddress, size_t memorySize)
 Request to Download via TransferData.
UDSErr_t UDSSendRequestUpload (UDSClient_t *client, uint8_t dataFormatIdentifier, uint8_t addressAndLengthFormatIdentifier, size_t memoryAddress, size_t memorySize)
 Request to Upload via TransferData.
UDSErr_t UDSSendTransferData (UDSClient_t *client, uint8_t blockSequenceCounter, uint16_t blockLength, const uint8_t *data, uint16_t size)
 Transfer Data to/from a buffer.
UDSErr_t UDSSendRequestTransferExit (UDSClient_t *client)
 Call this when finished with TransferData.
UDSErr_t UDSSendRequestFileTransfer (UDSClient_t *client, uint8_t mode, const char *filePath, size_t filePathLen, size_t fileSizeUncompressed, size_t fileSizeCompressed)
 filesystem-based frontend to TransferData
UDSErr_t UDSCtrlDTCSetting (UDSClient_t *client, uint8_t dtcSettingType, const uint8_t *dtcSettingControlOptionRecord, uint16_t len)
 control DTC setting
UDSErr_t UDSUnpackRDBIResponse (UDSClient_t *client, UDSRDBIVar_t *vars, uint16_t numVars)
 Parse server's response to RDBI.
UDSErr_t UDSUnpackSecurityAccessResponse (const UDSClient_t *client, struct SecurityAccessResponse *resp)
 Parse server's response to SecurityAccess.
UDSErr_t UDSUnpackRequestDownloadResponse (const UDSClient_t *client, struct RequestDownloadResponse *resp)
 Parse server's response to RequestDownload.
UDSErr_t UDSUnpackRoutineControlResponse (const UDSClient_t *client, struct RoutineControlResponse *resp)
 Parse server's response to RoutineControl.
UDSErr_t UDSServerInit (UDSServer_t *srv)
 call this once
void UDSServerPoll (UDSServer_t *srv)
 Call this at <5ms intervals.
UDSErr_t UDSServerTpISOTpCInit (UDSTpISOTpC_t *tp, uint32_t source_addr, uint32_t target_addr, uint32_t source_addr_func)
 Initialize isotp-c transport for UDSServer_t.
UDSErr_t UDSClientTpISOTpCInit (UDSTpISOTpC_t *tp, uint32_t source_addr, uint32_t target_addr, uint32_t target_addr_func)
 Initialize isotp-c transport for UDSClient_t.
UDSErr_t UDSTpISOTpCInit (UDSTpISOTpC_t *tp, uint32_t sa, uint32_t ta, uint32_t sa_func, uint32_t ta_func)
UDSErr_t UDSTpISOTpCPoll (UDSTp_t *tp)
UDSErr_t UDSServerTpISOTpCSocketCANInit (UDSTpISOTpCSocketCAN_t *tp, const char *ifname, uint32_t source_addr, uint32_t target_addr, uint32_t source_addr_func)
 Initialize isotp-c over SocketCAN transport for UDSServer_t.
UDSErr_t UDSClientTpISOTpCSocketCANInit (UDSTpISOTpCSocketCAN_t *tp, const char *ifname, uint32_t source_addr, uint32_t target_addr, uint32_t target_addr_func)
 Initialize isotp-c over SocketCAN transport for UDSClient_t.
void UDSTpISOTpCSocketCANDeinit (UDSTpISOTpCSocketCAN_t *tp)
 release socket
UDSErr_t UDSServerTpIsoTpSockInit (UDSTpIsoTpSock_t *tp, const char *ifname, uint32_t source_addr, uint32_t target_addr, uint32_t source_addr_func)
 for UDSServer_t
UDSErr_t UDSClientTpIsoTpSockInit (UDSTpIsoTpSock_t *tp, const char *ifname, uint32_t source_addr, uint32_t target_addr, uint32_t target_addr_func)
 for UDSClient_t
void UDSTpIsoTpSockDeinit (const UDSTpIsoTpSock_t *tp)
 release sockets

Detailed Description

SPDX-License-Identifier: MIT

See also
documentation at https://github.com/driftregion/iso14229

Definition in file iso14229.h.

Macro Definition Documentation

◆ ISO_TP_NO_FORMATTED_ERRORS

#define ISO_TP_NO_FORMATTED_ERRORS   1

Definition at line 260 of file iso14229.h.

◆ ISO_TP_USER_SEND_CAN_ARG

#define ISO_TP_USER_SEND_CAN_ARG   1

Definition at line 255 of file iso14229.h.

◆ static_assert

#define static_assert ( expr,
msg )

Definition at line 33 of file iso14229.h.

◆ UDS_A_MTYPE_DIAG

#define UDS_A_MTYPE_DIAG   0U

Definition at line 526 of file iso14229.h.

◆ UDS_A_MTYPE_REMOTE_DIAG

#define UDS_A_MTYPE_REMOTE_DIAG   1U

Definition at line 527 of file iso14229.h.

◆ UDS_A_MTYPE_SECURE_DIAG

#define UDS_A_MTYPE_SECURE_DIAG   2U

Definition at line 528 of file iso14229.h.

◆ UDS_A_MTYPE_SECURE_REMOTE_DIAG

#define UDS_A_MTYPE_SECURE_REMOTE_DIAG   3U

Definition at line 529 of file iso14229.h.

◆ UDS_A_TA_TYPE_FUNCTIONAL

#define UDS_A_TA_TYPE_FUNCTIONAL   1U

Definition at line 537 of file iso14229.h.

◆ UDS_A_TA_TYPE_PHYSICAL

#define UDS_A_TA_TYPE_PHYSICAL   0U

Definition at line 536 of file iso14229.h.

◆ UDS_ASSERT

#define UDS_ASSERT ( x)
Value:
assert(x)

Definition at line 622 of file iso14229.h.

◆ UDS_AUTOSELECT_TP

#define UDS_AUTOSELECT_TP   1

Definition at line 203 of file iso14229.h.

◆ UDS_CLIENT_DEFAULT_P2_MS

#define UDS_CLIENT_DEFAULT_P2_MS   (150U)

Definition at line 146 of file iso14229.h.

◆ UDS_CLIENT_DEFAULT_P2_STAR_MS

#define UDS_CLIENT_DEFAULT_P2_STAR_MS   (1500U)

Definition at line 150 of file iso14229.h.

◆ UDS_CLIENT_RECV_BUF_SIZE

#define UDS_CLIENT_RECV_BUF_SIZE   (UDS_TP_MTU)

Definition at line 142 of file iso14229.h.

◆ UDS_CLIENT_SEND_BUF_SIZE

#define UDS_CLIENT_SEND_BUF_SIZE   (UDS_TP_MTU)

Definition at line 137 of file iso14229.h.

◆ UDS_CUSTOM_MILLIS

#define UDS_CUSTOM_MILLIS

Bring your own UDSMillis implementation. Valid values:

See also
UDSMillis

Definition at line 228 of file iso14229.h.

◆ UDS_ISOTP_MTU

#define UDS_ISOTP_MTU   (4095U)

Definition at line 114 of file iso14229.h.

◆ UDS_LOG_LEVEL

#define UDS_LOG_LEVEL   0U

set UDS_LOG_LEVEL to 0U (UDS_LOG_NONE) to remove logging entirely.

See also
valid values for UDS_LOG_LEVEL for valid values

Definition at line 111 of file iso14229.h.

◆ UDS_LOG_SDU

#define UDS_LOG_SDU ( tag,
buffer,
buff_len,
info )
Value:
UDS_LogSDUInternal(UDS_LOG_DEBUG, tag, buffer, buff_len, info)
#define UDS_LOG_DEBUG
Definition iso14229.h:660

Definition at line 702 of file iso14229.h.

◆ UDS_LOGD

#define UDS_LOGD ( tag,
format,
... )
Value:
UDS_LogDummy(UDS_LOG_NONE, tag, format, ##__VA_ARGS__)
#define UDS_LOG_NONE
Definition iso14229.h:656

Definition at line 696 of file iso14229.h.

◆ UDS_LOGE

#define UDS_LOGE ( tag,
format,
... )
Value:
UDS_LogDummy(UDS_LOG_NONE, tag, format, ##__VA_ARGS__)

Definition at line 675 of file iso14229.h.

◆ UDS_LOGI

#define UDS_LOGI ( tag,
format,
... )
Value:
UDS_LogDummy(UDS_LOG_NONE, tag, format, ##__VA_ARGS__)

Definition at line 689 of file iso14229.h.

◆ UDS_LOGV

#define UDS_LOGV ( tag,
format,
... )
Value:
UDS_LogWrite(UDS_LOG_VERBOSE, tag, UDS_LOG_FORMAT(V, format), UDSMillis(), tag, ##__VA_ARGS__)
#define UDS_LOG_VERBOSE
Definition iso14229.h:661
uint32_t UDSMillis(void)
Get time in milliseconds.

Definition at line 700 of file iso14229.h.

◆ UDS_LOGW

#define UDS_LOGW ( tag,
format,
... )
Value:
UDS_LogDummy(UDS_LOG_NONE, tag, format, ##__VA_ARGS__)

Definition at line 682 of file iso14229.h.

◆ UDS_PRINTF_FORMAT

#define UDS_PRINTF_FORMAT ( fmt_index,
first_arg )

Definition at line 714 of file iso14229.h.

◆ UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_AUTH_FAIL_DELAY_MS

#define UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_AUTH_FAIL_DELAY_MS   (1000U)

Definition at line 191 of file iso14229.h.

◆ UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_BOOT_DELAY_MS

#define UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_BOOT_DELAY_MS   (1000U)

Definition at line 186 of file iso14229.h.

◆ UDS_SERVER_DEFAULT_P2_MS

#define UDS_SERVER_DEFAULT_P2_MS   (50)

Definition at line 156 of file iso14229.h.

◆ UDS_SERVER_DEFAULT_P2_STAR_MS

#define UDS_SERVER_DEFAULT_P2_STAR_MS   (5000)

Definition at line 160 of file iso14229.h.

◆ UDS_SERVER_DEFAULT_POWER_DOWN_TIME_MS

#define UDS_SERVER_DEFAULT_POWER_DOWN_TIME_MS   (60)

Duration between the server sending a positive response to an ECU reset request and the emission of a UDS_EVT_DoScheduledReset event. This should be set to a duration adequate for the server transport layer to finish responding to the ECU reset request.

Definition at line 177 of file iso14229.h.

◆ UDS_SERVER_DEFAULT_S3_MS

#define UDS_SERVER_DEFAULT_S3_MS   (5100)

Definition at line 164 of file iso14229.h.

◆ UDS_SERVER_DEFAULT_XFER_DATA_MAX_BLOCKLENGTH

#define UDS_SERVER_DEFAULT_XFER_DATA_MAX_BLOCKLENGTH   (UDS_TP_MTU)

ISO14229-1:2013 Table 396. This parameter is used by the requestDownload positive response message to inform the client how many data bytes (maxNumberOfBlockLength) to include in each TransferData request message from the client.

Definition at line 198 of file iso14229.h.

◆ UDS_SERVER_RECV_BUF_SIZE

#define UDS_SERVER_RECV_BUF_SIZE   (UDS_TP_MTU)

Definition at line 132 of file iso14229.h.

◆ UDS_SERVER_SEND_BUF_SIZE

#define UDS_SERVER_SEND_BUF_SIZE   (UDS_TP_MTU)

Definition at line 127 of file iso14229.h.

◆ UDS_SYS

#define UDS_SYS   UDS_SYS_CUSTOM
See also
valid values of UDS_SYS for the list of valid values

Definition at line 79 of file iso14229.h.

◆ UDS_TP_MTU

#define UDS_TP_MTU   UDS_ISOTP_MTU

Definition at line 118 of file iso14229.h.

◆ UDS_TP_NOOP_ADDR

#define UDS_TP_NOOP_ADDR   (0xFFFFFFFFU)

Definition at line 555 of file iso14229.h.

Typedef Documentation

◆ UDS_A_Mtype_t

typedef uint8_t UDS_A_Mtype_t

Definition at line 531 of file iso14229.h.

◆ UDS_A_TA_Type_t

typedef uint8_t UDS_A_TA_Type_t

Definition at line 539 of file iso14229.h.

◆ UDS_LogLevel_t

typedef unsigned int UDS_LogLevel_t

Definition at line 664 of file iso14229.h.

Enumeration Type Documentation

◆ UDSErr_t

enum UDSErr_t
See also
UDSErrToStr

Definition at line 317 of file iso14229.h.

◆ UDSEvent_t

enum UDSEvent_t

Events are passed to the server or client callback function along with a pointer to the associated argument structure.

Enumerator
UDS_EVT_Err 

Common event. Argument type: UDSErr_t *

UDS_EVT_DiagSessCtrl 

Server evt 0x10, argtype: UDSDiagSessCtrlArgs_t *

UDS_EVT_EcuReset 

Server evt 0x11, argtype: UDSECUResetArgs_t *

UDS_EVT_ClearDiagnosticInfo 

Server evt 0x14, argtype: UDSCDIArgs_t *

UDS_EVT_ReadDTCInformation 

Server evt 0x19, argtype: UDSRDTCIArgs_t *

UDS_EVT_ReadDataByIdent 

Server evt 0x22, argtype: UDSRDBIArgs_t *

UDS_EVT_ReadMemByAddr 

Server evt 0x23, argtype: UDSReadMemByAddrArgs_t *

UDS_EVT_CommCtrl 

Server evt 0x28, argtype: UDSCommCtrlArgs_t *

UDS_EVT_SecAccessRequestSeed 

Server evt 0x27, argtype: UDSSecAccessRequestSeedArgs_t *

UDS_EVT_SecAccessValidateKey 

Server evt 0x27, argtype: UDSSecAccessValidateKeyArgs_t *

UDS_EVT_WriteDataByIdent 

Server evt 0x2E, argtype: UDSWDBIArgs_t *

UDS_EVT_WriteMemByAddr 

Server evt 0x3D, argtype: UDSWriteMemByAddrArgs_t *

UDS_EVT_DynamicDefineDataId 

Server evt 0x2C, argtype: UDSDDDIArgs_t *

UDS_EVT_IOControl 

Server evt 0x2F, argtype: UDSIOCtrlArgs_t *

UDS_EVT_RoutineCtrl 

Server evt 0x31, argtype: UDSRoutineCtrlArgs_t *

UDS_EVT_RequestDownload 

Server evt 0x34, argtype: UDSRequestDownloadArgs_t *

UDS_EVT_RequestUpload 

Server evt 0x35, argtype: UDSRequestUploadArgs_t *

UDS_EVT_TransferData 

Server evt 0x36, argtype: UDSTransferDataArgs_t *

UDS_EVT_RequestTransferExit 

Server evt 0x37, argtype: UDSRequestTransferExitArgs_t *

UDS_EVT_SessionTimeout 

Server evt 0x38, argtype: NULL

UDS_EVT_DoScheduledReset 

Server evt 0x39, argtype: uint8_t *

UDS_EVT_RequestFileTransfer 

Server evt 0x38, argtype: UDSRequestFileTransferArgs_t *

UDS_EVT_ControlDTCSetting 

Server evt 0x85, argtype: UDSControlDTCSettingArgs_t *

UDS_EVT_LinkControl 

Server evt 0x87, argtype: UDSLinkCtrlArgs_t *

UDS_EVT_Custom 

Server evt other, argtype: UDSCustomArgs_t *

UDS_EVT_Poll 

Client evt: Poll. Argument type: NULL

UDS_EVT_SendComplete 

Client evt: Send complete. Argument type: NULL

UDS_EVT_ResponseReceived 

Client evt: Response received. Argument type: NULL

UDS_EVT_Idle 

Client evt: Idle. Argument type: NULL

UDS_EVT_MAX 

Unused sentinel value

Definition at line 277 of file iso14229.h.

Function Documentation

◆ UDSClientInit()

UDSErr_t UDSClientInit ( UDSClient_t * client)

Definition at line 366 of file iso14229.c.

◆ UDSClientPoll()

UDSErr_t UDSClientPoll ( UDSClient_t * client)

Definition at line 1173 of file iso14229.c.

◆ UDSClientTpISOTpCInit()

UDSErr_t UDSClientTpISOTpCInit ( UDSTpISOTpC_t * tp,
uint32_t source_addr,
uint32_t target_addr,
uint32_t target_addr_func )
Parameters
tpUDSTpISOTpC_t instance.
source_addrClient listens for responses at this address.
target_addrClient sends physical requests to this address.
target_addr_funcClient sends functional transmissions to this address.

Definition at line 3323 of file iso14229.c.

◆ UDSClientTpISOTpCSocketCANInit()

UDSErr_t UDSClientTpISOTpCSocketCANInit ( UDSTpISOTpCSocketCAN_t * tp,
const char * ifname,
uint32_t source_addr,
uint32_t target_addr,
uint32_t target_addr_func )
Parameters
tpUDSTpISOTpC_t instance.
source_addrClient listens for responses at this address.
target_addrClient sends physical requests to this address.
target_addr_funcClient sends functional transmissions to this address.

Definition at line 3476 of file iso14229.c.

◆ UDSClientTpIsoTpSockInit()

UDSErr_t UDSClientTpIsoTpSockInit ( UDSTpIsoTpSock_t * tp,
const char * ifname,
uint32_t source_addr,
uint32_t target_addr,
uint32_t target_addr_func )

Definition at line 3744 of file iso14229.c.

◆ UDSCtrlDTCSetting()

UDSErr_t UDSCtrlDTCSetting ( UDSClient_t * client,
uint8_t dtcSettingType,
const uint8_t * dtcSettingControlOptionRecord,
uint16_t len )

Definition at line 1022 of file iso14229.c.

◆ UDSMillis()

uint32_t UDSMillis ( void )
Returns
current time in milliseconds
Note
implementers must ensure the return value is monotonically increasing between calls. The value must never go backwards. Wrap-around (overflow back to 0) is expected; this is handled by UDSTimeAfter.

◆ UDSSendBytes()

UDSErr_t UDSSendBytes ( UDSClient_t * client,
const uint8_t * data,
uint16_t size )

Definition at line 654 of file iso14229.c.

◆ UDSSendCommCtrl()

UDSErr_t UDSSendCommCtrl ( UDSClient_t * client,
uint8_t ctrl,
uint8_t comm )

Definition at line 689 of file iso14229.c.

◆ UDSSendDiagSessCtrl()

UDSErr_t UDSSendDiagSessCtrl ( UDSClient_t * client,
uint8_t mode )

Definition at line 678 of file iso14229.c.

◆ UDSSendECUReset()

UDSErr_t UDSSendECUReset ( UDSClient_t * client,
uint8_t type )

Definition at line 667 of file iso14229.c.

◆ UDSSendRDBI()

UDSErr_t UDSSendRDBI ( UDSClient_t * client,
const uint16_t * didList,
uint16_t numDataIdentifiers )

Definition at line 712 of file iso14229.c.

◆ UDSSendRequestDownload()

UDSErr_t UDSSendRequestDownload ( UDSClient_t * client,
uint8_t dataFormatIdentifier,
uint8_t addressAndLengthFormatIdentifier,
size_t memoryAddress,
size_t memorySize )

Definition at line 804 of file iso14229.c.

◆ UDSSendRequestFileTransfer()

UDSErr_t UDSSendRequestFileTransfer ( UDSClient_t * client,
uint8_t mode,
const char * filePath,
size_t filePathLen,
size_t fileSizeUncompressed,
size_t fileSizeCompressed )

Definition at line 917 of file iso14229.c.

◆ UDSSendRequestTransferExit()

UDSErr_t UDSSendRequestTransferExit ( UDSClient_t * client)

Definition at line 907 of file iso14229.c.

◆ UDSSendRequestUpload()

UDSErr_t UDSSendRequestUpload ( UDSClient_t * client,
uint8_t dataFormatIdentifier,
uint8_t addressAndLengthFormatIdentifier,
size_t memoryAddress,
size_t memorySize )

Definition at line 841 of file iso14229.c.

◆ UDSSendRoutineCtrl()

UDSErr_t UDSSendRoutineCtrl ( UDSClient_t * client,
uint8_t type,
uint16_t routineIdentifier,
const uint8_t * data,
uint16_t size )

Definition at line 768 of file iso14229.c.

◆ UDSSendSecurityAccess()

UDSErr_t UDSSendSecurityAccess ( UDSClient_t * client,
uint8_t level,
const uint8_t * data,
uint16_t size )

Definition at line 1062 of file iso14229.c.

◆ UDSSendTesterPresent()

UDSErr_t UDSSendTesterPresent ( UDSClient_t * client)

Definition at line 701 of file iso14229.c.

◆ UDSSendTransferData()

UDSErr_t UDSSendTransferData ( UDSClient_t * client,
uint8_t blockSequenceCounter,
uint16_t blockLength,
const uint8_t * data,
uint16_t size )

Definition at line 876 of file iso14229.c.

◆ UDSSendWDBI()

UDSErr_t UDSSendWDBI ( UDSClient_t * client,
uint16_t dataIdentifier,
const uint8_t * data,
uint16_t size )

Definition at line 736 of file iso14229.c.

◆ UDSServerInit()

UDSErr_t UDSServerInit ( UDSServer_t * srv)

Definition at line 2773 of file iso14229.c.

◆ UDSServerPoll()

void UDSServerPoll ( UDSServer_t * srv)

Definition at line 2790 of file iso14229.c.

◆ UDSServerTpISOTpCInit()

UDSErr_t UDSServerTpISOTpCInit ( UDSTpISOTpC_t * tp,
uint32_t source_addr,
uint32_t target_addr,
uint32_t source_addr_func )
Parameters
tpUDSTpISOTpC_t instance.
source_addrServer listens for physical transmissions on this address.
target_addrServer sends responses to this address.
source_addr_funcServer listens for functional transmissions on this address.

Definition at line 3318 of file iso14229.c.

◆ UDSServerTpISOTpCSocketCANInit()

UDSErr_t UDSServerTpISOTpCSocketCANInit ( UDSTpISOTpCSocketCAN_t * tp,
const char * ifname,
uint32_t source_addr,
uint32_t target_addr,
uint32_t source_addr_func )
Parameters
tpUDSTpISOTpSocketCAN_t instance.
source_addrServer listens for physical transmissions on this address.
target_addrServer sends responses to this address.
source_addr_funcServer listens for functional transmissions on this address.

Definition at line 3469 of file iso14229.c.

◆ UDSServerTpIsoTpSockInit()

UDSErr_t UDSServerTpIsoTpSockInit ( UDSTpIsoTpSock_t * tp,
const char * ifname,
uint32_t source_addr,
uint32_t target_addr,
uint32_t source_addr_func )

Definition at line 3717 of file iso14229.c.

◆ UDSTpISOTpCInit()

UDSErr_t UDSTpISOTpCInit ( UDSTpISOTpC_t * tp,
uint32_t sa,
uint32_t ta,
uint32_t sa_func,
uint32_t ta_func )

Definition at line 3298 of file iso14229.c.

◆ UDSTpISOTpCPoll()

UDSErr_t UDSTpISOTpCPoll ( UDSTp_t * tp)

Definition at line 3182 of file iso14229.c.

◆ UDSTpISOTpCSocketCANDeinit()

void UDSTpISOTpCSocketCANDeinit ( UDSTpISOTpCSocketCAN_t * tp)

Definition at line 3483 of file iso14229.c.

◆ UDSTpIsoTpSockDeinit()

void UDSTpIsoTpSockDeinit ( const UDSTpIsoTpSock_t * tp)

Definition at line 3770 of file iso14229.c.

◆ UDSTpPoll()

UDSErr_t UDSTpPoll ( UDSTp_t * hdl)

Definition at line 2899 of file iso14229.c.

◆ UDSTpRecv()

UDSErr_t UDSTpRecv ( UDSTp_t * hdl,
uint8_t * buf,
size_t bufsiz,
size_t * recvlen,
UDSSDU_t * info )

Definition at line 2891 of file iso14229.c.

◆ UDSTpSend()

UDSErr_t UDSTpSend ( UDSTp_t * hdl,
const uint8_t * buf,
size_t len,
const UDSSDU_t * info )

Definition at line 2884 of file iso14229.c.

◆ UDSUnpackRDBIResponse()

UDSErr_t UDSUnpackRDBIResponse ( UDSClient_t * client,
UDSRDBIVar_t * vars,
uint16_t numVars )

Definition at line 1191 of file iso14229.c.

◆ UDSUnpackRequestDownloadResponse()

UDSErr_t UDSUnpackRequestDownloadResponse ( const UDSClient_t * client,
struct RequestDownloadResponse * resp )

Definition at line 1151 of file iso14229.c.

◆ UDSUnpackRoutineControlResponse()

UDSErr_t UDSUnpackRoutineControlResponse ( const UDSClient_t * client,
struct RoutineControlResponse * resp )

Definition at line 1124 of file iso14229.c.

◆ UDSUnpackSecurityAccessResponse()

UDSErr_t UDSUnpackSecurityAccessResponse ( const UDSClient_t * client,
struct SecurityAccessResponse * resp )

Definition at line 1099 of file iso14229.c.