Skip to content

Commit adcfe97

Browse files
authored
Merge branch 'develop' into pcan-config-query
2 parents 4300c8f + 3023b70 commit adcfe97

File tree

1 file changed

+63
-4
lines changed

1 file changed

+63
-4
lines changed

can/interfaces/vector/vxlapi.py

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,90 @@
2828
XL_ERR_QUEUE_IS_EMPTY = 10
2929
XL_ERR_HW_NOT_PRESENT = 129
3030

31+
# XLeventTag
32+
# Common and CAN events
33+
XL_NO_COMMAND = 0
3134
XL_RECEIVE_MSG = 1
32-
XL_CAN_EV_TAG_RX_OK = 1024
33-
XL_CAN_EV_TAG_TX_OK = 1028
35+
XL_CHIP_STATE = 4
36+
XL_TRANSCEIVER = 6
37+
XL_TIMER = 8
3438
XL_TRANSMIT_MSG = 10
35-
XL_CAN_EV_TAG_TX_MSG = 1088
36-
39+
XL_SYNC_PULSE = 11
40+
XL_APPLICATION_NOTIFICATION = 15
41+
42+
# CAN/CAN-FD event tags
43+
# Rx
44+
XL_CAN_EV_TAG_RX_OK = 0x0400
45+
XL_CAN_EV_TAG_RX_ERROR = 0x0401
46+
XL_CAN_EV_TAG_TX_ERROR = 0x0402
47+
XL_CAN_EV_TAG_TX_REQUEST = 0x0403
48+
XL_CAN_EV_TAG_TX_OK = 0x0404
49+
XL_CAN_EV_TAG_CHIP_STATE = 0x0409
50+
# Tx
51+
XL_CAN_EV_TAG_TX_MSG = 0x0440
52+
53+
# s_xl_can_msg : id
3754
XL_CAN_EXT_MSG_ID = 0x80000000
55+
56+
# s_xl_can_msg : flags
3857
XL_CAN_MSG_FLAG_ERROR_FRAME = 0x01
3958
XL_CAN_MSG_FLAG_REMOTE_FRAME = 0x10
4059
XL_CAN_MSG_FLAG_TX_COMPLETED = 0x40
4160

61+
# to be used with
62+
# XLcanTxEvent::XL_CAN_TX_MSG::msgFlags
4263
XL_CAN_TXMSG_FLAG_EDL = 0x0001
4364
XL_CAN_TXMSG_FLAG_BRS = 0x0002
4465
XL_CAN_TXMSG_FLAG_RTR = 0x0010
66+
XL_CAN_TXMSG_FLAG_HIGHPRIO = 0x0080
67+
XL_CAN_TXMSG_FLAG_WAKEUP = 0x0200
68+
69+
# to be used with
70+
# XLcanRxEvent::XL_CAN_EV_RX_MSG::msgFlags
71+
# XLcanRxEvent::XL_CAN_EV_TX_REQUEST::msgFlags
72+
# XLcanRxEvent::XL_CAN_EV_RX_MSG::msgFlags
73+
# XLcanRxEvent::XL_CAN_EV_TX_REMOVED::msgFlags
74+
# XLcanRxEvent::XL_CAN_EV_ERROR::msgFlags
4575
XL_CAN_RXMSG_FLAG_EDL = 0x0001
4676
XL_CAN_RXMSG_FLAG_BRS = 0x0002
4777
XL_CAN_RXMSG_FLAG_ESI = 0x0004
4878
XL_CAN_RXMSG_FLAG_RTR = 0x0010
4979
XL_CAN_RXMSG_FLAG_EF = 0x0200
80+
XL_CAN_RXMSG_FLAG_ARB_LOST = 0x0400
81+
XL_CAN_RXMSG_FLAG_WAKEUP = 0x2000
82+
XL_CAN_RXMSG_FLAG_TE = 0x4000
5083

84+
# acceptance filter
5185
XL_CAN_STD = 1
5286
XL_CAN_EXT = 2
5387

88+
# s_xl_chip_state : busStatus
89+
XL_CHIPSTAT_BUSOFF = 0x01
90+
XL_CHIPSTAT_ERROR_PASSIVE = 0x02
91+
XL_CHIPSTAT_ERROR_WARNING = 0x04
92+
XL_CHIPSTAT_ERROR_ACTIVE = 0x08
93+
94+
# s_xl_can_ev_error : errorCode
95+
XL_CAN_ERRC_BIT_ERROR = 1
96+
XL_CAN_ERRC_FORM_ERROR = 2
97+
XL_CAN_ERRC_STUFF_ERROR = 3
98+
XL_CAN_ERRC_OTHER_ERROR = 4
99+
XL_CAN_ERRC_CRC_ERROR = 5
100+
XL_CAN_ERRC_ACK_ERROR = 6
101+
XL_CAN_ERRC_NACK_ERROR = 7
102+
XL_CAN_ERRC_OVLD_ERROR = 8
103+
XL_CAN_ERRC_EXCPT_ERROR = 9
104+
54105
XLuint64 = ctypes.c_int64
55106
XLaccess = XLuint64
56107
XLhandle = ctypes.c_void_p
57108

58109
MAX_MSG_LEN = 8
59110

111+
# CAN / CAN-FD types and definitions
60112
XL_CAN_MAX_DATA_LEN = 64
113+
XL_CANFD_RX_EVENT_HEADER_SIZE = 32
114+
XL_CANFD_MAX_EVENT_SIZE = 128
61115

62116
# current version
63117
XL_INTERFACE_VERSION = 3
@@ -424,3 +478,8 @@ def check_status(result, function, arguments):
424478
xlCanResetAcceptance.argtypes = [XLportHandle, XLaccess, ctypes.c_uint]
425479
xlCanResetAcceptance.restype = XLstatus
426480
xlCanResetAcceptance.errcheck = check_status
481+
482+
xlCanRequestChipState = _xlapi_dll.xlCanRequestChipState
483+
xlCanRequestChipState.argtypes = [XLportHandle, XLaccess]
484+
xlCanRequestChipState.restype = XLstatus
485+
xlCanRequestChipState.errcheck = check_status

0 commit comments

Comments
 (0)