odxtools 10.1.1__py3-none-any.whl → 10.2.1__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 (112) 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/diaglayers/diaglayer.py +31 -11
  13. odxtools/diaglayers/ecuvariant.py +12 -19
  14. odxtools/diaglayers/hierarchyelement.py +5 -5
  15. odxtools/diaglayers/protocol.py +14 -0
  16. odxtools/direction.py +7 -0
  17. odxtools/ecumem.py +71 -0
  18. odxtools/ecumemconnector.py +136 -0
  19. odxtools/encryptcompressmethod.py +39 -0
  20. odxtools/encryptcompressmethodtype.py +13 -0
  21. odxtools/expectedident.py +40 -0
  22. odxtools/externflashdata.py +34 -0
  23. odxtools/filter.py +32 -0
  24. odxtools/flash.py +88 -0
  25. odxtools/flashclass.py +32 -0
  26. odxtools/flashdata.py +70 -0
  27. odxtools/fwchecksum.py +7 -0
  28. odxtools/fwsignature.py +7 -0
  29. odxtools/identdesc.py +54 -0
  30. odxtools/identvalue.py +32 -0
  31. odxtools/identvaluetype.py +14 -0
  32. odxtools/internflashdata.py +33 -0
  33. odxtools/loadfile.py +1 -1
  34. odxtools/mem.py +80 -0
  35. odxtools/modification.py +3 -2
  36. odxtools/negoffset.py +21 -0
  37. odxtools/odxlink.py +4 -2
  38. odxtools/ownident.py +38 -0
  39. odxtools/physicaltype.py +12 -10
  40. odxtools/physmem.py +52 -0
  41. odxtools/physsegment.py +42 -0
  42. odxtools/posoffset.py +21 -0
  43. odxtools/security.py +42 -0
  44. odxtools/securitymethod.py +7 -0
  45. odxtools/segment.py +63 -0
  46. odxtools/session.py +88 -0
  47. odxtools/sessiondesc.py +101 -0
  48. odxtools/sessionsubelemtype.py +14 -0
  49. odxtools/sizedeffilter.py +33 -0
  50. odxtools/sizedefphyssegment.py +33 -0
  51. odxtools/specialdata.py +2 -1
  52. odxtools/subcomponentparamconnector.py +1 -1
  53. odxtools/targetaddroffset.py +13 -0
  54. odxtools/templates/comparam-spec.odx-c.xml.jinja2 +1 -0
  55. odxtools/templates/comparam-subset.odx-cs.xml.jinja2 +1 -0
  56. odxtools/templates/diag_layer_container.odx-d.xml.jinja2 +2 -1
  57. odxtools/templates/flash.odx-f.xml.jinja2 +42 -0
  58. odxtools/templates/macros/printAdminData.xml.jinja2 +4 -4
  59. odxtools/templates/macros/printAudience.xml.jinja2 +3 -3
  60. odxtools/templates/macros/printChecksum.xml.jinja2 +36 -0
  61. odxtools/templates/macros/printComparam.xml.jinja2 +1 -1
  62. odxtools/templates/macros/printComparamRef.xml.jinja2 +1 -3
  63. odxtools/templates/macros/printCompuMethod.xml.jinja2 +1 -1
  64. odxtools/templates/macros/printDOP.xml.jinja2 +3 -3
  65. odxtools/templates/macros/printDatablock.xml.jinja2 +78 -0
  66. odxtools/templates/macros/printDiagComm.xml.jinja2 +2 -2
  67. odxtools/templates/macros/printDiagLayer.xml.jinja2 +2 -1
  68. odxtools/templates/macros/printDiagVariable.xml.jinja2 +4 -4
  69. odxtools/templates/macros/printDynDefinedSpec.xml.jinja2 +3 -3
  70. odxtools/templates/macros/printDynamicEndmarkerField.xml.jinja2 +2 -2
  71. odxtools/templates/macros/printDynamicLengthField.xml.jinja2 +2 -2
  72. odxtools/templates/macros/printEcuMem.xml.jinja2 +24 -0
  73. odxtools/templates/macros/printEcuMemConnector.xml.jinja2 +58 -0
  74. odxtools/templates/macros/printEndOfPdu.xml.jinja2 +1 -1
  75. odxtools/templates/macros/printEnvDataDesc.xml.jinja2 +1 -1
  76. odxtools/templates/macros/printExpectedIdent.xml.jinja2 +21 -0
  77. odxtools/templates/macros/printFlashdata.xml.jinja2 +43 -0
  78. odxtools/templates/macros/printIdentDesc.xml.jinja2 +17 -0
  79. odxtools/templates/macros/printMem.xml.jinja2 +35 -0
  80. odxtools/templates/macros/printMux.xml.jinja2 +3 -3
  81. odxtools/templates/macros/printOdxCategory.xml.jinja2 +4 -4
  82. odxtools/templates/macros/printOwnIdent.xml.jinja2 +17 -0
  83. odxtools/templates/macros/printParam.xml.jinja2 +4 -4
  84. odxtools/templates/macros/printParentRef.xml.jinja2 +1 -5
  85. odxtools/templates/macros/printPhysMem.xml.jinja2 +20 -0
  86. odxtools/templates/macros/printPhysSegment.xml.jinja2 +33 -0
  87. odxtools/templates/macros/printPreConditionStateRef.xml.jinja2 +1 -1
  88. odxtools/templates/macros/printProtStack.xml.jinja2 +1 -1
  89. odxtools/templates/macros/printProtocol.xml.jinja2 +1 -1
  90. odxtools/templates/macros/printSecurity.xml.jinja2 +37 -0
  91. odxtools/templates/macros/printSegment.xml.jinja2 +31 -0
  92. odxtools/templates/macros/printService.xml.jinja2 +3 -3
  93. odxtools/templates/macros/printSession.xml.jinja2 +45 -0
  94. odxtools/templates/macros/printSessionDesc.xml.jinja2 +40 -0
  95. odxtools/templates/macros/printSingleEcuJob.xml.jinja2 +3 -3
  96. odxtools/templates/macros/printSpecialData.xml.jinja2 +2 -2
  97. odxtools/templates/macros/printStateTransitionRef.xml.jinja2 +1 -1
  98. odxtools/templates/macros/printStaticField.xml.jinja2 +1 -1
  99. odxtools/templates/macros/printSubComponent.xml.jinja2 +3 -3
  100. odxtools/templates/macros/printTable.xml.jinja2 +6 -6
  101. odxtools/templates/macros/printUnitSpec.xml.jinja2 +2 -2
  102. odxtools/text.py +2 -6
  103. odxtools/utils.py +22 -1
  104. odxtools/validityfor.py +30 -0
  105. odxtools/version.py +2 -2
  106. odxtools/writepdxfile.py +70 -21
  107. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/METADATA +1 -1
  108. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/RECORD +112 -55
  109. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/WHEEL +1 -1
  110. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/entry_points.txt +0 -0
  111. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/licenses/LICENSE +0 -0
  112. {odxtools-10.1.1.dist-info → odxtools-10.2.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,101 @@
1
+ # SPDX-License-Identifier: MIT
2
+ from dataclasses import dataclass, field
3
+ from typing import Any, cast
4
+ from xml.etree import ElementTree
5
+
6
+ from .audience import Audience
7
+ from .direction import Direction
8
+ from .element import NamedElement
9
+ from .exceptions import odxraise, odxrequire
10
+ from .flashclass import FlashClass
11
+ from .nameditemlist import NamedItemList
12
+ from .odxdoccontext import OdxDocContext
13
+ from .odxlink import OdxLinkDatabase, OdxLinkId, OdxLinkRef
14
+ from .ownident import OwnIdent
15
+ from .snrefcontext import SnRefContext
16
+ from .specialdatagroup import SpecialDataGroup
17
+ from .utils import dataclass_fields_asdict
18
+
19
+
20
+ @dataclass(kw_only=True)
21
+ class SessionDesc(NamedElement):
22
+ partnumber: str | None = None
23
+ priority: int | None = None
24
+ session_snref: str
25
+ diag_comm_snref: str | None = None
26
+ flash_class_refs: list[OdxLinkRef] = field(default_factory=list)
27
+ sdgs: list[SpecialDataGroup] = field(default_factory=list)
28
+ audience: Audience | None = None
29
+ own_ident: OwnIdent | None = None
30
+ oid: str | None = None
31
+ direction: Direction
32
+
33
+ @property
34
+ def flash_classes(self) -> NamedItemList[FlashClass]:
35
+ return self._flash_classes
36
+
37
+ @staticmethod
38
+ def from_et(et_element: ElementTree.Element, context: OdxDocContext) -> "SessionDesc":
39
+
40
+ kwargs = dataclass_fields_asdict(NamedElement.from_et(et_element, context))
41
+
42
+ partnumber = et_element.findtext("PARTNUMBER")
43
+ priority = None
44
+ if (priority_str := et_element.findtext("PRIORITY")) is not None:
45
+ try:
46
+ priority = int(priority_str)
47
+ except Exception as e:
48
+ odxraise(f"Cannot parse PRIORITY: {e}")
49
+ session_snref = None
50
+ if (session_snref_elem := odxrequire(et_element.find("SESSION-SNREF"))) is not None:
51
+ session_snref = odxrequire(session_snref_elem.attrib.get("SHORT-NAME"))
52
+ diag_comm_snref = None
53
+ if (diag_comm_snref_elem := et_element.find("DIAG-COMM-SNREF")) is not None:
54
+ diag_comm_snref = odxrequire(diag_comm_snref_elem.attrib.get("SHORT-NAME"))
55
+ flash_class_refs = [
56
+ OdxLinkRef.from_et(el, context)
57
+ for el in et_element.iterfind("FLASH-CLASS-REFS/FLASH-CLASS-REF")
58
+ ]
59
+ sdgs = [SpecialDataGroup.from_et(sdge, context) for sdge in et_element.iterfind("SDGS/SDG")]
60
+ audience = None
61
+ if (audience_elem := et_element.find("AUDIENCE")) is not None:
62
+ audience = Audience.from_et(audience_elem, context)
63
+ own_ident = None
64
+ if (own_ident_elem := et_element.find("OWN-IDENT")) is not None:
65
+ own_ident = OwnIdent.from_et(own_ident_elem, context)
66
+ direction_str = odxrequire(et_element.attrib.get("DIRECTION"))
67
+ try:
68
+ direction = Direction(direction_str)
69
+ except ValueError:
70
+ odxraise(f"Encountered unknown DIRECTION '{direction_str}'")
71
+ direction = cast(Direction, None)
72
+ oid = et_element.attrib.get("OID")
73
+
74
+ return SessionDesc(
75
+ partnumber=partnumber,
76
+ priority=priority,
77
+ session_snref=session_snref,
78
+ diag_comm_snref=diag_comm_snref,
79
+ flash_class_refs=flash_class_refs,
80
+ sdgs=sdgs,
81
+ audience=audience,
82
+ own_ident=own_ident,
83
+ direction=direction,
84
+ oid=oid,
85
+ **kwargs)
86
+
87
+ def _build_odxlinks(self) -> dict[OdxLinkId, Any]:
88
+ odxlinks: dict[OdxLinkId, Any] = {}
89
+
90
+ if self.own_ident is not None:
91
+ odxlinks.update(self.own_ident._build_odxlinks())
92
+
93
+ return odxlinks
94
+
95
+ def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
96
+ self._flash_classes = NamedItemList(
97
+ [odxlinks.resolve(ref, FlashClass) for ref in self.flash_class_refs])
98
+
99
+ def _resolve_snrefs(self, context: SnRefContext) -> None:
100
+ # TODO: resolve session_snref and diag_comm_snref
101
+ pass
@@ -0,0 +1,14 @@
1
+ # SPDX-License-Identifier: MIT
2
+ from enum import Enum
3
+
4
+ from .odxtypes import DataType
5
+
6
+
7
+ class SessionSubElemType(Enum):
8
+ A_UINT32 = "A_UINT32"
9
+ A_BYTEFIELD = "A_BYTEFIELD"
10
+ A_ASCIISTRING = "A_ASCIISTRING"
11
+
12
+ @property
13
+ def data_type(self) -> DataType:
14
+ return DataType(self.value)
@@ -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 .filter import Filter
8
+ from .odxdoccontext import OdxDocContext
9
+ from .odxlink import OdxLinkDatabase, OdxLinkId
10
+ from .snrefcontext import SnRefContext
11
+ from .utils import dataclass_fields_asdict
12
+
13
+
14
+ @dataclass(kw_only=True)
15
+ class SizedefFilter(Filter):
16
+ filter_size: int
17
+
18
+ @staticmethod
19
+ def from_et(et_element: ElementTree.Element, context: OdxDocContext) -> "SizedefFilter":
20
+ kwargs = dataclass_fields_asdict(Filter.from_et(et_element, context))
21
+
22
+ filter_size = int(odxrequire(et_element.findtext("FILTER-SIZE")) or "0")
23
+
24
+ return SizedefFilter(filter_size=filter_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)
@@ -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)
@@ -77,7 +77,7 @@ class SubComponentParamConnector(IdentifiableElement):
77
77
  odxrequire(context.diag_layer).diag_comms, DiagService)
78
78
  self._service = service
79
79
 
80
- if self._service.request is not None:
80
+ if self._service.request is None:
81
81
  odxraise()
82
82
  return
83
83
  if not self._service.positive_responses:
@@ -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>