I've run into some problems with the OTGv1 driver that is used instead of USBv1 for the P103 board. In the board definitions the lld macros for connecting and disconnecting the USB is redefined:
Code: Select all
/*
* USB bus activation macro, required by the USB driver.
*/
#define usb_lld_connect_bus(usbp) palClearPad(GPIOC, GPIOC_USB_DISC)
/*
* USB bus de-activation macro, required by the USB driver.
*/
#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOC, GPIOC_USB_DISC)
This works fine for the USBv1 driver, but not OTGv1 I changed the usb_lld.h from
Code: Select all
/**
* @brief Connects the USB device.
*
* @api
*/
#define usb_lld_connect_bus(usbp) ((usbp)->otg->GCCFG |= GCCFG_VBUSBSEN)
/**
* @brief Disconnect the USB device.
*
* @api
*/
#define usb_lld_disconnect_bus(usbp) ((usbp)->otg->GCCFG &= ~GCCFG_VBUSBSEN)
to
Code: Select all
/**
* @brief Connects the USB device.
*
* @api
*/
#if !defined(usb_lld_connect_bus)
#define usb_lld_connect_bus(usbp) ((usbp)->otg->GCCFG |= GCCFG_VBUSBSEN)
#endif
/**
* @brief Disconnect the USB device.
*
* @api
*/
#if !defined(usb_lld_disconnect_bus)
#define usb_lld_disconnect_bus(usbp) ((usbp)->otg->GCCFG &= ~GCCFG_VBUSBSEN)
#endif
Similar to the implementation in USBv1, and got rid of a lot of compiler warnings. Is there a reason for omitting this check in the OTGv1 driver, or was this just missed?