pyxcp 0.25.5__cp312-cp312-macosx_11_0_arm64.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.
- pyxcp/__init__.py +20 -0
- pyxcp/aml/EtasCANMonitoring.a2l +82 -0
- pyxcp/aml/EtasCANMonitoring.aml +67 -0
- pyxcp/aml/XCP_Common.aml +408 -0
- pyxcp/aml/XCPonCAN.aml +78 -0
- pyxcp/aml/XCPonEth.aml +33 -0
- pyxcp/aml/XCPonFlx.aml +113 -0
- pyxcp/aml/XCPonSxI.aml +66 -0
- pyxcp/aml/XCPonUSB.aml +106 -0
- pyxcp/aml/ifdata_CAN.a2l +20 -0
- pyxcp/aml/ifdata_Eth.a2l +11 -0
- pyxcp/aml/ifdata_Flx.a2l +94 -0
- pyxcp/aml/ifdata_SxI.a2l +13 -0
- pyxcp/aml/ifdata_USB.a2l +81 -0
- pyxcp/asam/__init__.py +0 -0
- pyxcp/asam/types.py +131 -0
- pyxcp/asamkeydll +0 -0
- pyxcp/asamkeydll.c +116 -0
- pyxcp/asamkeydll.sh +2 -0
- pyxcp/checksum.py +732 -0
- pyxcp/cmdline.py +71 -0
- pyxcp/config/__init__.py +1257 -0
- pyxcp/config/legacy.py +120 -0
- pyxcp/constants.py +47 -0
- pyxcp/cpp_ext/__init__.py +0 -0
- pyxcp/cpp_ext/aligned_buffer.hpp +168 -0
- pyxcp/cpp_ext/bin.hpp +105 -0
- pyxcp/cpp_ext/blockmem.hpp +58 -0
- pyxcp/cpp_ext/cpp_ext.cpython-310-darwin.so +0 -0
- pyxcp/cpp_ext/cpp_ext.cpython-311-darwin.so +0 -0
- pyxcp/cpp_ext/cpp_ext.cpython-312-darwin.so +0 -0
- pyxcp/cpp_ext/daqlist.hpp +374 -0
- pyxcp/cpp_ext/event.hpp +67 -0
- pyxcp/cpp_ext/extension_wrapper.cpp +208 -0
- pyxcp/cpp_ext/framing.hpp +360 -0
- pyxcp/cpp_ext/helper.hpp +280 -0
- pyxcp/cpp_ext/mcobject.hpp +248 -0
- pyxcp/cpp_ext/sxi_framing.hpp +332 -0
- pyxcp/cpp_ext/tsqueue.hpp +46 -0
- pyxcp/daq_stim/__init__.py +291 -0
- pyxcp/daq_stim/optimize/__init__.py +67 -0
- pyxcp/daq_stim/optimize/binpacking.py +41 -0
- pyxcp/daq_stim/scheduler.cpp +62 -0
- pyxcp/daq_stim/scheduler.hpp +75 -0
- pyxcp/daq_stim/stim.cpp +13 -0
- pyxcp/daq_stim/stim.cpython-310-darwin.so +0 -0
- pyxcp/daq_stim/stim.cpython-311-darwin.so +0 -0
- pyxcp/daq_stim/stim.cpython-312-darwin.so +0 -0
- pyxcp/daq_stim/stim.hpp +604 -0
- pyxcp/daq_stim/stim_wrapper.cpp +50 -0
- pyxcp/dllif.py +100 -0
- pyxcp/errormatrix.py +878 -0
- pyxcp/examples/conf_can.toml +19 -0
- pyxcp/examples/conf_can_user.toml +16 -0
- pyxcp/examples/conf_can_vector.json +11 -0
- pyxcp/examples/conf_can_vector.toml +11 -0
- pyxcp/examples/conf_eth.toml +9 -0
- pyxcp/examples/conf_nixnet.json +20 -0
- pyxcp/examples/conf_socket_can.toml +12 -0
- pyxcp/examples/run_daq.py +165 -0
- pyxcp/examples/xcp_policy.py +60 -0
- pyxcp/examples/xcp_read_benchmark.py +38 -0
- pyxcp/examples/xcp_skel.py +48 -0
- pyxcp/examples/xcp_unlock.py +36 -0
- pyxcp/examples/xcp_user_supplied_driver.py +43 -0
- pyxcp/examples/xcphello.py +65 -0
- pyxcp/examples/xcphello_recorder.py +107 -0
- pyxcp/master/__init__.py +10 -0
- pyxcp/master/errorhandler.py +677 -0
- pyxcp/master/master.py +2641 -0
- pyxcp/py.typed +0 -0
- pyxcp/recorder/.idea/.gitignore +8 -0
- pyxcp/recorder/.idea/misc.xml +4 -0
- pyxcp/recorder/.idea/modules.xml +8 -0
- pyxcp/recorder/.idea/recorder.iml +6 -0
- pyxcp/recorder/.idea/sonarlint/issuestore/3/8/3808afc69ac1edb9d760000a2f137335b1b99728 +7 -0
- pyxcp/recorder/.idea/sonarlint/issuestore/9/a/9a2aa4db38d3115ed60da621e012c0efc0172aae +0 -0
- pyxcp/recorder/.idea/sonarlint/issuestore/b/4/b49006702b459496a8e8c94ebe60947108361b91 +0 -0
- pyxcp/recorder/.idea/sonarlint/issuestore/index.pb +7 -0
- pyxcp/recorder/.idea/sonarlint/securityhotspotstore/3/8/3808afc69ac1edb9d760000a2f137335b1b99728 +0 -0
- pyxcp/recorder/.idea/sonarlint/securityhotspotstore/9/a/9a2aa4db38d3115ed60da621e012c0efc0172aae +0 -0
- pyxcp/recorder/.idea/sonarlint/securityhotspotstore/b/4/b49006702b459496a8e8c94ebe60947108361b91 +0 -0
- pyxcp/recorder/.idea/sonarlint/securityhotspotstore/index.pb +7 -0
- pyxcp/recorder/.idea/vcs.xml +10 -0
- pyxcp/recorder/__init__.py +96 -0
- pyxcp/recorder/build_clang.cmd +1 -0
- pyxcp/recorder/build_clang.sh +2 -0
- pyxcp/recorder/build_gcc.cmd +1 -0
- pyxcp/recorder/build_gcc.sh +2 -0
- pyxcp/recorder/build_gcc_arm.sh +2 -0
- pyxcp/recorder/converter/__init__.py +444 -0
- pyxcp/recorder/lz4.c +2829 -0
- pyxcp/recorder/lz4.h +879 -0
- pyxcp/recorder/lz4hc.c +2041 -0
- pyxcp/recorder/lz4hc.h +413 -0
- pyxcp/recorder/mio.hpp +1714 -0
- pyxcp/recorder/reader.hpp +138 -0
- pyxcp/recorder/reco.py +278 -0
- pyxcp/recorder/recorder.rst +0 -0
- pyxcp/recorder/rekorder.cpp +59 -0
- pyxcp/recorder/rekorder.cpython-310-darwin.so +0 -0
- pyxcp/recorder/rekorder.cpython-311-darwin.so +0 -0
- pyxcp/recorder/rekorder.cpython-312-darwin.so +0 -0
- pyxcp/recorder/rekorder.hpp +274 -0
- pyxcp/recorder/setup.py +41 -0
- pyxcp/recorder/test_reko.py +34 -0
- pyxcp/recorder/unfolder.hpp +1354 -0
- pyxcp/recorder/wrap.cpp +184 -0
- pyxcp/recorder/writer.hpp +302 -0
- pyxcp/scripts/__init__.py +0 -0
- pyxcp/scripts/pyxcp_probe_can_drivers.py +20 -0
- pyxcp/scripts/xcp_examples.py +64 -0
- pyxcp/scripts/xcp_fetch_a2l.py +40 -0
- pyxcp/scripts/xcp_id_scanner.py +18 -0
- pyxcp/scripts/xcp_info.py +159 -0
- pyxcp/scripts/xcp_profile.py +26 -0
- pyxcp/scripts/xmraw_converter.py +31 -0
- pyxcp/stim/__init__.py +0 -0
- pyxcp/tests/test_asam_types.py +24 -0
- pyxcp/tests/test_binpacking.py +186 -0
- pyxcp/tests/test_can.py +1324 -0
- pyxcp/tests/test_checksum.py +95 -0
- pyxcp/tests/test_daq.py +193 -0
- pyxcp/tests/test_daq_opt.py +426 -0
- pyxcp/tests/test_frame_padding.py +156 -0
- pyxcp/tests/test_framing.py +262 -0
- pyxcp/tests/test_master.py +2116 -0
- pyxcp/tests/test_transport.py +177 -0
- pyxcp/tests/test_utils.py +30 -0
- pyxcp/timing.py +60 -0
- pyxcp/transport/__init__.py +13 -0
- pyxcp/transport/base.py +484 -0
- pyxcp/transport/base_transport.hpp +0 -0
- pyxcp/transport/can.py +660 -0
- pyxcp/transport/eth.py +254 -0
- pyxcp/transport/hdf5_policy.py +167 -0
- pyxcp/transport/sxi.py +209 -0
- pyxcp/transport/transport_ext.cpython-310-darwin.so +0 -0
- pyxcp/transport/transport_ext.cpython-311-darwin.so +0 -0
- pyxcp/transport/transport_ext.cpython-312-darwin.so +0 -0
- pyxcp/transport/transport_ext.hpp +214 -0
- pyxcp/transport/transport_wrapper.cpp +249 -0
- pyxcp/transport/usb_transport.py +229 -0
- pyxcp/types.py +987 -0
- pyxcp/utils/__init__.py +127 -0
- pyxcp/utils/cli.py +78 -0
- pyxcp/vector/__init__.py +0 -0
- pyxcp/vector/map.py +82 -0
- pyxcp-0.25.5.dist-info/METADATA +341 -0
- pyxcp-0.25.5.dist-info/RECORD +153 -0
- pyxcp-0.25.5.dist-info/WHEEL +6 -0
- pyxcp-0.25.5.dist-info/entry_points.txt +9 -0
- pyxcp-0.25.5.dist-info/licenses/LICENSE +165 -0
pyxcp/types.py
ADDED
|
@@ -0,0 +1,987 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import enum
|
|
3
|
+
from collections import namedtuple
|
|
4
|
+
|
|
5
|
+
import construct
|
|
6
|
+
from construct import (
|
|
7
|
+
BitsInteger,
|
|
8
|
+
BitStruct,
|
|
9
|
+
Bytes,
|
|
10
|
+
Enum,
|
|
11
|
+
Flag,
|
|
12
|
+
GreedyBytes,
|
|
13
|
+
GreedyRange,
|
|
14
|
+
If,
|
|
15
|
+
IfThenElse,
|
|
16
|
+
Int8ul,
|
|
17
|
+
Int16ub,
|
|
18
|
+
Int16ul,
|
|
19
|
+
Int32ub,
|
|
20
|
+
Int32ul,
|
|
21
|
+
Int64ub,
|
|
22
|
+
Int64ul,
|
|
23
|
+
Padding,
|
|
24
|
+
Struct,
|
|
25
|
+
Switch,
|
|
26
|
+
this,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if construct.version < (2, 8):
|
|
31
|
+
print("pyXCP requires at least construct 2.8")
|
|
32
|
+
exit(1)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
NumericType = (int, float)
|
|
36
|
+
MtaType = namedtuple("MtaType", "address ext")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class FrameSizeError(Exception):
|
|
40
|
+
"""
|
|
41
|
+
A frame with an invalid size was received.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class XcpResponseError(Exception):
|
|
46
|
+
"""
|
|
47
|
+
Raise an `exception` from an XCP error packet.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def get_error_code(self):
|
|
51
|
+
return self.args[0]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class XcpTimeoutError(Exception):
|
|
55
|
+
"""
|
|
56
|
+
Timeout while waiting for a response occured.
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class XcpGetIdType(enum.IntEnum):
|
|
61
|
+
ASCII_TEXT = 0
|
|
62
|
+
FILENAME = 1
|
|
63
|
+
FILE_AND_PATH = 2
|
|
64
|
+
URL = 3
|
|
65
|
+
FILE_TO_UPLOAD = 4
|
|
66
|
+
EPK = 5
|
|
67
|
+
ECU = 6
|
|
68
|
+
SYSID = 7
|
|
69
|
+
# Extensions by Vector Informatik.
|
|
70
|
+
VECTOR_MAPNAMES = 0xDB
|
|
71
|
+
VECTOR_MDI = 0xDC
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class XcpGetIdModeType(enum.IntEnum):
|
|
75
|
+
TRANSFER_MODE = 1
|
|
76
|
+
COMPRESSED_ENCRYPTED = 2
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class Command(enum.IntEnum):
|
|
80
|
+
# STD
|
|
81
|
+
|
|
82
|
+
# Mandatory Commands
|
|
83
|
+
CONNECT = 0xFF
|
|
84
|
+
DISCONNECT = 0xFE
|
|
85
|
+
GET_STATUS = 0xFD
|
|
86
|
+
SYNCH = 0xFC
|
|
87
|
+
|
|
88
|
+
# Optional Commands
|
|
89
|
+
GET_COMM_MODE_INFO = 0xFB
|
|
90
|
+
GET_ID = 0xFA
|
|
91
|
+
SET_REQUEST = 0xF9
|
|
92
|
+
GET_SEED = 0xF8
|
|
93
|
+
UNLOCK = 0xF7
|
|
94
|
+
SET_MTA = 0xF6
|
|
95
|
+
UPLOAD = 0xF5
|
|
96
|
+
SHORT_UPLOAD = 0xF4
|
|
97
|
+
BUILD_CHECKSUM = 0xF3
|
|
98
|
+
TRANSPORT_LAYER_CMD = 0xF2
|
|
99
|
+
USER_CMD = 0xF1
|
|
100
|
+
GET_VERSION = 0xC000
|
|
101
|
+
|
|
102
|
+
# CAL
|
|
103
|
+
|
|
104
|
+
# Mandatory Commands
|
|
105
|
+
DOWNLOAD = 0xF0
|
|
106
|
+
|
|
107
|
+
# Optional Commands
|
|
108
|
+
DOWNLOAD_NEXT = 0xEF
|
|
109
|
+
DOWNLOAD_MAX = 0xEE
|
|
110
|
+
SHORT_DOWNLOAD = 0xED
|
|
111
|
+
MODIFY_BITS = 0xEC
|
|
112
|
+
|
|
113
|
+
# PAG
|
|
114
|
+
|
|
115
|
+
# Mandatory Commands
|
|
116
|
+
SET_CAL_PAGE = 0xEB
|
|
117
|
+
GET_CAL_PAGE = 0xEA
|
|
118
|
+
|
|
119
|
+
# Optional Commands
|
|
120
|
+
GET_PAG_PROCESSOR_INFO = 0xE9
|
|
121
|
+
GET_SEGMENT_INFO = 0xE8
|
|
122
|
+
GET_PAGE_INFO = 0xE7
|
|
123
|
+
SET_SEGMENT_MODE = 0xE6
|
|
124
|
+
GET_SEGMENT_MODE = 0xE5
|
|
125
|
+
COPY_CAL_PAGE = 0xE4
|
|
126
|
+
|
|
127
|
+
# DAQ
|
|
128
|
+
|
|
129
|
+
# Mandatory Commands
|
|
130
|
+
CLEAR_DAQ_LIST = 0xE3
|
|
131
|
+
SET_DAQ_PTR = 0xE2
|
|
132
|
+
WRITE_DAQ = 0xE1
|
|
133
|
+
WRITE_DAQ_MULTIPLE = 0xC7
|
|
134
|
+
SET_DAQ_LIST_MODE = 0xE0
|
|
135
|
+
GET_DAQ_LIST_MODE = 0xDF
|
|
136
|
+
START_STOP_DAQ_LIST = 0xDE
|
|
137
|
+
START_STOP_SYNCH = 0xDD
|
|
138
|
+
|
|
139
|
+
# Optional Commands
|
|
140
|
+
GET_DAQ_CLOCK = 0xDC
|
|
141
|
+
READ_DAQ = 0xDB
|
|
142
|
+
GET_DAQ_PROCESSOR_INFO = 0xDA
|
|
143
|
+
GET_DAQ_RESOLUTION_INFO = 0xD9
|
|
144
|
+
GET_DAQ_LIST_INFO = 0xD8
|
|
145
|
+
GET_DAQ_EVENT_INFO = 0xD7
|
|
146
|
+
DTO_CTR_PROPERTIES = 0xC5
|
|
147
|
+
SET_DAQ_PACKED_MODE = 0xC001
|
|
148
|
+
GET_DAQ_PACKED_MODE = 0xC002
|
|
149
|
+
FREE_DAQ = 0xD6
|
|
150
|
+
ALLOC_DAQ = 0xD5
|
|
151
|
+
ALLOC_ODT = 0xD4
|
|
152
|
+
ALLOC_ODT_ENTRY = 0xD3
|
|
153
|
+
|
|
154
|
+
# PGM
|
|
155
|
+
|
|
156
|
+
# Mandatory Commands
|
|
157
|
+
PROGRAM_START = 0xD2
|
|
158
|
+
PROGRAM_CLEAR = 0xD1
|
|
159
|
+
PROGRAM = 0xD0
|
|
160
|
+
PROGRAM_RESET = 0xCF
|
|
161
|
+
|
|
162
|
+
# Optional Commands
|
|
163
|
+
GET_PGM_PROCESSOR_INFO = 0xCE
|
|
164
|
+
GET_SECTOR_INFO = 0xCD
|
|
165
|
+
PROGRAM_PREPARE = 0xCC
|
|
166
|
+
PROGRAM_FORMAT = 0xCB
|
|
167
|
+
PROGRAM_NEXT = 0xCA
|
|
168
|
+
PROGRAM_MAX = 0xC9
|
|
169
|
+
PROGRAM_VERIFY = 0xC8
|
|
170
|
+
|
|
171
|
+
TIME_CORRELATION_PROPERTIES = 0xC6
|
|
172
|
+
|
|
173
|
+
# DBG
|
|
174
|
+
|
|
175
|
+
DBG_ATTACH = 0xC0FC00
|
|
176
|
+
DBG_GET_VENDOR_INFO = 0xC0FC01
|
|
177
|
+
DBG_GET_MODE_INFO = 0xC0FC02
|
|
178
|
+
DBG_GET_JTAG_ID = 0xC0FC03
|
|
179
|
+
DBG_HALT_AFTER_RESET = 0xC0FC04
|
|
180
|
+
DBG_GET_HWIO_INFO = 0xC0FC05
|
|
181
|
+
DBG_SET_HWIO_EVENT = 0xC0FC06
|
|
182
|
+
DBG_HWIO_CONTROL = 0xC0FC07
|
|
183
|
+
DBG_EXCLUSIVE_TARGET_ACCESS = 0xC0FC08
|
|
184
|
+
DBG_SEQUENCE_MULTIPLE = 0xC0FC09
|
|
185
|
+
DBG_LLT = 0xC0FC0A
|
|
186
|
+
DBG_READ_MODIFY_WRITE = 0xC0FC0B
|
|
187
|
+
DBG_WRITE = 0xC0FC0C
|
|
188
|
+
DBG_WRITE_NEXT = 0xC0FC0D
|
|
189
|
+
DBG_WRITE_CAN1 = 0xC0FC0E
|
|
190
|
+
DBG_WRITE_CAN2 = 0xC0FC0F
|
|
191
|
+
DBG_WRITE_CAN_NEXT = 0xC0FC10
|
|
192
|
+
DBG_READ = 0xC0FC11
|
|
193
|
+
DBG_READ_CAN1 = 0xC0FC12
|
|
194
|
+
DBG_READ_CAN2 = 0xC0FC13
|
|
195
|
+
DBG_GET_TRI_DESC_TBL = 0xC0FC14
|
|
196
|
+
DBG_LLBT = 0xC0FC15
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class CommandCategory(enum.IntEnum):
|
|
200
|
+
"""Values reflect resources (resource protection status / unlock)."""
|
|
201
|
+
|
|
202
|
+
STD = 0
|
|
203
|
+
CAL_PAG = 1
|
|
204
|
+
DAQ = 4
|
|
205
|
+
STIM = 8
|
|
206
|
+
PGM = 16
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
COMMAND_CATEGORIES = { # Mainly needed to automatically UNLOCK.
|
|
210
|
+
Command.CONNECT: CommandCategory.STD,
|
|
211
|
+
Command.DISCONNECT: CommandCategory.STD,
|
|
212
|
+
Command.GET_STATUS: CommandCategory.STD,
|
|
213
|
+
Command.SYNCH: CommandCategory.STD,
|
|
214
|
+
Command.GET_COMM_MODE_INFO: CommandCategory.STD,
|
|
215
|
+
Command.GET_ID: CommandCategory.STD,
|
|
216
|
+
Command.SET_REQUEST: CommandCategory.STD,
|
|
217
|
+
Command.GET_SEED: CommandCategory.STD,
|
|
218
|
+
Command.UNLOCK: CommandCategory.STD,
|
|
219
|
+
Command.SET_MTA: CommandCategory.STD,
|
|
220
|
+
Command.UPLOAD: CommandCategory.STD,
|
|
221
|
+
Command.SHORT_UPLOAD: CommandCategory.STD,
|
|
222
|
+
Command.BUILD_CHECKSUM: CommandCategory.STD,
|
|
223
|
+
Command.TRANSPORT_LAYER_CMD: CommandCategory.STD,
|
|
224
|
+
Command.USER_CMD: CommandCategory.STD,
|
|
225
|
+
Command.GET_VERSION: CommandCategory.STD,
|
|
226
|
+
Command.DOWNLOAD: CommandCategory.CAL_PAG,
|
|
227
|
+
Command.DOWNLOAD_NEXT: CommandCategory.CAL_PAG,
|
|
228
|
+
Command.DOWNLOAD_MAX: CommandCategory.CAL_PAG,
|
|
229
|
+
Command.SHORT_DOWNLOAD: CommandCategory.CAL_PAG,
|
|
230
|
+
Command.MODIFY_BITS: CommandCategory.CAL_PAG,
|
|
231
|
+
Command.SET_CAL_PAGE: CommandCategory.CAL_PAG,
|
|
232
|
+
Command.GET_CAL_PAGE: CommandCategory.CAL_PAG,
|
|
233
|
+
Command.GET_PAG_PROCESSOR_INFO: CommandCategory.CAL_PAG,
|
|
234
|
+
Command.GET_SEGMENT_INFO: CommandCategory.CAL_PAG,
|
|
235
|
+
Command.GET_PAGE_INFO: CommandCategory.CAL_PAG,
|
|
236
|
+
Command.SET_SEGMENT_MODE: CommandCategory.CAL_PAG,
|
|
237
|
+
Command.GET_SEGMENT_MODE: CommandCategory.CAL_PAG,
|
|
238
|
+
Command.COPY_CAL_PAGE: CommandCategory.CAL_PAG,
|
|
239
|
+
Command.CLEAR_DAQ_LIST: CommandCategory.DAQ,
|
|
240
|
+
Command.CLEAR_DAQ_LIST: CommandCategory.DAQ,
|
|
241
|
+
Command.SET_DAQ_PTR: CommandCategory.DAQ,
|
|
242
|
+
Command.WRITE_DAQ: CommandCategory.DAQ,
|
|
243
|
+
Command.WRITE_DAQ_MULTIPLE: CommandCategory.DAQ,
|
|
244
|
+
Command.SET_DAQ_LIST_MODE: CommandCategory.DAQ,
|
|
245
|
+
Command.GET_DAQ_LIST_MODE: CommandCategory.DAQ,
|
|
246
|
+
Command.START_STOP_DAQ_LIST: CommandCategory.DAQ,
|
|
247
|
+
Command.START_STOP_SYNCH: CommandCategory.DAQ,
|
|
248
|
+
Command.GET_DAQ_CLOCK: CommandCategory.DAQ,
|
|
249
|
+
Command.READ_DAQ: CommandCategory.DAQ,
|
|
250
|
+
Command.GET_DAQ_PROCESSOR_INFO: CommandCategory.DAQ,
|
|
251
|
+
Command.GET_DAQ_RESOLUTION_INFO: CommandCategory.DAQ,
|
|
252
|
+
Command.GET_DAQ_LIST_INFO: CommandCategory.DAQ,
|
|
253
|
+
Command.GET_DAQ_EVENT_INFO: CommandCategory.DAQ,
|
|
254
|
+
Command.DTO_CTR_PROPERTIES: CommandCategory.DAQ,
|
|
255
|
+
Command.SET_DAQ_PACKED_MODE: CommandCategory.DAQ,
|
|
256
|
+
Command.GET_DAQ_PACKED_MODE: CommandCategory.DAQ,
|
|
257
|
+
Command.FREE_DAQ: CommandCategory.DAQ,
|
|
258
|
+
Command.ALLOC_DAQ: CommandCategory.DAQ,
|
|
259
|
+
Command.ALLOC_ODT: CommandCategory.DAQ,
|
|
260
|
+
Command.ALLOC_ODT_ENTRY: CommandCategory.DAQ,
|
|
261
|
+
Command.PROGRAM_START: CommandCategory.PGM,
|
|
262
|
+
Command.PROGRAM_CLEAR: CommandCategory.PGM,
|
|
263
|
+
Command.PROGRAM: CommandCategory.PGM,
|
|
264
|
+
Command.PROGRAM_RESET: CommandCategory.PGM,
|
|
265
|
+
Command.GET_PGM_PROCESSOR_INFO: CommandCategory.PGM,
|
|
266
|
+
Command.GET_SECTOR_INFO: CommandCategory.PGM,
|
|
267
|
+
Command.PROGRAM_PREPARE: CommandCategory.PGM,
|
|
268
|
+
Command.PROGRAM_FORMAT: CommandCategory.PGM,
|
|
269
|
+
Command.PROGRAM_NEXT: CommandCategory.PGM,
|
|
270
|
+
Command.PROGRAM_MAX: CommandCategory.PGM,
|
|
271
|
+
Command.PROGRAM_VERIFY: CommandCategory.PGM,
|
|
272
|
+
# Well... ?
|
|
273
|
+
# TIME_CORRELATION_PROPERTIES
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
class TransportLayerCommands(enum.IntEnum):
|
|
278
|
+
# CAN
|
|
279
|
+
GET_SLAVE_ID = 0xFF
|
|
280
|
+
GET_DAQ_ID = 0xFE
|
|
281
|
+
SET_DAQ_ID = 0xFD
|
|
282
|
+
|
|
283
|
+
# Flexray
|
|
284
|
+
FLX_ASSIGN = 0xFF
|
|
285
|
+
FLX_ACTIVATE = 0xFE
|
|
286
|
+
FLX_DEACTIVATE = 0xFD
|
|
287
|
+
GET_DAQ_FLX_BUF = 0xFC
|
|
288
|
+
SET_DAQ_FLX_BUF = 0xFB
|
|
289
|
+
|
|
290
|
+
# USB
|
|
291
|
+
GET_DAQ_EP = 0xFF
|
|
292
|
+
SET_DAQ_EP = 0xFE
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
XcpError = Enum(
|
|
296
|
+
Int8ul,
|
|
297
|
+
ERR_CMD_SYNCH=0x00, # Command processor synchronization. S0
|
|
298
|
+
ERR_CMD_BUSY=0x10, # Command was not executed. S2
|
|
299
|
+
ERR_DAQ_ACTIVE=0x11, # Command rejected because DAQ is running. S2
|
|
300
|
+
ERR_PGM_ACTIVE=0x12, # Command rejected because PGM is running. S2
|
|
301
|
+
ERR_CMD_UNKNOWN=0x20, # Unknown command or not implemented optional
|
|
302
|
+
# command. S2
|
|
303
|
+
ERR_CMD_SYNTAX=0x21, # Command syntax invalid. S2
|
|
304
|
+
ERR_OUT_OF_RANGE=0x22, # Command syntax valid but command parameter(s)
|
|
305
|
+
# out of range. S2
|
|
306
|
+
ERR_WRITE_PROTECTED=0x23, # The memory location is write protected. S2
|
|
307
|
+
ERR_ACCESS_DENIED=0x24, # The memory location is not accessible. S2
|
|
308
|
+
ERR_ACCESS_LOCKED=0x25, # Access denied, Seed & Key is required. S2
|
|
309
|
+
ERR_PAGE_NOT_VALID=0x26, # Selected page not available. S2
|
|
310
|
+
ERR_MODE_NOT_VALID=0x27, # Selected page mode not available. S2
|
|
311
|
+
ERR_SEGMENT_NOT_VALID=0x28, # Selected segment not valid. S2
|
|
312
|
+
ERR_SEQUENCE=0x29, # Sequence error. S2
|
|
313
|
+
ERR_DAQ_CONFIG=0x2A, # DAQ configuration not valid. S2
|
|
314
|
+
ERR_MEMORY_OVERFLOW=0x30, # Memory overflow error. S2
|
|
315
|
+
ERR_GENERIC=0x31, # Generic error. S2
|
|
316
|
+
ERR_VERIFY=0x32, # The slave internal program verify routine detects an
|
|
317
|
+
# error. S3
|
|
318
|
+
# NEW IN 1.1
|
|
319
|
+
ERR_RESOURCE_TEMPORARY_NOT_ACCESSIBLE=0x33,
|
|
320
|
+
# Access to the requested resource is temporary not possible. S3
|
|
321
|
+
ERR_TIMEOUT=0xFF, # Used by errorhandler; not an offical errorcode.
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
class Event(enum.IntEnum):
|
|
326
|
+
"""XCP Event Codes"""
|
|
327
|
+
|
|
328
|
+
EV_RESUME_MODE = 0x00
|
|
329
|
+
EV_CLEAR_DAQ = 0x01
|
|
330
|
+
EV_STORE_DAQ = 0x02
|
|
331
|
+
EV_STORE_CAL = 0x03
|
|
332
|
+
EV_CMD_PENDING = 0x05
|
|
333
|
+
EV_DAQ_OVERLOAD = 0x06
|
|
334
|
+
EV_SESSION_TERMINATED = 0x07
|
|
335
|
+
EV_TIME_SYNC = 0x08
|
|
336
|
+
EV_STIM_TIMEOUT = 0x09
|
|
337
|
+
EV_SLEEP = 0x0A
|
|
338
|
+
EV_WAKE_UP = 0x0B
|
|
339
|
+
EV_USER = 0xFE
|
|
340
|
+
EV_TRANSPORT = 0xFF
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
Response = Struct(
|
|
344
|
+
"type"
|
|
345
|
+
/ Enum(
|
|
346
|
+
Int8ul,
|
|
347
|
+
OK=0xFF,
|
|
348
|
+
ERR=0xFE,
|
|
349
|
+
EV=0xFD,
|
|
350
|
+
SERV=0xFC,
|
|
351
|
+
)
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
DAQ = Struct(
|
|
355
|
+
"odt" / Int8ul,
|
|
356
|
+
"daq" / Int8ul,
|
|
357
|
+
"data" / GreedyBytes,
|
|
358
|
+
)
|
|
359
|
+
|
|
360
|
+
ResourceType = BitStruct(
|
|
361
|
+
Padding(2),
|
|
362
|
+
"dbg" / Flag,
|
|
363
|
+
"pgm" / Flag,
|
|
364
|
+
"stim" / Flag,
|
|
365
|
+
"daq" / Flag,
|
|
366
|
+
Padding(1),
|
|
367
|
+
"calpag" / Flag,
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
RESOURCE_VALUES = {
|
|
371
|
+
"dbg": 32,
|
|
372
|
+
"pgm": 16,
|
|
373
|
+
"stim": 8,
|
|
374
|
+
"daq": 4,
|
|
375
|
+
"calpag": 1,
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
AddressGranularity = Enum(BitsInteger(2), BYTE=0b00, WORD=0b01, DWORD=0b10, RESERVED=0b11)
|
|
379
|
+
|
|
380
|
+
ByteOrder = Enum(BitsInteger(1), INTEL=0, MOTOROLA=1)
|
|
381
|
+
|
|
382
|
+
# byte-order dependent types
|
|
383
|
+
Int16u = IfThenElse(this._.byteOrder == ByteOrder.INTEL, Int16ul, Int16ub)
|
|
384
|
+
Int32u = IfThenElse(this._.byteOrder == ByteOrder.INTEL, Int32ul, Int32ub)
|
|
385
|
+
Int64u = IfThenElse(this._.byteOrder == ByteOrder.INTEL, Int64ul, Int64ub)
|
|
386
|
+
|
|
387
|
+
CommModeBasic = BitStruct(
|
|
388
|
+
"optional" / Flag, # The OPTIONAL flag indicates whether additional
|
|
389
|
+
# information on supported types of Communication mode
|
|
390
|
+
# is available. The master can get that additional
|
|
391
|
+
# information with GET_COMM_MODE_INFO
|
|
392
|
+
"slaveBlockMode" / Flag,
|
|
393
|
+
Padding(3),
|
|
394
|
+
"addressGranularity" / AddressGranularity,
|
|
395
|
+
"byteOrder" / ByteOrder,
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
ConnectResponsePartial = Struct("resource" / ResourceType, "commModeBasic" / CommModeBasic)
|
|
399
|
+
|
|
400
|
+
ConnectResponse = Struct(
|
|
401
|
+
"resource" / ResourceType,
|
|
402
|
+
"commModeBasic" / CommModeBasic,
|
|
403
|
+
"maxCto" / Int8ul,
|
|
404
|
+
"maxDto" / Int16u,
|
|
405
|
+
"protocolLayerVersion" / Int8ul,
|
|
406
|
+
"transportLayerVersion" / Int8ul,
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
GetVersionResponse = Struct(
|
|
410
|
+
Padding(1),
|
|
411
|
+
"protocolMajor" / Int8ul,
|
|
412
|
+
"protocolMinor" / Int8ul,
|
|
413
|
+
"transportMajor" / Int8ul,
|
|
414
|
+
"transportMinor" / Int8ul,
|
|
415
|
+
)
|
|
416
|
+
|
|
417
|
+
SessionStatus = BitStruct(
|
|
418
|
+
"resume" / Flag,
|
|
419
|
+
"daqRunning" / Flag,
|
|
420
|
+
Padding(2),
|
|
421
|
+
"clearDaqRequest" / Flag,
|
|
422
|
+
"storeDaqRequest" / Flag,
|
|
423
|
+
Padding(1),
|
|
424
|
+
"storeCalRequest" / Flag,
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
GetStatusResponse = Struct(
|
|
428
|
+
"sessionStatus" / SessionStatus,
|
|
429
|
+
"resourceProtectionStatus" / ResourceType,
|
|
430
|
+
Padding(1),
|
|
431
|
+
"sessionConfiguration" / Int16u,
|
|
432
|
+
)
|
|
433
|
+
|
|
434
|
+
CommModeOptional = BitStruct(
|
|
435
|
+
Padding(6),
|
|
436
|
+
"interleavedMode" / Flag,
|
|
437
|
+
"masterBlockMode" / Flag,
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
GetCommModeInfoResponse = Struct(
|
|
441
|
+
Padding(1),
|
|
442
|
+
"commModeOptional" / CommModeOptional,
|
|
443
|
+
Padding(1),
|
|
444
|
+
"maxBs" / Int8ul,
|
|
445
|
+
"minSt" / Int8ul,
|
|
446
|
+
"queueSize" / Int8ul,
|
|
447
|
+
"xcpDriverVersionNumber" / Int8ul,
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
GetIDResponse = Struct(
|
|
451
|
+
"mode" / Int8ul,
|
|
452
|
+
Padding(2),
|
|
453
|
+
"length" / Int32u,
|
|
454
|
+
"identification" / If(this.mode == 1, Int8ul[this.length]),
|
|
455
|
+
)
|
|
456
|
+
|
|
457
|
+
GetSeedResponse = Struct("length" / Int8ul, "seed" / If(this.length > 0, Int8ul[this.length]))
|
|
458
|
+
|
|
459
|
+
SetRequestMode = BitStruct(
|
|
460
|
+
Padding(4),
|
|
461
|
+
"clearDaqReq" / Flag,
|
|
462
|
+
"storeDaqReq" / Flag,
|
|
463
|
+
Padding(1),
|
|
464
|
+
"storeCalReq" / Flag,
|
|
465
|
+
)
|
|
466
|
+
|
|
467
|
+
BuildChecksumResponse = Struct(
|
|
468
|
+
"checksumType"
|
|
469
|
+
/ Enum(
|
|
470
|
+
Int8ul,
|
|
471
|
+
XCP_NONE=0x00,
|
|
472
|
+
XCP_ADD_11=0x01,
|
|
473
|
+
XCP_ADD_12=0x02,
|
|
474
|
+
XCP_ADD_14=0x03,
|
|
475
|
+
XCP_ADD_22=0x04,
|
|
476
|
+
XCP_ADD_24=0x05,
|
|
477
|
+
XCP_ADD_44=0x06,
|
|
478
|
+
XCP_CRC_16=0x07,
|
|
479
|
+
XCP_CRC_16_CITT=0x08,
|
|
480
|
+
XCP_CRC_32=0x09,
|
|
481
|
+
XCP_USER_DEFINED=0xFF,
|
|
482
|
+
),
|
|
483
|
+
Padding(2),
|
|
484
|
+
"checksum" / Int32u,
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
SetCalPageMode = BitStruct(
|
|
488
|
+
"all" / Flag,
|
|
489
|
+
Padding(5),
|
|
490
|
+
"xcp" / Flag,
|
|
491
|
+
"ecu" / Flag,
|
|
492
|
+
)
|
|
493
|
+
|
|
494
|
+
PagProperties = BitStruct(
|
|
495
|
+
Padding(7),
|
|
496
|
+
"freezeSupported" / Flag,
|
|
497
|
+
)
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
GetPagProcessorInfoResponse = Struct(
|
|
501
|
+
"maxSegments" / Int8ul,
|
|
502
|
+
"pagProperties" / PagProperties,
|
|
503
|
+
)
|
|
504
|
+
|
|
505
|
+
GetSegmentInfoMode0Response = Struct(
|
|
506
|
+
Padding(3),
|
|
507
|
+
"basicInfo" / Int32u,
|
|
508
|
+
)
|
|
509
|
+
|
|
510
|
+
GetSegmentInfoMode1Response = Struct(
|
|
511
|
+
"maxPages" / Int8ul,
|
|
512
|
+
"addressExtension" / Int8ul,
|
|
513
|
+
"maxMapping" / Int8ul,
|
|
514
|
+
"compressionMethod" / Int8ul,
|
|
515
|
+
"encryptionMethod" / Int8ul,
|
|
516
|
+
)
|
|
517
|
+
|
|
518
|
+
GetSegmentInfoMode2Response = Struct(
|
|
519
|
+
Padding(3),
|
|
520
|
+
"mappingInfo" / Int32u,
|
|
521
|
+
)
|
|
522
|
+
|
|
523
|
+
PageProperties = BitStruct(
|
|
524
|
+
Padding(2),
|
|
525
|
+
"xcpWriteAccessWithEcu" / Flag,
|
|
526
|
+
"xcpWriteAccessWithoutEcu" / Flag,
|
|
527
|
+
"xcpReadAccessWithEcu" / Flag,
|
|
528
|
+
"xcpReadAccessWithoutEcu" / Flag,
|
|
529
|
+
"ecuAccessWithXcp" / Flag,
|
|
530
|
+
"ecuAccessWithoutXcp" / Flag,
|
|
531
|
+
)
|
|
532
|
+
|
|
533
|
+
DaqProperties = BitStruct(
|
|
534
|
+
"overloadEvent" / Flag,
|
|
535
|
+
"overloadMsb" / Flag,
|
|
536
|
+
"pidOffSupported" / Flag,
|
|
537
|
+
"timestampSupported" / Flag,
|
|
538
|
+
"bitStimSupported" / Flag,
|
|
539
|
+
"resumeSupported" / Flag,
|
|
540
|
+
"prescalerSupported" / Flag,
|
|
541
|
+
"daqConfigType" / Enum(BitsInteger(1), STATIC=0b0, DYNAMIC=0b1),
|
|
542
|
+
)
|
|
543
|
+
|
|
544
|
+
GetDaqProcessorInfoResponse = Struct(
|
|
545
|
+
"daqProperties" / DaqProperties,
|
|
546
|
+
"maxDaq" / Int16u,
|
|
547
|
+
"maxEventChannel" / Int16u,
|
|
548
|
+
"minDaq" / Int8ul,
|
|
549
|
+
"daqKeyByte"
|
|
550
|
+
/ BitStruct(
|
|
551
|
+
"Identification_Field"
|
|
552
|
+
/ Enum(
|
|
553
|
+
BitsInteger(2),
|
|
554
|
+
IDF_ABS_ODT_NUMBER=0b00,
|
|
555
|
+
IDF_REL_ODT_NUMBER_ABS_DAQ_LIST_NUMBER_BYTE=0b01,
|
|
556
|
+
IDF_REL_ODT_NUMBER_ABS_DAQ_LIST_NUMBER_WORD=0b10,
|
|
557
|
+
IDF_REL_ODT_NUMBER_ABS_DAQ_LIST_NUMBER_WORD_ALIGNED=0b11,
|
|
558
|
+
),
|
|
559
|
+
"Address_Extension"
|
|
560
|
+
/ Enum(
|
|
561
|
+
BitsInteger(2),
|
|
562
|
+
AE_DIFFERENT_WITHIN_ODT=0b00,
|
|
563
|
+
AE_SAME_FOR_ALL_ODT=0b01,
|
|
564
|
+
_NOT_ALLOWED=0b10,
|
|
565
|
+
AE_SAME_FOR_ALL_DAQ=0b11,
|
|
566
|
+
),
|
|
567
|
+
"Optimisation_Type"
|
|
568
|
+
/ Enum(
|
|
569
|
+
BitsInteger(4),
|
|
570
|
+
OM_DEFAULT=0b0000,
|
|
571
|
+
OM_ODT_TYPE_16=0b0001,
|
|
572
|
+
OM_ODT_TYPE_32=0b0010,
|
|
573
|
+
OM_ODT_TYPE_64=0b0011,
|
|
574
|
+
OM_ODT_TYPE_ALIGNMENT=0b0100,
|
|
575
|
+
OM_MAX_ENTRY_SIZE=0b0101,
|
|
576
|
+
),
|
|
577
|
+
),
|
|
578
|
+
)
|
|
579
|
+
|
|
580
|
+
DAQ_DIRECTION = Enum(BitsInteger(1), DAQ=0, STIM=1)
|
|
581
|
+
|
|
582
|
+
PID_OFF = Enum(BitsInteger(1), DTO_WITH_ID_FIELD=0, DTO_WITHOUT_ID_FIELD=1)
|
|
583
|
+
|
|
584
|
+
CurrentMode = BitStruct(
|
|
585
|
+
"resume" / Flag,
|
|
586
|
+
"running" / Flag,
|
|
587
|
+
"pid_off" / PID_OFF,
|
|
588
|
+
"timestamp" / Flag,
|
|
589
|
+
Padding(2),
|
|
590
|
+
"direction" / DAQ_DIRECTION,
|
|
591
|
+
"selected" / Flag,
|
|
592
|
+
)
|
|
593
|
+
|
|
594
|
+
GetDaqListModeResponse = Struct(
|
|
595
|
+
"currentMode" / CurrentMode,
|
|
596
|
+
Padding(2),
|
|
597
|
+
"currentEventChannel" / Int16u,
|
|
598
|
+
"currentPrescaler" / Int8ul,
|
|
599
|
+
"currentPriority" / Int8ul,
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
SetDaqListMode = BitStruct(
|
|
603
|
+
Padding(2),
|
|
604
|
+
"pid_off" / PID_OFF,
|
|
605
|
+
"enable_timestamp" / Flag,
|
|
606
|
+
Padding(2),
|
|
607
|
+
"direction" / DAQ_DIRECTION,
|
|
608
|
+
Padding(1),
|
|
609
|
+
)
|
|
610
|
+
|
|
611
|
+
DaqElement = Struct(
|
|
612
|
+
"bitOffset" / Int8ul,
|
|
613
|
+
"size" / Int8ul,
|
|
614
|
+
"address" / Int32u,
|
|
615
|
+
"addressExt" / Int8ul,
|
|
616
|
+
Padding(1),
|
|
617
|
+
)
|
|
618
|
+
|
|
619
|
+
GetDaqClockResponse = Struct(
|
|
620
|
+
Padding(3),
|
|
621
|
+
"timestamp" / Int32u,
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
DaqPackedMode = Enum(Int8ul, NONE=0, ELEMENT_GROUPED=1, EVENT_GROUPED=2)
|
|
625
|
+
|
|
626
|
+
GetDaqPackedModeResponse = Struct(
|
|
627
|
+
Padding(1),
|
|
628
|
+
"daqPackedMode" / DaqPackedMode,
|
|
629
|
+
"dpmTimestampMode"
|
|
630
|
+
/ If(
|
|
631
|
+
(this.daqPackedMode == "ELEMENT_GROUPED") | (this.daqPackedMode == "EVENT_GROUPED"),
|
|
632
|
+
Int8ul,
|
|
633
|
+
),
|
|
634
|
+
"dpmSampleCount"
|
|
635
|
+
/ If(
|
|
636
|
+
(this.daqPackedMode == "ELEMENT_GROUPED") | (this.daqPackedMode == "EVENT_GROUPED"),
|
|
637
|
+
Int16u,
|
|
638
|
+
),
|
|
639
|
+
)
|
|
640
|
+
|
|
641
|
+
ReadDaqResponse = Struct(
|
|
642
|
+
"bitOffset" / Int8ul,
|
|
643
|
+
"sizeofDaqElement" / Int8ul,
|
|
644
|
+
"adressExtension" / Int8ul,
|
|
645
|
+
"address" / Int32u,
|
|
646
|
+
)
|
|
647
|
+
|
|
648
|
+
DaqTimestampUnit = Enum(
|
|
649
|
+
BitsInteger(4),
|
|
650
|
+
DAQ_TIMESTAMP_UNIT_1NS=0b0000,
|
|
651
|
+
DAQ_TIMESTAMP_UNIT_10NS=0b0001,
|
|
652
|
+
DAQ_TIMESTAMP_UNIT_100NS=0b0010,
|
|
653
|
+
DAQ_TIMESTAMP_UNIT_1US=0b0011,
|
|
654
|
+
DAQ_TIMESTAMP_UNIT_10US=0b0100,
|
|
655
|
+
DAQ_TIMESTAMP_UNIT_100US=0b0101,
|
|
656
|
+
DAQ_TIMESTAMP_UNIT_1MS=0b0110,
|
|
657
|
+
DAQ_TIMESTAMP_UNIT_10MS=0b0111,
|
|
658
|
+
DAQ_TIMESTAMP_UNIT_100MS=0b1000,
|
|
659
|
+
DAQ_TIMESTAMP_UNIT_1S=0b1001,
|
|
660
|
+
DAQ_TIMESTAMP_UNIT_1PS=0b1010,
|
|
661
|
+
DAQ_TIMESTAMP_UNIT_10PS=0b1011,
|
|
662
|
+
DAQ_TIMESTAMP_UNIT_100PS=0b1100,
|
|
663
|
+
)
|
|
664
|
+
|
|
665
|
+
GetDaqResolutionInfoResponse = Struct(
|
|
666
|
+
"granularityOdtEntrySizeDaq" / Int8ul,
|
|
667
|
+
"maxOdtEntrySizeDaq" / Int8ul,
|
|
668
|
+
"granularityOdtEntrySizeStim" / Int8ul,
|
|
669
|
+
"maxOdtEntrySizeStim" / Int8ul,
|
|
670
|
+
"timestampMode"
|
|
671
|
+
/ BitStruct( # Int8ul,
|
|
672
|
+
"unit" / DaqTimestampUnit,
|
|
673
|
+
"fixed" / Flag,
|
|
674
|
+
"size"
|
|
675
|
+
/ Enum(
|
|
676
|
+
BitsInteger(3),
|
|
677
|
+
NO_TIME_STAMP=0b000,
|
|
678
|
+
S1=0b001,
|
|
679
|
+
S2=0b010,
|
|
680
|
+
NOT_ALLOWED=0b011,
|
|
681
|
+
S4=0b100,
|
|
682
|
+
),
|
|
683
|
+
),
|
|
684
|
+
"timestampTicks" / Int16u,
|
|
685
|
+
)
|
|
686
|
+
|
|
687
|
+
DaqListProperties = BitStruct(
|
|
688
|
+
Padding(3),
|
|
689
|
+
"packed" / Flag,
|
|
690
|
+
"stim" / Flag,
|
|
691
|
+
"daq" / Flag,
|
|
692
|
+
"eventFixed" / Flag,
|
|
693
|
+
"predefined" / Flag,
|
|
694
|
+
)
|
|
695
|
+
|
|
696
|
+
GetDaqListInfoResponse = Struct(
|
|
697
|
+
"daqListProperties" / DaqListProperties,
|
|
698
|
+
"maxOdt" / Int8ul,
|
|
699
|
+
"maxOdtEntries" / Int8ul,
|
|
700
|
+
"fixedEvent" / Int16u,
|
|
701
|
+
)
|
|
702
|
+
|
|
703
|
+
StartStopDaqListResponse = Struct("firstPid" / Int8ul)
|
|
704
|
+
|
|
705
|
+
DaqEventProperties = BitStruct(
|
|
706
|
+
"consistency"
|
|
707
|
+
/ Enum(
|
|
708
|
+
BitsInteger(2),
|
|
709
|
+
CONSISTENCY_ODT=0b00,
|
|
710
|
+
CONSISTENCY_DAQ=0b01,
|
|
711
|
+
CONSISTENCY_EVENTCHANNEL=0b10,
|
|
712
|
+
CONSISTENCY_NONE=0b11,
|
|
713
|
+
),
|
|
714
|
+
Padding(1),
|
|
715
|
+
"packed" / Flag,
|
|
716
|
+
"stim" / Flag,
|
|
717
|
+
"daq" / Flag,
|
|
718
|
+
Padding(2),
|
|
719
|
+
)
|
|
720
|
+
|
|
721
|
+
GetEventChannelInfoResponse = Struct(
|
|
722
|
+
"daqEventProperties" / DaqEventProperties,
|
|
723
|
+
"maxDaqList" / Int8ul,
|
|
724
|
+
"eventChannelNameLength" / Int8ul,
|
|
725
|
+
"eventChannelTimeCycle" / Int8ul,
|
|
726
|
+
"eventChannelTimeUnit"
|
|
727
|
+
/ Enum(
|
|
728
|
+
Int8ul,
|
|
729
|
+
EVENT_CHANNEL_TIME_UNIT_1NS=0,
|
|
730
|
+
EVENT_CHANNEL_TIME_UNIT_10NS=1,
|
|
731
|
+
EVENT_CHANNEL_TIME_UNIT_100NS=2,
|
|
732
|
+
EVENT_CHANNEL_TIME_UNIT_1US=3,
|
|
733
|
+
EVENT_CHANNEL_TIME_UNIT_10US=4,
|
|
734
|
+
EVENT_CHANNEL_TIME_UNIT_100US=5,
|
|
735
|
+
EVENT_CHANNEL_TIME_UNIT_1MS=6,
|
|
736
|
+
EVENT_CHANNEL_TIME_UNIT_10MS=7,
|
|
737
|
+
EVENT_CHANNEL_TIME_UNIT_100MS=8,
|
|
738
|
+
EVENT_CHANNEL_TIME_UNIT_1S=9,
|
|
739
|
+
EVENT_CHANNEL_TIME_UNIT_1PS=10,
|
|
740
|
+
EVENT_CHANNEL_TIME_UNIT_10PS=11,
|
|
741
|
+
EVENT_CHANNEL_TIME_UNIT_100PS=12,
|
|
742
|
+
),
|
|
743
|
+
"eventChannelPriority" / Int8ul,
|
|
744
|
+
)
|
|
745
|
+
|
|
746
|
+
GetSlaveIdResponse = Struct(
|
|
747
|
+
"magic" / Bytes(3),
|
|
748
|
+
"identifier" / Int32u,
|
|
749
|
+
)
|
|
750
|
+
|
|
751
|
+
GetDaqIdResponse = Struct(
|
|
752
|
+
"canIdFixed"
|
|
753
|
+
/ Enum(
|
|
754
|
+
Int8ul,
|
|
755
|
+
CONFIGURABLE=0,
|
|
756
|
+
FIXED=1,
|
|
757
|
+
),
|
|
758
|
+
Padding(2),
|
|
759
|
+
"identifier" / Int32u,
|
|
760
|
+
)
|
|
761
|
+
|
|
762
|
+
DtoCtrProperties = BitStruct(
|
|
763
|
+
"evtCtrPresent" / Flag,
|
|
764
|
+
"stimCtrCpyPresent" / Flag,
|
|
765
|
+
"stimModePresent" / Flag,
|
|
766
|
+
"daqModePresent" / Flag,
|
|
767
|
+
"relatedEventPresent" / Flag,
|
|
768
|
+
"stimModeFixed" / Flag,
|
|
769
|
+
"daqModeFixed" / Flag,
|
|
770
|
+
"relatedEventFixed" / Flag,
|
|
771
|
+
)
|
|
772
|
+
|
|
773
|
+
DtoCtrMode = BitStruct(Padding(6), "stimMode" / Flag, "daqMode" / Flag)
|
|
774
|
+
|
|
775
|
+
DtoCtrPropertiesResponse = Struct("properties" / DtoCtrProperties, "relatedEventChannel" / Int16u, "mode" / DtoCtrMode)
|
|
776
|
+
|
|
777
|
+
CommModePgm = BitStruct(
|
|
778
|
+
Padding(1),
|
|
779
|
+
"slaveBlockMode" / Flag,
|
|
780
|
+
Padding(4),
|
|
781
|
+
"interleavedMode" / Flag,
|
|
782
|
+
"masterBlockMode" / Flag,
|
|
783
|
+
)
|
|
784
|
+
|
|
785
|
+
ProgramStartResponse = Struct(
|
|
786
|
+
Padding(1),
|
|
787
|
+
"commModePgm" / CommModePgm,
|
|
788
|
+
"maxCtoPgm" / Int8ul,
|
|
789
|
+
"maxBsPgm" / Int8ul,
|
|
790
|
+
"minStPgm" / Int8ul,
|
|
791
|
+
"queueSizePgm" / Int8ul,
|
|
792
|
+
)
|
|
793
|
+
|
|
794
|
+
PgmProperties = BitStruct(
|
|
795
|
+
"nonSeqPgmRequired" / Flag,
|
|
796
|
+
"nonSeqPgmSupported" / Flag,
|
|
797
|
+
"encryptionRequired" / Flag,
|
|
798
|
+
"encryptionSupported" / Flag,
|
|
799
|
+
"compressionRequired" / Flag,
|
|
800
|
+
"compressionSupported" / Flag,
|
|
801
|
+
"functionalMode" / Flag,
|
|
802
|
+
"absoluteMode" / Flag,
|
|
803
|
+
)
|
|
804
|
+
|
|
805
|
+
GetPgmProcessorInfoResponse = Struct("pgmProperties" / PgmProperties, "maxSector" / Int8ul)
|
|
806
|
+
|
|
807
|
+
GetSectorInfoResponseMode01 = Struct(
|
|
808
|
+
"clearSequenceNumber" / Int8ul,
|
|
809
|
+
"programSequenceNumber" / Int8ul,
|
|
810
|
+
"programmingMethod" / Int8ul,
|
|
811
|
+
"sectorInfo" / Int32u,
|
|
812
|
+
)
|
|
813
|
+
|
|
814
|
+
GetSectorInfoResponseMode2 = Struct("sectorNameLength" / Int8ul)
|
|
815
|
+
|
|
816
|
+
TimeCorrelationPropertiesResponse = Struct(
|
|
817
|
+
"slaveConfig" / Int8ul,
|
|
818
|
+
"observableClocks" / Int8ul,
|
|
819
|
+
"syncState" / Int8ul,
|
|
820
|
+
"clockInfo" / Int8ul,
|
|
821
|
+
Padding(1),
|
|
822
|
+
"clusterId" / Int16u,
|
|
823
|
+
)
|
|
824
|
+
|
|
825
|
+
DaqPtr = namedtuple("DaqPtr", "daqListNumber odtNumber odtEntryNumber")
|
|
826
|
+
|
|
827
|
+
DbgAttachResponse = Struct(
|
|
828
|
+
"major" / Int8ul,
|
|
829
|
+
"minor" / Int8ul,
|
|
830
|
+
"timeout1" / Int8ul,
|
|
831
|
+
"timeout7" / Int8ul,
|
|
832
|
+
Padding(1),
|
|
833
|
+
"maxCtoDbg" / Int16u,
|
|
834
|
+
)
|
|
835
|
+
|
|
836
|
+
DbgGetVendorInfoResponse = Struct(
|
|
837
|
+
"length" / Int8ul,
|
|
838
|
+
"vendorId" / Int16u,
|
|
839
|
+
"vendorInfo" / Int8ul[this.length],
|
|
840
|
+
)
|
|
841
|
+
|
|
842
|
+
DbgGetModeInfoResponse = Struct(
|
|
843
|
+
Padding(1),
|
|
844
|
+
"maxHwIoPins" / Int8ul,
|
|
845
|
+
"dialect" / Int8ul,
|
|
846
|
+
"feature" / Int8ul,
|
|
847
|
+
"serviceLevel" / Int8ul,
|
|
848
|
+
)
|
|
849
|
+
|
|
850
|
+
DbgGetJtagIdResponse = Struct(
|
|
851
|
+
Padding(3),
|
|
852
|
+
"jtagId" / Int32u,
|
|
853
|
+
)
|
|
854
|
+
|
|
855
|
+
DbgGetHwioInfoPin = Struct(
|
|
856
|
+
"index" / Int8ul,
|
|
857
|
+
"mode" / Int8ul,
|
|
858
|
+
"pinClass" / Int8ul,
|
|
859
|
+
"state" / Int8ul,
|
|
860
|
+
)
|
|
861
|
+
|
|
862
|
+
DbgGetHwioInfoResponse = Struct(
|
|
863
|
+
"num" / Int8ul,
|
|
864
|
+
"pins" / DbgGetHwioInfoPin[this.num],
|
|
865
|
+
)
|
|
866
|
+
|
|
867
|
+
DbgHwioControlResponse = GreedyBytes
|
|
868
|
+
|
|
869
|
+
DbgSequenceMultipleResult = Struct(
|
|
870
|
+
"status" / Int8ul,
|
|
871
|
+
"repeat" / Int8ul,
|
|
872
|
+
"tdo" / Int32ub,
|
|
873
|
+
)
|
|
874
|
+
|
|
875
|
+
DbgSequenceMultipleResponse = Struct(
|
|
876
|
+
Padding(1),
|
|
877
|
+
"num" / Int8ul,
|
|
878
|
+
"results" / DbgSequenceMultipleResult[this.num],
|
|
879
|
+
)
|
|
880
|
+
|
|
881
|
+
DbgLltResult = Struct(
|
|
882
|
+
"length" / Int8ul,
|
|
883
|
+
"data" / Int8ul[this.length // 8],
|
|
884
|
+
)
|
|
885
|
+
|
|
886
|
+
DbgLltResponse = Struct(
|
|
887
|
+
"num" / Int8ul,
|
|
888
|
+
"results" / DbgLltResult[this.num],
|
|
889
|
+
)
|
|
890
|
+
|
|
891
|
+
DbgReadModifyWriteResponse = Struct(
|
|
892
|
+
If(this._.width == 2, Padding(1)),
|
|
893
|
+
If(this._.width == 4, Padding(3)),
|
|
894
|
+
If(this._.width == 8, Padding(7)),
|
|
895
|
+
"value" / Switch(this._.width, {1: Int8ul, 2: Int16u, 4: Int32u, 8: Int64u}),
|
|
896
|
+
)
|
|
897
|
+
|
|
898
|
+
DbgReadResponse = Struct(
|
|
899
|
+
If(this._.width == 2, Padding(1)),
|
|
900
|
+
If(this._.width == 4, Padding(3)),
|
|
901
|
+
If(this._.width == 8, Padding(7)),
|
|
902
|
+
"data" / GreedyRange(Switch(this._.width, {1: Int8ul, 2: Int16u, 4: Int32u, 8: Int64u})),
|
|
903
|
+
)
|
|
904
|
+
|
|
905
|
+
DbgGetTriDescTblTrad = Struct(
|
|
906
|
+
"trai" / Int64ul,
|
|
907
|
+
"trdt" / Int16ul,
|
|
908
|
+
"trat" / Int16ul,
|
|
909
|
+
Padding(4),
|
|
910
|
+
)
|
|
911
|
+
|
|
912
|
+
DbgGetTriDescTblTri = Struct(
|
|
913
|
+
"tri" / Int8ul,
|
|
914
|
+
"trad_cnt" / Int8ul,
|
|
915
|
+
Padding(6),
|
|
916
|
+
"trads" / DbgGetTriDescTblTrad[this.trad_cnt],
|
|
917
|
+
)
|
|
918
|
+
|
|
919
|
+
DbgGetTriDescTbl = Struct("tri_cnt" / Int8ul, Padding(7), "tris" / DbgGetTriDescTblTri[this.tri_cnt])
|
|
920
|
+
|
|
921
|
+
DbgGetTriDescTblResponse = Struct("mode" / Int8ul, Padding(2), "length" / Int32u, "table" / DbgGetTriDescTbl)
|
|
922
|
+
|
|
923
|
+
DbgLlbtResponse = Struct(Padding(1), "length" / Int16u, "data" / Int8ul[this.length])
|
|
924
|
+
|
|
925
|
+
# Convert to seconds.
|
|
926
|
+
DAQ_TIMESTAMP_UNIT_TO_EXP = {
|
|
927
|
+
"DAQ_TIMESTAMP_UNIT_1PS": -12,
|
|
928
|
+
"DAQ_TIMESTAMP_UNIT_10PS": -11,
|
|
929
|
+
"DAQ_TIMESTAMP_UNIT_100PS": -10,
|
|
930
|
+
"DAQ_TIMESTAMP_UNIT_1NS": -9,
|
|
931
|
+
"DAQ_TIMESTAMP_UNIT_10NS": -8,
|
|
932
|
+
"DAQ_TIMESTAMP_UNIT_100NS": -7,
|
|
933
|
+
"DAQ_TIMESTAMP_UNIT_1US": -6,
|
|
934
|
+
"DAQ_TIMESTAMP_UNIT_10US": -5,
|
|
935
|
+
"DAQ_TIMESTAMP_UNIT_100US": -4,
|
|
936
|
+
"DAQ_TIMESTAMP_UNIT_1MS": -3,
|
|
937
|
+
"DAQ_TIMESTAMP_UNIT_10MS": -2,
|
|
938
|
+
"DAQ_TIMESTAMP_UNIT_100MS": -1,
|
|
939
|
+
"DAQ_TIMESTAMP_UNIT_1S": 0,
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
# Convert to nano-seconds.
|
|
943
|
+
DAQ_TIMESTAMP_UNIT_TO_NS = {
|
|
944
|
+
"DAQ_TIMESTAMP_UNIT_1PS": 0.001,
|
|
945
|
+
"DAQ_TIMESTAMP_UNIT_10PS": 0.01,
|
|
946
|
+
"DAQ_TIMESTAMP_UNIT_100PS": 0.1,
|
|
947
|
+
"DAQ_TIMESTAMP_UNIT_1NS": 1,
|
|
948
|
+
"DAQ_TIMESTAMP_UNIT_10NS": 10,
|
|
949
|
+
"DAQ_TIMESTAMP_UNIT_100NS": 100,
|
|
950
|
+
"DAQ_TIMESTAMP_UNIT_1US": 1000,
|
|
951
|
+
"DAQ_TIMESTAMP_UNIT_10US": 10 * 1000,
|
|
952
|
+
"DAQ_TIMESTAMP_UNIT_100US": 100 * 1000,
|
|
953
|
+
"DAQ_TIMESTAMP_UNIT_1MS": 1000 * 1000,
|
|
954
|
+
"DAQ_TIMESTAMP_UNIT_10MS": 10 * 1000 * 1000,
|
|
955
|
+
"DAQ_TIMESTAMP_UNIT_100MS": 100 * 1000 * 1000,
|
|
956
|
+
"DAQ_TIMESTAMP_UNIT_1S": 1000 * 1000 * 1000,
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
EVENT_CHANNEL_TIME_UNIT_TO_EXP = {
|
|
960
|
+
"EVENT_CHANNEL_TIME_UNIT_1PS": -12,
|
|
961
|
+
"EVENT_CHANNEL_TIME_UNIT_10PS": -11,
|
|
962
|
+
"EVENT_CHANNEL_TIME_UNIT_100PS": -10,
|
|
963
|
+
"EVENT_CHANNEL_TIME_UNIT_1NS": -9,
|
|
964
|
+
"EVENT_CHANNEL_TIME_UNIT_10NS": -8,
|
|
965
|
+
"EVENT_CHANNEL_TIME_UNIT_100NS": -7,
|
|
966
|
+
"EVENT_CHANNEL_TIME_UNIT_1US": -6,
|
|
967
|
+
"EVENT_CHANNEL_TIME_UNIT_10US": -5,
|
|
968
|
+
"EVENT_CHANNEL_TIME_UNIT_100US": -4,
|
|
969
|
+
"EVENT_CHANNEL_TIME_UNIT_1MS": -3,
|
|
970
|
+
"EVENT_CHANNEL_TIME_UNIT_10MS": -2,
|
|
971
|
+
"EVENT_CHANNEL_TIME_UNIT_100MS": -1,
|
|
972
|
+
"EVENT_CHANNEL_TIME_UNIT_1S": 0,
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
class XcpGetSeedMode(enum.IntEnum):
|
|
977
|
+
FIRST_PART = 0
|
|
978
|
+
REMAINING = 1
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
class TryCommandResult(enum.IntEnum):
|
|
982
|
+
""" """
|
|
983
|
+
|
|
984
|
+
OK = 0
|
|
985
|
+
XCP_ERROR = 1
|
|
986
|
+
NOT_IMPLEMENTED = 2
|
|
987
|
+
OTHER_ERROR = 3
|