pyxcp 0.23.8__cp313-cp313-macosx_11_0_arm64.whl → 0.25.7__cp313-cp313-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.
Files changed (89) hide show
  1. pyxcp/__init__.py +1 -1
  2. pyxcp/cmdline.py +14 -29
  3. pyxcp/config/__init__.py +1257 -1258
  4. pyxcp/cpp_ext/aligned_buffer.hpp +168 -0
  5. pyxcp/cpp_ext/bin.hpp +7 -6
  6. pyxcp/cpp_ext/cpp_ext.cpython-310-darwin.so +0 -0
  7. pyxcp/cpp_ext/cpp_ext.cpython-311-darwin.so +0 -0
  8. pyxcp/cpp_ext/cpp_ext.cpython-312-darwin.so +0 -0
  9. pyxcp/cpp_ext/cpp_ext.cpython-313-darwin.so +0 -0
  10. pyxcp/cpp_ext/daqlist.hpp +241 -73
  11. pyxcp/cpp_ext/extension_wrapper.cpp +123 -15
  12. pyxcp/cpp_ext/framing.hpp +360 -0
  13. pyxcp/cpp_ext/helper.hpp +280 -280
  14. pyxcp/cpp_ext/mcobject.hpp +248 -246
  15. pyxcp/cpp_ext/sxi_framing.hpp +332 -0
  16. pyxcp/daq_stim/__init__.py +145 -67
  17. pyxcp/daq_stim/optimize/binpacking.py +2 -2
  18. pyxcp/daq_stim/scheduler.cpp +8 -8
  19. pyxcp/errormatrix.py +2 -2
  20. pyxcp/examples/run_daq.py +5 -4
  21. pyxcp/examples/xcp_policy.py +6 -6
  22. pyxcp/examples/xcp_read_benchmark.py +2 -2
  23. pyxcp/examples/xcp_skel.py +1 -2
  24. pyxcp/examples/xcp_unlock.py +10 -12
  25. pyxcp/examples/xcp_user_supplied_driver.py +1 -2
  26. pyxcp/examples/xcphello.py +2 -15
  27. pyxcp/examples/xcphello_recorder.py +2 -2
  28. pyxcp/master/__init__.py +1 -0
  29. pyxcp/master/errorhandler.py +134 -4
  30. pyxcp/master/master.py +823 -252
  31. pyxcp/recorder/.idea/.gitignore +8 -0
  32. pyxcp/recorder/.idea/misc.xml +4 -0
  33. pyxcp/recorder/.idea/modules.xml +8 -0
  34. pyxcp/recorder/.idea/recorder.iml +6 -0
  35. pyxcp/recorder/.idea/sonarlint/issuestore/3/8/3808afc69ac1edb9d760000a2f137335b1b99728 +7 -0
  36. pyxcp/recorder/.idea/sonarlint/issuestore/9/a/9a2aa4db38d3115ed60da621e012c0efc0172aae +0 -0
  37. pyxcp/recorder/.idea/sonarlint/issuestore/b/4/b49006702b459496a8e8c94ebe60947108361b91 +0 -0
  38. pyxcp/recorder/.idea/sonarlint/issuestore/index.pb +7 -0
  39. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/3/8/3808afc69ac1edb9d760000a2f137335b1b99728 +0 -0
  40. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/9/a/9a2aa4db38d3115ed60da621e012c0efc0172aae +0 -0
  41. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/b/4/b49006702b459496a8e8c94ebe60947108361b91 +0 -0
  42. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/index.pb +7 -0
  43. pyxcp/recorder/.idea/vcs.xml +10 -0
  44. pyxcp/recorder/__init__.py +96 -98
  45. pyxcp/recorder/converter/__init__.py +4 -10
  46. pyxcp/recorder/reader.hpp +138 -139
  47. pyxcp/recorder/reco.py +1 -0
  48. pyxcp/recorder/rekorder.cpython-310-darwin.so +0 -0
  49. pyxcp/recorder/rekorder.cpython-311-darwin.so +0 -0
  50. pyxcp/recorder/rekorder.cpython-312-darwin.so +0 -0
  51. pyxcp/recorder/rekorder.cpython-313-darwin.so +0 -0
  52. pyxcp/recorder/rekorder.hpp +274 -274
  53. pyxcp/recorder/unfolder.hpp +1354 -1319
  54. pyxcp/recorder/wrap.cpp +184 -183
  55. pyxcp/recorder/writer.hpp +302 -302
  56. pyxcp/scripts/xcp_daq_recorder.py +54 -0
  57. pyxcp/scripts/xcp_fetch_a2l.py +2 -2
  58. pyxcp/scripts/xcp_id_scanner.py +1 -2
  59. pyxcp/scripts/xcp_info.py +66 -51
  60. pyxcp/scripts/xcp_profile.py +1 -2
  61. pyxcp/tests/test_daq.py +1 -1
  62. pyxcp/tests/test_framing.py +262 -0
  63. pyxcp/tests/test_master.py +210 -100
  64. pyxcp/tests/test_transport.py +138 -42
  65. pyxcp/timing.py +1 -1
  66. pyxcp/transport/__init__.py +8 -5
  67. pyxcp/transport/base.py +70 -180
  68. pyxcp/transport/can.py +58 -7
  69. pyxcp/transport/eth.py +32 -15
  70. pyxcp/transport/hdf5_policy.py +167 -0
  71. pyxcp/transport/sxi.py +126 -52
  72. pyxcp/transport/transport_ext.cpython-310-darwin.so +0 -0
  73. pyxcp/transport/transport_ext.cpython-311-darwin.so +0 -0
  74. pyxcp/transport/transport_ext.cpython-312-darwin.so +0 -0
  75. pyxcp/transport/transport_ext.cpython-313-darwin.so +0 -0
  76. pyxcp/transport/transport_ext.hpp +214 -0
  77. pyxcp/transport/transport_wrapper.cpp +249 -0
  78. pyxcp/transport/usb_transport.py +47 -31
  79. pyxcp/types.py +0 -13
  80. pyxcp/{utils.py → utils/__init__.py} +1 -2
  81. pyxcp/utils/cli.py +78 -0
  82. {pyxcp-0.23.8.dist-info → pyxcp-0.25.7.dist-info}/METADATA +4 -2
  83. pyxcp-0.25.7.dist-info/RECORD +158 -0
  84. {pyxcp-0.23.8.dist-info → pyxcp-0.25.7.dist-info}/WHEEL +1 -1
  85. pyxcp/examples/conf_sxi.json +0 -9
  86. pyxcp/examples/conf_sxi.toml +0 -7
  87. pyxcp-0.23.8.dist-info/RECORD +0 -135
  88. {pyxcp-0.23.8.dist-info → pyxcp-0.25.7.dist-info}/entry_points.txt +0 -0
  89. {pyxcp-0.23.8.dist-info → pyxcp-0.25.7.dist-info/licenses}/LICENSE +0 -0
@@ -1,246 +1,248 @@
1
-
2
- #if !defined(__MC_OBJECT_HPP)
3
- #define __MC_OBJECT_HPP
4
-
5
- #include <cstdint>
6
- #include <map>
7
- #include <optional>
8
- #include <ranges>
9
- #include <string>
10
- #include <vector>
11
-
12
- #include "helper.hpp"
13
-
14
- const std::map<const std::string, std::tuple<std::uint16_t, std::uint16_t>> TYPE_MAP = {
15
- { "U8", { 0, 1 } },
16
- { "I8", { 1, 1 } },
17
- { "U16", { 2, 2 } },
18
- { "I16", { 3, 2 } },
19
- { "U32", { 4, 4 } },
20
- { "I32", { 5, 4 } },
21
- { "U64", { 6, 8 } },
22
- { "I64", { 7, 8 } },
23
- { "F32", { 8, 4 } },
24
- { "F64", { 9, 8 } },
25
- #if HAS_FLOAT16
26
- { "F16", { 10, 2 } },
27
- #endif
28
- #if HAS_BFLOAT16
29
- { "BF16", { 11, 2 } },
30
- #endif
31
- };
32
-
33
- enum class TypeCode : std::uint8_t {
34
- U8,
35
- I8,
36
- U16,
37
- I16,
38
- U32,
39
- I32,
40
- U64,
41
- I64,
42
- F32,
43
- F64,
44
- F16,
45
- BF16,
46
- };
47
-
48
- const std::map<const std::string, TypeCode> TYPE_TO_TYPE_CODE_MAP = {
49
- { "U8", TypeCode::U8 },
50
- { "I8", TypeCode::I8 },
51
- { "U16", TypeCode::U16 },
52
- { "I16", TypeCode::I16 },
53
- { "U32", TypeCode::U32 },
54
- { "I32", TypeCode::I32 },
55
- { "U64", TypeCode::U64 },
56
- { "I64", TypeCode::I64 },
57
- { "F32", TypeCode::F32 },
58
- { "F64", TypeCode::F64 },
59
- #if HAS_FLOAT16
60
- { "F16", TypeCode::F16 },
61
- #endif
62
- #if HAS_BFLOAT16
63
- { "BF16", TypeCode::BF16 },
64
- #endif
65
- };
66
-
67
- const std::map<std::uint16_t, const std::string> TYPE_MAP_REV = {
68
- { 0, "U8" },
69
- { 1, "I8" },
70
- { 2, "U16" },
71
- { 3, "I16" },
72
- { 4, "U32" },
73
- { 5, "I32" },
74
- { 6, "U64" },
75
- { 7, "I64" },
76
- { 8, "F32" },
77
- { 9, "F64" },
78
- #if HAS_FLOAT16
79
- { 10, "F16" },
80
- #endif
81
- #if HAS_BFLOAT16
82
- { 11, "BF16" },
83
- #endif
84
- };
85
-
86
- inline std::vector<std::string> get_data_types() {
87
- std::vector<std::string> result;
88
-
89
- for (const auto& [k, v] : TYPE_MAP) {
90
- result.emplace_back(k);
91
- }
92
-
93
- return result;
94
- }
95
-
96
- class McObject {
97
- public:
98
-
99
- explicit McObject(
100
- std::string_view name, std::uint32_t address, std::uint8_t ext, std::uint16_t length, const std::string& data_type,
101
- const std::vector<McObject>& components = std::vector<McObject>()
102
- ) :
103
- m_name(name),
104
- m_address(address),
105
- m_ext(ext),
106
- m_length(length),
107
- m_data_type(data_type),
108
- m_type_index(-1),
109
- m_components(components) {
110
- if (data_type != "") {
111
- std::string dt_toupper;
112
-
113
- dt_toupper.resize(data_type.size());
114
-
115
- std::transform(data_type.begin(), data_type.end(), dt_toupper.begin(), [](unsigned char c) -> unsigned char {
116
- return std::toupper(c);
117
- });
118
-
119
- if (!TYPE_MAP.contains(dt_toupper)) {
120
- throw std::runtime_error("Invalid data type: " + data_type);
121
- }
122
-
123
- const auto [ti, len] = TYPE_MAP.at(dt_toupper);
124
- m_type_index = ti;
125
- m_length = len;
126
- }
127
- }
128
-
129
- McObject(const McObject& obj) = default;
130
- McObject(McObject&& obj) = default;
131
- McObject& operator=(const McObject&) = default;
132
- McObject& operator=(McObject&&) = default;
133
-
134
- const std::string& get_name() const {
135
- return m_name;
136
- }
137
-
138
- void set_name(std::string_view name) {
139
- m_name = name;
140
- }
141
-
142
- std::uint32_t get_address() const {
143
- return m_address;
144
- }
145
-
146
- void set_address(std::uint32_t address) {
147
- m_address = address;
148
- }
149
-
150
- std::uint8_t get_ext() const {
151
- return m_ext;
152
- }
153
-
154
- void set_ext(std::uint8_t ext) {
155
- m_ext = ext;
156
- }
157
-
158
- const std::string& get_data_type() const {
159
- return m_data_type;
160
- }
161
-
162
- void set_data_type(const std::string& value) {
163
- m_data_type = value;
164
- }
165
-
166
- std::uint16_t get_length() const {
167
- return m_length;
168
- }
169
-
170
- void set_length(std::uint16_t length) {
171
- m_length = length;
172
- }
173
-
174
- std::int32_t get_type_index() const {
175
- return m_type_index;
176
- }
177
-
178
- const std::vector<McObject>& get_components() const {
179
- return m_components;
180
- }
181
-
182
- void add_component(const McObject& obj) {
183
- m_components.emplace_back(obj);
184
- }
185
-
186
- bool operator==(const McObject& other) const {
187
- return (m_name == other.m_name) && (m_address == other.m_address) && (m_ext == other.m_ext) &&
188
- (m_length == other.m_length) && (m_data_type == other.m_data_type) &&
189
- (std::equal(m_components.begin(), m_components.end(), other.m_components.begin(), other.m_components.end()));
190
- }
191
-
192
- std::string dumps() const noexcept {
193
- std::stringstream ss;
194
-
195
- ss << to_binary(m_name);
196
- ss << to_binary(m_address);
197
- ss << to_binary(m_ext);
198
- ss << to_binary(m_length);
199
- ss << to_binary(m_data_type);
200
- ss << to_binary(m_type_index);
201
-
202
- std::size_t ccount = m_components.size();
203
- ss << to_binary(ccount);
204
- for (const auto& obj : m_components) {
205
- ss << obj.dumps();
206
- }
207
- return ss.str();
208
- }
209
-
210
- auto get_hash() const noexcept {
211
- std::hash<std::string> hash_fn;
212
- return hash_fn(dumps());
213
- }
214
-
215
- private:
216
-
217
- std::string m_name;
218
- std::uint32_t m_address;
219
- std::uint8_t m_ext;
220
- std::uint16_t m_length;
221
- std::string m_data_type;
222
- std::int16_t m_type_index;
223
- std::vector<McObject> m_components{};
224
- };
225
-
226
- std::string mc_components_to_string(const std::vector<McObject>& components);
227
-
228
- std::string to_string(const McObject& obj) {
229
- std::stringstream ss;
230
-
231
- ss << "McObject(name='" << obj.get_name() << "', address=" << obj.get_address()
232
- << ", ext=" << static_cast<std::uint16_t >(obj.get_ext()) << ", data_type='" << obj.get_data_type()
233
- << "', length=" << obj.get_length() << ", components=[" << mc_components_to_string(obj.get_components()) << "])";
234
- return ss.str();
235
- }
236
-
237
- std::string mc_components_to_string(const std::vector<McObject>& components) {
238
- std::stringstream ss;
239
-
240
- for (const auto& obj : components) {
241
- ss << to_string(obj) << ",\n ";
242
- }
243
- return ss.str();
244
- }
245
-
246
- #endif // __MC_OBJECT_HPP
1
+
2
+ #if !defined(__MC_OBJECT_HPP)
3
+ #define __MC_OBJECT_HPP
4
+
5
+ #include <cstdint>
6
+ #include <map>
7
+ #include <optional>
8
+ #include <ranges>
9
+ #include <string>
10
+ #include <vector>
11
+
12
+ #include "helper.hpp"
13
+
14
+ const std::map<const std::string, std::tuple<std::uint16_t, std::uint16_t>> TYPE_MAP = {
15
+ { "U8", { 0, 1 } },
16
+ { "I8", { 1, 1 } },
17
+ { "U16", { 2, 2 } },
18
+ { "I16", { 3, 2 } },
19
+ { "U32", { 4, 4 } },
20
+ { "I32", { 5, 4 } },
21
+ { "U64", { 6, 8 } },
22
+ { "I64", { 7, 8 } },
23
+ { "F32", { 8, 4 } },
24
+ { "F64", { 9, 8 } },
25
+ #if HAS_FLOAT16
26
+ { "F16", { 10, 2 } },
27
+ #endif
28
+ #if HAS_BFLOAT16
29
+ { "BF16", { 11, 2 } },
30
+ #endif
31
+ };
32
+
33
+ enum class TypeCode : std::uint8_t {
34
+ U8,
35
+ I8,
36
+ U16,
37
+ I16,
38
+ U32,
39
+ I32,
40
+ U64,
41
+ I64,
42
+ F32,
43
+ F64,
44
+ F16,
45
+ BF16,
46
+ };
47
+
48
+ const std::map<const std::string, TypeCode> TYPE_TO_TYPE_CODE_MAP = {
49
+ { "U8", TypeCode::U8 },
50
+ { "I8", TypeCode::I8 },
51
+ { "U16", TypeCode::U16 },
52
+ { "I16", TypeCode::I16 },
53
+ { "U32", TypeCode::U32 },
54
+ { "I32", TypeCode::I32 },
55
+ { "U64", TypeCode::U64 },
56
+ { "I64", TypeCode::I64 },
57
+ { "F32", TypeCode::F32 },
58
+ { "F64", TypeCode::F64 },
59
+ #if HAS_FLOAT16
60
+ { "F16", TypeCode::F16 },
61
+ #endif
62
+ #if HAS_BFLOAT16
63
+ { "BF16", TypeCode::BF16 },
64
+ #endif
65
+ };
66
+
67
+ const std::map<std::uint16_t, const std::string> TYPE_MAP_REV = {
68
+ { 0, "U8" },
69
+ { 1, "I8" },
70
+ { 2, "U16" },
71
+ { 3, "I16" },
72
+ { 4, "U32" },
73
+ { 5, "I32" },
74
+ { 6, "U64" },
75
+ { 7, "I64" },
76
+ { 8, "F32" },
77
+ { 9, "F64" },
78
+ #if HAS_FLOAT16
79
+ { 10, "F16" },
80
+ #endif
81
+ #if HAS_BFLOAT16
82
+ { 11, "BF16" },
83
+ #endif
84
+ };
85
+
86
+ inline std::vector<std::string> get_data_types() {
87
+ std::vector<std::string> result;
88
+
89
+ for (const auto& [k, v] : TYPE_MAP) {
90
+ result.emplace_back(k);
91
+ }
92
+
93
+ return result;
94
+ }
95
+
96
+ class McObject {
97
+ public:
98
+
99
+ explicit McObject(
100
+ std::string_view name, std::uint32_t address, std::uint8_t ext, std::uint16_t length, const std::string& data_type,
101
+ const std::vector<McObject>& components = std::vector<McObject>()
102
+ ) :
103
+ m_name(name),
104
+ m_address(address),
105
+ m_ext(ext),
106
+ m_length(length),
107
+ m_data_type(data_type),
108
+ m_type_index(-1),
109
+ m_components(components) {
110
+ if (data_type != "") {
111
+ std::string dt_toupper;
112
+
113
+ dt_toupper.resize(data_type.size());
114
+
115
+ std::transform(data_type.begin(), data_type.end(), dt_toupper.begin(), [](unsigned char c) -> unsigned char {
116
+ return std::toupper(c);
117
+ });
118
+
119
+ if (!TYPE_MAP.contains(dt_toupper)) {
120
+ throw std::runtime_error("Invalid data type: " + data_type);
121
+ }
122
+
123
+ const auto [ti, len] = TYPE_MAP.at(dt_toupper);
124
+ m_type_index = ti;
125
+ m_length = len;
126
+ }
127
+ }
128
+
129
+ McObject(const McObject& obj) = default;
130
+ McObject(McObject&& obj) = default;
131
+ McObject& operator=(const McObject&) = default;
132
+ McObject& operator=(McObject&&) = default;
133
+
134
+ const std::string& get_name() const {
135
+ return m_name;
136
+ }
137
+
138
+ void set_name(std::string_view name) {
139
+ m_name = name;
140
+ }
141
+
142
+ std::uint32_t get_address() const {
143
+ return m_address;
144
+ }
145
+
146
+ void set_address(std::uint32_t address) {
147
+ m_address = address;
148
+ }
149
+
150
+ std::uint8_t get_ext() const {
151
+ return m_ext;
152
+ }
153
+
154
+ void set_ext(std::uint8_t ext) {
155
+ m_ext = ext;
156
+ }
157
+
158
+ const std::string& get_data_type() const {
159
+ return m_data_type;
160
+ }
161
+
162
+ void set_data_type(const std::string& value) {
163
+ m_data_type = value;
164
+ }
165
+
166
+ std::uint16_t get_length() const {
167
+ return m_length;
168
+ }
169
+
170
+ void set_length(std::uint16_t length) {
171
+ m_length = length;
172
+ }
173
+
174
+ std::int32_t get_type_index() const {
175
+ return m_type_index;
176
+ }
177
+
178
+ const std::vector<McObject>& get_components() const {
179
+ return m_components;
180
+ }
181
+
182
+ void add_component(const McObject& obj) {
183
+ m_components.emplace_back(obj);
184
+ }
185
+
186
+ bool operator==(const McObject& other) const {
187
+ return (m_name == other.m_name) && (m_address == other.m_address) && (m_ext == other.m_ext) &&
188
+ (m_length == other.m_length) && (m_data_type == other.m_data_type) &&
189
+ (std::equal(m_components.begin(), m_components.end(), other.m_components.begin(), other.m_components.end()));
190
+ }
191
+
192
+ std::string dumps() const noexcept {
193
+ std::stringstream ss;
194
+
195
+ ss << to_binary(m_name);
196
+ ss << to_binary(m_address);
197
+ ss << to_binary(m_ext);
198
+ ss << to_binary(m_length);
199
+ ss << to_binary(m_data_type);
200
+ ss << to_binary(m_type_index);
201
+
202
+ std::size_t ccount = m_components.size();
203
+ ss << to_binary(ccount);
204
+ for (const auto& obj : m_components) {
205
+ ss << obj.dumps();
206
+ }
207
+ return ss.str();
208
+ }
209
+
210
+ auto get_hash() const noexcept {
211
+ std::hash<std::string> hash_fn;
212
+ return hash_fn(dumps());
213
+ }
214
+
215
+ private:
216
+
217
+ std::string m_name;
218
+ std::uint32_t m_address;
219
+ std::uint8_t m_ext;
220
+ std::uint16_t m_length;
221
+ std::string m_data_type;
222
+ std::int16_t m_type_index;
223
+ std::vector<McObject> m_components{};
224
+ };
225
+
226
+ std::string mc_components_to_string(const std::vector<McObject>& components);
227
+
228
+ std::string to_string(const McObject& obj) {
229
+ std::stringstream ss;
230
+
231
+ ss << "McObject(name='" << obj.get_name() << "', address=" << obj.get_address()
232
+ << ", ext=" << static_cast<std::uint16_t >(obj.get_ext()) << ", data_type='" << obj.get_data_type()
233
+ << "', length=" << obj.get_length() << ", components=[" << mc_components_to_string(obj.get_components()) << "])";
234
+ return ss.str();
235
+ }
236
+
237
+ std::string mc_components_to_string(const std::vector<McObject>& components) {
238
+ std::stringstream ss;
239
+ for (std::size_t i = 0; i < components.size(); ++i) {
240
+ ss << to_string(components[i]);
241
+ if (i + 1 < components.size()) {
242
+ ss << ", ";
243
+ }
244
+ }
245
+ return ss.str();
246
+ }
247
+
248
+ #endif // __MC_OBJECT_HPP