Click here for back issues.
https://www.simulationroom999.com/blog/diagnostic-communication-en-back-issue/
Introduction.
AUTOSAR-Dcm Configuration Explained.
In this article, the configuration code of Dsd will be explained.
Let me show you the configuration code of Dsd.
As the class diagram was simple, the code is also simple.
//----------------------------------------------------------------
// DSD
//----------------------------------------------------------------
// SID table
#define SID_DIAGNOSTIC_SESSION_CONTROL 0x10
#define SID_ECU_RESET 0x11
#define SID_CLEAR_DIAGNOSTIC_INFORMATION 0x14
#define SID_READ_DTC_INFORMATION 0x19
#define SID_READ_DATA_BY_IDENTIFIER 0x22
#define SID_READ_MEMORY_BY_ADDRESS 0x23
#define SID_READ_SCALING_DATA_BY_IDENTIFIER 0x24
#define SID_SECURITY_ACCESS 0x27
#define SID_COMMUNICATION_CONTROL 0x28
#define SID_READ_DATA_BY_PERIODIC_IDENTIFIER 0x2A
#define SID_DYNAMICALLY_DEFINE_DATA_IDENTIFIER 0x2C
#define SID_WRITE_DATA_BY_IDENTIFIER 0x2E
#define SID_INPUT_OUTPUT_CONTROL_BY_IDENTIFIER 0x2F
#define SID_ROUTINE_CONTROL 0x31
#define SID_REQUEST_DOWNLOAD 0x34
#define SID_REQUEST_UPLOAD 0x35
#define SID_TRANSFER_DATA 0x36
#define SID_REQUEST_TRANSFER_EXIT 0x37
#define SID_WRITE_MEMORY_BY_ADDRESS 0x3D
#define SID_TESTER_PRESENT 0x3E
#define SID_NEGATIVE_RESPONSE 0x7F
#define SID_CONTROL_DTC_SETTING 0x85
static const Dcm_DsdServiceType DIAG_P2PorP2A_serviceList[] = {
{
SID_DIAGNOSTIC_SESSION_CONTROL, /* DsdSidTabServiceId */
TRUE, /* DsdSidTabSubfuncAvail */
UnProtected_SecurityList, /* DsdSidTabSecurityLevelRef */
ALL_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_SECURITY_ACCESS, /* DsdSidTabServiceId */
TRUE, /* DsdSidTabSubfuncAvail */
UnProtected_SecurityList, /* DsdSidTabSecurityLevelRef */
SecurityAccess_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_READ_MEMORY_BY_ADDRESS, /* DsdSidTabServiceId */
TRUE, /* DsdSidTabSubfuncAvail */
UnProtected_SecurityList, /* DsdSidTabSecurityLevelRef */
ALL_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_READ_DATA_BY_IDENTIFIER, /* DsdSidTabServiceId */
TRUE, /* DsdSidTabSubfuncAvail */
UnProtected_SecurityList, /* DsdSidTabSecurityLevelRef */
ALL_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_WRITE_DATA_BY_IDENTIFIER, /* DsdSidTabServiceId */
TRUE, /* DsdSidTabSubfuncAvail */
RWDID_SecurityList, /* DsdSidTabSecurityLevelRef */
RWDID_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_ROUTINE_CONTROL, /* DsdSidTabServiceId */
TRUE, /* DsdSidTabSubfuncAvail */
RC_SecurityList, /* DsdSidTabSecurityLevelRef */
RC_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_TESTER_PRESENT, /* DsdSidTabServiceId */
TRUE, /* DsdSidTabSubfuncAvail */
UnProtected_SecurityList, /* DsdSidTabSecurityLevelRef */
ALL_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_ECU_RESET, /* DsdSidTabServiceId */
TRUE, /* DsdSidTabSubfuncAvail */
UnProtected_SecurityList, /* DsdSidTabSecurityLevelRef */
ALL_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_REQUEST_DOWNLOAD, /* DsdSidTabServiceId */
FALSE, /* DsdSidTabSubfuncAvail */
UnProtected_SecurityList, /* DsdSidTabSecurityLevelRef */
ALL_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_REQUEST_UPLOAD, /* DsdSidTabServiceId */
FALSE, /* DsdSidTabSubfuncAvail */
UnProtected_SecurityList, /* DsdSidTabSecurityLevelRef */
ALL_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_REQUEST_TRANSFER_EXIT, /* DsdSidTabServiceId */
FALSE, /* DsdSidTabSubfuncAvail */
UnProtected_SecurityList, /* DsdSidTabSecurityLevelRef */
ALL_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_TRANSFER_DATA, /* DsdSidTabServiceId */
FALSE, /* DsdSidTabSubfuncAvail */
UnProtected_SecurityList, /* DsdSidTabSecurityLevelRef */
ALL_SessionList, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
FALSE /* Arc_EOL */
},
{
SID_TRANSFER_DATA, /* DsdSidTabServiceId */
FALSE, /* DsdSidTabSubfuncAvail */
NULL_PTR, /* DsdSidTabSecurityLevelRef */
NULL_PTR, /* DsdSidTabSessionLevelRef */
NULL_PTR, /* Dcm_DsdConditionGetFncType */
NULL_PTR, /* Dcm_DsdResetPidsFncType */
TRUE, /* Arc_EOL */
}
};
static const Dcm_DsdServiceTableType DsdServiceTable[] = {
{
0, /* DsdSidTabId */
DIAG_P2PorP2A_serviceList, /* DsdService */
FALSE /* Arc_EOL */
},
{
0, /* DsdSidTabId */
NULL_PTR, /* DsdService */
TRUE /* Arc_EOL */
}
};
static const Dcm_DsdType Dsd = {
DsdServiceTable /* DsdServiceTable */
};
AUTOSAR-Dcm Dsd configuration code explanation
There are quite a few lines, but they are not complicated.
As you can see, UnProtected_SecurityList and ALL_SessionList are not defined in this.
This is a list of security levels and sessions, but the entities are in Dsp, not Dsl.
Therefore, the entity does not appear here, only by reference this time.
I’ll let you be prepared for this part when I explain Dps.
(Next article is the Dsp, though….)
Conclusion
- I wrote the configuration code for Dsd.
- The corresponding security level and session entity are in Dsp and only referenced from Dsd.
Click here for back issues.
コメント