@@ -993,24 +993,24 @@ static void pcan_usb_fd_free(struct peak_usb_device *dev)
993993static const struct can_bittiming_const pcan_usb_fd_const = {
994994 .name = "pcan_usb_fd" ,
995995 .tseg1_min = 1 ,
996- .tseg1_max = 64 ,
996+ .tseg1_max = ( 1 << PUCAN_TSLOW_TSGEG1_BITS ) ,
997997 .tseg2_min = 1 ,
998- .tseg2_max = 16 ,
999- .sjw_max = 16 ,
998+ .tseg2_max = ( 1 << PUCAN_TSLOW_TSGEG2_BITS ) ,
999+ .sjw_max = ( 1 << PUCAN_TSLOW_SJW_BITS ) ,
10001000 .brp_min = 1 ,
1001- .brp_max = 1024 ,
1001+ .brp_max = ( 1 << PUCAN_TSLOW_BRP_BITS ) ,
10021002 .brp_inc = 1 ,
10031003};
10041004
10051005static const struct can_bittiming_const pcan_usb_fd_data_const = {
10061006 .name = "pcan_usb_fd" ,
10071007 .tseg1_min = 1 ,
1008- .tseg1_max = 16 ,
1008+ .tseg1_max = ( 1 << PUCAN_TFAST_TSGEG1_BITS ) ,
10091009 .tseg2_min = 1 ,
1010- .tseg2_max = 8 ,
1011- .sjw_max = 4 ,
1010+ .tseg2_max = ( 1 << PUCAN_TFAST_TSGEG2_BITS ) ,
1011+ .sjw_max = ( 1 << PUCAN_TFAST_SJW_BITS ) ,
10121012 .brp_min = 1 ,
1013- .brp_max = 1024 ,
1013+ .brp_max = ( 1 << PUCAN_TFAST_BRP_BITS ) ,
10141014 .brp_inc = 1 ,
10151015};
10161016
@@ -1065,24 +1065,24 @@ const struct peak_usb_adapter pcan_usb_fd = {
10651065static const struct can_bittiming_const pcan_usb_pro_fd_const = {
10661066 .name = "pcan_usb_pro_fd" ,
10671067 .tseg1_min = 1 ,
1068- .tseg1_max = 64 ,
1068+ .tseg1_max = ( 1 << PUCAN_TSLOW_TSGEG1_BITS ) ,
10691069 .tseg2_min = 1 ,
1070- .tseg2_max = 16 ,
1071- .sjw_max = 16 ,
1070+ .tseg2_max = ( 1 << PUCAN_TSLOW_TSGEG2_BITS ) ,
1071+ .sjw_max = ( 1 << PUCAN_TSLOW_SJW_BITS ) ,
10721072 .brp_min = 1 ,
1073- .brp_max = 1024 ,
1073+ .brp_max = ( 1 << PUCAN_TSLOW_BRP_BITS ) ,
10741074 .brp_inc = 1 ,
10751075};
10761076
10771077static const struct can_bittiming_const pcan_usb_pro_fd_data_const = {
10781078 .name = "pcan_usb_pro_fd" ,
10791079 .tseg1_min = 1 ,
1080- .tseg1_max = 16 ,
1080+ .tseg1_max = ( 1 << PUCAN_TFAST_TSGEG1_BITS ) ,
10811081 .tseg2_min = 1 ,
1082- .tseg2_max = 8 ,
1083- .sjw_max = 4 ,
1082+ .tseg2_max = ( 1 << PUCAN_TFAST_TSGEG2_BITS ) ,
1083+ .sjw_max = ( 1 << PUCAN_TFAST_SJW_BITS ) ,
10841084 .brp_min = 1 ,
1085- .brp_max = 1024 ,
1085+ .brp_max = ( 1 << PUCAN_TFAST_BRP_BITS ) ,
10861086 .brp_inc = 1 ,
10871087};
10881088
@@ -1132,3 +1132,75 @@ const struct peak_usb_adapter pcan_usb_pro_fd = {
11321132
11331133 .do_get_berr_counter = pcan_usb_fd_get_berr_counter ,
11341134};
1135+
1136+ /* describes the PCAN-USB X6 adapter */
1137+ static const struct can_bittiming_const pcan_usb_x6_const = {
1138+ .name = "pcan_usb_x6" ,
1139+ .tseg1_min = 1 ,
1140+ .tseg1_max = (1 << PUCAN_TSLOW_TSGEG1_BITS ),
1141+ .tseg2_min = 1 ,
1142+ .tseg2_max = (1 << PUCAN_TSLOW_TSGEG2_BITS ),
1143+ .sjw_max = (1 << PUCAN_TSLOW_SJW_BITS ),
1144+ .brp_min = 1 ,
1145+ .brp_max = (1 << PUCAN_TSLOW_BRP_BITS ),
1146+ .brp_inc = 1 ,
1147+ };
1148+
1149+ static const struct can_bittiming_const pcan_usb_x6_data_const = {
1150+ .name = "pcan_usb_x6" ,
1151+ .tseg1_min = 1 ,
1152+ .tseg1_max = (1 << PUCAN_TFAST_TSGEG1_BITS ),
1153+ .tseg2_min = 1 ,
1154+ .tseg2_max = (1 << PUCAN_TFAST_TSGEG2_BITS ),
1155+ .sjw_max = (1 << PUCAN_TFAST_SJW_BITS ),
1156+ .brp_min = 1 ,
1157+ .brp_max = (1 << PUCAN_TFAST_BRP_BITS ),
1158+ .brp_inc = 1 ,
1159+ };
1160+
1161+ const struct peak_usb_adapter pcan_usb_x6 = {
1162+ .name = "PCAN-USB X6" ,
1163+ .device_id = PCAN_USBX6_PRODUCT_ID ,
1164+ .ctrl_count = PCAN_USBPROFD_CHANNEL_COUNT ,
1165+ .ctrlmode_supported = CAN_CTRLMODE_FD |
1166+ CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY ,
1167+ .clock = {
1168+ .freq = PCAN_UFD_CRYSTAL_HZ ,
1169+ },
1170+ .bittiming_const = & pcan_usb_x6_const ,
1171+ .data_bittiming_const = & pcan_usb_x6_data_const ,
1172+
1173+ /* size of device private data */
1174+ .sizeof_dev_private = sizeof (struct pcan_usb_fd_device ),
1175+
1176+ /* timestamps usage */
1177+ .ts_used_bits = 32 ,
1178+ .ts_period = 1000000 , /* calibration period in ts. */
1179+ .us_per_ts_scale = 1 , /* us = (ts * scale) >> shift */
1180+ .us_per_ts_shift = 0 ,
1181+
1182+ /* give here messages in/out endpoints */
1183+ .ep_msg_in = PCAN_USBPRO_EP_MSGIN ,
1184+ .ep_msg_out = {PCAN_USBPRO_EP_MSGOUT_0 , PCAN_USBPRO_EP_MSGOUT_1 },
1185+
1186+ /* size of rx/tx usb buffers */
1187+ .rx_buffer_size = PCAN_UFD_RX_BUFFER_SIZE ,
1188+ .tx_buffer_size = PCAN_UFD_TX_BUFFER_SIZE ,
1189+
1190+ /* device callbacks */
1191+ .intf_probe = pcan_usb_pro_probe , /* same as PCAN-USB Pro */
1192+ .dev_init = pcan_usb_fd_init ,
1193+
1194+ .dev_exit = pcan_usb_fd_exit ,
1195+ .dev_free = pcan_usb_fd_free ,
1196+ .dev_set_bus = pcan_usb_fd_set_bus ,
1197+ .dev_set_bittiming = pcan_usb_fd_set_bittiming_slow ,
1198+ .dev_set_data_bittiming = pcan_usb_fd_set_bittiming_fast ,
1199+ .dev_decode_buf = pcan_usb_fd_decode_buf ,
1200+ .dev_start = pcan_usb_fd_start ,
1201+ .dev_stop = pcan_usb_fd_stop ,
1202+ .dev_restart_async = pcan_usb_fd_restart_async ,
1203+ .dev_encode_msg = pcan_usb_fd_encode_msg ,
1204+
1205+ .do_get_berr_counter = pcan_usb_fd_get_berr_counter ,
1206+ };
0 commit comments