USB public APIs cleanup (#11034)

The contents of the usb directory were moved to appropriate locations and the usb directory removed.

* Public USB headers moved under drivers/
* Internal USB headers moved under drivers/internal/
* USB Source code moved under drivers/source/usb/
* Moved usb/device/hal/ under hal/usb/
* Moved usb/device/USBPhy/ under hal/usb/
* Merged usb/device/targets/ into targets/
* Separated public and private USB API documentation under Doxygen groups drivers-public-api and drivers-internal-api.
pull/11073/head
George Psimenos 2019-07-18 16:55:26 +01:00 committed by Evelyne Donnaes
parent 8013af2f1e
commit df5baf6031
73 changed files with 214 additions and 43 deletions

View File

@ -1,4 +1,4 @@
# Copyright (c) 2013-2018 Arm Limited. All rights reserved. # Copyright (c) 2013-2019 Arm Limited. All rights reserved.
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
@ -222,7 +222,7 @@ matrix:
# Check that example compiles without rtos # Check that example compiles without rtos
- sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' ${EVENTS}/README.md > main.cpp - sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' ${EVENTS}/README.md > main.cpp
- | - |
rm -r rtos usb features/cellular features/netsocket features/nanostack \ rm -r rtos drivers/source/usb features/cellular features/netsocket features/nanostack \
features/lwipstack features/frameworks/greentea-client \ features/lwipstack features/frameworks/greentea-client \
features/frameworks/utest features/frameworks/unity components BUILD features/frameworks/utest features/frameworks/unity components BUILD
- python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0 - python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, ARM Limited, All Rights Reserved * Copyright (c) 2018-2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may * Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, ARM Limited, All Rights Reserved * Copyright (c) 2018-2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may * Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@ -28,6 +28,15 @@
#include "ByteBuffer.h" #include "ByteBuffer.h"
#include "rtos/EventFlags.h" #include "rtos/EventFlags.h"
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_USBAudio USBAudio class
* @{
*/
/** /**
* USBAudio example * USBAudio example
* *
@ -373,4 +382,7 @@ private:
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -27,6 +27,14 @@
class AsyncOp; class AsyncOp;
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_USBCDC USBCDC class
* @{
*/
class USBCDC: public USBDevice { class USBCDC: public USBDevice {
public: public:
@ -224,4 +232,7 @@ protected:
uint32_t _rx_size; uint32_t _rx_size;
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, Arm Limited and affiliates. * Copyright (c) 2018-2019, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -38,6 +38,14 @@
#define PACKET_TYPE_BROADCAST (1<<3) #define PACKET_TYPE_BROADCAST (1<<3)
#define PACKET_TYPE_MULTICAST (1<<4) #define PACKET_TYPE_MULTICAST (1<<4)
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_USBCDC_ECM USBCDC_ECM class
* @{
*/
class USBCDC_ECM: public USBDevice { class USBCDC_ECM: public USBDevice {
public: public:
@ -267,4 +275,7 @@ private:
void _notify_connect(); void _notify_connect();
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -26,6 +26,13 @@
#include "OperationList.h" #include "OperationList.h"
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_USBHID USBHID class
* @{
*/
/** /**
* USBHID example * USBHID example
@ -268,4 +275,7 @@ private:
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -74,6 +74,14 @@ enum FUNCTION_KEY {
UP_ARROW, /* Up arrow */ UP_ARROW, /* Up arrow */
}; };
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_USBKeyboard USBKeyboard class
* @{
*/
/** /**
* USBKeyboard example * USBKeyboard example
* @code * @code
@ -181,7 +189,7 @@ public:
virtual void report_rx(); virtual void report_rx();
/** /**
* 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: * 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:
* - First bit: NUM_LOCK * - First bit: NUM_LOCK
* - Second bit: CAPS_LOCK * - Second bit: CAPS_LOCK
* - Third bit: SCROLL_LOCK * - Third bit: SCROLL_LOCK
@ -209,4 +217,7 @@ private:
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -30,6 +30,14 @@
#define DEFAULT_CONFIGURATION (1) #define DEFAULT_CONFIGURATION (1)
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_USBMIDI USBMIDI class
* @{
*/
/** /**
* USBMIDI example * USBMIDI example
* *
@ -182,4 +190,7 @@ private:
bool _next_message(); bool _next_message();
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -22,19 +22,27 @@
#include "USBDescriptor.h" #include "USBDescriptor.h"
#include "USBDevice_Types.h" #include "USBDevice_Types.h"
#include "platform/Callback.h" #include "platform/Callback.h"
#include "events/PolledQueue.h" #include "drivers/internal/PolledQueue.h"
#include "events/Task.h" #include "drivers/internal/Task.h"
#include "BlockDevice.h" #include "BlockDevice.h"
#include "Mutex.h" #include "Mutex.h"
#include "USBDevice.h" #include "USBDevice.h"
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_USBMSD USBMSD class
* @{
*/
/** /**
* USBMSD class: generic class in order to use all kinds of blocks storage chip * USBMSD class: generic class in order to use all kinds of blocks storage chip
* *
* Introduction * Introduction
* *
* USBMSD implements the MSD protocol. It permits to access a block device (flash, sdcard,...) * USBMSD implements the MSD protocol. It permits to access a block device (flash, SD Card,...)
* from a computer over USB. * from a computer over USB.
* *
* @code * @code
@ -304,4 +312,7 @@ private:
void fail(); void fail();
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -49,6 +49,14 @@ enum MOUSE_TYPE {
REL_MOUSE, REL_MOUSE,
}; };
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_USBMouse USBMouse class
* @{
*/
/** /**
* *
* USBMouse example * USBMouse example
@ -232,4 +240,7 @@ private:
bool mouse_send(int8_t x, int8_t y, uint8_t buttons, int8_t z); bool mouse_send(int8_t x, int8_t y, uint8_t buttons, int8_t z);
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -28,6 +28,14 @@
#include "USBHID.h" #include "USBHID.h"
#include "PlatformMutex.h" #include "PlatformMutex.h"
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_USBMouseKeyboard USBMouseKeyboard class
* @{
*/
/** /**
* USBMouseKeyboard example * USBMouseKeyboard example
* @code * @code
@ -207,7 +215,7 @@ public:
bool media_control(MEDIA_KEY key); bool media_control(MEDIA_KEY key);
/** /**
* 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: * 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:
* - First bit: NUM_LOCK * - First bit: NUM_LOCK
* - Second bit: CAPS_LOCK * - Second bit: CAPS_LOCK
* - Third bit: SCROLL_LOCK * - Third bit: SCROLL_LOCK
@ -243,4 +251,7 @@ private:
virtual int _getc(); virtual int _getc();
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -22,6 +22,14 @@
#include "Stream.h" #include "Stream.h"
#include "Callback.h" #include "Callback.h"
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_USBSerial USBSerial class
* @{
*/
/** /**
* USBSerial example * USBSerial example
* *
@ -216,4 +224,7 @@ private:
void (*_settings_changed_callback)(int baud, int bits, int parity, int stop); void (*_settings_changed_callback)(int baud, int bits, int parity, int stop);
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -25,6 +25,13 @@
#include "LinkEntry.h" #include "LinkEntry.h"
#include "OperationListBase.h" #include "OperationListBase.h"
/** \ingroup drivers */
/** \addtogroup drivers-internal-api */
/** @{*/
/**
* \defgroup drivers_AsyncOp AsyncOp class
* @{
*/
class AsyncOp: public LinkEntry { class AsyncOp: public LinkEntry {
public: public:
@ -109,4 +116,7 @@ private:
static void _host_unlock(rtos::Mutex *host_mutex); static void _host_unlock(rtos::Mutex *host_mutex);
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -20,6 +20,13 @@
#include <stdint.h> #include <stdint.h>
/** \ingroup drivers */
/** \addtogroup drivers-internal-api */
/** @{*/
/**
* \defgroup drivers_ByteBuffer ByteBuffer class
* @{
*/
class ByteBuffer { class ByteBuffer {
public: public:
@ -116,5 +123,7 @@ private:
uint8_t *_buf; uint8_t *_buf;
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -29,7 +29,14 @@
* to check if the device has enough resources for the * to check if the device has enough resources for the
* given configuration. * given configuration.
* *
* @ingroup usb_device_core */
/** \ingroup drivers */
/** \addtogroup drivers-internal-api */
/** @{*/
/**
* \defgroup drivers_EndpointResolver EndpointResolver class
* @{
*/ */
class EndpointResolver { class EndpointResolver {
public: public:
@ -89,5 +96,7 @@ private:
bool _valid; bool _valid;
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -20,6 +20,13 @@
#include <cstddef> #include <cstddef>
/** \ingroup drivers */
/** \addtogroup drivers-internal-api */
/** @{*/
/**
* \defgroup drivers_LinkEntry LinkEntry class
* @{
*/
class LinkEntry { class LinkEntry {
public: public:
LinkEntry(): _next(NULL) LinkEntry(): _next(NULL)
@ -32,5 +39,7 @@ private:
LinkEntry *_next; LinkEntry *_next;
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -21,6 +21,13 @@
#include "LinkEntry.h" #include "LinkEntry.h"
#include "LinkedListBase.h" #include "LinkedListBase.h"
/** \ingroup drivers */
/** \addtogroup drivers-internal-api */
/** @{*/
/**
* \defgroup drivers_LinkedList LinkedList class
* @{
*/
template<class T> template<class T>
class LinkedList: public LinkedListBase { class LinkedList: public LinkedListBase {
public: public:
@ -58,4 +65,7 @@ public:
} }
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -20,6 +20,13 @@
#include "LinkEntry.h" #include "LinkEntry.h"
/** \ingroup drivers */
/** \addtogroup drivers-internal-api */
/** @{*/
/**
* \defgroup drivers_LinkedListBase LinkedListBase class
* @{
*/
class LinkedListBase { class LinkedListBase {
public: public:
LinkedListBase(); LinkedListBase();
@ -58,4 +65,7 @@ private:
LinkEntry *_tail; LinkEntry *_tail;
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -40,6 +40,14 @@
#define CABLE_NUM (0<<4) #define CABLE_NUM (0<<4)
/** \ingroup drivers */
/** \addtogroup drivers-internal-api */
/** @{*/
/**
* \defgroup drivers_MIDIMessage MIDIMessage class
* @{
*/
/** A MIDI message container */ /** A MIDI message container */
class MIDIMessage { class MIDIMessage {
public: public:
@ -472,4 +480,7 @@ public:
uint16_t length; uint16_t length;
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -75,7 +75,7 @@ public:
* Additionally process() must be called on this object * Additionally process() must be called on this object
* if there are still elements in the list. * if there are still elements in the list.
* *
* @return The async op at the head of the list * @return The asynchronous op at the head of the list
*/ */
T *dequeue_raw() T *dequeue_raw()
{ {

View File

@ -18,8 +18,7 @@
#ifndef MBED_OPERATION_LIST_BASE_H #ifndef MBED_OPERATION_LIST_BASE_H
#define MBED_OPERATION_LIST_BASE_H #define MBED_OPERATION_LIST_BASE_H
#include "LinkedListBase.h" #include "drivers/internal/LinkedListBase.h"
#include "Mutex.h"
class AsyncOp; class AsyncOp;
@ -72,7 +71,7 @@ public:
* Additionally process() must be called on this object * Additionally process() must be called on this object
* if there are still elements in the list. * if there are still elements in the list.
* *
* @return The async op at the head of the list * @return The asynchronous op at the head of the list
*/ */
AsyncOp *dequeue_raw(); AsyncOp *dequeue_raw();

View File

@ -18,7 +18,7 @@
#ifndef POLLED_QUEUE_H #ifndef POLLED_QUEUE_H
#define POLLED_QUEUE_H #define POLLED_QUEUE_H
#include "events/TaskQueue.h" #include "drivers/internal/TaskQueue.h"
#include "platform/Callback.h" #include "platform/Callback.h"
#include "LinkedList.h" #include "LinkedList.h"
namespace events { namespace events {

View File

@ -19,7 +19,7 @@
#define MBED_TASK_H #define MBED_TASK_H
#include "events/EventQueue.h" #include "events/EventQueue.h"
#include "events/TaskBase.h" #include "drivers/internal/TaskBase.h"
#include "platform/mbed_assert.h" #include "platform/mbed_assert.h"
#include "platform/Callback.h" #include "platform/Callback.h"

View File

@ -18,7 +18,7 @@
#ifndef TASK_QUEUE_H #ifndef TASK_QUEUE_H
#define TASK_QUEUE_H #define TASK_QUEUE_H
#include "events/TaskBase.h" #include "drivers/internal/TaskBase.h"
#include "platform/Callback.h" #include "platform/Callback.h"
#include "mbed_critical.h" #include "mbed_critical.h"
@ -68,7 +68,7 @@ public:
* *
* Cancels the given event so the event's memory can be reused. * Cancels the given event so the event's memory can be reused.
* *
* The cancel function is irq safe. * The cancel function is IRQ safe.
* *
* If called while the event queue's dispatch loop is active, the cancel * If called while the event queue's dispatch loop is active, the cancel
* function does not guarantee that the event will not execute after it * function does not guarantee that the event will not execute after it

View File

@ -23,23 +23,18 @@
#include "USBPhy.h" #include "USBPhy.h"
#include "mbed_critical.h" #include "mbed_critical.h"
/** \ingroup drivers */
/** \addtogroup drivers-internal-api */
/** @{*/
/** /**
* \defgroup usb_device USB Device * \defgroup drivers_USBDevice USBDevice class
* * @{
*/
/**
* \defgroup usb_device_core Core
*
* @ingroup usb_device
*/ */
/** /**
* Core USB Device driver * Core USB Device driver
* *
* USB driver which wraps and provides synchronization for a USBPhy object. * USB driver which wraps and provides synchronization for a USBPhy object.
*
* @ingroup usb_device_core
*/ */
class USBDevice: public USBPhyEvents { class USBDevice: public USBPhyEvents {
public: public:
@ -189,13 +184,13 @@ public:
void endpoint_stall(usb_ep_t endpoint); void endpoint_stall(usb_ep_t endpoint);
/** /**
* Unstall an endpoint * Un-stall an endpoint
* *
* Unstalling an endpoint resets data toggle back to DATA0. * Un-stalling an endpoint resets data toggle back to DATA0.
* Additionally, if there is an ongoing transfer on this endpoint * Additionally, if there is an ongoing transfer on this endpoint
* it will be aborted. * it will be aborted.
* *
* @param endpoint Endpoint to unstall * @param endpoint Endpoint to un-stall
* @note This endpoint must already have been setup with endpoint_add * @note This endpoint must already have been setup with endpoint_add
*/ */
void endpoint_unstall(usb_ep_t endpoint); void endpoint_unstall(usb_ep_t endpoint);
@ -617,4 +612,7 @@ private:
uint32_t _locked; uint32_t _locked;
}; };
/** @}*/
/** @}*/
#endif #endif

View File

@ -998,4 +998,3 @@ void USBAudio::_send_isr()
_tx_done.call(Transfer); _tx_done.call(Transfer);
} }
} }

View File

@ -149,4 +149,3 @@ bool ByteBuffer::empty()
{ {
return _head == _tail; return _head == _tail;
} }

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include "events/PolledQueue.h" #include "drivers/internal/PolledQueue.h"
#include "events/mbed_events.h" #include "events/mbed_events.h"
#include "platform/Callback.h" #include "platform/Callback.h"

View File

@ -15,8 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include "events/TaskBase.h" #include "drivers/internal/TaskBase.h"
#include "events/TaskQueue.h" #include "drivers/internal/TaskQueue.h"
#include "events/mbed_events.h" #include "events/mbed_events.h"
#include "rtos/Semaphore.h" #include "rtos/Semaphore.h"
#include "platform/mbed_critical.h" #include "platform/mbed_critical.h"

View File

@ -259,7 +259,7 @@ public:
virtual void endpoint_stall(usb_ep_t endpoint) = 0; virtual void endpoint_stall(usb_ep_t endpoint) = 0;
/** /**
* Unstall the endpoint * Un-stall the endpoint
* *
* Clear the HALT feature on this endpoint so communication can * Clear the HALT feature on this endpoint so communication can
* resume. * resume.

View File

@ -99,4 +99,5 @@ TCPSocket
UDPSocket UDPSocket
Socket Socket
unregister unregister
deinit
_doxy_ _doxy_

View File

@ -1,3 +0,0 @@
{
"name": "usb"
}