X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/e372a22696a079ea7f3bb00aa46e8a8281f1c49f..4b51897df818c0cef960dbfab815c7e69586c654:/embedded/app/usbcan/usb_vend.c diff --git a/embedded/app/usbcan/usb_vend.c b/embedded/app/usbcan/usb_vend.c index fbe5be9..460c85d 100644 --- a/embedded/app/usbcan/usb_vend.c +++ b/embedded/app/usbcan/usb_vend.c @@ -14,7 +14,7 @@ #include #endif -#include "./can/lpc17xx_can.h" +#include "./can/can_bittiming.h" extern struct canuser_t *canuser; extern uint8_t vendor_ret; @@ -140,12 +140,12 @@ error: 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; @@ -155,14 +155,13 @@ int get_bittiming_const_complete_fnc(usb_device_t *udev){ 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 @@ -217,7 +216,7 @@ int usbcan_vendor(usb_device_t *udev) return 1; case USBCAN_VENDOR_GET_BITTIMING_CONST: - get_bittiming_const_complete_fnc(udev); + usbcan_get_bittiming_const_reply(udev); return 1; //lpc17xx - end