+
+ if (chips_p[dest_chip]->chipspecops->set_bittiming(chips_p[dest_chip], brp, sjw, tseg1, tseg2)<0)
+ goto error;
+ }
+ return 0;
+
+error:
+ return -1;
+}
+
+int get_bittiming_const_complete_fnc(usb_device_t *udev){
+
+ int dest_chip;
+
+ struct can_lmc1_chip_data *chip_data=NULL;
+ struct can_bittiming_const *btc;
+
+ uint8_t buffer[USBCAN_BITTIMING_CONST_SIZE];
+ uint32_t *ptr;
+
+ if (udev->request.bRequest==USBCAN_VENDOR_GET_BITTIMING_CONST){
+
+ dest_chip=(udev->request.wIndex);
+ if ((dest_chip>=MAX_TOT_CHIPS)||(dest_chip<0))
+ goto error;
+ if (!chips_p[dest_chip])
+ goto error;
+ if ((chip_data=((struct can_lmc1_chip_data*)(chips_p[dest_chip]->chip_data)))==NULL){
+ goto error;
+ }
+
+ btc = &chip_data->btc;
+
+ ptr = (uint32_t*) buffer;
+
+ #if __BYTE_ORDER == __BIG_ENDIAN
+ *(ptr++) = bswap_32(chips_p[dest_chip]->clock);
+ *(ptr++) = bswap_32(btc->tseg1_min);
+ *(ptr++) = bswap_32(btc->tseg1_max);
+ *(ptr++) = bswap_32(btc->tseg2_min);
+ *(ptr++) = bswap_32(btc->tseg2_max);
+ *(ptr++) = bswap_32(btc->sjw_max);
+ *(ptr++) = bswap_32(btc->brp_min);
+ *(ptr++) = bswap_32(btc->brp_max);
+ *(ptr) = bswap_32(btc->brp_inc);
+ #else
+ *(ptr++) = chips_p[dest_chip]->clock;
+ *(ptr++) = btc->tseg1_min;
+ *(ptr++) = btc->tseg1_max;
+ *(ptr++) = btc->tseg2_min;
+ *(ptr++) = btc->tseg2_max;
+ *(ptr++) = btc->sjw_max;
+ *(ptr++) = btc->brp_min;
+ *(ptr++) = btc->brp_max;
+ *(ptr) = btc->brp_inc;
+ #endif
+
+ usb_send_control_data(udev, buffer, USBCAN_BITTIMING_CONST_SIZE);