pyxcp 0.25.4__cp313-cp313-win_amd64.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 (157) 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.exe +0 -0
  19. pyxcp/asamkeydll.sh +2 -0
  20. pyxcp/checksum.py +732 -0
  21. pyxcp/cmdline.py +71 -0
  22. pyxcp/config/__init__.py +1257 -0
  23. pyxcp/config/legacy.py +120 -0
  24. pyxcp/constants.py +47 -0
  25. pyxcp/cpp_ext/__init__.py +0 -0
  26. pyxcp/cpp_ext/aligned_buffer.hpp +168 -0
  27. pyxcp/cpp_ext/bin.hpp +105 -0
  28. pyxcp/cpp_ext/blockmem.hpp +58 -0
  29. pyxcp/cpp_ext/cpp_ext.cp310-win_amd64.pyd +0 -0
  30. pyxcp/cpp_ext/cpp_ext.cp311-win_amd64.pyd +0 -0
  31. pyxcp/cpp_ext/cpp_ext.cp312-win_amd64.pyd +0 -0
  32. pyxcp/cpp_ext/cpp_ext.cp313-win_amd64.pyd +0 -0
  33. pyxcp/cpp_ext/daqlist.hpp +374 -0
  34. pyxcp/cpp_ext/event.hpp +67 -0
  35. pyxcp/cpp_ext/extension_wrapper.cpp +131 -0
  36. pyxcp/cpp_ext/framing.hpp +360 -0
  37. pyxcp/cpp_ext/helper.hpp +280 -0
  38. pyxcp/cpp_ext/mcobject.hpp +248 -0
  39. pyxcp/cpp_ext/sxi_framing.hpp +332 -0
  40. pyxcp/cpp_ext/tsqueue.hpp +46 -0
  41. pyxcp/daq_stim/__init__.py +291 -0
  42. pyxcp/daq_stim/optimize/__init__.py +67 -0
  43. pyxcp/daq_stim/optimize/binpacking.py +41 -0
  44. pyxcp/daq_stim/scheduler.cpp +62 -0
  45. pyxcp/daq_stim/scheduler.hpp +75 -0
  46. pyxcp/daq_stim/stim.cp310-win_amd64.pyd +0 -0
  47. pyxcp/daq_stim/stim.cp311-win_amd64.pyd +0 -0
  48. pyxcp/daq_stim/stim.cp312-win_amd64.pyd +0 -0
  49. pyxcp/daq_stim/stim.cp313-win_amd64.pyd +0 -0
  50. pyxcp/daq_stim/stim.cpp +13 -0
  51. pyxcp/daq_stim/stim.hpp +604 -0
  52. pyxcp/daq_stim/stim_wrapper.cpp +50 -0
  53. pyxcp/dllif.py +100 -0
  54. pyxcp/errormatrix.py +878 -0
  55. pyxcp/examples/conf_can.toml +19 -0
  56. pyxcp/examples/conf_can_user.toml +16 -0
  57. pyxcp/examples/conf_can_vector.json +11 -0
  58. pyxcp/examples/conf_can_vector.toml +11 -0
  59. pyxcp/examples/conf_eth.toml +9 -0
  60. pyxcp/examples/conf_nixnet.json +20 -0
  61. pyxcp/examples/conf_socket_can.toml +12 -0
  62. pyxcp/examples/run_daq.py +165 -0
  63. pyxcp/examples/xcp_policy.py +60 -0
  64. pyxcp/examples/xcp_read_benchmark.py +38 -0
  65. pyxcp/examples/xcp_skel.py +48 -0
  66. pyxcp/examples/xcp_unlock.py +36 -0
  67. pyxcp/examples/xcp_user_supplied_driver.py +43 -0
  68. pyxcp/examples/xcphello.py +65 -0
  69. pyxcp/examples/xcphello_recorder.py +107 -0
  70. pyxcp/master/__init__.py +10 -0
  71. pyxcp/master/errorhandler.py +677 -0
  72. pyxcp/master/master.py +2641 -0
  73. pyxcp/py.typed +0 -0
  74. pyxcp/recorder/.idea/.gitignore +8 -0
  75. pyxcp/recorder/.idea/misc.xml +4 -0
  76. pyxcp/recorder/.idea/modules.xml +8 -0
  77. pyxcp/recorder/.idea/recorder.iml +6 -0
  78. pyxcp/recorder/.idea/sonarlint/issuestore/3/8/3808afc69ac1edb9d760000a2f137335b1b99728 +7 -0
  79. pyxcp/recorder/.idea/sonarlint/issuestore/9/a/9a2aa4db38d3115ed60da621e012c0efc0172aae +0 -0
  80. pyxcp/recorder/.idea/sonarlint/issuestore/b/4/b49006702b459496a8e8c94ebe60947108361b91 +0 -0
  81. pyxcp/recorder/.idea/sonarlint/issuestore/index.pb +7 -0
  82. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/3/8/3808afc69ac1edb9d760000a2f137335b1b99728 +0 -0
  83. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/9/a/9a2aa4db38d3115ed60da621e012c0efc0172aae +0 -0
  84. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/b/4/b49006702b459496a8e8c94ebe60947108361b91 +0 -0
  85. pyxcp/recorder/.idea/sonarlint/securityhotspotstore/index.pb +7 -0
  86. pyxcp/recorder/.idea/vcs.xml +10 -0
  87. pyxcp/recorder/__init__.py +96 -0
  88. pyxcp/recorder/build_clang.cmd +1 -0
  89. pyxcp/recorder/build_clang.sh +2 -0
  90. pyxcp/recorder/build_gcc.cmd +1 -0
  91. pyxcp/recorder/build_gcc.sh +2 -0
  92. pyxcp/recorder/build_gcc_arm.sh +2 -0
  93. pyxcp/recorder/converter/__init__.py +444 -0
  94. pyxcp/recorder/lz4.c +2829 -0
  95. pyxcp/recorder/lz4.h +879 -0
  96. pyxcp/recorder/lz4hc.c +2041 -0
  97. pyxcp/recorder/lz4hc.h +413 -0
  98. pyxcp/recorder/mio.hpp +1714 -0
  99. pyxcp/recorder/reader.hpp +138 -0
  100. pyxcp/recorder/reco.py +278 -0
  101. pyxcp/recorder/recorder.rst +0 -0
  102. pyxcp/recorder/rekorder.cp310-win_amd64.pyd +0 -0
  103. pyxcp/recorder/rekorder.cp311-win_amd64.pyd +0 -0
  104. pyxcp/recorder/rekorder.cp312-win_amd64.pyd +0 -0
  105. pyxcp/recorder/rekorder.cp313-win_amd64.pyd +0 -0
  106. pyxcp/recorder/rekorder.cpp +59 -0
  107. pyxcp/recorder/rekorder.hpp +274 -0
  108. pyxcp/recorder/setup.py +41 -0
  109. pyxcp/recorder/test_reko.py +34 -0
  110. pyxcp/recorder/unfolder.hpp +1354 -0
  111. pyxcp/recorder/wrap.cpp +184 -0
  112. pyxcp/recorder/writer.hpp +302 -0
  113. pyxcp/scripts/__init__.py +0 -0
  114. pyxcp/scripts/pyxcp_probe_can_drivers.py +20 -0
  115. pyxcp/scripts/xcp_examples.py +64 -0
  116. pyxcp/scripts/xcp_fetch_a2l.py +40 -0
  117. pyxcp/scripts/xcp_id_scanner.py +18 -0
  118. pyxcp/scripts/xcp_info.py +159 -0
  119. pyxcp/scripts/xcp_profile.py +26 -0
  120. pyxcp/scripts/xmraw_converter.py +31 -0
  121. pyxcp/stim/__init__.py +0 -0
  122. pyxcp/tests/test_asam_types.py +24 -0
  123. pyxcp/tests/test_binpacking.py +186 -0
  124. pyxcp/tests/test_can.py +1324 -0
  125. pyxcp/tests/test_checksum.py +95 -0
  126. pyxcp/tests/test_daq.py +193 -0
  127. pyxcp/tests/test_daq_opt.py +426 -0
  128. pyxcp/tests/test_frame_padding.py +156 -0
  129. pyxcp/tests/test_framing.py +262 -0
  130. pyxcp/tests/test_master.py +2116 -0
  131. pyxcp/tests/test_transport.py +177 -0
  132. pyxcp/tests/test_utils.py +30 -0
  133. pyxcp/timing.py +60 -0
  134. pyxcp/transport/__init__.py +13 -0
  135. pyxcp/transport/base.py +484 -0
  136. pyxcp/transport/base_transport.hpp +0 -0
  137. pyxcp/transport/can.py +660 -0
  138. pyxcp/transport/eth.py +254 -0
  139. pyxcp/transport/hdf5_policy.py +129 -0
  140. pyxcp/transport/sxi.py +209 -0
  141. pyxcp/transport/transport_ext.cp310-win_amd64.pyd +0 -0
  142. pyxcp/transport/transport_ext.cp311-win_amd64.pyd +0 -0
  143. pyxcp/transport/transport_ext.cp312-win_amd64.pyd +0 -0
  144. pyxcp/transport/transport_ext.cp313-win_amd64.pyd +0 -0
  145. pyxcp/transport/transport_ext.hpp +214 -0
  146. pyxcp/transport/transport_wrapper.cpp +249 -0
  147. pyxcp/transport/usb_transport.py +229 -0
  148. pyxcp/types.py +987 -0
  149. pyxcp/utils/__init__.py +127 -0
  150. pyxcp/utils/cli.py +78 -0
  151. pyxcp/vector/__init__.py +0 -0
  152. pyxcp/vector/map.py +82 -0
  153. pyxcp-0.25.4.dist-info/METADATA +341 -0
  154. pyxcp-0.25.4.dist-info/RECORD +157 -0
  155. pyxcp-0.25.4.dist-info/WHEEL +4 -0
  156. pyxcp-0.25.4.dist-info/entry_points.txt +9 -0
  157. pyxcp-0.25.4.dist-info/licenses/LICENSE +165 -0
pyxcp/aml/XCPonEth.aml ADDED
@@ -0,0 +1,33 @@
1
+ /************************************************************************************/
2
+ /* */
3
+ /* ASAP2 meta language for XCP on UDP_IP V1.0 */
4
+ /* */
5
+ /* 2003-03-03 */
6
+ /* */
7
+ /* Vector Informatik, Schuermans */
8
+ /* */
9
+ /* Datatypes: */
10
+ /* */
11
+ /* A2ML ASAP2 Windows description */
12
+ /* ---------------------------------------------------------------------------------*/
13
+ /* uchar UBYTE BYTE unsigned 8 Bit */
14
+ /* char SBYTE char signed 8 Bit */
15
+ /* uint UWORD WORD unsigned integer 16 Bit */
16
+ /* int SWORD int signed integer 16 Bit */
17
+ /* ulong ULONG DWORD unsigned integer 32 Bit */
18
+ /* long SLONG LONG signed integer 32 Bit */
19
+ /* float FLOAT32_IEEE float 32 Bit */
20
+ /* */
21
+ /************************************************************************************/
22
+
23
+ /************************** start of UDP_IP *****************************************/
24
+ struct UDP_IP_Parameters { /* at MODULE */
25
+ uint; /* XCP on UDP_IP version */
26
+ /* e.g. "1.0" = 0x0100 */
27
+ uint; /* PORT */
28
+ taggedunion {
29
+ "HOST_NAME" char[256];
30
+ "ADDRESS" char[15];
31
+ };
32
+
33
+ };/*************************** end of UDP_IP ***********************************/
pyxcp/aml/XCPonFlx.aml ADDED
@@ -0,0 +1,113 @@
1
+ /************************************************************************************/
2
+ /* */
3
+ /* ASAP2 meta language for XCP on FlexRay V1.0 */
4
+ /* */
5
+ /* 2005-10-13 */
6
+ /* */
7
+ /* Datatypes: */
8
+ /* */
9
+ /* A2ML ASAP2 Windows description */
10
+ /* ---------------------------------------------------------------------------------*/
11
+ /* uchar UBYTE BYTE unsigned 8 Bit */
12
+ /* char SBYTE char signed 8 Bit */
13
+ /* uint UWORD WORD unsigned integer 16 Bit */
14
+ /* int SWORD int signed integer 16 Bit */
15
+ /* ulong ULONG DWORD unsigned integer 32 Bit */
16
+ /* long SLONG LONG signed integer 32 Bit */
17
+ /* float FLOAT32_IEEE float 32 Bit */
18
+ /* */
19
+ /************************************************************************************/
20
+
21
+ /************************ start of FLX **************************************/
22
+ enum packet_assignment_type {
23
+ "NOT_ALLOWED",
24
+ "FIXED",
25
+ "VARIABLE_INITIALISED",
26
+ "VARIABLE"
27
+ }; /* end of packet_assignment_type */
28
+
29
+ struct buffer {
30
+ uchar; /* FLX_BUF */
31
+ taggedstruct {
32
+ "MAX_FLX_LEN_BUF" taggedunion {
33
+ "FIXED" uchar; /* constant value */
34
+ "VARIABLE" uchar; /* initial value */
35
+ }; /* end of MAX_FLX_LEN_BUF */
36
+ block "LPDU_ID" taggedstruct {
37
+ "FLX_SLOT_ID" taggedunion {
38
+ "FIXED" uint;
39
+ "VARIABLE" taggedstruct{
40
+ "INITIAL_VALUE" uint;
41
+ };
42
+ }; /* end of FLX_SLOT_ID */
43
+ "OFFSET" taggedunion {
44
+ "FIXED" uchar;
45
+ "VARIABLE" taggedstruct{
46
+ "INITIAL_VALUE" uchar;
47
+ };
48
+ }; /* end of OFFSET */
49
+ "CYCLE_REPETITION" taggedunion {
50
+ "FIXED" uchar;
51
+ "VARIABLE" taggedstruct{
52
+ "INITIAL_VALUE" uchar;
53
+ };
54
+ }; /* end of CYCLE_REPETITION */
55
+ "CHANNEL" taggedunion {
56
+ "FIXED" enum {
57
+ "A" = 0,
58
+ "B" = 1
59
+ };
60
+ "VARIABLE" taggedstruct{
61
+ "INITIAL_VALUE" enum {
62
+ "A" = 0,
63
+ "B" = 1
64
+ };
65
+ };
66
+ }; /* end of CHANNEL */
67
+ }; /* end of LPDU_ID */
68
+ block "XCP_PACKET" taggedstruct {
69
+ "CMD" enum packet_assignment_type; /* end of CMD */
70
+ "RES_ERR" enum packet_assignment_type; /* end of RES_ERR */
71
+ "EV_SERV" enum packet_assignment_type; /* end of EV_SERV */
72
+ "DAQ" enum packet_assignment_type; /* end of DAQ */
73
+ "STIM" enum packet_assignment_type; /* end of STIM */
74
+ }; /* end of XCP_PACKET */
75
+ };
76
+ }; /* end of buffer */
77
+
78
+ struct FLX_Parameters {
79
+ uint; /* XCP on FlexRay version */
80
+ /* e.g. "1.0" = 0x0100 */
81
+ uint; /* T1_FLX [ms] */
82
+ char[256]; /* FIBEX-file including CHI information */
83
+ /* including extension */
84
+ /* without path */
85
+ char[256]; /* Cluster-ID */
86
+ uchar; /* NAX */
87
+ enum {
88
+ "HEADER_NAX" = 0,
89
+ "HEADER_NAX_FILL" = 1,
90
+ "HEADER_NAX_CTR" = 2,
91
+ "HEADER_NAX_FILL3" = 3,
92
+ "HEADER_NAX_CTR_FILL2" = 4,
93
+ "HEADER_NAX_LEN" = 5,
94
+ "HEADER_NAX_CTR_LEN" = 6,
95
+ "HEADER_NAX_FILL2_LEN" = 7,
96
+ "HEADER_NAX_CTR_FILL_LEN" = 8
97
+ };
98
+ enum {
99
+ "PACKET_ALIGNMENT_8" = 0,
100
+ "PACKET_ALIGNMENT_16" = 1,
101
+ "PACKET_ALIGNMENT_32" = 2
102
+ };
103
+ taggedunion {
104
+ block "INITIAL_CMD_BUFFER" struct buffer;
105
+ };
106
+ taggedunion {
107
+ block "INITIAL_RES_ERR_BUFFER" struct buffer;
108
+ };
109
+ taggedstruct {
110
+ (block "POOL_BUFFER" struct buffer)*;
111
+ };
112
+ };
113
+ /************************* end of FLX ***********************************/
pyxcp/aml/XCPonSxI.aml ADDED
@@ -0,0 +1,66 @@
1
+ /************************************************************************************/
2
+ /* */
3
+ /* ASAP2 meta language for XCP on SxI V1.0 */
4
+ /* */
5
+ /* 2007-08-07 */
6
+ /* */
7
+ /* Vector Informatik, Schuermans */
8
+ /* */
9
+ /* Datatypes: */
10
+ /* */
11
+ /* A2ML ASAP2 Windows description */
12
+ /* ---------------------------------------------------------------------------------*/
13
+ /* uchar UBYTE BYTE unsigned 8 Bit */
14
+ /* char SBYTE char signed 8 Bit */
15
+ /* uint UWORD WORD unsigned integer 16 Bit */
16
+ /* int SWORD int signed integer 16 Bit */
17
+ /* ulong ULONG DWORD unsigned integer 32 Bit */
18
+ /* long SLONG LONG signed integer 32 Bit */
19
+ /* float FLOAT32_IEEE float 32 Bit */
20
+ /* */
21
+ /************************************************************************************/
22
+
23
+ /************************** start of SxI ************************************/
24
+ struct SxI_Parameters { /* At MODULE */
25
+ uint; /* XCP on SxI version */
26
+ /* e.g. "1.0" = 0x0100 */
27
+ ulong; /* BAUDRATE [Hz] */
28
+ taggedstruct { /* exclusive tags */
29
+ "ASYNCH_FULL_DUPLEX_MODE"� struct {
30
+ enum {
31
+ "PARITY_NONE" = 0,
32
+ "PARITY_ODD" = 1,
33
+ "PARITY_EVEN" = 2
34
+ };
35
+ enum {
36
+ "ONE_STOP_BIT" = 1,
37
+ "TWO_STOP_BITS" = 2
38
+ };
39
+ taggedstruct {
40
+ block "FRAMING"� struct {
41
+ uchar; /* SYNC */
42
+ uchar; /* ESC */
43
+ };
44
+ };
45
+ "SYNCH_FULL_DUPLEX_MODE_BYTE"��;
46
+ "SYNCH_FULL_DUPLEX_MODE_WORD"��;
47
+ "SYNCH_FULL_DUPLEX_MODE_DWORD";��
48
+ "SYNCH_MASTER_SLAVE_MODE_BYTE";��
49
+ "SYNCH_MASTER_SLAVE_MODE_WORD";��
50
+ "SYNCH_MASTER_SLAVE_MODE_DWORD";�;
51
+ };
52
+ enum {
53
+ "HEADER_LEN_BYTE" = 0,
54
+ "HEADER_LEN_CTR_BYTE" = 1,
55
+ "HEADER_LEN_FILL_BYTE"�� = 2,
56
+ "HEADER_LEN_WORD" = 3,
57
+ "HEADER_LEN_CTR_WORD" = 4,
58
+ "HEADER_LEN_FILL_WORD" = 5
59
+ };
60
+ enum {
61
+ "NO_CHECKSUM" = 0,
62
+ "CHECKSUM_BYTE" = 1,
63
+ "CHECKSUM_WORD" = 2
64
+ };
65
+ };
66
+ /*************************** end of SxI ***********************************/
pyxcp/aml/XCPonUSB.aml ADDED
@@ -0,0 +1,106 @@
1
+ /****************************************************************************/
2
+ /* */
3
+ /* ASAP2 meta language for XCP on USB V1.0 */
4
+ /* Assumes ASAP2 V1.4 or later */
5
+ /* */
6
+ /* 2003-12-16 */
7
+ /* */
8
+ /* XCP on USB working group */
9
+ /* */
10
+ /* Datatypes: */
11
+ /* */
12
+ /* A2ML ASAP2 Windows description */
13
+ /* ------------------------------------------------------------------------ */
14
+ /* uchar UBYTE BYTE unsigned 8 Bit */
15
+ /* char SBYTE char signed 8 Bit */
16
+ /* uint UWORD WORD unsigned integer 16 Bit */
17
+ /* int SWORD int signed integer 16 Bit */
18
+ /* ulong ULONG DWORD unsigned integer 32 Bit */
19
+ /* long SLONG LONG signed integer 32 Bit */
20
+ /* float FLOAT32_IEEE float 32 Bit */
21
+ /****************************************************************************/
22
+
23
+ /begin A2ML
24
+
25
+ /************************ start of USB **************************************/
26
+ struct ep_parameters {
27
+ uchar; /* ENDPOINT_NUMBER, not endpoint address */
28
+
29
+ enum {
30
+ "BULK_TRANSFER" = 2, /* Numbers according to USB spec. */
31
+ "INTERRUPT_TRANSFER" = 3
32
+ };
33
+
34
+ uint; /* wMaxPacketSize: Maximum packet */
35
+ /* size of endpoint in bytes */
36
+ uchar; /* bInterval: polling of endpoint */
37
+ enum { /* Packing of XCP Messages */
38
+ "MESSAGE_PACKING_SINGLE" = 0, /* Single per USB data packet */
39
+ "MESSAGE_PACKING_MULTIPLE" = 1, /* Multiple per USB data packet */
40
+ "MESSAGE_PACKING_STREAMING" = 2 /* No restriction by packet sizes */
41
+ };
42
+ enum { /* Alignment mandatory for all */
43
+ "ALIGNMENT_8_BIT" = 0, /* packing types */
44
+ "ALIGNMENT_16_BIT"= 1,
45
+ "ALIGNMENT_32_BIT"= 2,
46
+ "ALIGNMENT_64_BIT"= 3
47
+ };
48
+ taggedstruct { /* Optional */
49
+ "RECOMMENDED_HOST_BUFSIZE" uint; /* Recommended size for the host */
50
+ /* buffer size. The size is defined*/
51
+ /* as multiple of wMaxPacketSize. */
52
+ };
53
+ }; /* end of ep_parameters */
54
+
55
+ struct USB_Parameters {
56
+ uint; /* XCP on USB version */
57
+ /* e.g. „1.0“ = 0x0100 */
58
+ uint; /* Vendor ID */
59
+ uint; /* Product ID */
60
+ uchar; /* Number of interface */
61
+ enum {
62
+ "HEADER_LEN_BYTE" = 0,
63
+ "HEADER_LEN_CTR_BYTE" = 1,
64
+ "HEADER_LEN_FILL_BYTE" = 2,
65
+ "HEADER_LEN_WORD" = 3,
66
+ "HEADER_LEN_CTR_WORD" = 4,
67
+ "HEADER_LEN_FILL_WORD" = 5
68
+ };
69
+ /* OUT-EP for CMD and */
70
+ /* STIM (additional USB Endpoints may also be specified) */
71
+ taggedunion {
72
+ block "OUT_EP_CMD_STIM" struct ep_parameters;
73
+ };
74
+ /* IN-EP for RES/ERR, */
75
+ /* DAQ (additional USB Endpoints may also be specified) */
76
+ /* and EV/SERV (if not specified otherwise) */
77
+ taggedunion {
78
+ block "IN_EP_RESERR_DAQ_EVSERV" struct ep_parameters;
79
+ };
80
+ /* ----------- Begin of optional ------- */
81
+ taggedstruct { /* Optional */
82
+ "ALTERNATE_SETTING_NO" uchar; /* Number of alternate setting */
83
+ /* String Descriptor of XCP */
84
+ /* interface */
85
+ "INTERFACE_STRING_DESCRIPTOR" char [101];
86
+ /* multiple OUT-EP's for STIM */
87
+ (block "OUT_EP_ONLY_STIM" struct ep_parameters)*;
88
+ /* multiple IN-EP's for DAQ */
89
+ (block "IN_EP_ONLY_DAQ" struct ep_parameters)*;
90
+ /* only one IN-EP for EV/SERV */
91
+ block "IN_EP_ONLY_EVSERV" struct ep_parameters;
92
+ /* Not associated DAQ-Lists are assigned per default to */
93
+ /* OUT_EP_CD_STIM / IN_EP_RESERR_DAQ_EVSERV */
94
+ (block "DAQ_LIST_USB_ENDPOINT" struct {
95
+ uint; /* reference to DAQ_LIST_NUMBER */
96
+ taggedstruct { /* only mentioned if not VARIABLE */
97
+ "FIXED_IN" uchar; /* this DAQ list always */
98
+ /* ENDPOINT_NUMBER, not endpoint address */
99
+ "FIXED_OUT" uchar; /* this STIM list always */
100
+ /* ENDPOINT_NUMBER, not endpoint address */
101
+ };
102
+ })*; /* end of DAQ_LIST_USB_ENDPOINT */
103
+ }; /* end of optional */
104
+ };
105
+ /************************* end of USB ***********************************/
106
+ /end A2ML
@@ -0,0 +1,20 @@
1
+ begin XCP_ON_CAN
2
+ 0x0100 /* XCP on CAN version */
3
+ CAN_ID_BROADCAST 0x0100 /* Broadcast */
4
+ CAN_ID_MASTER 0x0200 /* CMD/STIM */
5
+ CAN_ID_MASTER_INCREMENTAL
6
+ CAN_ID_SLAVE 0x0300 /* RES/ERR/EV/SERV/DAQ */
7
+ BAUDRATE 500000 /* BAUDRATE */
8
+ /begin DAQ_LIST_CAN_ID
9
+ 0x0000 /* for DAQ_LIST 0 */
10
+ FIXED 0x310
11
+ /end DAQ_LIST_CAN_ID
12
+ /begin DAQ_LIST_CAN_ID
13
+ 0x0001 /* for DAQ_LIST 1 */
14
+ FIXED 0x320
15
+ /end DAQ_LIST_CAN_ID
16
+ /begin DAQ_LIST_CAN_ID
17
+ 0x0002 /* for DAQ_LIST 2 */
18
+ FIXED 0x330
19
+ /end DAQ_LIST_CAN_ID
20
+ /end XCP_ON_CAN
@@ -0,0 +1,11 @@
1
+ /begin XCP_ON_TCP_IP
2
+ 0x0100 /* XCP on TCP_IP version */
3
+ 0x5555 /* PORT */
4
+ "127.0.0.1" /* ADDRESS */
5
+ /end XCP_ON_TCP_IP
6
+
7
+ /begin XCP_ON_UDP_IP
8
+ 0x0100 /* XCP on UDP_IP version */
9
+ 0x5555 /* PORT */
10
+ "127.0.0.1" /* ADDRESS */
11
+ /end XCP_ON_UDP_IP
@@ -0,0 +1,94 @@
1
+ /begin XCP_ON_FLX
2
+ 0x0100 /* XCP on FlexRay 1.0 */
3
+ 0x0019 /* T1_FLX [ms] */
4
+ "MyFlexRayNetwork.xml" /* FIBEX-file including CHI information */
5
+ "MyCluster" /* Cluster-ID */
6
+ 0x02 /* NAX */
7
+ HEADER_NAX_CTR_LEN
8
+ PACKET_ALIGNMENT_8
9
+ /begin INITIAL_CMD_BUFFER
10
+ 0x01 /* FLX_BUF */
11
+ MAX_FLX_LEN_BUF FIXED 32
12
+ /begin LPDU_ID
13
+ FLX_SLOT_ID FIXED 0x07B
14
+ OFFSET FIXED 0
15
+ CYCLE_REPETITION FIXED 1
16
+ CHANNEL FIXED A
17
+ /end LPDU_ID
18
+ /begin XCP_PACKET
19
+ CMD FIXED
20
+ RES_ERR NOT_ALLOWED
21
+ EV_SERV NOT_ALLOWED
22
+ DAQ NOT_ALLOWED
23
+ STIM FIXED
24
+ /end XCP_PACKET
25
+ /end INITIAL_CMD_BUFFER
26
+ /begin INITIAL_RES_ERR_BUFFER
27
+ 0x02 /* FLX_BUF */
28
+ MAX_FLX_LEN_BUF FIXED 32
29
+ /begin LPDU_ID
30
+ FLX_SLOT_ID FIXED 0x07C
31
+ OFFSET FIXED 1
32
+ CYCLE_REPETITION FIXED 1
33
+ CHANNEL FIXED A
34
+ /end LPDU_ID
35
+ /begin XCP_PACKET
36
+ CMD NOT_ALLOWED
37
+ RES_ERR FIXED
38
+ EV_SERV FIXED
39
+ DAQ FIXED
40
+ STIM NOT_ALLOWED
41
+ /end XCP_PACKET
42
+ /end INITIAL_RES_ERR_BUFFER
43
+ begin POOL_BUFFER
44
+ 0x03 /* FLX_BUF */
45
+ MAX_FLX_LEN_BUF FIXED 32
46
+ /begin LPDU_ID
47
+ FLX_SLOT_ID VARIABLE INITIAL_VALUE 0x07D
48
+ OFFSET FIXED 0
49
+ CYCLE_REPETITION FIXED 1
50
+ CHANNEL FIXED A
51
+ /end LPDU_ID
52
+ /begin XCP_PACKET
53
+ CMD NOT_ALLOWED
54
+ RES_ERR VARIABLE
55
+ EV_SERV VARIABLE
56
+ DAQ VARIABLE_INITIALISED
57
+ STIM NOT_ALLOWED
58
+ /end XCP_PACKET
59
+ /end POOL_BUFFER
60
+ /begin POOL_BUFFER
61
+ 0x04 /* FLX_BUF */
62
+ MAX_FLX_LEN_BUF VARIABLE 64
63
+ /begin LPDU_ID
64
+ FLX_SLOT_ID FIXED 0x07E
65
+ OFFSET VARIABLE
66
+ CYCLE_REPETITION VARIABLE
67
+ CHANNEL FIXED A
68
+ /end LPDU_ID
69
+ /begin XCP_PACKET
70
+ CMD VARIABLE
71
+ RES_ERR VARIABLE
72
+ EV_SERV VARIABLE
73
+ DAQ VARIABLE
74
+ STIM VARIABLE
75
+ /end XCP_PACKET
76
+ /end POOL_BUFFER
77
+ /begin POOL_BUFFER
78
+ 0x05 /* FLX_BUF */
79
+ MAX_FLX_LEN_BUF VARIABLE 64
80
+ /begin LPDU_ID
81
+ FLX_SLOT_ID VARIABLE
82
+ OFFSET VARIABLE
83
+ CYCLE_REPETITION VARIABLE
84
+ CHANNEL VARIABLE
85
+ /end LPDU_ID
86
+ /begin XCP_PACKET
87
+ CMD VARIABLE
88
+ RES_ERR VARIABLE
89
+ EV_SERV VARIABLE
90
+ DAQ VARIABLE
91
+ STIM VARIABLE
92
+ /end XCP_PACKET
93
+ /end POOL_BUFFER
94
+ /end XCP_ON_FLX
@@ -0,0 +1,13 @@
1
+ /begin XCP_ON_SxI
2
+ 0x0100 /* XCP on SxI version */
3
+ 25000 /* BAUDRATE */
4
+ ASYNCH_FULL_DUPLEX_MODE
5
+ PARITY_ODD
6
+ TWO_STOP_BITS
7
+ /begin FRAMING
8
+ 0x9A /* SYNC */
9
+ 0x9B /* ESC */
10
+ /end FRAMING
11
+ HEADER_LEN_CTR_WORD
12
+ NO_CHECKSUM
13
+ /end XCP_ON_SxI
@@ -0,0 +1,81 @@
1
+ /begin XCP_ON_USB
2
+ 0x0100 /* XCP on USB version */
3
+ 0x108C /* Vendor ID is 0x108C */
4
+ 0x0EDC /* Product ID is 0x0EDC */
5
+ 0x02 /* Number of interface is 2 */
6
+ HEADER_LEN_FILL_WORD
7
+ /* OUT-EP for CMD and */
8
+ /* STIM (additional USB Endpoints may also be specified) */
9
+ /begin OUT_EP_CMD_STIM
10
+ 0x01 /* Endpoint number is 1 (dir=OUT) */
11
+ BULK_TRANSFER
12
+ 0x40 /* Maximum packet size is 64 bytes */
13
+ 0 /* Polling interval don�t care */
14
+ MESSAGE_PACKING_SINGLE /* Only one XCP Message/packet */
15
+ ALIGNMENT_32_BIT /* XCP Message starts on 32 bit */
16
+ /* addresses within USB data packet*/
17
+ /end OUT_EP_CMD_STIM
18
+ /* IN-EP for RES/ERR, */
19
+ /* DAQ (additional USB Endpoints may also be specified) */
20
+ /* and EV/SERV (if not specified otherwise) */
21
+ /begin IN_EP_RESERR_DAQ_EVSERV
22
+ 0x01 /* Endpoint number is 1 (dir=IN) */
23
+ BULK_TRANSFER
24
+ 0x40 /* Maximum packet size is 64 bytes */
25
+ 0 /* Polling interval don�t care */
26
+ MESSAGE_PACKING_SINGLE /* Only one XCP Message/packet */
27
+ ALIGNMENT_32_BIT /* XCP Message starts on 32 bit */
28
+ /* addresses within USB data packet*/
29
+ RECOMMENDED_HOST_BUFSIZE 1 /* Host: 1 * 64 bytes = 64 bytes */
30
+ /end IN_EP_RESERR_DAQ_EVSERV
31
+ /* ----------- Begin of optional ------- */
32
+ ALTERNATE_SETTING_NO 0x01 /* Use alternate setting number 1 */
33
+ /* of XCP interface */
34
+ /* Identification for assignment */
35
+ /* description file */
36
+ INTERFACE_STRING_DESCRIPTOR "XCP Master ECU on interface 1"
37
+ /begin OUT_EP_ONLY_STIM /* Endpoint supporting packet type */
38
+ /* only STIM */
39
+ 0x02 /* Endpoint number is 2 (dir=OUT) */
40
+ BULK_TRANSFER
41
+ 0x40 /* Maximum packet size is 64 bytes */
42
+ 0 /* Polling interval don�t care */
43
+ MESSAGE_PACKING_MULTIPLE /* Multiple XCP Messages/packet */
44
+ ALIGNMENT_32_BIT /* XCP Messages start on 32 bit */
45
+ /* addresses within USB data packet*/
46
+ /end OUT_EP_ONLY_STIM
47
+ /begin IN_EP_ONLY_DAQ /* Endpoint supporting packet type */
48
+ /* only DAQ */
49
+ 0x02 /* Endpoint number is 2 (dir=IN) */
50
+ BULK_TRANSFER
51
+ 0x40 /* Maximum packet size is 64 bytes */
52
+ 0 /* Polling interval don�t care */
53
+ MESSAGE_PACKING_STREAMING /* Streaming mode */
54
+ ALIGNMENT_32_BIT /* XCP Messages start on 32 bit */
55
+ /* addresses within USB data packet*/
56
+ RECOMMENDED_HOST_BUFSIZE 5 /* Host: 5 * 64 bytes = 320 bytes */
57
+ /end IN_EP_ONLY_DAQ
58
+ /begin IN_EP_ONLY_EVSERV /* Endpoint supporting packet types */
59
+ /* only EV, SERV */
60
+ 0x03 /* Endpoint number is 3 (dir=IN) */
61
+ INTERRUPT_TRANSFER
62
+ 0x40 /* Maximum packet size is 64 bytes */
63
+ 0x10 /* Polling interval is 16 ms */
64
+ MESSAGE_PACKING_SINGLE /* Only one XCP Message/packet */
65
+ ALIGNMENT_32_BIT /* XCP Message starts on 32 bit */
66
+ /* addresses within USB data packet*/
67
+ RECOMMENDED_HOST_BUFSIZE 1 /* Host: 1 * 64 bytes = 64 bytes */
68
+ /end IN_EP_ONLY_EVSERV
69
+ /begin DAQ_LIST_USB_ENDPOINT
70
+ 0x0000 /* DTO-DAQ dedicated to list 0 */
71
+ FIXED_IN 0x02 /* uses Endpoint 2 IN. */
72
+ /end DAQ_LIST_USB_ENDPOINT
73
+ /begin DAQ_LIST_USB_ENDPOINT
74
+ 0x0001 /* DTO-DAQ dedicated to list 1 */
75
+ FIXED_IN 0x02 /* uses Endpoint 2 IN. */
76
+ /end DAQ_LIST_USB_ENDPOINT
77
+ /begin DAQ_LIST_USB_ENDPOINT
78
+ 0x0002 /* DTO-STIM dedicated to list 2 */
79
+ FIXED_OUT 0x02 /* uses Endpoint 2 OUT. */
80
+ /end DAQ_LIST_USB_ENDPOINT
81
+ /end XCP_ON_USB
pyxcp/asam/__init__.py ADDED
File without changes
pyxcp/asam/types.py ADDED
@@ -0,0 +1,131 @@
1
+ #!/usr/bin/env python
2
+ import struct
3
+
4
+
5
+ INTEL = "<"
6
+ MOTOROLA = ">"
7
+
8
+ """
9
+ A_VOID: pseudo type for non-existing elements
10
+ A_BIT: one bit
11
+ A_ASCIISTRING: string, ISO-8859-1 encoded
12
+ A_UTF8STRING: string, UTF-8 encoded
13
+ A_UNICODE2STRING: string, UCS-2 encoded
14
+ A_BYTEFIELD: Field of bytes
15
+ """
16
+
17
+
18
+ class AsamBaseType:
19
+ """Base class for ASAM codecs.
20
+
21
+ Note
22
+ ----
23
+ Always use derived classes.
24
+ """
25
+
26
+ def __init__(self, byteorder):
27
+ """
28
+
29
+ Parameters
30
+ ----------
31
+ byteorder: char {'<', '>'}
32
+ - '<' Little-endian
33
+ - '>' Big-endian
34
+ """
35
+ if byteorder not in ("<", ">"):
36
+ raise ValueError("Invalid byteorder.")
37
+ self.byteorder = byteorder
38
+
39
+ def encode(self, value):
40
+ """Encode a value.
41
+
42
+ Encode means convert a value, eg. an integer, to a byte-string.
43
+
44
+ Parameters
45
+ ----------
46
+ value: data-type
47
+ data-type is determined by derived class.
48
+
49
+ Returns
50
+ -------
51
+ bytes
52
+ Encoded value.
53
+ """
54
+ return struct.pack(f"{self.byteorder}{self.FMT}", value)
55
+
56
+ def decode(self, value):
57
+ """Decode a value.
58
+
59
+ Decode means convert a byte-string to a meaningful data-type, eg. an
60
+ integer.
61
+
62
+ Parameters
63
+ ----------
64
+ value: bytes
65
+
66
+ Returns
67
+ -------
68
+ data-type
69
+ data-type is determined by derived class.
70
+ """
71
+ return struct.unpack(f"{self.byteorder}{self.FMT}", bytes(value))[0]
72
+
73
+
74
+ class A_Uint8(AsamBaseType):
75
+ """ASAM A_UINT8 codec."""
76
+
77
+ FMT = "B"
78
+
79
+
80
+ class A_Uint16(AsamBaseType):
81
+ """ASAM A_UINT16 codec."""
82
+
83
+ FMT = "H"
84
+
85
+
86
+ class A_Uint32(AsamBaseType):
87
+ """ASAM A_UINT32 codec."""
88
+
89
+ FMT = "I"
90
+
91
+
92
+ class A_Uint64(AsamBaseType):
93
+ """ASAM A_UINT64 codec."""
94
+
95
+ FMT = "Q"
96
+
97
+
98
+ class A_Int8(AsamBaseType):
99
+ """ASAM A_INT8 codec."""
100
+
101
+ FMT = "b"
102
+
103
+
104
+ class A_Int16(AsamBaseType):
105
+ """ASAM A_INT16 codec."""
106
+
107
+ FMT = "h"
108
+
109
+
110
+ class A_Int32(AsamBaseType):
111
+ """ASAM A_INT32 codec."""
112
+
113
+ FMT = "i"
114
+
115
+
116
+ class A_Int64(AsamBaseType):
117
+ """ASAM A_INT64 codec."""
118
+
119
+ FMT = "q"
120
+
121
+
122
+ class A_Float32(AsamBaseType):
123
+ """ASAM A_FLOAT32 codec."""
124
+
125
+ FMT = "f"
126
+
127
+
128
+ class A_Float64(AsamBaseType):
129
+ """ASAM A_FLOAT64 codec."""
130
+
131
+ FMT = "d"