SAM3 port: add clock initialization stubs
[bertos.git] / bertos / cpu / cortex-m3 / drv / usb_stm32.c
index ef1abda2aec54ad33d3fb1d220b7fefe41d021be..6b0b28e1d31751fa582330cfc33f9d5d922834c4 100644 (file)
@@ -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;