#include <byteswap.h>
#endif
-#include "./can/lpc17xx_can.h"
+#include "./can/can_bittiming.h"
extern struct canuser_t *canuser;
extern uint8_t vendor_ret;
return -1;
}
-int get_bittiming_const_complete_fnc(usb_device_t *udev){
-
+int usbcan_get_bittiming_const_reply(usb_device_t *udev){
int dest_chip;
+ struct canchip_t *chip;
- struct can_lmc1_chip_data *chip_data=NULL;
- struct can_bittiming_const *btc;
+ struct can_bittiming_const btc_buff;
+ struct can_bittiming_const *btc = &btc_buff;
uint8_t buffer[USBCAN_BITTIMING_CONST_SIZE];
uint32_t *ptr;
dest_chip=(udev->request.wIndex);
if ((dest_chip>=MAX_TOT_CHIPS)||(dest_chip<0))
goto error;
- if (!chips_p[dest_chip])
+ if ((chip = chips_p[dest_chip]) == NULL)
goto error;
- if ((chip_data=((struct can_lmc1_chip_data*)(chips_p[dest_chip]->chip_data)))==NULL){
+ if (chip->chipspecops->get_bittiming_const == NULL){
goto error;
}
- btc = &chip_data->btc;
-
+ chip->chipspecops->get_bittiming_const(chip, btc);
ptr = (uint32_t*) buffer;
#if __BYTE_ORDER == __BIG_ENDIAN
return 1;
case USBCAN_VENDOR_GET_BITTIMING_CONST:
- get_bittiming_const_complete_fnc(udev);
+ usbcan_get_bittiming_const_reply(udev);
return 1;
//lpc17xx - end