USB device stack

Dependents:   mbed-mX-USB-TEST1 USBMSD_SD_HID_HelloWorld HidTest MIDI_usb_bridge ... more

Legacy Warning

This is an mbed 2 library. To learn more about mbed OS 5, visit the docs.

Pull requests against this repository are no longer supported. Please raise against mbed OS 5 as documented above.

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Wed Apr 08 07:46:23 2015 +0100
Parent:
46:378357d7e90d
Child:
48:03f8e580579a
Commit message:
Synchronized with git revision 158cbeb2927b64c560005dbec6f60463a468c9da

Full URL: https://github.com/mbedmicro/mbed/commit/158cbeb2927b64c560005dbec6f60463a468c9da/

USB - Add macros to alias the endpoint callback functions to support configurability

Changed in this revision

USBAudio/USBAudio.cpp Show annotated file Show diff for this revision Revisions of this file
USBAudio/USBAudio.h Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBEndpoints_KL25Z.h Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBEndpoints_LPC11U.h Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBEndpoints_LPC17_LPC23.h Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBEndpoints_RZ_A1H.h Show annotated file Show diff for this revision Revisions of this file
USBDevice/USBEndpoints_STM32F4.h Show annotated file Show diff for this revision Revisions of this file
USBHID/USBKeyboard.cpp Show annotated file Show diff for this revision Revisions of this file
USBHID/USBKeyboard.h Show annotated file Show diff for this revision Revisions of this file
USBHID/USBMouseKeyboard.cpp Show annotated file Show diff for this revision Revisions of this file
USBHID/USBMouseKeyboard.h Show annotated file Show diff for this revision Revisions of this file
USBMIDI/USBMIDI.cpp Show annotated file Show diff for this revision Revisions of this file
USBMIDI/USBMIDI.h Show annotated file Show diff for this revision Revisions of this file
USBMSD/USBMSD.cpp Show annotated file Show diff for this revision Revisions of this file
USBMSD/USBMSD.h Show annotated file Show diff for this revision Revisions of this file
USBSerial/USBSerial.cpp Show annotated file Show diff for this revision Revisions of this file
USBSerial/USBSerial.h Show annotated file Show diff for this revision Revisions of this file
--- a/USBAudio/USBAudio.cpp	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBAudio/USBAudio.cpp	Wed Apr 08 07:46:23 2015 +0100
@@ -119,7 +119,7 @@
 }
 
 
-bool USBAudio::EP3_OUT_callback() {
+bool USBAudio::EPISO_OUT_callback() {
     uint32_t size = 0;
     interruptOUT = true;
     if (buf_stream_in != NULL) {
@@ -132,7 +132,7 @@
 }
 
 
-bool USBAudio::EP3_IN_callback() {
+bool USBAudio::EPISO_IN_callback() {
     interruptIN = true;
     writeIN = true;
     return true;
--- a/USBAudio/USBAudio.h	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBAudio/USBAudio.h	Wed Apr 08 07:46:23 2015 +0100
@@ -216,12 +216,12 @@
     /*
     * Callback called when a packet is received
     */
-    virtual bool EP3_OUT_callback();
+    virtual bool EPISO_OUT_callback();
 
     /*
     * Callback called when a packet has been sent
     */
-    virtual bool EP3_IN_callback();
+    virtual bool EPISO_IN_callback();
 
 private:
 
--- a/USBDevice/USBEndpoints_KL25Z.h	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBDevice/USBEndpoints_KL25Z.h	Wed Apr 08 07:46:23 2015 +0100
@@ -81,12 +81,18 @@
 /* Bulk endpoints */
 #define EPBULK_OUT  (EP2OUT)
 #define EPBULK_IN   (EP2IN)
+#define EPBULK_OUT_callback   EP2_OUT_callback
+#define EPBULK_IN_callback    EP2_IN_callback
 /* Interrupt endpoints */
 #define EPINT_OUT   (EP1OUT)
 #define EPINT_IN    (EP1IN)
+#define EPINT_OUT_callback    EP1_OUT_callback
+#define EPINT_IN_callback     EP1_IN_callback
 /* Isochronous endpoints */
 #define EPISO_OUT   (EP3OUT)
 #define EPISO_IN    (EP3IN)
+#define EPISO_OUT_callback    EP3_OUT_callback
+#define EPISO_IN_callback     EP3_IN_callback
 
 #define MAX_PACKET_SIZE_EPBULK  (MAX_PACKET_SIZE_EP2)
 #define MAX_PACKET_SIZE_EPINT   (MAX_PACKET_SIZE_EP1)
--- a/USBDevice/USBEndpoints_LPC11U.h	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBDevice/USBEndpoints_LPC11U.h	Wed Apr 08 07:46:23 2015 +0100
@@ -53,12 +53,18 @@
 /* Bulk endpoint */
 #define EPBULK_OUT  (EP2OUT)
 #define EPBULK_IN   (EP2IN)
+#define EPBULK_OUT_callback   EP2_OUT_callback
+#define EPBULK_IN_callback    EP2_IN_callback
 /* Interrupt endpoint */
 #define EPINT_OUT   (EP1OUT)
 #define EPINT_IN    (EP1IN)
+#define EPINT_OUT_callback    EP1_OUT_callback
+#define EPINT_IN_callback     EP1_IN_callback
 /* Isochronous endpoint */
 #define EPISO_OUT   (EP3OUT)
 #define EPISO_IN    (EP3IN)
+#define EPISO_OUT_callback    EP3_OUT_callback
+#define EPISO_IN_callback     EP3_IN_callback
 
 #define MAX_PACKET_SIZE_EPBULK  (MAX_PACKET_SIZE_EP2)
 #define MAX_PACKET_SIZE_EPINT   (MAX_PACKET_SIZE_EP1)
--- a/USBDevice/USBEndpoints_LPC17_LPC23.h	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBDevice/USBEndpoints_LPC17_LPC23.h	Wed Apr 08 07:46:23 2015 +0100
@@ -81,12 +81,18 @@
 /* Bulk endpoints */
 #define EPBULK_OUT  (EP2OUT)
 #define EPBULK_IN   (EP2IN)
+#define EPBULK_OUT_callback   EP2_OUT_callback
+#define EPBULK_IN_callback    EP2_IN_callback
 /* Interrupt endpoints */
 #define EPINT_OUT   (EP1OUT)
 #define EPINT_IN    (EP1IN)
+#define EPINT_OUT_callback    EP1_OUT_callback
+#define EPINT_IN_callback     EP1_IN_callback
 /* Isochronous endpoints */
 #define EPISO_OUT   (EP3OUT)
 #define EPISO_IN    (EP3IN)
+#define EPISO_OUT_callback    EP3_OUT_callback
+#define EPISO_IN_callback     EP3_IN_callback
 
 #define MAX_PACKET_SIZE_EPBULK  (MAX_PACKET_SIZE_EP2)
 #define MAX_PACKET_SIZE_EPINT   (MAX_PACKET_SIZE_EP1)
--- a/USBDevice/USBEndpoints_RZ_A1H.h	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBDevice/USBEndpoints_RZ_A1H.h	Wed Apr 08 07:46:23 2015 +0100
@@ -65,12 +65,18 @@
 /* Bulk endpoints */
 #define EPBULK_OUT  (EP2OUT)
 #define EPBULK_IN   (EP2IN)
+#define EPBULK_OUT_callback   EP2_OUT_callback
+#define EPBULK_IN_callback    EP2_IN_callback
 /* Interrupt endpoints */
 #define EPINT_OUT   (EP1OUT)
 #define EPINT_IN    (EP1IN)
+#define EPINT_OUT_callback    EP1_OUT_callback
+#define EPINT_IN_callback     EP1_IN_callback
 /* Isochronous endpoints */
 #define EPISO_OUT   (EP3OUT)
 #define EPISO_IN    (EP3IN)
+#define EPISO_OUT_callback    EP3_OUT_callback
+#define EPISO_IN_callback     EP3_IN_callback
 
 #define MAX_PACKET_SIZE_EPBULK  (MAX_PACKET_SIZE_EP2)
 #define MAX_PACKET_SIZE_EPINT   (MAX_PACKET_SIZE_EP1)
--- a/USBDevice/USBEndpoints_STM32F4.h	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBDevice/USBEndpoints_STM32F4.h	Wed Apr 08 07:46:23 2015 +0100
@@ -49,12 +49,18 @@
 /* Bulk endpoint */
 #define EPBULK_OUT  (EP2OUT)
 #define EPBULK_IN   (EP2IN)
+#define EPBULK_OUT_callback   EP2_OUT_callback
+#define EPBULK_IN_callback    EP2_IN_callback
 /* Interrupt endpoint */
 #define EPINT_OUT   (EP1OUT)
 #define EPINT_IN    (EP1IN)
+#define EPINT_OUT_callback    EP1_OUT_callback
+#define EPINT_IN_callback     EP1_IN_callback
 /* Isochronous endpoint */
 #define EPISO_OUT   (EP3OUT)
 #define EPISO_IN    (EP3IN)
+#define EPISO_OUT_callback    EP3_OUT_callback
+#define EPISO_IN_callback     EP3_IN_callback
 
 #define MAX_PACKET_SIZE_EPBULK  (MAX_PACKET_SIZE_EP2)
 #define MAX_PACKET_SIZE_EPINT   (MAX_PACKET_SIZE_EP1)
--- a/USBHID/USBKeyboard.cpp	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBHID/USBKeyboard.cpp	Wed Apr 08 07:46:23 2015 +0100
@@ -420,7 +420,7 @@
 }
 
 
-bool USBKeyboard::EP1_OUT_callback() {
+bool USBKeyboard::EPINT_OUT_callback() {
     uint32_t bytesRead = 0;
     uint8_t led[65];
     USBDevice::readEP(EPINT_OUT, led, &bytesRead, MAX_HID_REPORT_SIZE);
--- a/USBHID/USBKeyboard.h	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBHID/USBKeyboard.h	Wed Apr 08 07:46:23 2015 +0100
@@ -150,7 +150,7 @@
     *
     * @returns if handle by subclass, return true
     */
-    virtual bool EP1_OUT_callback();
+    virtual bool EPINT_OUT_callback();
 
     /**
     * Read status of lock keys. Useful to switch-on/off leds according to key pressed. Only the first three bits of the result is important:
--- a/USBHID/USBMouseKeyboard.cpp	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBHID/USBMouseKeyboard.cpp	Wed Apr 08 07:46:23 2015 +0100
@@ -548,7 +548,7 @@
     return NULL;
 }
 
-bool USBMouseKeyboard::EP1_OUT_callback() {
+bool USBMouseKeyboard::EPINT_OUT_callback() {
     uint32_t bytesRead = 0;
     uint8_t led[65];
     USBDevice::readEP(EPINT_OUT, led, &bytesRead, MAX_HID_REPORT_SIZE);
--- a/USBHID/USBMouseKeyboard.h	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBHID/USBMouseKeyboard.h	Wed Apr 08 07:46:23 2015 +0100
@@ -202,7 +202,7 @@
         *
         * @returns if handle by subclass, return true
         */
-        virtual bool EP1_OUT_callback();
+        virtual bool EPINT_OUT_callback();
 
 
     private:
--- a/USBMIDI/USBMIDI.cpp	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBMIDI/USBMIDI.cpp	Wed Apr 08 07:46:23 2015 +0100
@@ -35,7 +35,7 @@
 }
 
 
-bool USBMIDI::EP2_OUT_callback() {
+bool USBMIDI::EPBULK_OUT_callback() {
     uint8_t buf[64];
     uint32_t len;
     readEP(EPBULK_OUT, buf, &len, 64);
--- a/USBMIDI/USBMIDI.h	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBMIDI/USBMIDI.h	Wed Apr 08 07:46:23 2015 +0100
@@ -78,7 +78,7 @@
 
 
 protected:
-    virtual bool EP2_OUT_callback();
+    virtual bool EPBULK_OUT_callback();
     virtual bool USBCallback_setConfiguration(uint8_t configuration);
     /*
     * Get string product descriptor
--- a/USBMSD/USBMSD.cpp	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBMSD/USBMSD.cpp	Wed Apr 08 07:46:23 2015 +0100
@@ -147,7 +147,7 @@
 
 
 // Called in ISR context called when a data is received
-bool USBMSD::EP2_OUT_callback() {
+bool USBMSD::EPBULK_OUT_callback() {
     uint32_t size = 0;
     uint8_t buf[MAX_PACKET_SIZE_EPBULK];
     readEP(EPBULK_OUT, buf, &size, MAX_PACKET_SIZE_EPBULK);
@@ -184,7 +184,7 @@
 }
 
 // Called in ISR context when a data has been transferred
-bool USBMSD::EP2_IN_callback() {
+bool USBMSD::EPBULK_IN_callback() {
     switch (stage) {
 
             // the device has to send data to the host
--- a/USBMSD/USBMSD.h	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBMSD/USBMSD.h	Wed Apr 08 07:46:23 2015 +0100
@@ -158,12 +158,12 @@
     /*
     * Callback called when a packet is received
     */
-    virtual bool EP2_OUT_callback();
+    virtual bool EPBULK_OUT_callback();
 
     /*
     * Callback called when a packet has been sent
     */
-    virtual bool EP2_IN_callback();
+    virtual bool EPBULK_IN_callback();
 
     /*
     * Set configuration of device. Add endpoints
--- a/USBSerial/USBSerial.cpp	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBSerial/USBSerial.cpp	Wed Apr 08 07:46:23 2015 +0100
@@ -46,7 +46,7 @@
 
 
 
-bool USBSerial::EP2_OUT_callback() {
+bool USBSerial::EPBULK_OUT_callback() {
     uint8_t c[65];
     uint32_t size = 0;
 
--- a/USBSerial/USBSerial.h	Tue Mar 31 16:15:39 2015 +0100
+++ b/USBSerial/USBSerial.h	Wed Apr 08 07:46:23 2015 +0100
@@ -145,7 +145,7 @@
     }
 
 protected:
-    virtual bool EP2_OUT_callback();
+    virtual bool EPBULK_OUT_callback();
     virtual void lineCodingChanged(int baud, int bits, int parity, int stop){
         if (settingsChangedCallback) {
             settingsChangedCallback(baud, bits, parity, stop);