odxtools 10.1.1__py3-none-any.whl → 10.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. odxtools/addrdeffilter.py +33 -0
  2. odxtools/addrdefphyssegment.py +33 -0
  3. odxtools/checksum.py +67 -0
  4. odxtools/checksumresult.py +7 -0
  5. odxtools/database.py +24 -4
  6. odxtools/datablock.py +153 -0
  7. odxtools/datafile.py +23 -0
  8. odxtools/dataformat.py +39 -0
  9. odxtools/dataformatselection.py +9 -0
  10. odxtools/description.py +2 -5
  11. odxtools/diagdatadictionaryspec.py +1 -3
  12. odxtools/direction.py +7 -0
  13. odxtools/ecumem.py +71 -0
  14. odxtools/ecumemconnector.py +136 -0
  15. odxtools/encryptcompressmethod.py +39 -0
  16. odxtools/encryptcompressmethodtype.py +13 -0
  17. odxtools/expectedident.py +40 -0
  18. odxtools/externflashdata.py +34 -0
  19. odxtools/filter.py +32 -0
  20. odxtools/flash.py +88 -0
  21. odxtools/flashclass.py +32 -0
  22. odxtools/flashdata.py +70 -0
  23. odxtools/fwchecksum.py +7 -0
  24. odxtools/fwsignature.py +7 -0
  25. odxtools/identdesc.py +54 -0
  26. odxtools/identvalue.py +32 -0
  27. odxtools/identvaluetype.py +14 -0
  28. odxtools/internflashdata.py +33 -0
  29. odxtools/loadfile.py +1 -1
  30. odxtools/mem.py +80 -0
  31. odxtools/modification.py +3 -2
  32. odxtools/negoffset.py +21 -0
  33. odxtools/ownident.py +38 -0
  34. odxtools/physicaltype.py +12 -10
  35. odxtools/physmem.py +52 -0
  36. odxtools/physsegment.py +42 -0
  37. odxtools/posoffset.py +21 -0
  38. odxtools/security.py +42 -0
  39. odxtools/securitymethod.py +7 -0
  40. odxtools/segment.py +63 -0
  41. odxtools/session.py +88 -0
  42. odxtools/sessiondesc.py +101 -0
  43. odxtools/sessionsubelemtype.py +14 -0
  44. odxtools/sizedeffilter.py +33 -0
  45. odxtools/sizedefphyssegment.py +33 -0
  46. odxtools/specialdata.py +2 -1
  47. odxtools/targetaddroffset.py +13 -0
  48. odxtools/templates/comparam-spec.odx-c.xml.jinja2 +1 -0
  49. odxtools/templates/comparam-subset.odx-cs.xml.jinja2 +1 -0
  50. odxtools/templates/diag_layer_container.odx-d.xml.jinja2 +2 -1
  51. odxtools/templates/flash.odx-f.xml.jinja2 +42 -0
  52. odxtools/templates/macros/printAdminData.xml.jinja2 +4 -4
  53. odxtools/templates/macros/printAudience.xml.jinja2 +3 -3
  54. odxtools/templates/macros/printChecksum.xml.jinja2 +36 -0
  55. odxtools/templates/macros/printComparam.xml.jinja2 +1 -1
  56. odxtools/templates/macros/printComparamRef.xml.jinja2 +1 -3
  57. odxtools/templates/macros/printCompuMethod.xml.jinja2 +1 -1
  58. odxtools/templates/macros/printDOP.xml.jinja2 +3 -3
  59. odxtools/templates/macros/printDatablock.xml.jinja2 +78 -0
  60. odxtools/templates/macros/printDiagComm.xml.jinja2 +2 -2
  61. odxtools/templates/macros/printDiagLayer.xml.jinja2 +2 -1
  62. odxtools/templates/macros/printDiagVariable.xml.jinja2 +4 -4
  63. odxtools/templates/macros/printDynDefinedSpec.xml.jinja2 +3 -3
  64. odxtools/templates/macros/printDynamicEndmarkerField.xml.jinja2 +2 -2
  65. odxtools/templates/macros/printDynamicLengthField.xml.jinja2 +2 -2
  66. odxtools/templates/macros/printEcuMem.xml.jinja2 +24 -0
  67. odxtools/templates/macros/printEcuMemConnector.xml.jinja2 +58 -0
  68. odxtools/templates/macros/printEndOfPdu.xml.jinja2 +1 -1
  69. odxtools/templates/macros/printEnvDataDesc.xml.jinja2 +1 -1
  70. odxtools/templates/macros/printExpectedIdent.xml.jinja2 +21 -0
  71. odxtools/templates/macros/printFlashdata.xml.jinja2 +43 -0
  72. odxtools/templates/macros/printIdentDesc.xml.jinja2 +17 -0
  73. odxtools/templates/macros/printMem.xml.jinja2 +35 -0
  74. odxtools/templates/macros/printMux.xml.jinja2 +3 -3
  75. odxtools/templates/macros/printOdxCategory.xml.jinja2 +4 -4
  76. odxtools/templates/macros/printOwnIdent.xml.jinja2 +17 -0
  77. odxtools/templates/macros/printParam.xml.jinja2 +4 -4
  78. odxtools/templates/macros/printParentRef.xml.jinja2 +1 -5
  79. odxtools/templates/macros/printPhysMem.xml.jinja2 +20 -0
  80. odxtools/templates/macros/printPhysSegment.xml.jinja2 +33 -0
  81. odxtools/templates/macros/printPreConditionStateRef.xml.jinja2 +1 -1
  82. odxtools/templates/macros/printProtStack.xml.jinja2 +1 -1
  83. odxtools/templates/macros/printProtocol.xml.jinja2 +1 -1
  84. odxtools/templates/macros/printSecurity.xml.jinja2 +37 -0
  85. odxtools/templates/macros/printSegment.xml.jinja2 +31 -0
  86. odxtools/templates/macros/printService.xml.jinja2 +3 -3
  87. odxtools/templates/macros/printSession.xml.jinja2 +45 -0
  88. odxtools/templates/macros/printSessionDesc.xml.jinja2 +40 -0
  89. odxtools/templates/macros/printSingleEcuJob.xml.jinja2 +3 -3
  90. odxtools/templates/macros/printSpecialData.xml.jinja2 +2 -2
  91. odxtools/templates/macros/printStateTransitionRef.xml.jinja2 +1 -1
  92. odxtools/templates/macros/printStaticField.xml.jinja2 +1 -1
  93. odxtools/templates/macros/printSubComponent.xml.jinja2 +3 -3
  94. odxtools/templates/macros/printTable.xml.jinja2 +6 -6
  95. odxtools/templates/macros/printUnitSpec.xml.jinja2 +2 -2
  96. odxtools/text.py +2 -6
  97. odxtools/utils.py +22 -1
  98. odxtools/validityfor.py +30 -0
  99. odxtools/version.py +2 -2
  100. odxtools/writepdxfile.py +70 -21
  101. {odxtools-10.1.1.dist-info → odxtools-10.2.0.dist-info}/METADATA +1 -1
  102. {odxtools-10.1.1.dist-info → odxtools-10.2.0.dist-info}/RECORD +106 -49
  103. {odxtools-10.1.1.dist-info → odxtools-10.2.0.dist-info}/WHEEL +1 -1
  104. {odxtools-10.1.1.dist-info → odxtools-10.2.0.dist-info}/entry_points.txt +0 -0
  105. {odxtools-10.1.1.dist-info → odxtools-10.2.0.dist-info}/licenses/LICENSE +0 -0
  106. {odxtools-10.1.1.dist-info → odxtools-10.2.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,33 @@
1
+ # SPDX-License-Identifier: MIT
2
+ from dataclasses import dataclass
3
+ from typing import Any
4
+ from xml.etree import ElementTree
5
+
6
+ from .exceptions import odxrequire
7
+ from .odxdoccontext import OdxDocContext
8
+ from .odxlink import OdxLinkDatabase, OdxLinkId
9
+ from .physsegment import PhysSegment
10
+ from .snrefcontext import SnRefContext
11
+ from .utils import dataclass_fields_asdict
12
+
13
+
14
+ @dataclass(kw_only=True)
15
+ class SizedefPhysSegment(PhysSegment):
16
+ size: int
17
+
18
+ @staticmethod
19
+ def from_et(et_element: ElementTree.Element, context: OdxDocContext) -> "SizedefPhysSegment":
20
+ kwargs = dataclass_fields_asdict(PhysSegment.from_et(et_element, context))
21
+
22
+ size = int(odxrequire(et_element.findtext("SIZE")) or "0")
23
+
24
+ return SizedefPhysSegment(size=size, **kwargs)
25
+
26
+ def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
27
+ return super()._build_odxlinks()
28
+
29
+ def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
30
+ super()._resolve_odxlinks(odxlinks)
31
+
32
+ def _resolve_snrefs(self, context: SnRefContext) -> None:
33
+ super()._resolve_snrefs(context)
odxtools/specialdata.py CHANGED
@@ -6,6 +6,7 @@ from xml.etree import ElementTree
6
6
  from .odxdoccontext import OdxDocContext
7
7
  from .odxlink import OdxLinkDatabase, OdxLinkId
8
8
  from .snrefcontext import SnRefContext
9
+ from .utils import strip_indent
9
10
 
10
11
 
11
12
  @dataclass(kw_only=True)
@@ -19,7 +20,7 @@ class SpecialData:
19
20
  def from_et(et_element: ElementTree.Element, context: OdxDocContext) -> "SpecialData":
20
21
  semantic_info = et_element.get("SI")
21
22
  text_identifier = et_element.get("TI")
22
- value = et_element.text or ""
23
+ value = strip_indent(et_element.text) or ""
23
24
 
24
25
  return SpecialData(
25
26
  semantic_info=semantic_info, text_identifier=text_identifier, value=value)
@@ -0,0 +1,13 @@
1
+ # SPDX-License-Identifier: MIT
2
+ from dataclasses import dataclass
3
+ from xml.etree import ElementTree
4
+
5
+ from .odxdoccontext import OdxDocContext
6
+
7
+
8
+ @dataclass(kw_only=True)
9
+ class TargetAddrOffset:
10
+
11
+ @staticmethod
12
+ def from_et(et_element: ElementTree.Element, context: OdxDocContext) -> "TargetAddrOffset":
13
+ return TargetAddrOffset()
@@ -12,6 +12,7 @@
12
12
  <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
13
13
  <!-- Written using odxtools {{odxtools_version}} -->
14
14
  <ODX MODEL-VERSION="2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="odx.xsd">
15
+ {{- set_category_docfrag(comparam_spec.short_name, "COMPARAM-SPEC") }}
15
16
  <COMPARAM-SPEC {{- poc.printOdxCategoryAttribs(comparam_spec) }}>
16
17
  {{- poc.printOdxCategorySubtags(comparam_spec)|indent(3) }}
17
18
  {%- if comparam_spec.prot_stacks %}
@@ -15,6 +15,7 @@
15
15
  <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
16
16
  <!-- Written using odxtools {{odxtools_version}} -->
17
17
  <ODX MODEL-VERSION="2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="odx.xsd">
18
+ {{- set_category_docfrag(comparam_subset.short_name, "COMPARAM-SUBSET") }}
18
19
  <COMPARAM-SUBSET {{- poc.printOdxCategoryAttribs(comparam_subset) }} {{make_xml_attrib("CATEGORY", comparam_subset.category)}}>
19
20
  {{- poc.printOdxCategorySubtags(comparam_subset)|indent(3) }}
20
21
  {%- if comparam_subset.comparams %}
@@ -14,6 +14,7 @@
14
14
  <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
15
15
  <!-- Written using odxtools {{odxtools_version}} -->
16
16
  <ODX MODEL-VERSION="2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="odx.xsd">
17
+ {{- set_category_docfrag(dlc.short_name, "CONTAINER") }}
17
18
  <DIAG-LAYER-CONTAINER {{- poc.printOdxCategoryAttribs(dlc) }}>
18
19
  {{- poc.printOdxCategorySubtags(dlc)|indent(3) }}
19
20
  {%- if dlc.protocols %}
@@ -44,7 +45,7 @@
44
45
  {%- endfor %}
45
46
  </BASE-VARIANTS>
46
47
  {%- endif %}
47
- {%- if dlc.ecu_variants %}
48
+ {%- if dlc.ecu_variants %}
48
49
  <ECU-VARIANTS>
49
50
  {%- for dl in dlc.ecu_variants %}
50
51
  {{pecuv.printEcuVariant(dl)|indent(3)}}
@@ -0,0 +1,42 @@
1
+ {#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ #
5
+ # This template writes an .odx-cs file for a communication
6
+ # parameter subset.
7
+ -#}
8
+ {%- import('macros/printOdxCategory.xml.jinja2') as poc %}
9
+ {%- import('macros/printEcuMem.xml.jinja2') as pem %}
10
+ {%- import('macros/printEcuMemConnector.xml.jinja2') as pemc %}
11
+ {%- import('macros/printAudience.xml.jinja2') as paud %}
12
+ {#- -#}
13
+
14
+ <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
15
+ <!-- Written using odxtools {{odxtools_version}} -->
16
+ <ODX MODEL-VERSION="2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="odx.xsd">
17
+ {{- set_category_docfrag(flash.short_name, "FLASH") }}
18
+ <FLASH {{- poc.printOdxCategoryAttribs(flash) }}>
19
+ {{- poc.printOdxCategorySubtags(flash)|indent(4) }}
20
+ {%- if flash.ecu_mems %}
21
+ <ECU-MEMS>
22
+ {%- for ecu_mem in flash.ecu_mems %}
23
+ {{ pem.printEcuMem(ecu_mem) | indent(6) }}
24
+ {%- endfor %}
25
+ </ECU-MEMS>
26
+ {%- endif %}
27
+ {%- if flash.ecu_mem_connectors %}
28
+ <ECU-MEM-CONNECTORS>
29
+ {%- for ecu_mem_connector in flash.ecu_mem_connectors %}
30
+ {{ pemc.printEcuMemConnector(ecu_mem_connector) | indent(6) }}
31
+ {%- endfor %}
32
+ </ECU-MEM-CONNECTORS>
33
+ {%- endif %}
34
+ {%- if flash.additional_audiences %}
35
+ <ADDITIONAL-AUDIENCES>
36
+ {%- for audience in flash.additional_audiences %}
37
+ {{ paud.printAdditionalAudience(audience) | indent(6) }}
38
+ {%- endfor %}
39
+ </ADDITIONAL-AUDIENCES>
40
+ {%- endif %}
41
+ </FLASH>
42
+ </ODX>
@@ -14,9 +14,9 @@
14
14
  <COMPANY-DOC-INFOS>
15
15
  {%- for cdi in admin_data.company_doc_infos %}
16
16
  <COMPANY-DOC-INFO>
17
- <COMPANY-DATA-REF ID-REF="{{cdi.company_data_ref.ref_id}}" />
17
+ <COMPANY-DATA-REF {{make_ref_attribs(cdi.company_data_ref)}} />
18
18
  {%- if cdi.team_member_ref is not none %}
19
- <TEAM-MEMBER-REF ID-REF="{{cdi.team_member_ref.ref_id}}" />
19
+ <TEAM-MEMBER-REF {{make_ref_attribs(cdi.team_member_ref)}} />
20
20
  {%- endif %}
21
21
  {%- if cdi.doc_label is not none %}
22
22
  <DOC-LABEL>{{cdi.doc_label|e}}</DOC-LABEL>
@@ -31,7 +31,7 @@
31
31
  {%- for doc_revision in admin_data.doc_revisions %}
32
32
  <DOC-REVISION>
33
33
  {%- if doc_revision.team_member_ref is not none %}
34
- <TEAM-MEMBER-REF ID-REF="{{doc_revision.team_member_ref.ref_id}}" />
34
+ <TEAM-MEMBER-REF {{make_ref_attribs(doc_revision.team_member_ref)}} />
35
35
  {%- endif %}
36
36
  {%- if doc_revision.revision_label is not none %}
37
37
  <REVISION-LABEL>{{doc_revision.revision_label|e}}</REVISION-LABEL>
@@ -47,7 +47,7 @@
47
47
  <COMPANY-REVISION-INFOS>
48
48
  {%- for cri in doc_revision.company_revision_infos %}
49
49
  <COMPANY-REVISION-INFO>
50
- <COMPANY-DATA-REF ID-REF="{{cri.company_data_ref.ref_id}}" />
50
+ <COMPANY-DATA-REF {{make_ref_attribs(cri.company_data_ref)}} />
51
51
  {%- if cri.revision_label is not none %}
52
52
  <REVISION-LABEL>{{cri.revision_label|e}}</REVISION-LABEL>
53
53
  {%- endif %}
@@ -7,7 +7,7 @@
7
7
 
8
8
  {%- macro printAdditionalAudience(audience) -%}
9
9
  <ADDITIONAL-AUDIENCE {{-peid.printElementIdAttribs(audience)}}>
10
- {{ peid.printElementIdSubtags(audience)|indent(1) }}
10
+ {{ peid.printElementIdSubtags(audience)|indent(2) }}
11
11
  </ADDITIONAL-AUDIENCE>
12
12
  {%- endmacro -%}
13
13
 
@@ -20,14 +20,14 @@
20
20
  {%- if audience.enabled_audience_refs %}
21
21
  <ENABLED-AUDIENCE-REFS>
22
22
  {%- for ref in audience.enabled_audience_refs %}
23
- <ENABLED-AUDIENCE-REF ID-REF="{{ref.ref_id}}" />
23
+ <ENABLED-AUDIENCE-REF {{make_ref_attribs(ref)}} />
24
24
  {%- endfor %}
25
25
  </ENABLED-AUDIENCE-REFS>
26
26
  {%- endif%}
27
27
  {%- if audience.disabled_audience_refs %}
28
28
  <DISABLED-AUDIENCE-REFS>
29
29
  {%- for ref in audience.disabled_audience_refs %}
30
- <DISABLED-AUDIENCE-REF ID-REF="{{ref.ref_id}}" />
30
+ <DISABLED-AUDIENCE-REF {{make_ref_attribs(ref)}} />
31
31
  {%- endfor %}
32
32
  </DISABLED-AUDIENCE-REFS>
33
33
  {%- endif%}
@@ -0,0 +1,36 @@
1
+ {#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ -#}
5
+
6
+ {%- import('macros/printElementId.xml.jinja2') as peid %}
7
+
8
+ {%- macro printChecksum(checksum) -%}
9
+ <CHECKSUM {{-peid.printElementIdAttribs(checksum)|indent(2) }}{# -#}>
10
+ {{ peid.printElementIdSubtags(checksum)|indent(2) }}
11
+ {%- if checksum.fillbyte is not none %}
12
+ {%- set num_nibbles = (checksum.fillbyte.bit_length() + 7) // 8 * 2 %}
13
+ <FILLBYTE>{{ ("%%0%dX" | format(num_nibbles | int)) | format(checksum.fillbyte | int) }}</FILLBYTE>
14
+ {%- endif %}
15
+ {%- set num_nibbles = (checksum.source_start_address.bit_length() + 7) // 8 * 2 %}
16
+ <SOURCE-START-ADDRESS>{{ ("%%0%dX" | format(num_nibbles | int)) | format(checksum.source_start_address | int) }}</SOURCE-START-ADDRESS>
17
+ {%- if checksum.compressed_size is not none %}
18
+ <COMPRESSED-SIZE>{{ checksum.compressed_size }}</COMPRESSED-SIZE>
19
+ {%- endif %}
20
+ {%- if checksum.checksum_alg is not none %}
21
+ <CHECKSUM-ALG>{{checksum.checksum_alg}}</CHECKSUM-ALG>
22
+ {%- endif %}
23
+ {%- if checksum.source_end_address is not none %}
24
+ {%- set num_nibbles = (checksum.source_end_address.bit_length() + 7) // 8 * 2 %}
25
+ <SOURCE-END-ADDRESS>{{ ("%%0%dX" | format(num_nibbles | int)) | format(checksum.source_end_address | int) }}</SOURCE-END-ADDRESS>
26
+ {%- endif %}
27
+ {%- if checksum.uncompressed_size is not none %}
28
+ <UNCOMPRESSED-SIZE>{{ checksum.uncompressed_size }}</UNCOMPRESSED-SIZE>
29
+ {%- endif %}
30
+ <CHECKSUM-RESULT
31
+ {%- if checksum.checksum_result.value_type is not none %}
32
+ {#- #} TYPE="{{ checksum.checksum_result.value_type.value }}"
33
+ {%- endif %}
34
+ {#- #}>{{checksum.checksum_result.value}}</CHECKSUM-RESULT>
35
+ </CHECKSUM>
36
+ {%- endmacro -%}
@@ -45,7 +45,7 @@
45
45
  CPUSAGE="{{cp.cpusage.value}}">
46
46
  {{ peid.printElementIdSubtags(cp)|indent(1) }}
47
47
  <PHYSICAL-DEFAULT-VALUE>{{cp.physical_default_value_raw}}</PHYSICAL-DEFAULT-VALUE>
48
- <DATA-OBJECT-PROP-REF ID-REF="{{cp.dop_ref.ref_id}}" />
48
+ <DATA-OBJECT-PROP-REF {{make_ref_attribs(cp.dop_ref)}} />
49
49
  </COMPARAM>
50
50
  {%- endmacro %}
51
51
 
@@ -7,9 +7,7 @@
7
7
  {#- -#}
8
8
 
9
9
  {%- macro printComparamRef(cp) %}
10
- <COMPARAM-REF ID-REF="{{cp.spec_ref.ref_id}}"
11
- DOCREF="{{cp.spec_ref.ref_docs[0].doc_name}}"
12
- DOCTYPE="COMPARAM-SUBSET">
10
+ <COMPARAM-REF {{make_ref_attribs(cp.spec_ref)}}>
13
11
  {%- if cp.value is string %}
14
12
  <SIMPLE-VALUE>{{cp.value}}</SIMPLE-VALUE>
15
13
  {{ pd.printDescription(cp.description) }}
@@ -103,7 +103,7 @@
103
103
  {%- if pc.library_refs %}
104
104
  <LIBRARY-REFS>
105
105
  {%- for libref in pc.library_refs %}
106
- <LIBRARY-REF ID-REF="{{libref.ref_id}}" />
106
+ <LIBRARY-REF {{make_ref_attribs(libref)}} />
107
107
  {%- endfor %}
108
108
  </LIBRARY-REFS>
109
109
  {%- endif %}
@@ -113,7 +113,7 @@
113
113
  {{- printInternalConstr(dop.internal_constr, False)|indent(1) }}
114
114
  {%- endif %}
115
115
  {%- if dop.unit_ref %}
116
- <UNIT-REF ID-REF="{{ dop.unit_ref.ref_id }}" />
116
+ <UNIT-REF {{make_ref_attribs(dop.unit_ref)}} />
117
117
  {%- endif %}
118
118
  {%- if dop.physical_constr %}
119
119
  {{- printInternalConstr(dop.internal_constr, True)|indent(1) }}
@@ -131,7 +131,7 @@
131
131
  <DTCS>
132
132
  {%- for dtc in dop.dtcs_raw %}
133
133
  {%- if hasattr(dtc, "ref_id") %}
134
- <DTC-REF ID-REF="{{dtc.ref_id}}" />
134
+ <DTC-REF {{make_ref_attribs(dtc)}} />
135
135
  {%- else %}
136
136
  <DTC {{-peid.printElementIdAttribs(dtc)}}>
137
137
  <SHORT-NAME>{{dtc.short_name}}</SHORT-NAME>
@@ -159,7 +159,7 @@
159
159
  {%- endfor %}
160
160
  </NOT-INHERITED-DTC-SNREFS>
161
161
  {%- endif %}
162
- <DTC-DOP-REF ID-REF="{{linked_dtc_dop.dtc_dop_ref.ref_id}}" />
162
+ <DTC-DOP-REF {{make_ref_attribs(linked_dtc_dop.dtc_dop_ref)}} />
163
163
  </LINKED-DTC-DOP>
164
164
  {%- endfor %}
165
165
  </LINKED-DTC-DOPS>
@@ -0,0 +1,78 @@
1
+ {#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ -#}
5
+
6
+ {%- import('macros/printElementId.xml.jinja2') as peid %}
7
+ {%- import('macros/printOwnIdent.xml.jinja2') as poi %}
8
+ {%- import('macros/printSecurity.xml.jinja2') as psec %}
9
+ {%- import('macros/printSegment.xml.jinja2') as pseg %}
10
+ {%- import('macros/printSpecialData.xml.jinja2') as psd %}
11
+
12
+ {%- macro printDatablock(datablock) -%}
13
+ <DATABLOCK {{peid.printElementIdAttribs(datablock)}} TYPE="{{datablock.data_type}}">
14
+ {{ peid.printElementIdSubtags(datablock)|indent(1) }}
15
+ {%- if datablock.logical_block_index is not none %}
16
+ {%- set num_nibbles = (datablock.logical_block_index.bit_length() + 7) // 8 * 2 %}
17
+ <LOGICAL-BLOCK-INDEX>{{("%%0%dX" | format(num_nibbles | int)) | format(datablock.logical_block_index | int)}}</LOGICAL-BLOCK-INDEX>
18
+ {%- endif %}
19
+ {%- if datablock.flashdata_ref is not none %}
20
+ <FLASHDATA-REF {{make_ref_attribs(datablock.flashdata_ref)}} />
21
+ {%- endif %}
22
+ {%- if datablock.filters %}
23
+ <FILTERS>
24
+ {%- for filter in datablock.filters %}
25
+ {%- if filter.filter_end %}
26
+ <FILTER xsi:type="ADDRDEF-FILTER">
27
+ {%- set num_nibbles = (filter.filter_start.bit_length() + 7) // 8 * 2 %}
28
+ <FILTER-START>{{ ("%%0%dX" | format(num_nibbles | int)) | format(filter.filter_start | int) }}</FILTER-START>
29
+ {%- set num_nibbles = (filter.filter_end.bit_length() + 7) // 8 * 2 %}
30
+ <FILTER-END>{{ ("%%0%dX" | format(num_nibbles | int)) | format(filter.filter_end | int) }}</FILTER-END>
31
+ </FILTER>
32
+ {%- elif filter.filter_size %}
33
+ <FILTER xsi:type="SIZEDEF-FILTER">
34
+ {%- set num_nibbles = (filter.filter_start.bit_length() + 7) // 8 * 2 %}
35
+ <FILTER-START>{{ ("%%0%dX" | format(num_nibbles | int)) | format(filter.filter_start | int) }}</FILTER-START>
36
+ <FILTER-SIZE>{{filter.filter_size}}</FILTER-SIZE>
37
+ </FILTER>
38
+ {%- endif %}
39
+ {%- endfor %}
40
+ </FILTERS>
41
+ {%- endif %}
42
+ {%- if datablock.segments %}
43
+ <SEGMENTS>
44
+ {%- for segment in datablock.segments %}
45
+ {{ pseg.printSegment(segment) | indent(4) }}
46
+ {%- endfor %}
47
+ </SEGMENTS>
48
+ {%- endif %}
49
+ {%- if datablock.target_addr_offset is not none %}
50
+ {%- if datablock.target_addr_offset.positive_offset is defined %}
51
+ <TARGET-ADDR-OFFSET xsi:type="POS-OFFSET">
52
+ {%- set num_nibbles = (datablock.target_addr_offset.positive_offset.bit_length() + 7) // 8 * 2 %}
53
+ <POSITIVE-OFFSET>{{("%%0%dX" | format(num_nibbles | int)) | format(datablock.target_addr_offset.positive_offset | int)}}</POSITIVE-OFFSET>
54
+ </TARGET-ADDR-OFFSET>
55
+ {%- elif datablock.target_addr_offset.negative_offset is defined %}
56
+ <TARGET-ADDR-OFFSET xsi:type="NEG-OFFSET">
57
+ {%- set num_nibbles = (datablock.target_addr_offset.negative_offset.bit_length() + 7) // 8 * 2 %}
58
+ <NEGATIVE-OFFSET>{{("%%0%dX" | format(num_nibbles | int)) | format(datablock.target_addr_offset.negative_offset | int)}}</NEGATIVE-OFFSET>
59
+ </TARGET-ADDR-OFFSET>
60
+ {%- endif %}
61
+ {%- endif %}
62
+ {%- if datablock.own_idents %}
63
+ <OWN-IDENTS>
64
+ {%- for own_ident in datablock.own_idents %}
65
+ {{ poi.printOwnIdent(own_ident)|indent(4) }}
66
+ {%- endfor %}
67
+ </OWN-IDENTS>
68
+ {%- endif %}
69
+ {%- if datablock.securities %}
70
+ <SECURITYS>
71
+ {%- for security in datablock.securities %}
72
+ {{ psec.printSecurity(security)|indent(4) }}
73
+ {%- endfor %}
74
+ </SECURITYS>
75
+ {%- endif %}
76
+ {{- psd.printSpecialDataGroups(datablock.sdgs)|indent(2, first=True) }}{#- #}
77
+ </DATABLOCK>
78
+ {%- endmacro -%}
@@ -28,7 +28,7 @@
28
28
  {%- if dc.functional_class_refs %}
29
29
  <FUNCT-CLASS-REFS>
30
30
  {%- for ref in dc.functional_class_refs %}
31
- <FUNCT-CLASS-REF ID-REF="{{ref.ref_id}}" />
31
+ <FUNCT-CLASS-REF {{make_ref_attribs(ref)}} />
32
32
  {%- endfor %}
33
33
  </FUNCT-CLASS-REFS>
34
34
  {%- endif%}
@@ -45,7 +45,7 @@
45
45
  {%- if dc.related_diag_comm_refs %}
46
46
  <RELATED-DIAG-COMM-REFS>
47
47
  {%- for ref in dc.related_diag_comm_refs %}
48
- <RELATED-DIAG-COMM-REF ID-REF="{{ref.ref_id}}">
48
+ <RELATED-DIAG-COMM-REF {{make_ref_attribs(ref)}}>
49
49
  <RELATION-TYPE>{{ref.relation_type}}</RELATION-TYPE>
50
50
  </RELATED-DIAG-COMM-REF>
51
51
  {%- endfor %}
@@ -33,6 +33,7 @@
33
33
  {%- endmacro -%}
34
34
 
35
35
  {%- macro printDiagLayerSubtags(dl) -%}
36
+ {{- set_layer_docfrag(dl.short_name) }}
36
37
  {%- set dlr = dl.diag_layer_raw %}
37
38
  {{ peid.printElementIdSubtags(dlr)|indent(1) }}
38
39
  {%- if dlr.admin_data is not none %}
@@ -149,7 +150,7 @@
149
150
 
150
151
  {%- if hasattr(dc, "ref_id") %}
151
152
  {#- -> reference to a diag-comm object #}
152
- <DIAG-COMM-REF ID-REF="{{dc.ref_id}}" />
153
+ <DIAG-COMM-REF {{make_ref_attribs(dc)}} />
153
154
  {%- elif hasattr(dc, "request") %}
154
155
  {#- -> service #}
155
156
  {{ ps.printService(dc)|indent(2) }}
@@ -14,7 +14,7 @@
14
14
  {%- if diag_variable.admin_data is not none %}
15
15
  {{ pad.printAdminData(diag_variable.admin_data)|indent(2) }}
16
16
  {%- endif %}
17
- <VARIABLE-GROUP-REF ID-REF="{{ diag_var.ref_id }}" />
17
+ <VARIABLE-GROUP-REF {{make_ref_attribs(diag_var)}} />
18
18
  {%- if diag_variable.sw_variables %}
19
19
  <SW-VARIABLES>
20
20
  {%- for sw_var in diag_variable.sw_variables %}
@@ -34,19 +34,19 @@
34
34
  {{ pd.printDescription(comm_relation.description) }}
35
35
  <RELATION-TYPE>{{comm_relation.relation_type}}</RELATION-TYPE>
36
36
  {%- if comm_relation.diag_comm_ref is not none %}
37
- <DIAG-COMM-REF ID-REF="{{comm_relation.diag_comm_ref.ref_id}}" />
37
+ <DIAG-COMM-REF {{make_ref_attribs(comm_relation.diag_comm_ref)}} />
38
38
  {%- endif %}
39
39
  {%- if comm_relation.diag_comm_snref is not none %}
40
40
  <DIAG-COMM-SNREF SHORT-NAME="{{comm_relation.diag_comm_snref}}" />
41
41
  {%- endif %}
42
42
  {%- if comm_relation.in_param_if_ref is not none %}
43
- <IN-PARAM-IF-REF ID-REF="{{comm_relation.in_param_if_ref.ref_id}}" />
43
+ <IN-PARAM-IF-REF {{make_ref_attribs(comm_relation.in_param_if_ref)}} />
44
44
  {%- endif %}
45
45
  {%- if comm_relation.in_param_if_snref is not none %}
46
46
  <IN-PARAM-IF-SNREF SHORT-NAME="{{comm_relation.in_param_if_snref}}" />
47
47
  {%- endif %}
48
48
  {%- if comm_relation.out_param_if_ref is not none %}
49
- <OUT-PARAM-IF-REF ID-REF="{{comm_relation.out_param_if_ref.ref_id}}" />
49
+ <OUT-PARAM-IF-REF {{make_ref_attribs(comm_relation.out_param_if_ref)}} />
50
50
  {%- endif %}
51
51
  {%- if comm_relation.out_param_if_snref is not none %}
52
52
  <OUT-PARAM-IF-SNREF SHORT-NAME="{{comm_relation.out_param_if_snref}}" />
@@ -11,13 +11,13 @@
11
11
  <DYN-ID-DEF-MODE-INFO>
12
12
  <DEF-MODE>{{ diddmi.def_mode }}</DEF-MODE>
13
13
  {%- if diddmi.clear_dyn_def_message_ref is not none %}
14
- <CLEAR-DYN-DEF-MESSAGE-REF ID-REF="{{diddmi.clear_dyn_def_message_ref.ref_id}}" />
14
+ <CLEAR-DYN-DEF-MESSAGE-REF {{make_ref_attribs(diddmi.clear_dyn_def_message_ref)}} />
15
15
  {%- endif %}
16
16
  {%- if diddmi.clear_dyn_def_message_snref is not none %}
17
17
  <CLEAR-DYN-DEF-MESSAGE-SNREF SHORT-NAME="{{diddmi.clear_dyn_def_message_snref}}" />
18
18
  {%- endif %}
19
19
  {%- if diddmi.read_dyn_def_message_ref is not none %}
20
- <READ-DYN-DEF-MESSAGE-REF ID-REF="{{diddmi.read_dyn_def_message_ref.ref_id}}" />
20
+ <READ-DYN-DEF-MESSAGE-REF {{make_ref_attribs(diddmi.read_dyn_def_message_ref)}} />
21
21
  {%- endif %}
22
22
  {%- if diddmi.read_dyn_def_message_snref is not none %}
23
23
  <READ-DYN-DEF-MESSAGE-SNREF SHORT-NAME="{{diddmi.read_dyn_def_message_snref}}" />
@@ -33,7 +33,7 @@
33
33
  <SELECTION-TABLE-REFS>
34
34
  {%- for seltref in diddmi.selection_table_refs %}
35
35
  {%- if hasattr(seltref, "ref_id") %}
36
- <SELECTION-TABLE-REF ID-REF="{{ seltref.ref_id }}" />
36
+ <SELECTION-TABLE-REF {{make_ref_attribs(seltref)}} />
37
37
  {%- else %}
38
38
  <SELECTION-TABLE-SNREF SHORT-NAME="{{ seltref }}" />
39
39
  {%- endif %}
@@ -8,8 +8,8 @@
8
8
  {%- macro printStaticField(demf) -%}
9
9
  <DYNAMIC-ENDMARKER-FIELD {{-peid.printElementIdAttribs(demf)}}>
10
10
  {{ peid.printElementIdSubtags(demf)|indent(1) }}
11
- <BASIC-STRUCTURE-REF ID-REF="{{demf.structure_ref.ref_id}}" />
12
- <DYN-END-DOP-REF ID-REF="{{demf.dyn_end_dop_ref.ref_id}}">
11
+ <BASIC-STRUCTURE-REF {{make_ref_attribs(demf.structure_ref)}} />
12
+ <DYN-END-DOP-REF {{make_ref_attribs(demf.dyn_end_dop_ref)}}>
13
13
  <TERMINATION-VALUE>{{demf.dyn_end_dop_ref.termination_value_raw}}</TERMINATION-VALUE>
14
14
  </DYN-END-DOP-REF>
15
15
  </DYNAMIC-ENDMARKER-FIELD>
@@ -8,7 +8,7 @@
8
8
  {%- macro printDynamicLengthField(dlf) -%}
9
9
  <DYNAMIC-LENGTH-FIELD {{-peid.printElementIdAttribs(dlf)}}>
10
10
  {{ peid.printElementIdSubtags(dlf)|indent(1) }}
11
- <BASIC-STRUCTURE-REF ID-REF="{{dlf.structure_ref.ref_id}}" />
11
+ <BASIC-STRUCTURE-REF {{make_ref_attribs(dlf.structure_ref)}} />
12
12
  <OFFSET>{{dlf.offset}}</OFFSET>
13
13
  <DETERMINE-NUMBER-OF-ITEMS>
14
14
  {%- set dni = dlf.determine_number_of_items %}
@@ -16,7 +16,7 @@
16
16
  {%- if dni.bit_position is not none %}
17
17
  <BIT-POSITION>{{dni.bit_position}}</BIT-POSITION>
18
18
  {%- endif %}
19
- <DATA-OBJECT-PROP-REF ID-REF="{{dni.dop_ref.ref_id}}" />
19
+ <DATA-OBJECT-PROP-REF {{make_ref_attribs(dni.dop_ref)}} />
20
20
  </DETERMINE-NUMBER-OF-ITEMS>
21
21
  </DYNAMIC-LENGTH-FIELD>
22
22
  {%- endmacro -%}
@@ -0,0 +1,24 @@
1
+ 1{#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ -#}
5
+
6
+ {%- import('macros/printAdminData.xml.jinja2') as pad %}
7
+ {%- import('macros/printElementId.xml.jinja2') as peid %}
8
+ {%- import('macros/printMem.xml.jinja2') as pm %}
9
+ {%- import('macros/printPhysMem.xml.jinja2') as ppm %}
10
+ {%- import('macros/printSpecialData.xml.jinja2') as psd %}
11
+
12
+ {%- macro printEcuMem(ecu_mem) -%}
13
+ <ECU-MEM {{peid.printElementIdAttribs(ecu_mem) | indent(1) }}>
14
+ {{peid.printElementIdSubtags(ecu_mem)|indent(2) }}
15
+ {%- if ecu_mem.admin_data is not none %}
16
+ {{ pad.printAdminData(ecu_mem.admin_data)|indent(2) }}
17
+ {%- endif %}
18
+ {{ pm.printMem(ecu_mem.mem)|indent(2) }}
19
+ {%- if ecu_mem.phys_mem is not none %}
20
+ {{ ppm.printPhysMem(ecu_mem.phys_mem)|indent(2) }}
21
+ {%- endif %}
22
+ {{- psd.printSpecialDataGroups(ecu_mem.sdgs)|indent(2, first=True) }}{#- #}
23
+ </ECU-MEM>
24
+ {%- endmacro -%}
@@ -0,0 +1,58 @@
1
+ 1{#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ -#}
5
+
6
+ {%- import('macros/printAdminData.xml.jinja2') as pad %}
7
+ {%- import('macros/printElementId.xml.jinja2') as peid %}
8
+ {%- import('macros/printIdentDesc.xml.jinja2') as pidd %}
9
+ {%- import('macros/printSpecialData.xml.jinja2') as psd %}
10
+ {%- import('macros/printSessionDesc.xml.jinja2') as psesd %}
11
+
12
+ {%- macro printEcuMemConnector(ecu_mem_connector) -%}
13
+ <ECU-MEM-CONNECTOR {{peid.printElementIdAttribs(ecu_mem_connector)}}>
14
+ {{peid.printElementIdSubtags(ecu_mem_connector)|indent(2) }}
15
+ {%- if ecu_mem_connector.admin_data is not none %}
16
+ {{ pad.printAdminData(ecu_mem_connector.admin_data)|indent(2) }}
17
+ {%- endif %}
18
+ {%- if ecu_mem_connector.flash_classes %}
19
+ <FLASH-CLASSS>
20
+ {%- for flash_class in ecu_mem_connector.flash_classes %}
21
+ <FLASH-CLASS {{peid.printElementIdAttribs(flash_class)}}>
22
+ {{peid.printElementIdSubtags(flash_class)|indent(6) }}
23
+ </FLASH-CLASS>
24
+ {%- endfor %}
25
+ </FLASH-CLASSS>
26
+ {%- endif %}
27
+ {%- if ecu_mem_connector.session_descs %}
28
+ <SESSION-DESCS>
29
+ {%- for session_desc in ecu_mem_connector.session_descs %}
30
+ {{psesd.printSessionDesc(session_desc)}}
31
+ {%- endfor %}
32
+ </SESSION-DESCS>
33
+ {%- endif %}
34
+ {%- if ecu_mem_connector.ident_descs %}
35
+ <IDENT-DESCS>
36
+ {%- for ident_desc in ecu_mem_connector.ident_descs %}
37
+ {{pidd.printIdentDesc(ident_desc)}}
38
+ {%- endfor %}
39
+ </IDENT-DESCS>
40
+ {%- endif %}
41
+ <ECU-MEM-REF {{make_ref_attribs(ecu_mem_connector.ecu_mem_ref)}} />
42
+ {%- if ecu_mem_connector.layer_refs %}
43
+ <LAYER-REFS>
44
+ {%- for layer_ref in ecu_mem_connector.layer_refs %}
45
+ <LAYER-REF {{make_ref_attribs(layer_ref)}} />
46
+ {%- endfor %}
47
+ </LAYER-REFS>
48
+ {%- endif %}
49
+ {%- if ecu_mem_connector.all_variant_refs %}
50
+ <ALL-VARIANT-REFS>
51
+ {%- for all_variant_ref in ecu_mem_connector.all_variant_refs %}
52
+ <ALL-VARIANT-REF {{make_ref_attribs(all_variant_ref)}} />
53
+ {%- endfor %}
54
+ </ALL-VARIANT-REFS>
55
+ {%- endif %}
56
+ {{- psd.printSpecialDataGroups(ecu_mem_connector.sdgs)|indent(2, first=True) }}{#- #}
57
+ </ECU-MEM-CONNECTOR>
58
+ {%- endmacro -%}
@@ -8,7 +8,7 @@
8
8
  {%- macro printEndOfPdu(eopdu) -%}
9
9
  <END-OF-PDU-FIELD {{-peid.printElementIdAttribs(eopdu)}}>
10
10
  {{ peid.printElementIdSubtags(eopdu)|indent(1) }}
11
- <BASIC-STRUCTURE-REF ID-REF="{{eopdu.structure_ref.ref_id}}" />
11
+ <BASIC-STRUCTURE-REF {{make_ref_attribs(eopdu.structure_ref)}} />
12
12
  {%- if eopdu.max_number_of_items is not none %}
13
13
  <MAX-NUMBER-OF-ITEMS>{{eopdu.max_number_of_items}}</MAX-NUMBER-OF-ITEMS>
14
14
  {%- endif %}
@@ -11,7 +11,7 @@
11
11
  <PARAM-SNREF SHORT-NAME="{{env_data_desc.param_snref}}"/>
12
12
  <ENV-DATA-REFS>
13
13
  {%- for env_data_ref in env_data_desc.env_data_refs %}
14
- <ENV-DATA-REF ID-REF="{{env_data_ref.ref_id}}"/>
14
+ <ENV-DATA-REF {{make_ref_attribs(env_data_ref)}}/>
15
15
  {%- endfor %}
16
16
  </ENV-DATA-REFS>
17
17
  </ENV-DATA-DESC>
@@ -0,0 +1,21 @@
1
+ {#- -*- mode: sgml; tab-width: 1; indent-tabs-mode: nil -*-
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ -#}
5
+
6
+ {%- import('macros/printElementId.xml.jinja2') as peid %}
7
+
8
+ {%- macro printExpectedIdent(expected_ident) -%}
9
+ <EXPECTED-IDENT {{-peid.printElementIdAttribs(expected_ident)}} >
10
+ {{ peid.printElementIdSubtags(expected_ident)}}
11
+ <IDENT-VALUES>
12
+ {%- for ident_value in expected_ident.ident_values %}
13
+ <IDENT-VALUE
14
+ {%- if ident_value.value_type is not none %}
15
+ {#- #} TYPE="{{ ident_value.value_type.value }}"
16
+ {%- endif %}
17
+ {#- #}>{{ident_value.value}}</IDENT-VALUE>
18
+ {%- endfor %}
19
+ </IDENT-VALUES>
20
+ </EXPECTED-IDENT>
21
+ {%- endmacro -%}