UDS Server Stack

Overview

RAPIDSEA supports ISO14229 protocol as explained in the ISO14229 - UDS Protocol page. This page explains the server architecture and details how the user should interface the stack with their custom logic and realize the ECU implementation quickly. It also provides guidelines on adopting the stack for different systems.

The below diagram captures the block level diagram of the DoCAN UDS server and how it interfaces with other modules.

DoCAN UDS Stack Block Diagram

The below diagram captures the block level diagram of the DoIP UDS server and how it interfaces with other modules.

DoIP UDS Stack Block Diagram

DoCAN Interface

The UDS server communicates over the CAN network through the underlying DoCAN stack (ISO15765). This DoCAN stack is also available as part of the RAPIDSEA components. All the functions that are needed are available as part of the DoCAN stack and has to be compiled together.

DoCAN Interface

Mode

Description

rs_iso15765_*

Set of functions called by UDS server to perform operation such as initialize, transmit messages etc

rs_uds_server_docan_callback

Callback function called by the DoCAN layer to inform of Data Indication, error etc

These details with respect to the DoCAN interface are covered in detail in the ISO15765 - DoCAN Protocol page.

DoIP Interface

The UDS server communicates over the Ethernet through the underlying DoIP stack (ISO13400). This DoIP stack is also available as part of the RAPIDSEA components. All the functions that are needed are available as part of the DoIP stack and has to be compiled together.

DoIP Interface

Mode

Description

rs_iso13400_*

Set of functions called by UDS server to perform operation such as initialize, transmit messages etc

rs_uds_server_docan_callback

Callback function called by the DoIP layer to inform of Data Indication, error etc

These details with respect to the DoIP interface are covered in detail in the ISO13400 - DoIP Protocol page.

Application Interface

While the RAPIDSEA UDS server stack can handle most of the functionality such as message validation, session management, timing control etc, the business logic has to implement the application functionality. the RAPIDSEA UDS server clearly defines API and callback functions that are essential for the user to use/implement.

The below table captures the function that are to be called from the application logic.

API Functions

Function

Description

rs_uds_server_open

To initialize the UDS server stack

rs_uds_server_set_p2_timing

To setup the P2 timing associated with the server

rcb_uds_server_session_timeout

To setup the session timeout value

rs_uds_server_process

To be called periodically to process the incoming/outgoing messages

rs_uds_server_close

To free the UDS server handle

There are many functions through which the UDS server stack retrieves information from the application logic or indicate actions to be performed. These functions are captured in the below table.

Callback Functions

Function

Description

rcb_uds_server_is_request_allowed

Called to check if security permission and session is available for the given service code

rcb_uds_server_10h_session_default

Called to indicate request for default session setup

rcb_uds_server_10h_session_programming

Called to indicate request for programming session setup

rcb_uds_server_10h_session_extended

Called to indicate request for extended diagnostic session setup

rcb_uds_server_10h_session_safety_system

Called to indicate request for safety system session setup

rcb_uds_server_10h_session_custom

Called to indicate request for custom session setup

rcb_uds_server_session_timeout

Called to indicate when the active session times out

rcb_uds_server_11h_ecu_reset_req

Called to indicate Reset request received from Tester

rcb_uds_server_14h_clear_dtc

Called to clear DTC information by group ID

rcb_uds_server_19h_read_dtc_info

Called to read DTC information by various report types

rcb_uds_server_22h_read_did

Called to read Data by ID

rcb_uds_server_23h_read_mem_by_addr

Called to read Memory by address

rcb_uds_server_24h_read_scaling_data_by_did

Called to read scaling data by ID

rcb_uds_server_27h_secure_access

Called to perform secure access on the device

rcb_uds_server_28h_comm_control

Called to indicate change in communication control

rcb_uds_server_2ah_read_data_periodic_by_id

Called to register/un-register for periodic read of data

rcb_uds_server_2eh_write_did

Called to write Data By ID

rcb_uds_server_2fh_io_control

Called to perform temporary control of given Data ID

rcb_uds_server_31h_routine_start

Called to Start a Routine

rcb_uds_server_31h_routine_stop

called to Stop a Routine

rcb_uds_server_31h_routine_status

Called to query status for a routine operation

rcb_uds_server_30h_get_block_size

Called to get the block size to be used for transfer

rcb_uds_server_30h_get_min_seperation_time

Called to get the separation for the transfer

rcb_uds_server_34h_get_max_block_len

Called to get maximum block size for transfer operation

rcb_uds_server_34h_req_download

Called to indicate download request from client

rcb_uds_server_36h_transfer_data

Called to transfer to/from client

rcb_uds_server_37h_req_transfer_exit

Called to terminate/stop transfer operation

rcb_uds_server_3dh_write_mem_by_addr

Called to write to given memory address

rcb_uds_server_3eh_tester_present

Called to indicate that the tester is still connected

rcb_uds_server_83h_access_timing_parameter

Called to get/set access timing parameters

rcb_uds_server_84h_secured_data_transmission

Called to transfer data in a secure way

rcb_uds_server_85h_control_dtc

Called to control DTC setting

rcb_uds_server_87h_link_control

Called to set link control parameters

rcb_uds_server_35h_req_upload

Called to initiate an upload session

rcb_uds_server_set_roe_start_processing

Called to set the given value to the roe start processing parameter

rcb_uds_server_get_roe_start_event

Called to get the value of roe start event.

rcb_uds_server_86h_get_num_of_activated_events

Called to get the how many events are activated.

rcb_uds_server_86h_resp_on_event

Called to perform response on event operation

These functions are documented in detail in the below sections. It is important for the server to implement these functions correct for proper operation of the system.

Implementation Guide

This section explains how the UDS server can be implemented using the RAPIDSEA stack. Whether the stack is available in source form or in binary form, the steps to be followed are

  • Implement the Callback functions mentioned above

  • Implement the underlying rs_can_* functions for DoCAN as per the underlying hardware design as described in the CAN Interface page and rs_iso13400_* functions for DoIP

  • Initialize the buffers necessary for the operation

  • Initialize the CAN, ISO15765 and ISO14229 stack function for DoCAN and Ethernet socket , ISO13400 and ISO14229 for DoIP.

  • Periodically call the process functions so that internal timeouts are handled.

High level flow chart is depicted below for DoCAN:

DoCAN UDS Server Flow Diagram

High level flow chart is depicted below for DoIP:

DoIP UDS Server Flow Diagram

This can be implemented in a bare-metal system or over RTOS or over full fledged OS such as Linux etc.

Example demo

An example implementation is available along with the release and is described in DoCAN UDS Server Demo.

UDS Header Details

Documentation from the relevant header as follows:

ISO14229 UDS Server Module.

This file contains the APIs for using ISO14229 defined UDS server module

Author

Embien RAPIDSEA Team

Copyright

Embien Technologies India Pvt. Ltd.

Defines

RS_UDS_SERVER_MAX_NUM_RX_MSGS

Number of receive messages that can be buffered during reception.

Typedefs

typedef struct tag_rs_uds_server_config rs_uds_server_config_t

Contains information about UDS server configuration.

typedef struct tag_rs_uds_server_instance rs_uds_server_instance_t

Contains information about UDS server instance.

Functions

rs_handle_t rs_uds_server_open(rs_uds_server_instance_t *ptr_instance, rs_uds_server_config_t *ptr_config)

Initializes the UDS server stack.

This function initializes the UDS stack for server operation

Parameters:
  • ptr_instance[in] - Pointer to the UDS server instance information

  • ptr_config[in] - Pointer to the UDS server configuration

Returns:

Handle of the UDS server instance information which include configuration information also

rs_ret_val_t rs_uds_server_set_p2_timing(rs_handle_t uds_server_handle, uint16_t u16_p2_server, uint16_t u16_p2_ext_server)

Configures the UDS server stack P2 timings.

This function sets the P2 timings for the UDS server stack

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u16_p2_server[in] - P2 server time

  • u16_p2_ext_server[in] - P2 extended server time

Returns:

Return 0 on success

rs_ret_val_t rs_uds_server_set_session_timeout(rs_handle_t uds_server_handle, uint16_t u16_session_timeout)

Configures the UDS server stack session timeout value.

This function sets the session timeout value for the UDS server stack

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u16_session_timeout[in] - Time in ms after which the session should timeout if there is no tester activity

Returns:

Return 0 on success

rs_ret_val_t rs_uds_server_process(rs_handle_t uds_server_handle)

Function to be called periodically to process underlying UDS server state machines.

This function is to be called at not more than 5 ms interval

Parameters:

uds_server_handle[in] - Handle to the UDS server instance

Returns:

Return 0 on success

rs_ret_val_t rcb_uds_server_is_request_allowed(rs_handle_t uds_serv_handle, uint8_t u8_service_id)

Callback function to know if session permission and security is allowed for the given service id.

This function is called by the underlying UDS server to check if the active diagnostics session/security permission is allowed for the given service code

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_service_id[in] - Service Code

Returns:

Return 1 if service is permissible or 0 if it has to be disallowed

rs_ret_val_t rcb_uds_server_10h_session_default(rs_handle_t uds_serv_handle)

Transition from the current session to default session.

This function is used to transition from the current session to default session. Decision to allow transition to this session, any timings/variables to be updated as per the session has to be handled by this function.

Parameters:

uds_server_handle[in] - Handle to the UDS server instance

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_10h_session_programming(rs_handle_t uds_serv_handle)

Transition from current session to programming session. Decision to allow transition to this session, any timings/variables to be updated as per the session has to be handled by this function.

This function is used to move from current session to programming session state

Parameters:

uds_server_handle[in] - Handle to the UDS server instance

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_10h_session_extended(rs_handle_t uds_serv_handle)

Transition from current session to extended session. Decision to allow transition to this session, any timings/variables to be updated as per the session has to be handled by this function.

This function is used to transition from current session to extended session.

Parameters:

uds_server_handle[in] - Handle to the UDS server instance

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_10h_session_safety_system(rs_handle_t uds_serv_handle)

Transition from current session to safety system session. Decision to allow transition to this session, any timings/variables to be updated as per the session has to be handled by this function.

This function is used to transition from current session to safety system session.

Parameters:

uds_server_handle[in] - Handle to the UDS server instance

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_10h_session_custom(rs_handle_t uds_serv_handle, uint8_t u8_session_type)

Transition from current session to a vendor/system specific session. Decision to allow transition to this session, any timings/variables to be updated as per the session has to be handled by this function.

This function is used to transition from current session to given session type.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_session_type[in] - Session type requested

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_session_timeout(rs_handle_t uds_serv_handle)

Called when a session times out.

This function is called when an active session times out due to client inactivity.

Parameters:

uds_server_handle[in] - Handle to the UDS server instance

Returns:

Return 0 on success

rs_ret_val_t rcb_uds_server_11h_ecu_reset_req(rs_handle_t uds_serv_handle, uint8_t u8_reset_type, uint8_t *ptr_power_down_time)

Resets the ECU.

This function resets the ECU based on reset type.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_reset_type[in] - Reset type.

  • u8_power_down_time[out] - Power down sequence time (in seconds) when RapidPowerShutDown(u8_reset_type(0x04)) is requested.

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_14h_clear_dtc(rs_handle_t uds_serv_handle, uint32_t u32_dtc)

Clear the specified diagnostic trouble code.

This function is used to perform a clear operation on the specified diagnostic trouble code.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u32_dtc[in] - Diagnostic trouble code to be cleared

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_19h_read_dtc_info(rs_handle_t uds_serv_handle, uint8_t u8_report_type, uint8_t *ptr_rec_data, uint16_t u16_rec_len, uint8_t *ptr_resp_param, uint16_t *ptr_resp_len)

Perform read the diagnostic trouble code operation.

This function is used to read diagnostic trouble code specified by given record id

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_report_type[in] - Report type requested

  • ptr_rec_data[in] - Pointer to record buffer

  • u16_rec_len[in] - Record length

  • ptr_resp_param[out] - Pointer to response buffer

  • ptr_resp_len[out] - Pointer to return response length

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_22h_read_did(rs_handle_t uds_serv_handle, uint16_t u16_data_id, uint8_t *ptr_data, uint16_t *ptr_data_len)

Read data from specified data id.

This function is to read information at an internal location specified by the provided data identifier.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u16_data_id[in] - ID to the server data record that the client is requesting to read.

  • ptr_data[out] - The data record associated with the data ID.

  • ptr_data_len[out] - Length of the data record.

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_23h_read_mem_by_addr(rs_handle_t uds_serv_handle, uint32_t u32_memory_address, uint32_t u32_memory_size, uint8_t *ptr_resp_data)

Perform to Read the data from specified location in memory.

This function is used to perform a Read data from specified location in memory.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u32_memory_address[in] - Memory location to read

  • u32_memory_size[in] - Size of memory to read in bytes

  • ptr_resp_data[out] - Pointer to response buffer to return the read contents

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_24h_read_scaling_data_by_did(rs_handle_t uds_serv_handle, uint16_t u16_data_id, uint8_t *ptr_data, uint16_t *ptr_data_len)

Read scaling data for specified data id.

This function is to read scaling information for the provided data identifier.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u16_data_id[in] - ID to the server data record that the client is requesting scaling information.

  • ptr_data[in] - Scaling data associated with the data ID.

  • ptr_data_len[out] - Length of the scaling data record.

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_27h_secure_access(rs_handle_t uds_serv_handle, uint8_t u8_access_type, uint8_t *ptr_record, uint32_t u32_rec_len, uint8_t *ptr_resp_param, uint32_t *ptr_resp_len)

To perform secure diagnostics access on the devices.

This function request to initiate a secure session for performing safety-critical operations.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_access_type[in] - Type of access to be performed

  • ptr_record[in] - Pointer to the record data

  • u32_rec_len[in] - Number of bytes of record

  • ptr_resp_param[in] - Pointer to store response data

  • ptr_resp_len[in] - Pointer to store response data length

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_28h_comm_control(rs_handle_t uds_serv_handle, uint8_t u8_ctrl_type, uint8_t u8_comm_type, uint16_t u16_node_id)

Communication control request.

This function request to switch on/off the transmission and/or the reception of certain messages.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_ctrl_type[in] - Type of modification applies on the u8_comm_type.

  • u8_comm_type[in] - Type of communication to be controlled.

  • u16_node_id[in] - Node ID on a sub-network.

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_2ah_read_data_periodic_by_id(rs_handle_t uds_serv_handle, uint8_t u8_transmission_mode, uint8_t *ptr_id, uint32_t u32_num_ids)

To register/un-register for periodic read of data.

This function is used to read data periodically with the given rate. Given IDs are to be prefixed with 0xF2.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_transmission_mode[in] - Start with given rate or Stop periodic update

  • ptr_id[in] - Pointer to the list of data ids

  • u32_num_ids[in] - Number of data ids

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_2eh_write_did(rs_handle_t uds_serv_handle, uint16_t u16_data_id, uint8_t *ptr_data, uint16_t u16_data_len)

Write data by Identifier.

This function is to write information at an internal location specified by the provided data identifier.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u16_data_id[in] - ID to the server data record that the client is requesting to write.

  • ptr_data[in] - The data record associated with the data ID.

  • u16_data_len[in] - Length of the data record.

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_2fh_io_control(rs_handle_t uds_serv_handle, uint16_t u16_data_id, uint8_t *ptr_rec, uint32_t u32_rec_len, uint8_t *ptr_resp, uint32_t *ptr_resp_len)

Perform IO Control operation on Data ID.

This function is used to perform IO control operation on the given Data ID

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u16_data_id[in] - Data ID to be controlled

  • ptr_rec[in] - Pointer to the record buffer received from the client.

  • u32_rec_len[in] - Record length

  • ptr_resp[out] - Pointer to response buffer to be sent to client

  • ptr_resp_len[out] - Pointer to return response length

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_31h_routine_start(rs_handle_t uds_serv_handle, uint16_t u16_routine_id, uint8_t *ptr_req_param, uint8_t u8_req_len, uint8_t *ptr_resp_param, uint8_t *ptr_resp_len)

Start a Routine.

This function is to start a routine.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u16_routine_id[in] - Routine ID.

  • ptr_req_param[in] - Routine request parameter.

  • u8_req_len[in] - Routine request parameter length.

  • ptr_resp_param[out] - Routine response parameter.

  • ptr_resp_len[out] - Routine response parameter length.

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_31h_routine_stop(rs_handle_t uds_serv_handle, uint16_t u16_routine_id, uint8_t *ptr_req_param, uint8_t u8_req_len, uint8_t *ptr_resp_param, uint8_t *ptr_resp_len)

Stop a Routine.

This function is to stop a routine.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u16_routine_id[in] - Routine ID.

  • ptr_req_param[in] - Routine request parameter.

  • u8_req_len[in] - Routine request parameter length.

  • ptr_resp_param[out] - Routine response parameter.

  • ptr_resp_len[out] - Routine response parameter length.

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_31h_routine_status(rs_handle_t uds_server_handle, uint16_t u16_routine_id, uint8_t *ptr_resp_param, uint8_t *ptr_resp_len)

Request Routine Status.

This function requests the routine results.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u16_routine_id[in] - Routine ID.

  • ptr_resp_param[out] - Routine response parameter.

  • ptr_resp_len[out] - Routine response length.

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_30h_get_block_size(void)

To get block size.

This function is to get acceptable number of consecutive frames per block.

Parameters:

None[in]

Returns:

Returns block size

rs_ret_val_t rcb_uds_server_30h_get_min_seperation_time(void)

To get minimum separation time.

This function is to get minimum separation time between consecutive frames.

Parameters:

None[in]

Returns:

Returns minimum separation time.

rs_ret_val_t rcb_uds_server_34h_get_max_block_len(rs_handle_t uds_serv_handle)

Getting maximum block length.

This function is to get acceptable maximum block length.

Parameters:

uds_server_handle[in] - Handle to the UDS server instance

Returns:

Return acceptable maximum block length

rs_ret_val_t rcb_uds_server_34h_req_download(rs_handle_t uds_serv_handle, uint8_t u8_data_format, uint32_t u32_memory_address, uint32_t u32_download_size)

Request for download.

This function requests for a download.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_data_format[in] - CompressionMethod and EncryptingMethod.

  • u32_memory_address[in] - Starting memory address.

  • u32_download_size[in] - Total memory size.

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_36h_transfer_data(rs_handle_t uds_serv_handle, uint8_t u8_seq_number, uint8_t *ptr_data, uint16_t *ptr_block_len)

Transfers data.

This function transfers the data for download/upload requests.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_seq_number[in] - Sequence number.

  • ptr_data[in] - Pointer to the RX/TX data message.

  • [in/out] – ptr_block_len - RX/TX message block length.

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_37h_req_transfer_exit(rs_handle_t uds_serv_handle, uint8_t *ptr_req_param, uint16_t u16_rec_len, uint8_t *ptr_resp_param, uint16_t *ptr_resp_len)

Request transfer exit.

This function requests for the transfer.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • ptr_req_param[in] - Request parameter.

  • u16_rec_len[in] - Request parameter length

  • ptr_resp_param[out] - Response parameter.

  • ptr_resp_len[out] - Response parameter length to return

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_3dh_write_mem_by_addr(rs_handle_t uds_serv_handle, uint32_t u32_mem_addr, uint32_t u32_mem_size, uint8_t *ptr_data)

Perform write to the specified memory address.

This function is used to perform write the contents of memory specified by given memory address

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u32_mem_addr[in] - Address of memory to be written

  • u32_mem_size[in] - Size of memory to be written in bytes

  • ptr_data[in] - Pointer to data to be written

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_85h_control_dtc(rs_handle_t uds_serv_handle, uint8_t u8_setting, uint8_t *ptr_rec, uint32_t u32_rec_len)

Perform Control DTC Setting.

This function is used to perform stop/resume of DTC status

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_setting[in] - DTC Control Setting

  • ptr_rec[out] -Pointer to optional record buffer

  • u32_rec_len[out] - Record length

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_3eh_tester_present(rs_handle_t uds_serv_handle, uint8_t u8_zero_sub_function)

Performs tester present operation.

This function is used to indicate the tester is still connected to the server

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_zero_sub_function[in] - sub function

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_35h_req_upload(rs_handle_t uds_serv_handle, uint8_t u8_data_format, uint32_t u32_memory_address, uint32_t u32_memory_size)

Initiate an upload session.

This function is used to start an upload session if one is not in progress.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_data_format[in] - CompressionMethod and EncryptingMethod.

  • u32_memory_address[in] - Starting memory address to upload from

  • u32_memory_size[in] - Bytes to be uploaded

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_83h_access_timing_parameter(rs_handle_t uds_serv_handle, uint8_t u8_timing_parameter, uint8_t *ptr_rec_data, uint16_t u16_rec_len, uint8_t *ptr_resp_param, uint16_t *ptr_resp_len)

Performs read or set on the access timing parameter.

This function is used to read or set the access timing parameter.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_timing_parameter[in] - Sub function code associated with this request

  • ptr_rec_data[in] - Pointer to record buffer

  • u16_rec_len[in] - Record length

  • ptr_resp_param[out] - Pointer to response buffer

  • ptr_resp_len[out] - Pointer to return response length

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_84h_secured_data_transmission(rs_handle_t uds_serv_handle, uint8_t *ptr_rec_data, uint16_t u16_rec_len, uint8_t *ptr_resp_param, uint16_t *ptr_resp_len)

To transmit data in a secure manner.

This function is used to send data in a secure mode protected by cryptographic methods

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • ptr_rec_data[in] - Pointer to record buffer

  • u16_rec_len[in] - Record length

  • ptr_resp_param[out] - Pointer to response buffer

  • ptr_resp_len[out] - Pointer to return response length

Returns:

Return 0 on success or error code on failure

Perform link control operation on the diagnostic bus.

This function is used to control the communication in order to gain bus bandwidth for diagnostic purposes.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_ctrl_type[in] - Link control type

  • u8_mode_id[in] - Modifier ID

  • ptr_mode_param[out] - Pointer to mode parameter to be returned

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_set_roe_start_processing(rs_handle_t uds_serv_handle, uint8_t u8_value)

Set the given value to the roe start processing parameter.

This function is used to set the given value to the roe start processing parameter.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_value[in] - Value which want to be set

Returns:

Return 0 on success or error code on failure

rs_ret_val_t rcb_uds_server_get_roe_start_event(rs_handle_t uds_serv_handle)

Get the value of roe start event.

This function is used to get the value of roe start event.

Parameters:

uds_server_handle[in] - Handle to the UDS server instance

Returns:

Return the value of roe start event

rs_ret_val_t rcb_uds_server_86h_get_num_of_activated_events(rs_handle_t uds_serv_handle)

Get the how many events are activated.

This function is used to get the how many events are activated.

Parameters:

uds_server_handle[in] - Handle to the UDS server instance

Returns:

Return the value of how many events are now activated

rs_ret_val_t rcb_uds_server_86h_resp_on_event(rs_handle_t uds_serv_handle, uint8_t u8_event_type, uint8_t *ptr_resp)

Perform response on event operation.

This function is used to perform server start or stop transmission of responses on a specified event.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u8_event_type[in] - specify the event to be configured in the server and to control the ResponseOnEvent set up.

  • ptr_resp[in] - Pointer to the response buffer.

Returns:

Return 0 on success or negative value on failure

rs_ret_val_t rcb_uds_server_2ch_dynamically_define_did_event(rs_handle_t uds_serv_handle, uint8_t *ptr_resp, uint16_t u16_data_len)

Perform dynamically define DID event operation.

This function is used to perform server dynamically define DID event operation.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • ptr_resp[in] - Pointer to the response buffer.

  • u16_data_len[in] - Length of the data.

Returns:

Return 0 on success or negative value on failure

rs_ret_val_t rs_uds_server_send_ddid_clear_resp(rs_handle_t uds_server_handle, uint8_t *ptr_data, uint8_t data_len)

Called to send the dynamically define DID clear response.

This function is used to send the dynamically define DID clear response.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • ptr_data[in] - Pointer to the response buffer.

  • u16_data_len[in] - Length of the data.

Returns:

Return 0 on success or negative value on failure

rs_ret_val_t rs_uds_server_send_response_on_event_timeout(rs_handle_t uds_server_handle, uint8_t *ptr_data, uint16_t u16_rep_len)

Called to send the response on event timeout message.

This function is used to send the response on event timeout message.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • ptr_data[in] - Pointer to the response buffer.

  • u16_rep_len[in] - Length of the data.

Returns:

Return 0 on success or negative value on failure

rs_ret_val_t rs_uds_server_send_response_on_event_for_change_of_did(rs_handle_t uds_server_handle, uint16_t u16_data_id)

Called to send the response on event response for change of DID.

This function is used to send the response on event response for change of DID.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • u16_data_id[in] - Data identifier.

Returns:

Return 0 on success or negative value on failure

rs_ret_val_t rs_uds_server_send_response_on_event_for_cov(rs_handle_t uds_server_handle, void *ptr_data, uint16_t u16_rep_len)

Called to send the response on event response for COV.

This function is used to send the response on event response for COV.

Parameters:
  • uds_server_handle[in] - Handle to the UDS server instance

  • ptr_data[in] - Pointer to the response buffer.

  • u16_rep_len[in] - Length of the data..

Returns:

Return 0 on success or negative value on failure

rs_ret_val_t rs_uds_server_close(rs_handle_t uds_server_handle)

Function to free the UDS server handle.

This function used to free the UDS server handle

Parameters:

uds_client_handle[in] - Handle of the UDS server instance information

Returns:

Return 0 on success or error code on failure

struct tag_rs_uds_server_config
#include <rs_uds_server.h>

Contains information about UDS server configuration.

Public Members

uint16_t p2_server

Server Response time.

uint16_t p2_ext_server

Server Extended Response time.

uint32_t session_timeout

Session timeout.

struct tag_rs_uds_server_instance
#include <rs_uds_server.h>

Contains information about UDS server instance.

Public Members

rs_uds_server_config_t *ptr_uds_server_config

Pointer to the UDS server configuration.

rs_handle_t tp_handle

Transport Handle with corresponding type (DoIP/ DoCAN)

rs_buffer_mgr_t rx_msg_mgr

RX message FIFO.

void *arr_rx_msgs[RS_UDS_SERVER_MAX_NUM_RX_MSGS]

Pointer array to hold incoming messages.

rs_search_mgr_t si_search_mgr

Search manager for service handlers lookup.

rs_an_tp_msg_t *ptr_cur_proc_msg

For P2 handling.

uint32_t last_active_time

Session activity timer.

uint32_t last_resp_time

Time last resp was sent to track P2.

uint8_t extend_timing

P2 Extension mode.

uint8_t session_id

Active Session.

uint8_t u8_curr_transfer_mode

set current transfer mode(upload or download)