X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=bertos%2Fcpu%2Fcortex-m3%2Fdrv%2Fusb_stm32.c;h=6b0b28e1d31751fa582330cfc33f9d5d922834c4;hb=3c57e466444d95d4358eb4f0e2a8130dcfb0f55b;hp=ef1abda2aec54ad33d3fb1d220b7fefe41d021be;hpb=7713a5e329a770f53d53e39e9b3b8dae55c71614;p=bertos.git diff --git a/bertos/cpu/cortex-m3/drv/usb_stm32.c b/bertos/cpu/cortex-m3/drv/usb_stm32.c index ef1abda2..6b0b28e1 100644 --- a/bertos/cpu/cortex-m3/drv/usb_stm32.c +++ b/bertos/cpu/cortex-m3/drv/usb_stm32.c @@ -611,9 +611,6 @@ static void __usb_ep_io(int EP) cpu_flags_t flags; \ stm32_usb_io_status_t ret; \ \ - /* NOTE: buffer must be 4-bytes aligned */ \ - ASSERT(!((size_t)__buf & 0x03)); \ - \ /* Fill EP descriptor */ \ IRQ_SAVE_DISABLE(flags); \ if (__size < 0) \ @@ -1558,6 +1555,17 @@ static void USB_StandardRequestHandler(void) } } +/* USB setup packet: class/vendor request handler */ +static void USB_EventHandler(void) +{ + /* + * TODO: get the appropriate usb_dev in function of the endpoint + * address. + */ + if (usb_dev->event_cb) + usb_dev->event_cb(&setup_packet); +} + /* USB setup packet handler */ static void USB_SetupHandler(void) { @@ -1573,11 +1581,13 @@ static void USB_SetupHandler(void) case USB_TYPE_CLASS: LOG_INFO("%s: bmRequestType=%02x (Class)\n", __func__, setup_packet.mRequestType); + USB_EventHandler(); break; /* Vendor */ case USB_TYPE_VENDOR: LOG_INFO("%s: bmRequestType=%02x (Vendor)\n", __func__, setup_packet.mRequestType); + USB_EventHandler(); break; case USB_TYPE_RESERVED: LOG_INFO("%s: bmRequestType=%02x (Reserved)\n", @@ -1592,6 +1602,7 @@ static void USB_SetupHandler(void) } } +/* USB: low-level hardware initialization */ static void usb_hw_reset(void) { unsigned int i;