TechnicalReference SD
TechnicalReference SD
Technical Reference
Service Discovery
Version 10.0.0
Document Information
History
Reference Documents
Caution
We have configured the programs in accordance with your specifications in the
questionnaire. Whereas the programs do support other configurations than the one
specified in your questionnaire, Vector´s release of the programs delivered to your
company is expressly restricted to the configuration you have specified in the
questionnaire.
Contents1................................................................................................................................... Introduction 8
1.1 Architecture Overview ................................................................................................. 9
3 Integration ............................................................................................................................ 17
3.1 Embedded Implementation ....................................................................................... 17
3.1.1 Static Files ................................................................................................ 17
3.1.2 Dynamic Files ........................................................................................... 17
3.2 Critical Sections ........................................................................................................ 17
3.3 Preemption ............................................................................................................... 18
5 Configuration ....................................................................................................................... 37
5.1 Configuration Variants ............................................................................................... 37
5.2 Configuration with DaVinci Configurator Pro ............................................................. 37
5.2.1 SD Communication Path ........................................................................... 37
5.2.1.1 Tx Data Path ........................................................................... 37
5.2.1.2 Rx Data Path .......................................................................... 38
5.2.2 General Information .................................................................................. 38
5.2.3 Server Service .......................................................................................... 39
5.2.3.1 Availability of a Server Service ................................................ 39
5.2.3.2 Event Handler ......................................................................... 39
5.2.3.3 Provided Methods ................................................................... 41
5.2.4 Client Service ............................................................................................ 41
5.2.4.1 Auto Require ........................................................................... 41
5.2.4.2 Version Driven Find Behavior.................................................. 42
5.2.4.3 Consumed Event Group ......................................................... 42
5.2.4.4 Consumed Method ................................................................. 43
5.2.5 SdInstance Container................................................................................ 44
5.2.5.1 Rx/Tx Queue Configuration..................................................... 44
5.2.5.2 Subscription Retry Mechanism ............................................... 44
5.2.5.3 SdMaxNrDestAddr .................................................................. 44
5.2.5.4 SdInstanceLocalAdressCheckLength ..................................... 45
5.2.6 SdGeneral Container ................................................................................ 46
5.2.6.1 Random Number Function ...................................................... 46
5.2.6.2 Measurement API ................................................................... 46
5.2.6.3 Runtime Measurement Support .............................................. 46
5.2.7 Handling of Configuration Options............................................................. 46
5.2.8 User configuration file ............................................................................... 48
5.3 Configuration of Post-Build ....................................................................................... 48
7 Contact ................................................................................................................................. 50
Tables
Table 2-1 Supported AUTOSAR standard conform features .............................................. 11
Table 2-2 Not supported AUTOSAR standard conform features ........................................ 12
Table 2-3 Features provided beyond the referenced AUTOSAR Standard Release
Version .............................................................................................................. 12
Table 2-4 General Limitations ............................................................................................ 12
Table 2-5 Service IDs ........................................................................................................ 15
Table 2-6 Development Errors reported to DET ................................................................. 15
Table 2-7 Runtime Errors reported to DET ........................................................................ 16
Table 2-8 Errors reported to DEM ...................................................................................... 16
Table 3-1 Static files .......................................................................................................... 17
Table 3-2 Generated files .................................................................................................. 17
Table 4-1 Type definitions.................................................................................................. 21
Table 4-2 Sd_InitMemory .................................................................................................. 22
Table 4-3 Sd_Init ............................................................................................................... 23
Table 4-4 Sd_ServerServiceSetState ................................................................................ 24
Table 4-5 Sd_ClientServiceSetState.................................................................................. 25
Table 4-6 Sd_ConsumedEventGroupSetState .................................................................. 26
Table 4-7 Sd_ServiceGroupStart ....................................................................................... 27
Table 4-8 Sd_ServiceGroupStop ....................................................................................... 28
Table 4-9 Sd_MainFunction ............................................................................................... 29
Table 4-10 Services used by the SD ................................................................................... 30
Table 4-11 Sd_RxIndication ................................................................................................ 31
Table 4-12 Sd_LocalIpAddrAssignmentChg ........................................................................ 32
Table 4-13 Sd_SoConModeChg .......................................................................................... 33
Table 4-14 <SdCapabilityRecordMatchCalloutName> ......................................................... 34
Table 4-15 Sd_GetVersionInfo ............................................................................................ 35
Table 4-16 Sd_GetAndResetMeasurementData .................................................................. 36
Table 6-1 Glossary ............................................................................................................ 49
Table 6-2 Abbreviations ..................................................................................................... 49
1 Introduction
This document describes the functionality, API and configuration of the AUTOSAR BSW
module SD as specified in [1].
The AUTOSAR Service Discovery (SD) module offers functionality to detect and offer
available services within the vehicle network in order to implement service-oriented
communication. Therefore, a SD server publishes its available services via IP multicast
messages in the network. A SD client which receives this offer message and is interested
in the service can use the functionality provided by the server.
The Service Discovery module is located between the AUTOSAR BSW Mode Manager
module (BswM see [4]) and the AUTOSAR Socket Adaptor module (SoAd see [3]).
The next figure shows the interfaces to adjacent modules of the SD. These interfaces are
described in chapter 4.
BswM
SD
SoAd
Applications do not access the services of the BSW modules directly. They use the service
ports provided by the BSW modules via the RTE. The Service Discovery does not support
any service ports.
2 Functional Description
2.1 Features
The features listed in the following tables cover the complete functionality specified for the
SD.
The AUTOSAR standard functionality is specified in [1], the corresponding features are
listed in the tables
> Table 2-1 Supported AUTOSAR standard conform features
> Table 2-2 Not supported AUTOSAR standard conform features
Vector Informatik provides further SD functionality beyond the AUTOSAR standard. The
corresponding features are listed in the table
> Table 2-3 Features provided beyond the referenced AUTOSAR Standard
2.1.1 Deviations
The following features specified in [1] are not supported:
Not Supported AUTOSAR Standard Conform Features
No deviations known.
Table 2-2 Not supported AUTOSAR standard conform features
2.1.3 Limitations
Table 2-4 shows general limitations that apply to the Sd.
Limitations
No general limitations known.
Table 2-4 General Limitations
2.2 Initialization
The SD module is initialized via a Sd_InitMemory() call followed by a call of
Sd_Init(). In all configuration Variants, the address of the global configuration data
structure of the module has to be passed to the Sd_Init() function.
Example
Sd_Init(Sd_Config_Ptr);
2.3 States
After initialization, the state of the SD instances is SD_INSTANCE_DOWN, because the Rx
and Tx socket connections of the SD module are down. If the IP address is successfully
configured, the state is indicated by a callback to the
Sd_LocalIpAddrAssignmentChg() function. This callback changes the state of the SD
instances to SD_INSTANCE_UP_AND_CONFIGURED and initiates the client and server
services to run.
Note
The worst-case execution time regarding Rx Event processing time can be influenced
by setting the maximum number of Rx queue entries which are processed during one
Main Function call by changing config parameter
Sd/SdConfig/SdInstance/SdInQueueProcessLimit
0x02u SD_SID_GET_VERSION_INFO
0x05u SD_SID_LOCAL_IP_ADDR_ASSIGNMENT_CHG
0x06u SD_SID_MAIN_FUNCTION
0x07u SD_SID_SERVER_SERVICE_SET_STATE
0x08u SD_SID_CLIENT_SERVICE_SET_STATE
0x09u SD_SID_CONSUMED_EVENTGROUP_SET_STATE
0x42u SD_SID_RX_INDICATION
0x43u SD_SID_SOCONMODE_CHG
0x44u SD_SID_SERVICE_GROUP_START
0x45u SD_SID_SERVICE_GROUP_STOP
0xA2u SD_SID_ADD_CLIENT_TO_LIST
0xA3u SD_SID_SERIALIZE_PENDING_MESSAGES
0xA4u SD_SID_COMMIT_SENDENTRY
0xA5u SD_SID_GET_EMPTY_SENDENTRY
0xA6u SD_SID_HANDLERETRYSUBSCRIPTION
0xA7u SD_SID_GET_RESET_MEASURE_DATA
The development errors reported to DET are described in the following table:
Error Code Description
0x00u SD_E_NO_ERROR No error occurred.
0x01u SD_E_NOT_INITIALIZED Module has not been initialized.
0x02u SD_E_PARAM_POINTER API service used with invalid pointer
parameter.
0x03u SD_E_INV_MODE Invalid mode request.
0x04u SD_E_INV_ID Invalid ID.
0x05u SD_E_INIT_FAILED Unused error code.
0x06u SD_E_COUNT_OF_RETRY_SUBSC Subscription retry was not successful.
RIPTION_EXCEEDED
0xA1u SD_E_PARAM_CONFIG API service Sd_Init() called with wrong
parameter.
0xA2u SD_E_INV_ARG API service
Sd_GetAndResetMeasurementData() called
with invalid argument.
0xB1u SD_E_ADDR_LIST_FULL Internal address list is full.
Check configuration parameter:
SdMaxNrDestAddr.
0xB2u SD_E_CLIENT_LIST_FULL Internal client list is full.
SdEventHandler is configured with
insufficient amount of corresponding
SoAdSocketConnection.
0xB3u SD_E_TX_BUFFER_FULL Size of SdEntry exceeds configured
SdMesage Tx buffer size. TxEntry is lost.
Check PDU size of SdTxPduRef or
configuration parameter SdTxBufferSize.
0xB4u SD_E_SEND_ENTRY_LIST_FULL All reserved Tx SdEntries for this instance
are occupied. TxEntry is lost.
0xB5u SD_E_FREE_SEND_ENTRY_LIST There are no free Tx SdEntries available.
_EMPTY TxEntry is lost.
The runtime errors reported to DET are described in the following table:
Error Code Description
0x06u SD_E_COUNT_OF_RETRY_SUB Subscription retry failed after
maximum number of attempts.
Table 2-7 Runtime Errors reported to DET
In order to clarify the individual DEM errors and to map them to the corresponding
instance, the Handle ID of the SdInstance (SD_E_OUT_OF_RES,
SD_E_MALFORMED_MSG) or the SdConsumedEventGroup (SD_E_SUBSCR_NACK_RECV)
is added at the end of the define.
3 Integration
This chapter gives necessary information for the integration of the MICROSAR Classic SD
into an application environment of an ECU.
3.3 Preemption
Sd expects that its own main function does not interrupt the main functions of related
modules (BswM, SoAd, TcpIp, …) and is not interrupted by main functions of related
modules.
Caution
Consider main function expectations when using preemptive tasks.
4 API Description
4.2.1 Sd_InitMemory
Prototype
void Sd_InitMemory (void)
Parameter
void none
Return Code
void none
Functional Description
This function is used to initialize the global variables of the Sd at startup if not done by startup code.
Particularities and Limitations
Service ID: see Table 2-5 Service IDs
Caution
This function shall be called before Sd_Init.
Pre-Conditions
none
Call Context
This function shall be called for initialization.
Table 4-2 Sd_InitMemory
4.2.2 Sd_Init
Prototype
void Sd_Init (
const Sd_ConfigType* ConfigPtr)
Parameter
ConfigPtr Pointer to the global configuration data structure of the Sd module.
Return Code
void none
Functional Description
This function is used to initialize the Sd component. The configuration data that shall be used by the Sd is
passed as parameter.
Particularities and Limitations
Service ID: see Table 2-5 Service IDs
Caution
This function has to be called before usage of the module.
Pre-Conditions
The function should be called after a call to Sd_InitMemory().
Call Context
This function shall be called for initialization.
Table 4-3 Sd_Init
4.2.3 Sd_ServerServiceSetState
Prototype
Std_ReturnType Sd_ServerServiceSetState (
uint16 SdServerServiceHandleId,
Sd_ServerServiceSetStateType ServerServiceState)
Parameter
SdServerServiceHandleId ID to identify the Server Service Instance.
ServerServiceState The state the Server Service Instance shall be set to.
Return Code
Std_ReturnType E_OK: State accepted
E_NOT_OK: State not accepted
Functional Description
This API function is used by the BswM to set the Server Service Instance state.
Particularities and Limitations
Service ID: see Table 2-5 Service IDs
Pre-Conditions
Module has to be initialized.
Call Context
Task level
Table 4-4 Sd_ServerServiceSetState
4.2.4 Sd_ClientServiceSetState
Prototype
Std_ReturnType Sd_ClientServiceSetState (
uint16 ClientServiceHandleID,
Sd_ClientServiceSetStateType ClientServiceState)
Parameter
ClientServiceHandleID ID to identify the Client Service Instance. ClientServiceState The state the
Client Service Instance shall be set to.
Return Code
Std_ReturnType E_OK: State accepted
E_NOT_OK: State not accepted
Functional Description
This API function is used by the BswM to set the Client Service Instance state.
Particularities and Limitations
Service ID: see Table 2-5 Service IDs
Pre-Conditions
Module has to be initialized.
Call Context
Task level
Table 4-5 Sd_ClientServiceSetState
4.2.5 Sd_ConsumedEventGroupSetState
Prototype
Std_ReturnType Sd_ConsumedEventGroupSetState (
uint16 SdConsumedEventGroupHandleId,
Sd_ConsumedEventGroupSetStateType ConsumedEventGroupState)
Parameter
SdConsumedEventGroupHandleId ID to identify the ConsumedEventGroupHandleId
ConsumedEventGroupState The state the EventGroup shall be set to
Return Code
Std_ReturnType E_OK: State accepted
E_NOT_OK: State not accepted
Functional Description
This API function is used by the BswM to set the requested state of the EventGroupStatus.
Particularities and Limitations
Service ID: see Table 2-5 Service IDs
Pre-Conditions
Module has to be initialized.
Call Context
Task level
Table 4-6 Sd_ConsumedEventGroupSetState
4.2.6 Sd_ServiceGroupStart
Prototype
void Sd_ServiceGroupStart (
uint16 ServiceGroupHandleId)
Parameter
ServiceGroupHandleId ID of the ServiceGroup which shall be started.
Return code
- -
Functional Description
Sets all members of the specified SdServiceGroup to REQUESTED / AVAILABLE.
Particularities and Limitations
> Module has to be initialized.
> API uses an internal request counter, see Sd_ServiceGroupStop().
Call context
Task level.
Table 4-7 Sd_ServiceGroupStart
4.2.7 Sd_ServiceGroupStop
Prototype
void Sd_ServiceGroupStop (
uint16 ServiceGroupHandleId)
Parameter
ServiceGroupHandleId ID of the ServiceGroup which shall be started.
Return code
- -
Functional Description
Sets all members of the specified SdServiceGroup to RELEASED / DOWN.
Particularities and Limitations
> Module has to be initialized.
> When using the ServiceGroup API, an internal request counter is increased (Start) / decreased (Stop)
for each service which is a member of the associated group. A service is only set to RELEASED/DOWN
if the request counter reaches zero. It is expected from the caller to keep track of the state of each
ServiceGroup and call the API symmetrically.
Call context
Task level.
Table 4-8 Sd_ServiceGroupStop
4.2.8 Sd_MainFunction
Prototype
void Sd_MainFunction (void)
Parameter
void none
Return Code
void none
Functional Description
Periodically called MainFunction that handles the Sd state for each service instance.
Particularities and Limitations
Service ID: see Table 2-5 Service IDs
Pre-Conditions
Sd_InitMemory() and Sd_Init() must have been called first.
Call Context
Task level
Table 4-9 Sd_MainFunction
4.4.1 Sd_RxIndication
Prototype
void Sd_RxIndication (
PduIdType RxPduId,
const PduInfoType *PduInfoPtr)
Parameter
RxPduId ID of the received I-PDU.
PduInfoPtr Contains the length (SduLength) of the received I-PDU and a pointer to a
buffer (SduDataPtr) containing the I-PDU.
Return Code
void none
Functional Description
Indication of a received I-PDU from a lower layer communication interface module.
Particularities and Limitations
Service ID: see Table 2-5 Service IDs
The function is called by the SoAd.
Pre-Conditions
Module has to be initialized.
Call Context
Interrupt level
Table 4-11 Sd_RxIndication
4.4.2 Sd_LocalIpAddrAssignmentChg
Prototype
void Sd_LocalIpAddrAssignmentChg (
SoAd_SoConIdType SoConId,
SoAd_IpAddrStateType State)
Parameter
SoConId Socket connection index specifying the socket connection where the IP
address assignment has changed.
State State of IP address assignment.
Return Code
void none
Functional Description
This function gets called by the SoAd if an IP address assignment related to a socket connection changes
(i.e. new address assigned or assigned address becomes invalid).
Particularities and Limitations
Service ID: see Table 2-5 Service IDs
Pre-Conditions
Module has to be initialized.
Call Context
Task level
Table 4-12 Sd_LocalIpAddrAssignmentChg
4.4.3 Sd_SoConModeChg
Prototype
void Sd_SoConModeChg (
SoAd_SoConIdType SoConId,
SoAd_SoConModeType Mode)
Parameter
SoConId Socket connection index specifying the socket connection with the mode
change.
Mode New socket connection mode.
Return Code
void none
Functional Description
This callback is called by the SoAd module if the socket connection state has changed.
Particularities and Limitations
The function is called by the SoAd.
Pre-Conditions
Module has to be initialized.
Call Context
Task level
Table 4-13 Sd_SoConModeChg
4.6.1 Sd_GetVersionInfo
Prototype
void Sd_GetVersionInfo (
Std_VersionInfoType* VersionInfoPtr)
Parameter
VersionInfoPtr Pointer to a memory location where the Sd version information shall be stored.
Return Code
void none
Functional Description
Returns version information, vendor ID and AUTOSAR module ID of the component.
The versions are BCD-coded.
Particularities and Limitations
Service ID: see Table 2-5 Service IDs
Pre-Conditions
> Availability: This function is only available if SdVersionInfoApi is enabled.
Call Context
This function can be called in any context.
Table 4-15 Sd_GetVersionInfo
4.6.2 Sd_GetAndResetMeasurementData
Prototype
Std_ReturnType Sd_GetAndResetMeasurementData (
Sd_MeasurementIdxType MeasurementIdx,
boolean MeasurementResetNeeded,
uint32* MeasurementDataPtr)
Parameter
MeasurementIdx Index of the measurement data value to retrieve and/or reset.
SD_MEAS_ALL can only be used to reset all measurement data values
with MeasurementResetNeeded = TRUE.
No counter value will be read back in this case and
MeasurementDataPtr should be NULL_PTR.
MeasurementResetNeeded Indicates if the counter value shall be reset.
MeasurementDataPtr Buffer where the value of the counter is to be copied into.
May be NULL_PTR for only resetting measurement values.
Return code
Std_ReturnType E_OK: Operations successful.
E_NOT_OK: Operations failed.
Functional Description
Gets the value of (and/or resets) a measurement data counter.
Particularities and Limitations
> Availability: This function is only available if SdGetAndResetMeasurementDataApi is enabled.
Call context
This function can be called in any context.
Table 4-16 Sd_GetAndResetMeasurementData
5 Configuration
In the SD the attributes can be configured with the tool DaVinci Configurator Pro.
Note
The SdInstanceTxPdu, SdInstanceUnicastRxPdu and
SdInstanceMulticastRxPdu are used by the SD to communicate with its lower
layer module SoAd. For these PDUs no configuration in the PduR and Com is required.
Note
The SD module is only able to change the configuration of a local or remote address if
the corresponding parameters are not preconfigured. Hence, if the IP address is not set
and the Ports are not configured (remote) or set to 0 (local).
Note
All SOMEIP communication paths have to be configured completely. Only the remote
and local IP addresses can be adapted dynamically during runtime.
Note
The maximum number of remote clients for an event handler is determined
automatically according to the number of referenced unicast SocketConnections or, if
no unicast communication is configured, according to the parameter
SdMaxNrDestAddr which is configurable per SdInstance.
The SD module can configure the multicast paths dynamically during runtime. This
possibility comprises the configuration of the local multicast IP address and port and
optionally the configuration of the remote IP address and port. The corresponding local IP
address must be configured with the address type “Multicast”.
The optional configuration of the socket remote address can be enabled and disabled by
the SdSetRemAddrOfClientRxMulticastSoCon parameter, which is located in the
SdGeneral container. The default value (ENABLED) leads to a behavior which is conform
to the AUTOSAR specification [1]. In this configuration, the remote IP address and port of
the server are configured at the corresponding SoAdSocketConnection, which allows
only a reception of messages from this particular remote server. Hence, the configuration
has to contain an individual SoAdSocketConnection for each remote server which shall
be used in parallel. If the SdSetRemAddrOfClientRxMulticastSoCon parameter is
disabled, the remote IP address and port of the multicast connection are not set by the SD
module. If the remote IP address and/or the port are configured to WILDCARD, this
connection can be used to receive messages from multiple remote servers using multicast.
Starting with version 8.00.00, the module supports also the retry subscription mechanism
for requested eventgroups which is described in AUTOSAR RfC80174 and implemented
with AUTOSAR4.4.0. This mechanism was introduced in order to increase the robustness
of the service discovery communication with respect to packet loss. If a client is configured
for subscription retries via the configuration parameters
SdSubscribeEventgroupRetryMax and SdSubscribeEventgroupRetryDelay,
the client will perform subscription retires if it does not receive any response from the
server.
Caution
It is not possible to configure multiple local addresses with the identical multicast IP
address. Neither as preconfigured address nor as dynamically assigned address during
runtime. Therefore, the user has to ensure that each eventgroup which is configured for
multicast contains valid communication paths to all required and during runtime
requested IP addresses. Therefore, multiple
SdConsumedEventGroupMulticastGroupRef references can be configured.
Note
While the RxQueue is only used to store (Stop)Subscribe SdEntries, the TxQueue is
used to store all SdEntries which shall be sent by the SdInstance.
5.2.5.4 SdInstanceLocalAdressCheckLength
Endpoints that are received in SdMessages shall be checked for topological correctness.
There are two options how to determine if an Endpoint shall be accepted or not:
> If parameter SdInstanceLocalAdressCheckLength does not exist in the
configuration, the configured netmask of the local address is used to check all
received Endpoints; SD communication will be restricted to the configured subnet. This
is the default behavior.
> If SdInstanceLocalAdressCheckLength does exist, the value of this parameter is
interpreted as CIDR network prefix length to check the correctness of the received
Endpoints. This might be useful for use cases for which SD Communication shall also
be possible with other subnets which are connect to the local SdInstance via a
gateway or router.
The SdGeneral container shown in Figure 5-7 contains configuration parameters which
are relevant for the entire SD module. A detailed description of each configuration
parameter can be found in the description view of the parameter properties.
5.2.6.1 Random Number Function
The SdRandomNumberFunctionIncludeFile and SdRandomNumberFunction have
to be provided by the customer. The random number function is used by the SD module in
order to delay outgoing response messages which have their origin in messages
transmitted by multicast.
5.2.6.2 Measurement API
If parameter SdGetAndResetMeasurementDataApi is enabled, diagnostic
measurement data can be retrieved by API Sd_GetAndResetMeasurementData.
5.2.6.3 Runtime Measurement Support
Parameter SdRuntimeMeasurementSupport can only be set if the Rtm module is part
of the configuration. If it is set to enabled, the Rtm module will be configured with
MeasurmentPoints to measure the runtime of the RxIndication and the runtime of the tasks
executed during the Sd MainFunction.
5.2.7 Handling of Configuration Options
The SD module provides the possibility to forward received configuration options to the
user in order to check and match them against the configured ones. Therefore, a
SdCapabilityRecordMatchCallout has to be configured as shown in Figure 5-8. A
The user callout will be invoked if a message for the service is received which contains
configuration options or if the service configures SdServerCapabilityRecords. The
return value of the callout will be used to decide whether the request is valid and shall be
processed or shall be ignored (FindService, OfferService, StopOfferService,
StopSubscribeEventgroup, SubscribeEventgroupAck, SubscribeEventgroupNack) or
answered negatively (SubscribeEventgroup).
Caution
The user callout is invoked in the (interrupt) context of message reception.
Caution
User configuration file content must either be described in this manual or agreed to by
Vector prior to using it in production code.
6.1 Glossary
Term Description
6.2 Abbreviations
Abbreviation Description
API Application Programming Interface
AUTOSAR Automotive Open System Architecture
BSW Basis Software
DEM Diagnostic Event Manager
DET Development Error Tracer
ECU Electronic Control Unit
ISR Interrupt Service Routine
MICROSAR Microcontroller Open System Architecture (the Vector AUTOSAR
solution)
RTE Runtime Environment
SD Service Discovery
SOAD Socket Adaptor
SOMEIP Scalable service-oriented middleware over IP
SRS Software Requirement Specification
SWC Software Component
SWS Software Specification
Table 6-2 Abbreviations
7 Contact
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector.com