pyxcp 0.22.23__cp310-cp310-manylinux_2_28_x86_64.manylinux_2_27_x86_64.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.

Potentially problematic release.


This version of pyxcp might be problematic. Click here for more details.

Files changed (131) hide show
  1. pyxcp/__init__.py +20 -0
  2. pyxcp/aml/EtasCANMonitoring.a2l +82 -0
  3. pyxcp/aml/EtasCANMonitoring.aml +67 -0
  4. pyxcp/aml/XCP_Common.aml +408 -0
  5. pyxcp/aml/XCPonCAN.aml +78 -0
  6. pyxcp/aml/XCPonEth.aml +33 -0
  7. pyxcp/aml/XCPonFlx.aml +113 -0
  8. pyxcp/aml/XCPonSxI.aml +66 -0
  9. pyxcp/aml/XCPonUSB.aml +106 -0
  10. pyxcp/aml/ifdata_CAN.a2l +20 -0
  11. pyxcp/aml/ifdata_Eth.a2l +11 -0
  12. pyxcp/aml/ifdata_Flx.a2l +94 -0
  13. pyxcp/aml/ifdata_SxI.a2l +13 -0
  14. pyxcp/aml/ifdata_USB.a2l +81 -0
  15. pyxcp/asam/__init__.py +0 -0
  16. pyxcp/asam/types.py +131 -0
  17. pyxcp/asamkeydll.c +116 -0
  18. pyxcp/asamkeydll.sh +2 -0
  19. pyxcp/checksum.py +722 -0
  20. pyxcp/cmdline.py +52 -0
  21. pyxcp/config/__init__.py +1100 -0
  22. pyxcp/config/legacy.py +120 -0
  23. pyxcp/constants.py +47 -0
  24. pyxcp/cpp_ext/__init__.py +0 -0
  25. pyxcp/cpp_ext/bin.hpp +104 -0
  26. pyxcp/cpp_ext/blockmem.hpp +58 -0
  27. pyxcp/cpp_ext/cpp_ext.cpython-310-x86_64-linux-gnu.so +0 -0
  28. pyxcp/cpp_ext/cpp_ext.cpython-39-x86_64-linux-gnu.so +0 -0
  29. pyxcp/cpp_ext/daqlist.hpp +200 -0
  30. pyxcp/cpp_ext/event.hpp +67 -0
  31. pyxcp/cpp_ext/extension_wrapper.cpp +96 -0
  32. pyxcp/cpp_ext/helper.hpp +280 -0
  33. pyxcp/cpp_ext/mcobject.hpp +246 -0
  34. pyxcp/cpp_ext/tsqueue.hpp +46 -0
  35. pyxcp/daq_stim/__init__.py +228 -0
  36. pyxcp/daq_stim/optimize/__init__.py +67 -0
  37. pyxcp/daq_stim/optimize/binpacking.py +41 -0
  38. pyxcp/daq_stim/scheduler.cpp +28 -0
  39. pyxcp/daq_stim/scheduler.hpp +75 -0
  40. pyxcp/daq_stim/stim.cpp +13 -0
  41. pyxcp/daq_stim/stim.cpython-310-x86_64-linux-gnu.so +0 -0
  42. pyxcp/daq_stim/stim.cpython-39-x86_64-linux-gnu.so +0 -0
  43. pyxcp/daq_stim/stim.hpp +604 -0
  44. pyxcp/daq_stim/stim_wrapper.cpp +48 -0
  45. pyxcp/dllif.py +95 -0
  46. pyxcp/errormatrix.py +878 -0
  47. pyxcp/examples/conf_can.toml +19 -0
  48. pyxcp/examples/conf_can_user.toml +16 -0
  49. pyxcp/examples/conf_can_vector.json +11 -0
  50. pyxcp/examples/conf_can_vector.toml +11 -0
  51. pyxcp/examples/conf_eth.toml +9 -0
  52. pyxcp/examples/conf_nixnet.json +20 -0
  53. pyxcp/examples/conf_socket_can.toml +12 -0
  54. pyxcp/examples/conf_sxi.json +9 -0
  55. pyxcp/examples/conf_sxi.toml +7 -0
  56. pyxcp/examples/ex_arrow.py +109 -0
  57. pyxcp/examples/ex_csv.py +85 -0
  58. pyxcp/examples/ex_excel.py +95 -0
  59. pyxcp/examples/ex_mdf.py +124 -0
  60. pyxcp/examples/ex_sqlite.py +128 -0
  61. pyxcp/examples/run_daq.py +148 -0
  62. pyxcp/examples/xcp_policy.py +60 -0
  63. pyxcp/examples/xcp_read_benchmark.py +38 -0
  64. pyxcp/examples/xcp_skel.py +49 -0
  65. pyxcp/examples/xcp_unlock.py +38 -0
  66. pyxcp/examples/xcp_user_supplied_driver.py +54 -0
  67. pyxcp/examples/xcphello.py +79 -0
  68. pyxcp/examples/xcphello_recorder.py +107 -0
  69. pyxcp/master/__init__.py +9 -0
  70. pyxcp/master/errorhandler.py +436 -0
  71. pyxcp/master/master.py +2030 -0
  72. pyxcp/py.typed +0 -0
  73. pyxcp/recorder/__init__.py +102 -0
  74. pyxcp/recorder/build_clang.cmd +1 -0
  75. pyxcp/recorder/build_clang.sh +2 -0
  76. pyxcp/recorder/build_gcc.cmd +1 -0
  77. pyxcp/recorder/build_gcc.sh +2 -0
  78. pyxcp/recorder/build_gcc_arm.sh +2 -0
  79. pyxcp/recorder/converter/__init__.py +37 -0
  80. pyxcp/recorder/lz4.c +2829 -0
  81. pyxcp/recorder/lz4.h +879 -0
  82. pyxcp/recorder/lz4hc.c +2041 -0
  83. pyxcp/recorder/lz4hc.h +413 -0
  84. pyxcp/recorder/mio.hpp +1714 -0
  85. pyxcp/recorder/reader.hpp +139 -0
  86. pyxcp/recorder/reco.py +277 -0
  87. pyxcp/recorder/recorder.rst +0 -0
  88. pyxcp/recorder/rekorder.cpp +59 -0
  89. pyxcp/recorder/rekorder.cpython-310-x86_64-linux-gnu.so +0 -0
  90. pyxcp/recorder/rekorder.cpython-39-x86_64-linux-gnu.so +0 -0
  91. pyxcp/recorder/rekorder.hpp +274 -0
  92. pyxcp/recorder/setup.py +41 -0
  93. pyxcp/recorder/test_reko.py +34 -0
  94. pyxcp/recorder/unfolder.hpp +1332 -0
  95. pyxcp/recorder/wrap.cpp +189 -0
  96. pyxcp/recorder/writer.hpp +302 -0
  97. pyxcp/scripts/__init__.py +0 -0
  98. pyxcp/scripts/pyxcp_probe_can_drivers.py +20 -0
  99. pyxcp/scripts/xcp_examples.py +64 -0
  100. pyxcp/scripts/xcp_fetch_a2l.py +40 -0
  101. pyxcp/scripts/xcp_id_scanner.py +19 -0
  102. pyxcp/scripts/xcp_info.py +112 -0
  103. pyxcp/scripts/xcp_profile.py +27 -0
  104. pyxcp/stim/__init__.py +0 -0
  105. pyxcp/tests/test_asam_types.py +24 -0
  106. pyxcp/tests/test_binpacking.py +186 -0
  107. pyxcp/tests/test_can.py +1324 -0
  108. pyxcp/tests/test_checksum.py +95 -0
  109. pyxcp/tests/test_daq.py +193 -0
  110. pyxcp/tests/test_frame_padding.py +156 -0
  111. pyxcp/tests/test_master.py +2006 -0
  112. pyxcp/tests/test_transport.py +64 -0
  113. pyxcp/tests/test_utils.py +30 -0
  114. pyxcp/timing.py +60 -0
  115. pyxcp/transport/__init__.py +10 -0
  116. pyxcp/transport/base.py +440 -0
  117. pyxcp/transport/base_transport.hpp +0 -0
  118. pyxcp/transport/can.py +443 -0
  119. pyxcp/transport/eth.py +219 -0
  120. pyxcp/transport/sxi.py +133 -0
  121. pyxcp/transport/transport_wrapper.cpp +0 -0
  122. pyxcp/transport/usb_transport.py +213 -0
  123. pyxcp/types.py +993 -0
  124. pyxcp/utils.py +102 -0
  125. pyxcp/vector/__init__.py +0 -0
  126. pyxcp/vector/map.py +82 -0
  127. pyxcp-0.22.23.dist-info/LICENSE +165 -0
  128. pyxcp-0.22.23.dist-info/METADATA +107 -0
  129. pyxcp-0.22.23.dist-info/RECORD +131 -0
  130. pyxcp-0.22.23.dist-info/WHEEL +6 -0
  131. pyxcp-0.22.23.dist-info/entry_points.txt +8 -0
@@ -0,0 +1,95 @@
1
+ import pytest
2
+
3
+ from pyxcp import checksum
4
+
5
+
6
+ """
7
+ XCP_ADD_11 0x10 0x10
8
+ XCP_ADD_12 0x0F10 0x0F10
9
+ XCP_ADD_14 0x00000F10 0x00000F10
10
+ XCP_ADD_22 0x1800 0x0710
11
+ XCP_ADD_24 0x00071800 0x00080710
12
+ XCP_ADD_44 0x140C03F8 0xFC040B10
13
+
14
+ XCP_CRC_16 0xC76A 0xC76A
15
+ XCP_CRC_16_CITT 0x9D50 0x9D50
16
+ XCP_CRC_32 0x89CD97CE 0x89CD97CE
17
+ """
18
+
19
+ TEST = bytes(
20
+ (
21
+ 0x01,
22
+ 0x02,
23
+ 0x03,
24
+ 0x04,
25
+ 0x05,
26
+ 0x06,
27
+ 0x07,
28
+ 0x08,
29
+ 0x09,
30
+ 0x0A,
31
+ 0x0B,
32
+ 0x0C,
33
+ 0x0D,
34
+ 0x0E,
35
+ 0x0F,
36
+ 0x10,
37
+ 0xF1,
38
+ 0xF2,
39
+ 0xF3,
40
+ 0xF4,
41
+ 0xF5,
42
+ 0xF6,
43
+ 0xF7,
44
+ 0xF8,
45
+ 0xF9,
46
+ 0xFA,
47
+ 0xFB,
48
+ 0xFC,
49
+ 0xFD,
50
+ 0xFE,
51
+ 0xFF,
52
+ 0x00,
53
+ )
54
+ )
55
+
56
+
57
+ def testAdd11():
58
+ assert checksum.check(TEST, "XCP_ADD_11") == 0x10
59
+
60
+
61
+ def testAdd12():
62
+ assert checksum.check(TEST, "XCP_ADD_12") == 0x0F10
63
+
64
+
65
+ def testAdd14():
66
+ assert checksum.check(TEST, "XCP_ADD_14") == 0x00000F10
67
+
68
+
69
+ def testAdd22():
70
+ assert checksum.check(TEST, "XCP_ADD_22") == 0x1800
71
+
72
+
73
+ def testAdd24():
74
+ assert checksum.check(TEST, "XCP_ADD_24") == 0x00071800
75
+
76
+
77
+ def testAdd44():
78
+ assert checksum.check(TEST, "XCP_ADD_44") == 0x140C03F8
79
+
80
+
81
+ def testCrc16():
82
+ assert checksum.check(TEST, "XCP_CRC_16") == 0xC76A
83
+
84
+
85
+ def testCrc16Ccitt():
86
+ assert checksum.check(TEST, "XCP_CRC_16_CITT") == 0x9D50
87
+
88
+
89
+ def testCrc32():
90
+ assert checksum.check(TEST, "XCP_CRC_32") == 0x89CD97CE
91
+
92
+
93
+ def testUserDefined():
94
+ with pytest.raises(NotImplementedError):
95
+ checksum.check(TEST, "XCP_USER_DEFINED")
@@ -0,0 +1,193 @@
1
+ #!/usr/bin/env python
2
+
3
+ from pyxcp.daq_stim import DaqList, DaqProcessor
4
+
5
+
6
+ DAQ_INFO = {
7
+ "channels": [
8
+ {
9
+ "cycle": 0,
10
+ "maxDaqList": 1,
11
+ "name": "Key T",
12
+ "priority": 0,
13
+ "properties": {"consistency": "CONSISTENCY_ODT", "daq": True, "packed": False, "stim": False},
14
+ "unit": "EVENT_CHANNEL_TIME_UNIT_1MS",
15
+ },
16
+ {
17
+ "cycle": 10,
18
+ "maxDaqList": 1,
19
+ "name": "10 ms",
20
+ "priority": 1,
21
+ "properties": {"consistency": "CONSISTENCY_ODT", "daq": True, "packed": False, "stim": True},
22
+ "unit": "EVENT_CHANNEL_TIME_UNIT_1MS",
23
+ },
24
+ {
25
+ "cycle": 100,
26
+ "maxDaqList": 1,
27
+ "name": "100ms",
28
+ "priority": 2,
29
+ "properties": {"consistency": "CONSISTENCY_ODT", "daq": True, "packed": False, "stim": True},
30
+ "unit": "EVENT_CHANNEL_TIME_UNIT_1MS",
31
+ },
32
+ {
33
+ "cycle": 1,
34
+ "maxDaqList": 1,
35
+ "name": "1ms",
36
+ "priority": 3,
37
+ "properties": {"consistency": "CONSISTENCY_ODT", "daq": True, "packed": False, "stim": True},
38
+ "unit": "EVENT_CHANNEL_TIME_UNIT_1MS",
39
+ },
40
+ {
41
+ "cycle": 10,
42
+ "maxDaqList": 1,
43
+ "name": "FilterBypassDaq",
44
+ "priority": 4,
45
+ "properties": {"consistency": "CONSISTENCY_ODT", "daq": True, "packed": False, "stim": True},
46
+ "unit": "EVENT_CHANNEL_TIME_UNIT_1MS",
47
+ },
48
+ {
49
+ "cycle": 10,
50
+ "maxDaqList": 1,
51
+ "name": "FilterBypassStim",
52
+ "priority": 5,
53
+ "properties": {"consistency": "CONSISTENCY_ODT", "daq": False, "packed": False, "stim": True},
54
+ "unit": "EVENT_CHANNEL_TIME_UNIT_1MS",
55
+ },
56
+ ],
57
+ "processor": {
58
+ "keyByte": {
59
+ "addressExtension": "AE_DIFFERENT_WITHIN_ODT",
60
+ "identificationField": "IDF_REL_ODT_NUMBER_ABS_DAQ_LIST_NUMBER_BYTE",
61
+ "optimisationType": "OM_DEFAULT",
62
+ },
63
+ "maxDaq": 0,
64
+ "minDaq": 0,
65
+ "properties": {
66
+ "bitStimSupported": False,
67
+ "configType": "DYNAMIC",
68
+ "overloadEvent": False,
69
+ "overloadMsb": True,
70
+ "pidOffSupported": False,
71
+ "prescalerSupported": True,
72
+ "resumeSupported": True,
73
+ "timestampSupported": True,
74
+ },
75
+ },
76
+ "resolution": {
77
+ "granularityOdtEntrySizeDaq": 1,
78
+ "granularityOdtEntrySizeStim": 1,
79
+ "maxOdtEntrySizeDaq": 218,
80
+ "maxOdtEntrySizeStim": 218,
81
+ "timestampMode": {"fixed": False, "size": "S4", "unit": "DAQ_TIMESTAMP_UNIT_10US"},
82
+ "timestampTicks": 10,
83
+ },
84
+ }
85
+
86
+ SLAVE_INFO = {
87
+ "addressGranularity": 0,
88
+ "byteOrder": 0,
89
+ "interleavedMode": False,
90
+ "masterBlockMode": True,
91
+ "maxBs": 2,
92
+ "maxCto": 255,
93
+ "maxDto": 1500,
94
+ "maxWriteDaqMultipleElements": 31,
95
+ "minSt": 0,
96
+ "optionalCommMode": True,
97
+ "pgmProcessor": {},
98
+ "protocolLayerVersion": 1,
99
+ "queueSize": 0,
100
+ "slaveBlockMode": True,
101
+ "supportsCalpag": True,
102
+ "supportsDaq": True,
103
+ "supportsPgm": True,
104
+ "supportsStim": True,
105
+ "transportLayerVersion": 1,
106
+ "xcpDriverVersionNumber": 25,
107
+ }
108
+
109
+
110
+ class AttrDict(dict):
111
+ def __getattr__(self, name):
112
+ return self[name]
113
+
114
+
115
+ class MockMaster:
116
+ def __init__(self):
117
+ self.slaveProperties = AttrDict(
118
+ {
119
+ "maxDto": 1500,
120
+ "supportsDaq": True,
121
+ }
122
+ )
123
+
124
+ def getDaqInfo(self):
125
+ return DAQ_INFO
126
+
127
+ def freeDaq(self):
128
+ pass
129
+
130
+ def allocDaq(self, daq_count):
131
+ self.daq_count = daq_count
132
+
133
+ def allocOdt(self, daq_num, odt_count):
134
+ pass
135
+
136
+ def allocOdtEntry(self, daq_num, odt_num, entry_count):
137
+ pass
138
+
139
+ def setDaqPtr(self, daqListNumber, odtNumber, odtEntryNumber):
140
+ pass
141
+
142
+ def writeDaq(self, bitOffset, entrySize, addressExt, address):
143
+ pass
144
+
145
+ def setDaqListMode(self, mode, daqListNumber, eventChannelNumber, prescaler, priority):
146
+ pass
147
+
148
+ def startStopDaqList(self, mode, daqListNumber):
149
+ pass
150
+
151
+ def startStopSynch(self, mode):
152
+ pass
153
+
154
+
155
+ DAQ_LISTS = [
156
+ DaqList(
157
+ "list1",
158
+ 1,
159
+ False,
160
+ True,
161
+ [
162
+ ("channel1", 0x1BD004, 0, "U32"),
163
+ ("channel2", 0x1BD008, 0, "U32"),
164
+ ("PWMFiltered", 0x1BDDE2, 0, "U8"),
165
+ ("PWM", 0x1BDDDF, 0, "U8"),
166
+ ("Triangle", 0x1BDDDE, 0, "U8"),
167
+ ],
168
+ ),
169
+ DaqList(
170
+ "list2",
171
+ 3,
172
+ False,
173
+ True,
174
+ [
175
+ ("TestWord_002", 0x1BE124, 0, "U16"),
176
+ ("TestWord_003", 0x1BE128, 0, "U16"),
177
+ ("TestWord_001", 0x1BE120, 0, "U16"),
178
+ ("TestWord_003", 0x1BE128, 0, "U16"),
179
+ ("TestWord_004", 0x1BE12C, 0, "U16"),
180
+ ("TestWord_005", 0x1BE134, 0, "U16"),
181
+ ("TestWord_006", 0x1BE134, 0, "U16"),
182
+ ("TestWord_007", 0x1BE138, 0, "U16"),
183
+ ("TestWord_008", 0x1BE13C, 0, "U16"),
184
+ ("TestWord_009", 0x1BE140, 0, "U16"),
185
+ ("TestWord_011", 0x1BE148, 0, "U16"),
186
+ ],
187
+ ),
188
+ ]
189
+
190
+ # daq = DaqProcessor(DAQ_LISTS)
191
+ # daq.set_master(MockMaster())
192
+ # daq.setup()
193
+ # daq.start()
@@ -0,0 +1,156 @@
1
+ import pytest
2
+
3
+ from pyxcp.transport.can import pad_frame
4
+
5
+
6
+ def test_frame_padding_no_padding_length():
7
+ EXPECTED = (
8
+ (0, 8),
9
+ (1, 8),
10
+ (2, 8),
11
+ (3, 8),
12
+ (4, 8),
13
+ (5, 8),
14
+ (6, 8),
15
+ (7, 8),
16
+ (8, 8),
17
+ (9, 12),
18
+ (10, 12),
19
+ (11, 12),
20
+ (12, 12),
21
+ (13, 16),
22
+ (14, 16),
23
+ (15, 16),
24
+ (16, 16),
25
+ (17, 20),
26
+ (18, 20),
27
+ (19, 20),
28
+ (20, 20),
29
+ (21, 24),
30
+ (22, 24),
31
+ (23, 24),
32
+ (24, 24),
33
+ (25, 32),
34
+ (26, 32),
35
+ (27, 32),
36
+ (28, 32),
37
+ (29, 32),
38
+ (30, 32),
39
+ (31, 32),
40
+ (32, 32),
41
+ (33, 48),
42
+ (34, 48),
43
+ (35, 48),
44
+ (36, 48),
45
+ (37, 48),
46
+ (38, 48),
47
+ (39, 48),
48
+ (40, 48),
49
+ (41, 48),
50
+ (42, 48),
51
+ (43, 48),
52
+ (44, 48),
53
+ (45, 48),
54
+ (46, 48),
55
+ (47, 48),
56
+ (48, 48),
57
+ (49, 64),
58
+ (50, 64),
59
+ (51, 64),
60
+ (52, 64),
61
+ (53, 64),
62
+ (54, 64),
63
+ (55, 64),
64
+ (56, 64),
65
+ (57, 64),
66
+ (58, 64),
67
+ (59, 64),
68
+ (60, 64),
69
+ (61, 64),
70
+ (62, 64),
71
+ (63, 64),
72
+ (64, 64),
73
+ )
74
+ for frame_len in range(65):
75
+ frame = bytes(frame_len)
76
+ padded_frame = pad_frame(frame, padding_value=0, pad_frame=True)
77
+ frame_len = len(padded_frame)
78
+ _, expected_len = EXPECTED[frame_len]
79
+ assert frame_len == expected_len
80
+
81
+
82
+ @pytest.mark.skip
83
+ def test_frame_padding_padding_length32():
84
+ EXPECTED = (
85
+ (0, 32),
86
+ (1, 32),
87
+ (2, 32),
88
+ (3, 32),
89
+ (4, 32),
90
+ (5, 32),
91
+ (6, 32),
92
+ (7, 32),
93
+ (8, 32),
94
+ (9, 32),
95
+ (10, 32),
96
+ (11, 32),
97
+ (12, 32),
98
+ (13, 32),
99
+ (14, 32),
100
+ (15, 32),
101
+ (16, 32),
102
+ (17, 32),
103
+ (18, 32),
104
+ (19, 32),
105
+ (20, 32),
106
+ (21, 32),
107
+ (22, 32),
108
+ (23, 32),
109
+ (24, 32),
110
+ (25, 32),
111
+ (26, 32),
112
+ (27, 32),
113
+ (28, 32),
114
+ (29, 32),
115
+ (30, 32),
116
+ (31, 32),
117
+ (32, 32),
118
+ (33, 48),
119
+ (34, 48),
120
+ (35, 48),
121
+ (36, 48),
122
+ (37, 48),
123
+ (38, 48),
124
+ (39, 48),
125
+ (40, 48),
126
+ (41, 48),
127
+ (42, 48),
128
+ (43, 48),
129
+ (44, 48),
130
+ (45, 48),
131
+ (46, 48),
132
+ (47, 48),
133
+ (48, 48),
134
+ (49, 64),
135
+ (50, 64),
136
+ (51, 64),
137
+ (52, 64),
138
+ (53, 64),
139
+ (54, 64),
140
+ (55, 64),
141
+ (56, 64),
142
+ (57, 64),
143
+ (58, 64),
144
+ (59, 64),
145
+ (60, 64),
146
+ (61, 64),
147
+ (62, 64),
148
+ (63, 64),
149
+ (64, 64),
150
+ )
151
+ for frame_len in range(65):
152
+ frame = bytes(frame_len)
153
+ padded_frame = pad_frame(frame, padding_value=0, pad_frame=True)
154
+ frame_len = len(padded_frame)
155
+ _, expected_len = EXPECTED[frame_len]
156
+ assert frame_len == expected_len