Remove inclusion of mbed.h from USB

Remove mbed.h from USB files and fix the build errors this causes.
This is required to pass CI.
pull/9768/head
Russ Butler 2019-01-29 15:16:27 -06:00
parent bd6e9aa4d2
commit 8d731561cf
21 changed files with 49 additions and 47 deletions

View File

@ -16,6 +16,7 @@
*/ */
#include "stdint.h" #include "stdint.h"
#include "stdlib.h"
#include "USBEndpointTester.h" #include "USBEndpointTester.h"
#include "mbed_shared_queues.h" #include "mbed_shared_queues.h"
#include "EndpointResolver.h" #include "EndpointResolver.h"
@ -167,7 +168,7 @@ USBEndpointTester::USBEndpointTester(USBPhy *phy, uint16_t vendor_id, uint16_t p
} }
MBED_ASSERT(resolver.valid()); MBED_ASSERT(resolver.valid());
queue = mbed_highprio_event_queue(); queue = mbed::mbed_highprio_event_queue();
configuration_desc(0); configuration_desc(0);
init(); init();
USBDevice::connect(); USBDevice::connect();

View File

@ -78,7 +78,7 @@ public:
}; };
protected: protected:
EventQueue *queue; events::EventQueue *queue;
rtos::EventFlags flags; rtos::EventFlags flags;
uint8_t ctrl_buf[2048]; uint8_t ctrl_buf[2048];

View File

@ -54,7 +54,7 @@ USBTester::USBTester(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint1
int_in = resolver.endpoint_in(USB_EP_TYPE_INT, 64); int_in = resolver.endpoint_in(USB_EP_TYPE_INT, 64);
int_out = resolver.endpoint_out(USB_EP_TYPE_INT, 64); int_out = resolver.endpoint_out(USB_EP_TYPE_INT, 64);
MBED_ASSERT(resolver.valid()); MBED_ASSERT(resolver.valid());
queue = mbed_highprio_event_queue(); queue = mbed::mbed_highprio_event_queue();
configuration_desc(0); configuration_desc(0);

View File

@ -106,7 +106,7 @@ protected:
uint8_t int_in; uint8_t int_in;
uint8_t int_out; uint8_t int_out;
uint8_t int_buf[64]; uint8_t int_buf[64];
EventQueue *queue; events::EventQueue *queue;
rtos::EventFlags flags; rtos::EventFlags flags;
volatile uint32_t reset_count; volatile uint32_t reset_count;
volatile uint32_t suspend_count; volatile uint32_t suspend_count;

View File

@ -145,9 +145,9 @@ void USBAudio::_init(uint32_t frequency_rx, uint8_t channel_count_rx, uint32_t f
_vol_max = 0x0100; _vol_max = 0x0100;
_vol_res = 0x0004; _vol_res = 0x0004;
_update_vol = callback(stub_volume); _update_vol = mbed::callback(stub_volume);
_tx_done = callback(stub_handler); _tx_done = mbed::callback(stub_handler);
_rx_done = callback(stub_handler); _rx_done = mbed::callback(stub_handler);
_rx_overflow = 0; _rx_overflow = 0;
_tx_underflow = 0; _tx_underflow = 0;
@ -348,7 +348,7 @@ float USBAudio::get_volume()
return ret; return ret;
} }
void USBAudio::attach(Callback<void()> &cb) void USBAudio::attach(mbed::Callback<void()> &cb)
{ {
lock(); lock();
@ -360,25 +360,25 @@ void USBAudio::attach(Callback<void()> &cb)
unlock(); unlock();
} }
void USBAudio::attach_tx(Callback<void(AudioEvent)> &cb) void USBAudio::attach_tx(mbed::Callback<void(AudioEvent)> &cb)
{ {
lock(); lock();
_tx_done = cb; _tx_done = cb;
if (!_tx_done) { if (!_tx_done) {
_tx_done = callback(stub_handler); _tx_done = mbed::callback(stub_handler);
} }
unlock(); unlock();
} }
void USBAudio::attach_rx(Callback<void(AudioEvent)> &cb) void USBAudio::attach_rx(mbed::Callback<void(AudioEvent)> &cb)
{ {
lock(); lock();
_rx_done = cb; _rx_done = cb;
if (!_rx_done) { if (!_rx_done) {
_rx_done = callback(stub_handler); _rx_done = mbed::callback(stub_handler);
} }
unlock(); unlock();

View File

@ -222,21 +222,21 @@ public:
* @param cb Callback to attach * @param cb Callback to attach
* *
*/ */
void attach(Callback<void()> &cb); void attach(mbed::Callback<void()> &cb);
/** attach a Callback to Tx Done /** attach a Callback to Tx Done
* *
* @param cb Callback to attach * @param cb Callback to attach
* *
*/ */
void attach_tx(Callback<void(AudioEvent)> &cb); void attach_tx(mbed::Callback<void(AudioEvent)> &cb);
/** attach a Callback to Rx Done /** attach a Callback to Rx Done
* *
* @param cb Callback to attach * @param cb Callback to attach
* *
*/ */
void attach_rx(Callback<void(AudioEvent)> &cb); void attach_rx(mbed::Callback<void(AudioEvent)> &cb);
protected: protected:
@ -303,13 +303,13 @@ private:
uint16_t _vol_res; uint16_t _vol_res;
// callback to update volume // callback to update volume
Callback<void()> _update_vol; mbed::Callback<void()> _update_vol;
// callback transmit Done // callback transmit Done
Callback<void(AudioEvent)> _tx_done; mbed::Callback<void(AudioEvent)> _tx_done;
// callback receive Done // callback receive Done
Callback<void(AudioEvent)> _rx_done; mbed::Callback<void(AudioEvent)> _rx_done;
// Number of times data was dropped due to an overflow // Number of times data was dropped due to an overflow
uint32_t _rx_overflow; uint32_t _rx_overflow;

View File

@ -14,7 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
#include "mbed.h"
#include "EndpointResolver.h" #include "EndpointResolver.h"
static uint32_t logical_to_index(uint32_t logical, bool in_not_out) static uint32_t logical_to_index(uint32_t logical, bool in_not_out)

View File

@ -17,8 +17,6 @@
#ifndef ENDPOINT_RESOLVER_H #ifndef ENDPOINT_RESOLVER_H
#define ENDPOINT_RESOLVER_H #define ENDPOINT_RESOLVER_H
#include "mbed.h"
#include "USBPhy.h" #include "USBPhy.h"
/** /**

View File

@ -14,11 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
#include "stdint.h" #include <stdint.h>
#include <string.h>
#include "USBDevice.h" #include "USBDevice.h"
#include "USBDescriptor.h" #include "USBDescriptor.h"
#include "usb_phy_api.h" #include "usb_phy_api.h"
#include "mbed_assert.h"
//#define DEBUG //#define DEBUG

View File

@ -17,7 +17,6 @@
#ifndef USBDEVICE_H #ifndef USBDEVICE_H
#define USBDEVICE_H #define USBDEVICE_H
#include "mbed.h"
#include "USBDevice_Types.h" #include "USBDevice_Types.h"
#include "USBPhy.h" #include "USBPhy.h"
#include "mbed_critical.h" #include "mbed_critical.h"

View File

@ -94,7 +94,7 @@ enum FUNCTION_KEY {
* *
* @note Synchronization level: Thread safe * @note Synchronization level: Thread safe
*/ */
class USBKeyboard: public USBHID, public Stream { class USBKeyboard: public USBHID, public mbed::Stream {
public: public:
/** /**

View File

@ -18,6 +18,7 @@
#include "USBMouse.h" #include "USBMouse.h"
#include "PlatformMutex.h" #include "PlatformMutex.h"
#include "usb_phy_api.h" #include "usb_phy_api.h"
#include "mbed_wait_api.h"
USBMouse::USBMouse(bool connect_blocking, MOUSE_TYPE mouse_type, uint16_t vendor_id, uint16_t product_id, uint16_t product_release): USBMouse::USBMouse(bool connect_blocking, MOUSE_TYPE mouse_type, uint16_t vendor_id, uint16_t product_id, uint16_t product_release):

View File

@ -17,6 +17,7 @@
#include "stdint.h" #include "stdint.h"
#include "USBMouseKeyboard.h" #include "USBMouseKeyboard.h"
#include "usb_phy_api.h" #include "usb_phy_api.h"
#include "mbed_wait_api.h"
typedef struct { typedef struct {
unsigned char usage; unsigned char usage;

View File

@ -68,7 +68,7 @@
* *
* @note Synchronization level: Thread safe * @note Synchronization level: Thread safe
*/ */
class USBMouseKeyboard: public USBHID, public Stream class USBMouseKeyboard: public USBHID, public mbed::Stream
{ {
public: public:

View File

@ -17,7 +17,7 @@
#ifndef MIDIMESSAGE_H #ifndef MIDIMESSAGE_H
#define MIDIMESSAGE_H #define MIDIMESSAGE_H
#include "mbed.h" #include <stdint.h>
#define MAX_MIDI_MESSAGE_SIZE 256 // Max message size. SysEx can be up to 65536 but 256 should be fine for most usage #define MAX_MIDI_MESSAGE_SIZE 256 // Max message size. SysEx can be up to 65536 but 256 should be fine for most usage

View File

@ -172,7 +172,7 @@ bool USBMIDI::read(MIDIMessage *m)
return true; return true;
} }
void USBMIDI::attach(Callback<void()> callback) void USBMIDI::attach(mbed::Callback<void()> callback)
{ {
lock(); lock();

View File

@ -134,7 +134,7 @@ public:
* *
* @param callback code to call when a packet is received * @param callback code to call when a packet is received
*/ */
void attach(Callback<void()> callback); void attach(mbed::Callback<void()> callback);
protected: protected:
@ -173,7 +173,7 @@ private:
usb_ep_t _bulk_out; usb_ep_t _bulk_out;
uint8_t _config_descriptor[0x65]; uint8_t _config_descriptor[0x65];
Callback<void()> _callback; mbed::Callback<void()> _callback;
void _init(); void _init();
void _in_callback(); void _in_callback();

View File

@ -14,7 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include "stdint.h" #include <stdint.h>
#include <stdlib.h>
#include "USBMSD.h" #include "USBMSD.h"
#include "EndpointResolver.h" #include "EndpointResolver.h"
#include "usb_phy_api.h" #include "usb_phy_api.h"
@ -86,11 +87,11 @@ void USBMSD::_init()
{ {
_bd->init(); _bd->init();
_in_task = callback(this, &USBMSD::_in); _in_task = mbed::callback(this, &USBMSD::_in);
_out_task = callback(this, &USBMSD::_out); _out_task = mbed::callback(this, &USBMSD::_out);
_reset_task = callback(this, &USBMSD::_reset); _reset_task = mbed::callback(this, &USBMSD::_reset);
_control_task = callback(this, &USBMSD::_control); _control_task = mbed::callback(this, &USBMSD::_control);
_configure_task = callback(this, &USBMSD::_configure); _configure_task = mbed::callback(this, &USBMSD::_configure);
EndpointResolver resolver(endpoint_table()); EndpointResolver resolver(endpoint_table());

View File

@ -237,12 +237,12 @@ private:
uint32_t _bulk_out_size; uint32_t _bulk_out_size;
// Interrupt to thread deferral // Interrupt to thread deferral
PolledQueue _queue; events::PolledQueue _queue;
Task<void()> _in_task; events::Task<void()> _in_task;
Task<void()> _out_task; events::Task<void()> _out_task;
Task<void()> _reset_task; events::Task<void()> _reset_task;
Task<void(const setup_packet_t *)> _control_task; events::Task<void(const setup_packet_t *)> _control_task;
Task<void()> _configure_task; events::Task<void()> _configure_task;
BlockDevice *_bd; BlockDevice *_bd;
rtos::Mutex _mutex_init; rtos::Mutex _mutex_init;

View File

@ -41,7 +41,7 @@
* } * }
* @endcode * @endcode
*/ */
class USBSerial: public USBCDC, public Stream { class USBSerial: public USBCDC, public mbed::Stream {
public: public:
/** /**
@ -149,7 +149,7 @@ public:
USBCDC::lock(); USBCDC::lock();
if ((mptr != NULL) && (tptr != NULL)) { if ((mptr != NULL) && (tptr != NULL)) {
rx = Callback<void()>(mptr, tptr); rx = mbed::Callback<void()>(mptr, tptr);
} }
USBCDC::unlock(); USBCDC::unlock();
@ -165,7 +165,7 @@ public:
USBCDC::lock(); USBCDC::lock();
if (fptr != NULL) { if (fptr != NULL) {
rx = Callback<void()>(fptr); rx = mbed::Callback<void()>(fptr);
} }
USBCDC::unlock(); USBCDC::unlock();
@ -176,7 +176,7 @@ public:
* *
* @param cb Callback to attach * @param cb Callback to attach
*/ */
void attach(Callback<void()> &cb) void attach(mbed::Callback<void()> &cb)
{ {
USBCDC::lock(); USBCDC::lock();
@ -211,7 +211,7 @@ protected:
} }
private: private:
Callback<void()> rx; mbed::Callback<void()> rx;
void (*_settings_changed_callback)(int baud, int bits, int parity, int stop); void (*_settings_changed_callback)(int baud, int bits, int parity, int stop);
}; };

View File

@ -18,7 +18,7 @@
#include "events/TaskQueue.h" #include "events/TaskQueue.h"
#include "events/mbed_events.h" #include "events/mbed_events.h"
#include "rtos/Semaphore.h" #include "rtos/Semaphore.h"
#include "mbed.h" #include "platform/mbed_critical.h"
TaskBase::TaskBase(TaskQueue *q) TaskBase::TaskBase(TaskQueue *q)
: _queue(q), _posted(false), _start_count(0), _flush_sem(NULL) : _queue(q), _posted(false), _start_count(0), _flush_sem(NULL)