diff --git a/.travis.yml b/.travis.yml index 19d3a75a4d4..23c3ab8c631 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 # @@ -222,14 +222,14 @@ matrix: # Check that example compiles without rtos - 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/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 # Run local equeue tests - - make -C ${EVENTS}/equeue test + - make -C ${EVENTS}/source test # Run profiling tests - - make -C ${EVENTS}/equeue prof | tee prof + - make -C ${EVENTS}/source prof | tee prof after_success: # Update status, comparing with master if possible. - | diff --git a/TESTS/mbed_hal/lp_ticker/main.cpp b/TESTS/mbed_hal/lp_ticker/main.cpp index 1d56bda276b..77fcd6644ab 100644 --- a/TESTS/mbed_hal/lp_ticker/main.cpp +++ b/TESTS/mbed_hal/lp_ticker/main.cpp @@ -21,6 +21,7 @@ #include "lp_ticker_api_tests.h" #include "hal/lp_ticker_api.h" #include "hal/mbed_lp_ticker_wrapper.h" +#include "hal/us_ticker_api.h" #if !DEVICE_LPTICKER #error [NOT_SUPPORTED] Low power timer not supported for this target diff --git a/TESTS/mbed_hal/qspi/main.cpp b/TESTS/mbed_hal/qspi/main.cpp index 0c772327f03..883cf48b46f 100644 --- a/TESTS/mbed_hal/qspi/main.cpp +++ b/TESTS/mbed_hal/qspi/main.cpp @@ -26,6 +26,7 @@ #include "mbed.h" #include "qspi_api.h" +#include "hal/us_ticker_api.h" #if !defined(QSPI_FLASH_CHIP_STRING) diff --git a/TESTS/mbed_hal/qspi/qspi_test_utils.cpp b/TESTS/mbed_hal/qspi/qspi_test_utils.cpp index 306123ad3be..7c423847249 100644 --- a/TESTS/mbed_hal/qspi/qspi_test_utils.cpp +++ b/TESTS/mbed_hal/qspi/qspi_test_utils.cpp @@ -17,6 +17,7 @@ #include "utest/utest.h" #include "hal/qspi_api.h" +#include "hal/us_ticker_api.h" #include "qspi_test_utils.h" #include "unity/unity.h" diff --git a/TESTS/mbed_hal/sleep/main.cpp b/TESTS/mbed_hal/sleep/main.cpp index c0730c5eb97..4767e594356 100644 --- a/TESTS/mbed_hal/sleep/main.cpp +++ b/TESTS/mbed_hal/sleep/main.cpp @@ -24,6 +24,7 @@ #include "unity/unity.h" #include "greentea-client/test_env.h" #include "mbed_lp_ticker_wrapper.h" +#include "hal/us_ticker_api.h" #include "sleep_test_utils.h" #include "sleep_api_tests.h" diff --git a/TESTS/mbed_hal/sleep_manager/main.cpp b/TESTS/mbed_hal/sleep_manager/main.cpp index 14a2e6e9007..97ecaff2909 100644 --- a/TESTS/mbed_hal/sleep_manager/main.cpp +++ b/TESTS/mbed_hal/sleep_manager/main.cpp @@ -19,6 +19,7 @@ #include #include "mbed.h" #include "mbed_lp_ticker_wrapper.h" +#include "hal/us_ticker_api.h" #include "../sleep/sleep_test_utils.h" #include "sleep_manager_api_tests.h" diff --git a/TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp b/TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp index c83ebb48d72..1ff3a37740f 100644 --- a/TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp +++ b/TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp @@ -27,6 +27,8 @@ #include "unity/unity.h" #include "greentea-client/test_env.h" +#include "platform/mbed_critical.h" + using namespace utest::v1; #include diff --git a/TESTS/usb_device/hid/main.cpp b/TESTS/usb_device/hid/main.cpp index e8816b99fa3..a9c5db76b73 100644 --- a/TESTS/usb_device/hid/main.cpp +++ b/TESTS/usb_device/hid/main.cpp @@ -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 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -27,6 +27,7 @@ #include "USBHID.h" #include "USBMouse.h" #include "USBKeyboard.h" +#include "hal/us_ticker_api.h" // Reuse the VID & PID from basic USB test. #define USB_HID_VID 0x0d28 diff --git a/TESTS/usb_device/serial/main.cpp b/TESTS/usb_device/serial/main.cpp index b84819bff97..11dc3acd8c8 100644 --- a/TESTS/usb_device/serial/main.cpp +++ b/TESTS/usb_device/serial/main.cpp @@ -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 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,6 +26,7 @@ #include "usb_phy_api.h" #include "USBCDC.h" #include "USBSerial.h" +#include "hal/us_ticker_api.h" #define USB_CDC_VID 0x1f00 #define USB_CDC_PID 0x2013 diff --git a/UNITTESTS/CMakeLists.txt b/UNITTESTS/CMakeLists.txt index 93970193f9f..7be660b00b5 100644 --- a/UNITTESTS/CMakeLists.txt +++ b/UNITTESTS/CMakeLists.txt @@ -105,7 +105,8 @@ set(unittest-includes-base "${PROJECT_SOURCE_DIR}/../drivers" "${PROJECT_SOURCE_DIR}/../hal" "${PROJECT_SOURCE_DIR}/../events" - "${PROJECT_SOURCE_DIR}/../events/equeue" + "${PROJECT_SOURCE_DIR}/../events/source" + "${PROJECT_SOURCE_DIR}/../events/internal" "${PROJECT_SOURCE_DIR}/../rtos" "${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX" "${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX/rtx5/Include" diff --git a/UNITTESTS/drivers/Watchdog/unittest.cmake b/UNITTESTS/drivers/Watchdog/unittest.cmake index d7bbfff54b1..1b907a9f54d 100644 --- a/UNITTESTS/drivers/Watchdog/unittest.cmake +++ b/UNITTESTS/drivers/Watchdog/unittest.cmake @@ -12,7 +12,7 @@ set(unittest-includes ${unittest-includes} # Source files set(unittest-sources - ../drivers/Watchdog.cpp + ../drivers/source/Watchdog.cpp ) # Test files diff --git a/UNITTESTS/stubs/SerialBase_stub.cpp b/UNITTESTS/stubs/SerialBase_stub.cpp index e156d8f4802..c0a19d3f54c 100644 --- a/UNITTESTS/stubs/SerialBase_stub.cpp +++ b/UNITTESTS/stubs/SerialBase_stub.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "SerialBase.h" +#include "drivers/SerialBase.h" namespace mbed { diff --git a/UNITTESTS/target_h/drivers/LowPowerTicker.h b/UNITTESTS/target_h/drivers/LowPowerTicker.h index 793ee0eab77..1d0bb6b5da2 100644 --- a/UNITTESTS/target_h/drivers/LowPowerTicker.h +++ b/UNITTESTS/target_h/drivers/LowPowerTicker.h @@ -21,7 +21,6 @@ #include "Callback.h" namespace mbed { -/** \addtogroup drivers */ /** mock Low Power Ticker * diff --git a/components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAtmel.cpp b/components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAtmel.cpp index 287d5023ded..abb2ee93e91 100644 --- a/components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAtmel.cpp +++ b/components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAtmel.cpp @@ -32,6 +32,7 @@ #include "SPI.h" #include "inttypes.h" #include "Timeout.h" +#include "platform/mbed_error.h" #define TRACE_GROUP "AtRF" diff --git a/components/802.15.4_RF/mcr20a-rf-driver/source/NanostackRfPhyMcr20a.cpp b/components/802.15.4_RF/mcr20a-rf-driver/source/NanostackRfPhyMcr20a.cpp index 18801a8ba25..2f70302ce70 100644 --- a/components/802.15.4_RF/mcr20a-rf-driver/source/NanostackRfPhyMcr20a.cpp +++ b/components/802.15.4_RF/mcr20a-rf-driver/source/NanostackRfPhyMcr20a.cpp @@ -23,6 +23,7 @@ #include #include "rtos.h" #include "mbed_interface.h" +#include "platform/mbed_error.h" using namespace mbed; using namespace rtos; diff --git a/components/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp b/components/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp index 435df3e4ae5..c979ae529ba 100644 --- a/components/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp +++ b/components/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp @@ -29,6 +29,7 @@ #include "Timeout.h" #include "Thread.h" #include "mbed_wait_api.h" +#include "platform/mbed_error.h" using namespace mbed; using namespace rtos; diff --git a/drivers/AnalogIn.h b/drivers/AnalogIn.h index 8f247e5975b..60637146a53 100644 --- a/drivers/AnalogIn.h +++ b/drivers/AnalogIn.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +26,21 @@ #include "platform/PlatformMutex.h" namespace mbed { -/** \addtogroup drivers */ +/** \defgroup mbed-os-public Public API */ + +/** \addtogroup drivers-public-api Drivers + * \ingroup mbed-os-public + */ + +/** \defgroup drivers-public-api-gpio GPIO + * \ingroup drivers-public-api + */ + +/** + * \defgroup drivers_AnalogIn AnalogIn class + * \ingroup drivers-public-api-gpio + * @{ + */ /** An analog input, used for reading the voltage on a pin * @@ -48,7 +62,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class AnalogIn { @@ -58,37 +71,20 @@ class AnalogIn { * * @param pin AnalogIn pin to connect to */ - AnalogIn(PinName pin) - { - lock(); - analogin_init(&_adc, pin); - unlock(); - } + AnalogIn(PinName pin); /** Read the input voltage, represented as a float in the range [0.0, 1.0] * * @returns A floating-point value representing the current input voltage, measured as a percentage */ - float read() - { - lock(); - float ret = analogin_read(&_adc); - unlock(); - return ret; - } + float read(); /** Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF] * * @returns * 16-bit unsigned short representing the current input voltage, normalized to a 16-bit value */ - unsigned short read_u16() - { - lock(); - unsigned short ret = analogin_read_u16(&_adc); - unlock(); - return ret; - } + unsigned short read_u16(); /** An operator shorthand for read() * @@ -129,8 +125,11 @@ class AnalogIn { analogin_t _adc; static SingletonPtr _mutex; #endif //!defined(DOXYGEN_ONLY) + }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/AnalogOut.h b/drivers/AnalogOut.h index d12cbafcc4d..fee78fd9401 100644 --- a/drivers/AnalogOut.h +++ b/drivers/AnalogOut.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +25,13 @@ #include "platform/PlatformMutex.h" namespace mbed { -/** \addtogroup drivers */ +/** \addtogroup drivers-public-api */ + +/** + * \defgroup drivers_AnalogOut AnalogOut class + * \ingroup drivers-public-api-gpio + * @{ + */ /** An analog output, used for setting the voltage on a pin * @@ -48,7 +54,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class AnalogOut { @@ -70,24 +75,14 @@ class AnalogOut { * 0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%). * Values outside this range will be saturated to 0.0f or 1.0f. */ - void write(float value) - { - lock(); - analogout_write(&_dac, value); - unlock(); - } + void write(float value); /** Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF] * * @param value 16-bit unsigned short representing the output voltage, * normalized to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v) */ - void write_u16(unsigned short value) - { - lock(); - analogout_write_u16(&_dac, value); - unlock(); - } + void write_u16(unsigned short value); /** Return the current output voltage setting, measured as a percentage (float) * @@ -99,13 +94,7 @@ class AnalogOut { * @note * This value may not match exactly the value set by a previous write(). */ - float read() - { - lock(); - float ret = analogout_read(&_dac); - unlock(); - return ret; - } + float read(); /** An operator shorthand for write() * \sa AnalogOut::write() @@ -158,6 +147,8 @@ class AnalogOut { #endif //!defined(DOXYGEN_ONLY) }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/BusIn.h b/drivers/BusIn.h index 61bf7b536e3..575203343c0 100644 --- a/drivers/BusIn.h +++ b/drivers/BusIn.h @@ -23,12 +23,15 @@ #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_BusIn BusIn class + * \ingroup drivers-public-api-gpio + * @{ + */ /** A digital input bus, used for reading the state of a collection of pins * * @note Synchronization level: Thread safe - * @ingroup drivers */ class BusIn : private NonCopyable { @@ -125,6 +128,8 @@ class BusIn : private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/BusInOut.h b/drivers/BusInOut.h index 618f9b8cf3b..59bcbce9dc9 100644 --- a/drivers/BusInOut.h +++ b/drivers/BusInOut.h @@ -22,7 +22,11 @@ #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_BusInOut BusInOut class + * \ingroup drivers-public-api-gpio + * @{ + */ /** A digital input output bus, used for setting the state of a collection of pins. * Implemented as an array of DigitalInOut pins, the bus can be constructed by any @@ -30,7 +34,6 @@ namespace mbed { * capabilities * * @note Synchronization level: Thread safe - * @ingroup drivers */ class BusInOut : private NonCopyable { @@ -147,6 +150,8 @@ class BusInOut : private NonCopyable { #endif //!defined(DOXYGEN_ONLY) }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/BusOut.h b/drivers/BusOut.h index ca83d00a17a..f9c2fdcee68 100644 --- a/drivers/BusOut.h +++ b/drivers/BusOut.h @@ -22,10 +22,13 @@ #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_BusOut BusOut class + * \ingroup drivers-public-api-gpio + * @{ + */ /** A digital output bus, used for setting the state of a collection of pins - * @ingroup drivers */ class BusOut : private NonCopyable { @@ -125,6 +128,8 @@ class BusOut : private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/CAN.h b/drivers/CAN.h index 665677efc0f..0485cf32a05 100644 --- a/drivers/CAN.h +++ b/drivers/CAN.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,12 +27,19 @@ #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup drivers */ +/** \defgroup drivers-public-api-can CAN + * \ingroup drivers-public-api + */ + +/** + * \defgroup drivers_CANMessage CANMessage class + * \ingroup drivers-public-api-can + * @{ + */ /** CANMessage class * * @note Synchronization level: Thread safe - * @ingroup drivers */ class CANMessage : public CAN_Message { @@ -98,8 +105,15 @@ class CANMessage : public CAN_Message { } }; +/** @}*/ + +/** + * \defgroup drivers_CAN CAN class + * \ingroup drivers-public-api-can + * @{ + */ + /** A can bus client, used for communicating with can devices - * @ingroup drivers */ class CAN : private NonCopyable { @@ -315,12 +329,15 @@ class CAN : private NonCopyable { protected: virtual void lock(); virtual void unlock(); + can_t _can; Callback _irq[IrqCnt]; PlatformMutex _mutex; #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/DigitalIn.h b/drivers/DigitalIn.h index 348a87bf33a..a6adf0bc9cf 100644 --- a/drivers/DigitalIn.h +++ b/drivers/DigitalIn.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,10 +20,13 @@ #include "platform/platform.h" #include "hal/gpio_api.h" -#include "platform/mbed_critical.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_DigitalIn DigitalIn class + * \ingroup drivers-public-api-gpio + * @{ + */ /** A digital input, used for reading the state of a pin * @@ -47,7 +50,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class DigitalIn { @@ -72,6 +74,7 @@ class DigitalIn { // No lock needed in the constructor gpio_init_in_ex(&gpio, pin, mode); } + /** Read the input, represented as 0 or 1 (int) * * @returns @@ -88,12 +91,7 @@ class DigitalIn { * * @param pull PullUp, PullDown, PullNone, OpenDrain */ - void mode(PinMode pull) - { - core_util_critical_section_enter(); - gpio_mode(&gpio, pull); - core_util_critical_section_exit(); - } + void mode(PinMode pull); /** Return the output setting, represented as 0 or 1 (int) * @@ -127,6 +125,8 @@ class DigitalIn { #endif //!defined(DOXYGEN_ONLY) }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/DigitalInOut.h b/drivers/DigitalInOut.h index 9ceb025aee8..26fafcac51c 100644 --- a/drivers/DigitalInOut.h +++ b/drivers/DigitalInOut.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,15 +20,17 @@ #include "platform/platform.h" #include "hal/gpio_api.h" -#include "platform/mbed_critical.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_DigitalInOut DigitalInOut class + * \ingroup drivers-public-api-gpio + * @{ + */ /** A digital input/output, used for setting or reading a bi-directional pin * * @note Synchronization level: Interrupt safe - * @ingroup drivers */ class DigitalInOut { @@ -81,32 +83,17 @@ class DigitalInOut { /** Set as an output */ - void output() - { - core_util_critical_section_enter(); - gpio_dir(&gpio, PIN_OUTPUT); - core_util_critical_section_exit(); - } + void output(); /** Set as an input */ - void input() - { - core_util_critical_section_enter(); - gpio_dir(&gpio, PIN_INPUT); - core_util_critical_section_exit(); - } + void input(); /** Set the input pin mode * * @param pull PullUp, PullDown, PullNone, OpenDrain */ - void mode(PinMode pull) - { - core_util_critical_section_enter(); - gpio_mode(&gpio, pull); - core_util_critical_section_exit(); - } + void mode(PinMode pull); /** Return the output setting, represented as 0 or 1 (int) * @@ -141,13 +128,7 @@ class DigitalInOut { * state from the DigitalInOut argument. * \sa DigitalInOut::write() */ - DigitalInOut &operator= (DigitalInOut &rhs) - { - core_util_critical_section_enter(); - write(rhs.read()); - core_util_critical_section_exit(); - return *this; - } + DigitalInOut &operator= (DigitalInOut &rhs); /** A shorthand for read() * \sa DigitalInOut::read() @@ -171,6 +152,8 @@ class DigitalInOut { #endif //!defined(DOXYGEN_ONLY) }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/DigitalOut.h b/drivers/DigitalOut.h index b9fe1f2d3ec..c7896ac4768 100644 --- a/drivers/DigitalOut.h +++ b/drivers/DigitalOut.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,10 +19,13 @@ #include "platform/platform.h" #include "hal/gpio_api.h" -#include "platform/mbed_critical.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_DigitalOut DigitalOut class + * \ingroup drivers-public-api-gpio + * @{ + */ /** A digital output, used for setting the state of a pin * @@ -42,7 +45,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class DigitalOut { @@ -122,13 +124,7 @@ class DigitalOut { * state from the DigitalOut argument. * \sa DigitalOut::write() */ - DigitalOut &operator= (DigitalOut &rhs) - { - core_util_critical_section_enter(); - write(rhs.read()); - core_util_critical_section_exit(); - return *this; - } + DigitalOut &operator= (DigitalOut &rhs); /** A shorthand for read() * \sa DigitalOut::read() @@ -150,6 +146,8 @@ class DigitalOut { #endif //!defined(DOXYGEN_ONLY) }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/Ethernet.h b/drivers/Ethernet.h index 30618806e52..e14be3a1790 100644 --- a/drivers/Ethernet.h +++ b/drivers/Ethernet.h @@ -23,9 +23,20 @@ #if DEVICE_ETHERNET || defined(DOXYGEN_ONLY) namespace mbed { -/** \addtogroup drivers */ +/** \ingroup mbed-os-public */ +/** \addtogroup drivers-public-api */ +/** @{*/ +/** + * \defgroup drivers_Ethernet Ethernet class + * @{ + */ /** An ethernet interface, to use with the ethernet pins. + * + * @deprecated + * EthInterface is now the preferred way to get an Ethernet object. + * Alternatively, use NetworkInterface to get an instance of an appropriate network + * interface (WiFi or Ethernet). * * @note Synchronization level: Not protected * @@ -54,18 +65,28 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ -class Ethernet : private NonCopyable { +class + MBED_DEPRECATED( + "EthInterface is now the preferred way to get an Ethernet object. " + "Alternatively, use NetworkInterface to get an instance of an appropriate network " + "interface (WiFi or Ethernet)." + ) Ethernet : private NonCopyable { public: - /** Initialize the ethernet interface. + /** + * @deprecated + * Initialize the ethernet interface. */ + MBED_DEPRECATED("The class has been deprecated and will be removed in the future.") Ethernet(); - /** Powers the hardware down. + /** + * @deprecated + * Powers the hardware down. */ + MBED_DEPRECATED("The class has been deprecated and will be removed in the future.") virtual ~Ethernet(); enum Mode { @@ -76,7 +97,9 @@ class Ethernet : private NonCopyable { FullDuplex100 }; - /** Writes into an outgoing ethernet packet. + /** + * @deprecated + * Writes into an outgoing ethernet packet. * * It will append size bytes of data to the previously written bytes. * @@ -86,9 +109,12 @@ class Ethernet : private NonCopyable { * @returns * The number of written bytes. */ + MBED_DEPRECATED("The class has been deprecated and will be removed in the future.") int write(const char *data, int size); - /** Send an outgoing ethernet packet. + /** + * @deprecated + * Send an outgoing ethernet packet. * * After filling in the data in an ethernet packet it must be send. * Send will provide a new packet to write to. @@ -97,9 +123,12 @@ class Ethernet : private NonCopyable { * 0 if the sending was failed, * or the size of the packet successfully sent. */ + MBED_DEPRECATED("The class has been deprecated and will be removed in the future.") int send(); - /** Receives an arrived ethernet packet. + /** + * @deprecated + * Receives an arrived ethernet packet. * * Receiving an ethernet packet will drop the last received ethernet packet * and make a new ethernet packet ready to read. @@ -109,9 +138,12 @@ class Ethernet : private NonCopyable { * 0 if no ethernet packet is arrived, * or the size of the arrived packet. */ + MBED_DEPRECATED("The class has been deprecated and will be removed in the future.") int receive(); - /** Read from an received ethernet packet. + /** + * @deprecated + * Read from an received ethernet packet. * * After receive returned a number bigger than 0 it is * possible to read bytes from this packet. @@ -124,15 +156,21 @@ class Ethernet : private NonCopyable { * Each time read will start reading after the last read byte before. * */ + MBED_DEPRECATED("The class has been deprecated and will be removed in the future.") int read(char *data, int size); - /** Gives the ethernet address of the mbed. + /** + * @deprecated + * Gives the ethernet address of the mbed. * * @param mac Must be a pointer to a 6 byte char array to copy the ethernet address in. */ + MBED_DEPRECATED("The class has been deprecated and will be removed in the future.") void address(char *mac); - /** Returns if an ethernet link is present or not. It takes a while after Ethernet initialization to show up. + /** + * @deprecated + * Returns if an ethernet link is present or not. It takes a while after Ethernet initialization to show up. * * @returns * 0 if no ethernet link is present, @@ -155,9 +193,12 @@ class Ethernet : private NonCopyable { * } * @endcode */ + MBED_DEPRECATED("The class has been deprecated and will be removed in the future.") int link(); - /** Sets the speed and duplex parameters of an ethernet link + /** + * @deprecated + * Sets the speed and duplex parameters of an ethernet link * * - AutoNegotiate Auto negotiate speed and duplex * - HalfDuplex10 10 Mbit, half duplex @@ -167,9 +208,13 @@ class Ethernet : private NonCopyable { * * @param mode the speed and duplex mode to set the link to: */ + MBED_DEPRECATED("The class has been deprecated and will be removed in the future.") void set_link(Mode mode); }; +/** @}*/ +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/FlashIAP.h b/drivers/FlashIAP.h index 0c3c8e10495..fdcda768f03 100644 --- a/drivers/FlashIAP.h +++ b/drivers/FlashIAP.h @@ -49,12 +49,17 @@ extern uint32_t Load$$LR$$LR_IROM1$$Limit[]; namespace mbed { -/** \addtogroup drivers */ +/** \ingroup mbed-os-public */ +/** \addtogroup drivers-public-api */ +/** @{*/ +/** + * \defgroup drivers_FlashIAP FlashIAP class + * @{ + */ /** Flash IAP driver. It invokes flash HAL functions. * * @note Synchronization level: Thread safe - * @ingroup drivers */ class FlashIAP : private NonCopyable { public: @@ -159,6 +164,9 @@ class FlashIAP : private NonCopyable { #endif }; +/** @}*/ +/** @}*/ + } /* namespace mbed */ #endif /* DEVICE_FLASH */ diff --git a/drivers/I2C.h b/drivers/I2C.h index 9a19bd12474..4fb06a3d267 100644 --- a/drivers/I2C.h +++ b/drivers/I2C.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2015 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,11 +30,19 @@ #if DEVICE_I2C_ASYNCH #include "platform/CThunk.h" #include "hal/dma_api.h" -#include "platform/FunctionPointer.h" +#include "platform/Callback.h" #endif namespace mbed { -/** \addtogroup drivers */ +/** \defgroup drivers-public-api-i2c I2C + * \ingroup drivers-public-api + */ + +/** + * \defgroup drivers_I2C I2C class + * \ingroup drivers-public-api-i2c + * @{ + */ /** An I2C Master, used for communicating with I2C slave devices * @@ -70,7 +78,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class I2C : private NonCopyable { @@ -242,6 +249,8 @@ class I2C : private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/I2CSlave.h b/drivers/I2CSlave.h index 78715ba9345..e2d123a9913 100644 --- a/drivers/I2CSlave.h +++ b/drivers/I2CSlave.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,11 @@ #include "hal/i2c_api.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \addtogroup drivers_I2CSlave I2CSlave class + * \ingroup drivers-public-api-i2c + * @{ + */ /** An I2C Slave, used for communicating with an I2C Master device. * @@ -64,7 +68,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class I2CSlave { @@ -160,6 +163,8 @@ class I2CSlave { #endif //!defined(DOXYGEN_ONLY) }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/InterruptIn.h b/drivers/InterruptIn.h index 32cc6619eec..cb1849a4202 100644 --- a/drivers/InterruptIn.h +++ b/drivers/InterruptIn.h @@ -29,7 +29,11 @@ #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_InterruptIn InterruptIn class + * \ingroup drivers-public-api-gpio + * @{ + */ /** A digital interrupt input, used to call a function on a rising or falling edge * @@ -57,7 +61,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class InterruptIn : private NonCopyable { @@ -175,6 +178,8 @@ class InterruptIn : private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/InterruptManager.h b/drivers/InterruptManager.h index 8b207f0c5ea..d6ff5c9dd70 100644 --- a/drivers/InterruptManager.h +++ b/drivers/InterruptManager.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,11 @@ #include namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_InterruptManager InterruptManager class + * \ingroup drivers-public-api-gpio + * @{ + */ /** Use this singleton if you need to chain interrupt handlers. * @deprecated Do not use this class. This class is not part of the public API of mbed-os and is being removed in the future. @@ -54,7 +58,6 @@ namespace mbed { * InterruptManager::get()->add_handler(handler, TIMER3_IRQn); * } * @endcode - * @ingroup drivers */ class InterruptManager : private NonCopyable { public: @@ -170,6 +173,7 @@ class InterruptManager : private NonCopyable { #if !defined(DOXYGEN_ONLY) private: InterruptManager(); + ~InterruptManager(); void lock(); @@ -203,6 +207,8 @@ class InterruptManager : private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/LowPowerTicker.h b/drivers/LowPowerTicker.h index a6f9fa94011..9a2a93cdf48 100644 --- a/drivers/LowPowerTicker.h +++ b/drivers/LowPowerTicker.h @@ -26,12 +26,19 @@ #include "hal/lp_ticker_api.h" namespace mbed { -/** \addtogroup drivers */ +/** \defgroup drivers-public-api-ticker Ticker + * \ingroup drivers-public-api + */ + +/** + * \defgroup drivers_LowPowerTicker LowPowerTicker class + * \ingroup drivers-public-api-ticker + * @{ + */ /** Low Power Ticker * * @note Synchronization level: Interrupt safe - * @ingroup drivers */ class LowPowerTicker : public Ticker, private NonCopyable { @@ -45,6 +52,8 @@ class LowPowerTicker : public Ticker, private NonCopyable { } }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/LowPowerTimeout.h b/drivers/LowPowerTimeout.h index 7198d7dc64c..08137329fae 100644 --- a/drivers/LowPowerTimeout.h +++ b/drivers/LowPowerTimeout.h @@ -26,12 +26,15 @@ #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \addtogroup drivers_LowPowerTimeout LowPowerTimeout class + * \ingroup drivers-public-api-ticker + * @{ + */ /** Low Power Timout * * @note Synchronization level: Interrupt safe - * @ingroup drivers */ class LowPowerTimeout : public LowPowerTicker, private NonCopyable { #if !defined(DOXYGEN_ONLY) @@ -43,7 +46,9 @@ class LowPowerTimeout : public LowPowerTicker, private NonCopyable { @@ -42,6 +45,8 @@ class LowPowerTimer : public Timer, private NonCopyable { }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/MbedCRC.h b/drivers/MbedCRC.h index c0726a92b9f..18ac97abc4e 100644 --- a/drivers/MbedCRC.h +++ b/drivers/MbedCRC.h @@ -17,7 +17,7 @@ #ifndef MBED_CRC_API_H #define MBED_CRC_API_H -#include "drivers/TableCRC.h" +#include "drivers/internal/TableCRC.h" #include "hal/crc_api.h" #include "platform/mbed_assert.h" #include "platform/SingletonPtr.h" @@ -40,8 +40,13 @@ but we check for ( width < 8) before performing shift, so it should not be an is #endif namespace mbed { -/** \addtogroup drivers */ +/** \ingroup mbed-os-public */ +/** \addtogroup drivers-public-api */ /** @{*/ +/** + * \defgroup drivers_MbedCRC MbedCRC class + * @{ + */ extern SingletonPtr mbed_crc_mutex; @@ -101,7 +106,6 @@ extern SingletonPtr mbed_crc_mutex; * return 0; * } * @endcode - * @ingroup drivers */ template class MbedCRC { @@ -565,6 +569,8 @@ class MbedCRC { #endif /** @}*/ +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/PortIn.h b/drivers/PortIn.h index f3ae250e98d..9525828287e 100644 --- a/drivers/PortIn.h +++ b/drivers/PortIn.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,10 +22,13 @@ #if DEVICE_PORTIN || defined(DOXYGEN_ONLY) #include "hal/port_api.h" -#include "platform/mbed_critical.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_PortIn PortIn class + * \ingroup drivers-public-api-gpio + * @{ + */ /** A multiple pin digital input * @@ -51,7 +54,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class PortIn { public: @@ -61,12 +63,7 @@ class PortIn { * @param port Port to connect to (as defined in target's PortNames.h) * @param mask Bitmask defines which port pins should be an input (0 - ignore, 1 - include) */ - PortIn(PortName port, int mask = 0xFFFFFFFF) - { - core_util_critical_section_enter(); - port_init(&_port, port, mask, PIN_INPUT); - core_util_critical_section_exit(); - } + PortIn(PortName port, int mask = 0xFFFFFFFF); /** Read the value input to the port * @@ -82,12 +79,7 @@ class PortIn { * * @param mode PullUp, PullDown, PullNone, OpenDrain */ - void mode(PinMode mode) - { - core_util_critical_section_enter(); - port_mode(&_port, mode); - core_util_critical_section_exit(); - } + void mode(PinMode mode); /** A shorthand for read() */ @@ -100,6 +92,8 @@ class PortIn { port_t _port; }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/PortInOut.h b/drivers/PortInOut.h index 2036eba2520..46a036b9404 100644 --- a/drivers/PortInOut.h +++ b/drivers/PortInOut.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,15 +22,17 @@ #if DEVICE_PORTINOUT || defined(DOXYGEN_ONLY) #include "hal/port_api.h" -#include "platform/mbed_critical.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_PortInOut PortInOut class + * \ingroup drivers-public-api-gpio + * @{ + */ /** A multiple pin digital in/out used to set/read multiple bi-directional pins * * @note Synchronization level: Interrupt safe - * @ingroup drivers */ class PortInOut { public: @@ -40,12 +42,7 @@ class PortInOut { * @param port Port to connect to (Port0-Port5) * @param mask A bitmask to identify which bits in the port should be included (0 - ignore) */ - PortInOut(PortName port, int mask = 0xFFFFFFFF) - { - core_util_critical_section_enter(); - port_init(&_port, port, mask, PIN_INPUT); - core_util_critical_section_exit(); - } + PortInOut(PortName port, int mask = 0xFFFFFFFF); /** Write the value to the output port * @@ -68,32 +65,17 @@ class PortInOut { /** Set as an output */ - void output() - { - core_util_critical_section_enter(); - port_dir(&_port, PIN_OUTPUT); - core_util_critical_section_exit(); - } + void output(); /** Set as an input */ - void input() - { - core_util_critical_section_enter(); - port_dir(&_port, PIN_INPUT); - core_util_critical_section_exit(); - } + void input(); /** Set the input pin mode * * @param mode PullUp, PullDown, PullNone, OpenDrain */ - void mode(PinMode mode) - { - core_util_critical_section_enter(); - port_mode(&_port, mode); - core_util_critical_section_exit(); - } + void mode(PinMode mode); /** A shorthand for write() * \sa PortInOut::write() @@ -125,6 +107,8 @@ class PortInOut { port_t _port; }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/PortOut.h b/drivers/PortOut.h index 18a0bcd3c5d..aa5b00722da 100644 --- a/drivers/PortOut.h +++ b/drivers/PortOut.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,10 +22,14 @@ #if DEVICE_PORTOUT || defined(DOXYGEN_ONLY) #include "hal/port_api.h" -#include "platform/mbed_critical.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_PortOut PortOut class + * \ingroup drivers-public-api-gpio + * @{ + */ + /** A multiple pin digital output * * @note Synchronization level: Interrupt safe @@ -50,7 +54,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class PortOut { public: @@ -60,12 +63,7 @@ class PortOut { * @param port Port to connect to (as defined in target's PortNames.h) * @param mask Bitmask defines which port pins are an output (0 - ignore, 1 - include) */ - PortOut(PortName port, int mask = 0xFFFFFFFF) - { - core_util_critical_section_enter(); - port_init(&_port, port, mask, PIN_OUTPUT); - core_util_critical_section_exit(); - } + PortOut(PortName port, int mask = 0xFFFFFFFF); /** Write the value to the output port * @@ -116,6 +114,8 @@ class PortOut { port_t _port; }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/PwmOut.h b/drivers/PwmOut.h index ed8765594a9..68102caaa57 100644 --- a/drivers/PwmOut.h +++ b/drivers/PwmOut.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,11 +21,13 @@ #if DEVICE_PWMOUT || defined(DOXYGEN_ONLY) #include "hal/pwmout_api.h" -#include "platform/mbed_critical.h" -#include "platform/mbed_power_mgmt.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_PwmOut PwmOut class + * \ingroup drivers-public-api-gpio + * @{ + */ /** A pulse-width modulation digital output * @@ -48,7 +50,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class PwmOut { @@ -58,20 +59,9 @@ class PwmOut { * * @param pin PwmOut pin to connect to */ - PwmOut(PinName pin) : _deep_sleep_locked(false) - { - core_util_critical_section_enter(); - pwmout_init(&_pwm, pin); - core_util_critical_section_exit(); - } + PwmOut(PinName pin); - ~PwmOut() - { - core_util_critical_section_enter(); - pwmout_free(&_pwm); - unlock_deep_sleep(); - core_util_critical_section_exit(); - } + ~PwmOut(); /** Set the output duty-cycle, specified as a percentage (float) * @@ -80,13 +70,7 @@ class PwmOut { * 0.0f (representing on 0%) and 1.0f (representing on 100%). * Values outside this range will be saturated to 0.0f or 1.0f. */ - void write(float value) - { - core_util_critical_section_enter(); - lock_deep_sleep(); - pwmout_write(&_pwm, value); - core_util_critical_section_exit(); - } + void write(float value); /** Return the current output duty-cycle setting, measured as a percentage (float) * @@ -98,13 +82,7 @@ class PwmOut { * @note * This value may not match exactly the value set by a previous write(). */ - float read() - { - core_util_critical_section_enter(); - float val = pwmout_read(&_pwm); - core_util_critical_section_exit(); - return val; - } + float read(); /** Set the PWM period, specified in seconds (float), keeping the duty cycle the same. * @@ -113,62 +91,32 @@ class PwmOut { * The resolution is currently in microseconds; periods smaller than this * will be set to zero. */ - void period(float seconds) - { - core_util_critical_section_enter(); - pwmout_period(&_pwm, seconds); - core_util_critical_section_exit(); - } + void period(float seconds); /** Set the PWM period, specified in milliseconds (int), keeping the duty cycle the same. * @param ms Change the period of a PWM signal in milliseconds without modifying the duty cycle */ - void period_ms(int ms) - { - core_util_critical_section_enter(); - pwmout_period_ms(&_pwm, ms); - core_util_critical_section_exit(); - } + void period_ms(int ms); /** Set the PWM period, specified in microseconds (int), keeping the duty cycle the same. * @param us Change the period of a PWM signal in microseconds without modifying the duty cycle */ - void period_us(int us) - { - core_util_critical_section_enter(); - pwmout_period_us(&_pwm, us); - core_util_critical_section_exit(); - } + void period_us(int us); /** Set the PWM pulsewidth, specified in seconds (float), keeping the period the same. * @param seconds Change the pulse width of a PWM signal specified in seconds (float) */ - void pulsewidth(float seconds) - { - core_util_critical_section_enter(); - pwmout_pulsewidth(&_pwm, seconds); - core_util_critical_section_exit(); - } + void pulsewidth(float seconds); /** Set the PWM pulsewidth, specified in milliseconds (int), keeping the period the same. * @param ms Change the pulse width of a PWM signal specified in milliseconds */ - void pulsewidth_ms(int ms) - { - core_util_critical_section_enter(); - pwmout_pulsewidth_ms(&_pwm, ms); - core_util_critical_section_exit(); - } + void pulsewidth_ms(int ms); /** Set the PWM pulsewidth, specified in microseconds (int), keeping the period the same. * @param us Change the pulse width of a PWM signal specified in microseconds */ - void pulsewidth_us(int us) - { - core_util_critical_section_enter(); - pwmout_pulsewidth_us(&_pwm, us); - core_util_critical_section_exit(); - } + void pulsewidth_us(int us); /** A operator shorthand for write() * \sa PwmOut::write() @@ -202,28 +150,18 @@ class PwmOut { #if !(DOXYGEN_ONLY) protected: /** Lock deep sleep only if it is not yet locked */ - void lock_deep_sleep() - { - if (_deep_sleep_locked == false) { - sleep_manager_lock_deep_sleep(); - _deep_sleep_locked = true; - } - } + void lock_deep_sleep(); /** Unlock deep sleep in case it is locked */ - void unlock_deep_sleep() - { - if (_deep_sleep_locked == true) { - sleep_manager_unlock_deep_sleep(); - _deep_sleep_locked = false; - } - } + void unlock_deep_sleep(); pwmout_t _pwm; bool _deep_sleep_locked; #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/QSPI.h b/drivers/QSPI.h index e247e8f6515..4ab356a0091 100644 --- a/drivers/QSPI.h +++ b/drivers/QSPI.h @@ -29,8 +29,15 @@ #define ONE_MHZ 1000000 namespace mbed { +/** \defgroup drivers-public-api-spi SPI + * \ingroup drivers-public-api + */ -/** \addtogroup drivers */ +/** + * \defgroup drivers_QSPI QSPI class + * \ingroup drivers-public-api-spi + * @{ + */ /** A QSPI Driver, used for communicating with QSPI slave devices * @@ -69,7 +76,6 @@ namespace mbed { * * } * @endcode - * @ingroup drivers */ class QSPI : private NonCopyable { @@ -225,6 +231,8 @@ class QSPI : private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/RawSerial.h b/drivers/RawSerial.h index 0e6c9c7c8ff..41b0522b277 100644 --- a/drivers/RawSerial.h +++ b/drivers/RawSerial.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,14 +21,21 @@ #if DEVICE_SERIAL || defined(DOXYGEN_ONLY) -#include "mbed_toolchain.h" +#include "platform/mbed_toolchain.h" #include "drivers/SerialBase.h" -#include "hal/serial_api.h" #include "platform/NonCopyable.h" #include namespace mbed { -/** \addtogroup drivers */ +/** \defgroup drivers-public-api-uart UART + * \ingroup drivers-public-api + */ + +/** + * \defgroup drivers_RawSerial RawSerial class + * \ingroup drivers-public-api-uart + * @{ + */ /** A serial port (UART) for communication with other serial devices * This is a variation of the Serial class that doesn't use streams, @@ -51,7 +58,6 @@ namespace mbed { * pc.putc('A'); * } * @endcode - * @ingroup drivers */ class RawSerial: public SerialBase, private NonCopyable { @@ -105,6 +111,8 @@ class RawSerial: public SerialBase, private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/ResetReason.h b/drivers/ResetReason.h index 8500abd49a8..289b4b9808e 100644 --- a/drivers/ResetReason.h +++ b/drivers/ResetReason.h @@ -22,14 +22,19 @@ #include "reset_reason_api.h" namespace mbed { -/** \addtogroup drivers */ +/** \ingroup mbed-os-public */ +/** \addtogroup drivers-public-api */ +/** @{*/ +/** + * \defgroup drivers_ResetReason ResetReason class + * @{ + */ /** A platform-independent method of checking the cause of the last system reset. * * When the system restarts, the reason for the restart is contained in * the system registers at boot time in a platform specific manner. * This API provides a generic method of fetching the reason for the restart. * - * @ingroup drivers */ class ResetReason { public: @@ -71,6 +76,9 @@ class ResetReason { static uint32_t get_raw(); }; +/** @}*/ +/** @}*/ + } // namespace mbed #endif // DEVICE_RESET_REASON diff --git a/drivers/SPI.h b/drivers/SPI.h index 48ba6946955..eaaabceeef0 100644 --- a/drivers/SPI.h +++ b/drivers/SPI.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2015 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,12 +40,16 @@ #include "platform/CThunk.h" #include "hal/dma_api.h" #include "platform/CircularBuffer.h" -#include "platform/FunctionPointer.h" +#include "platform/Callback.h" #include "platform/Transaction.h" #endif namespace mbed { -/** \addtogroup drivers */ +/** + * \addtogroup drivers_SPI SPI class + * \ingroup drivers-public-api-spi + * @{ + */ struct use_gpio_ssel_t { }; const use_gpio_ssel_t use_gpio_ssel; @@ -90,7 +94,6 @@ const use_gpio_ssel_t use_gpio_ssel; * device.unlock(); * } * @endcode - * @ingroup drivers */ class SPI : private NonCopyable { @@ -425,6 +428,8 @@ class SPI : private NonCopyable { #endif //!defined(DOXYGEN_ONLY) }; +/** @}*/ + } // namespace mbed #endif // DEVICE_SPI || DOXYGEN_ONLY diff --git a/drivers/SPISlave.h b/drivers/SPISlave.h index 878bc8d6721..5b9ae585577 100644 --- a/drivers/SPISlave.h +++ b/drivers/SPISlave.h @@ -25,7 +25,11 @@ #include "hal/spi_api.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_SPISlave SPISlave class + * \ingroup drivers-public-api-spi + * @{ + */ /** A SPI slave, used for communicating with a SPI master device. * @@ -51,7 +55,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class SPISlave : private NonCopyable { @@ -127,6 +130,8 @@ class SPISlave : private NonCopyable { #endif //!defined(DOXYGEN_ONLY) }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/Serial.h b/drivers/Serial.h index d19010808d5..d167e695805 100644 --- a/drivers/Serial.h +++ b/drivers/Serial.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,13 +22,16 @@ #if DEVICE_SERIAL || defined(DOXYGEN_ONLY) #include "platform/Stream.h" -#include "SerialBase.h" +#include "drivers/SerialBase.h" #include "platform/PlatformMutex.h" -#include "hal/serial_api.h" #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_Serial Serial class + * \ingroup drivers-public-api-uart + * @{ + */ /** A serial port (UART) for communication with other serial devices * @@ -49,7 +52,6 @@ namespace mbed { * pc.printf("Hello World\n"); * } * @endcode - * @ingroup drivers */ class Serial : public SerialBase, public Stream, private NonCopyable { @@ -111,6 +113,8 @@ class Serial : public SerialBase, public Stream, private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/SerialBase.h b/drivers/SerialBase.h index 99da7a9b45d..5213f325fd6 100644 --- a/drivers/SerialBase.h +++ b/drivers/SerialBase.h @@ -32,13 +32,16 @@ #endif namespace mbed { -/** \addtogroup drivers */ +/** + * \defgroup drivers_SerialBase SerialBase class + * \ingroup drivers-public-api-uart + * @{ + */ /** A base class for serial port implementations * Can't be instantiated directly (use Serial or RawSerial) * * @note Synchronization level: Set by subclass - * @ingroup drivers */ class SerialBase : private NonCopyable { @@ -289,6 +292,7 @@ class SerialBase : private NonCopyable { virtual ~SerialBase(); int _base_getc(); + int _base_putc(int c); #if DEVICE_SERIAL_ASYNCH @@ -307,6 +311,8 @@ class SerialBase : private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/SerialWireOutput.h b/drivers/SerialWireOutput.h index 0379687c9ba..6b43094daa4 100644 --- a/drivers/SerialWireOutput.h +++ b/drivers/SerialWireOutput.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2017 ARM Limited + * Copyright (c) 2017-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,29 +18,26 @@ #ifndef MBED_SERIALWIREOUTPUT_H #define MBED_SERIALWIREOUTPUT_H +#include "platform/platform.h" + #if defined(DEVICE_ITM) -#include "hal/itm_api.h" #include "platform/FileHandle.h" namespace mbed { +/** + * \defgroup drivers_SerialWireOutput SerialWireOutput class + * \ingroup drivers-public-api + * @{ + */ class SerialWireOutput : public FileHandle { public: - SerialWireOutput(void) - { - /* Initialize ITM using internal init function. */ - mbed_itm_init(); - } - - virtual ssize_t write(const void *buffer, size_t size) - { - mbed_itm_send_block(ITM_PORT_SWO, buffer, size); + SerialWireOutput(void); - return size; - } + virtual ssize_t write(const void *buffer, size_t size); virtual ssize_t read(void *buffer, size_t size) { @@ -72,6 +69,8 @@ class SerialWireOutput : public FileHandle { } }; +/** @}*/ + } // namespace mbed #endif // DEVICE_ITM diff --git a/drivers/Ticker.h b/drivers/Ticker.h index 8a68b4a00f6..ae7da0cca99 100644 --- a/drivers/Ticker.h +++ b/drivers/Ticker.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,12 +21,14 @@ #include "platform/Callback.h" #include "platform/mbed_toolchain.h" #include "platform/NonCopyable.h" -#include "platform/mbed_power_mgmt.h" #include "hal/lp_ticker_api.h" -#include "platform/mbed_critical.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \addtogroup drivers_Ticker Ticker class + * \ingroup drivers-public-api-ticker + * @{ + */ /** A Ticker is used to call a function at a recurring interval * @@ -62,19 +64,14 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class Ticker : public TimerEvent, private NonCopyable { public: - Ticker() : TimerEvent(), _function(0), _lock_deepsleep(true) - { - } + Ticker(); // When low power ticker is in use, then do not disable deep sleep. - Ticker(const ticker_data_t *data) : TimerEvent(data), _function(0), _lock_deepsleep(!data->interface->runs_in_deep_sleep) - { - } + Ticker(const ticker_data_t *data); /** Attach a function to be called by the Ticker, specifying the interval in seconds * @@ -155,6 +152,8 @@ class Ticker : public TimerEvent, private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/Timeout.h b/drivers/Timeout.h index c155c9bcecf..d4b63b37e40 100644 --- a/drivers/Timeout.h +++ b/drivers/Timeout.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,10 +19,13 @@ #include "drivers/Ticker.h" #include "platform/NonCopyable.h" -#include "platform/mbed_power_mgmt.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \addtogroup drivers_Timeout Timeout class + * \ingroup drivers-public-api-ticker + * @{ + */ /** A Timeout is used to call a function at a point in the future * @@ -53,7 +56,6 @@ namespace mbed { * } * } * @endcode - * @ingroup drivers */ class Timeout : public Ticker, private NonCopyable { @@ -63,6 +65,8 @@ class Timeout : public Ticker, private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/Timer.h b/drivers/Timer.h index 010f6019b5f..8ba20d6e47e 100644 --- a/drivers/Timer.h +++ b/drivers/Timer.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,10 +20,13 @@ #include "platform/platform.h" #include "hal/ticker_api.h" #include "platform/NonCopyable.h" -#include "platform/mbed_power_mgmt.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \addtogroup drivers_Timer Timer class + * \ingroup drivers-public-api-ticker + * @{ + */ /** A general purpose timer * @@ -47,7 +50,6 @@ namespace mbed { * printf("Toggle the led takes %d us", end - begin); * } * @endcode - * @ingroup drivers */ class Timer : private NonCopyable { @@ -108,6 +110,8 @@ class Timer : private NonCopyable { }; #endif +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/TimerEvent.h b/drivers/TimerEvent.h index 88f4c3b750d..1c47df0cca4 100644 --- a/drivers/TimerEvent.h +++ b/drivers/TimerEvent.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,16 +18,18 @@ #define MBED_TIMEREVENT_H #include "hal/ticker_api.h" -#include "hal/us_ticker_api.h" #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup drivers */ +/** + * \addtogroup drivers_TimerEvent TimerEvent class + * \ingroup drivers-public-api-ticker + * @{ + */ /** Base abstraction for timer interrupts * * @note Synchronization level: Interrupt safe - * @ingroup drivers */ class TimerEvent : private NonCopyable { public: @@ -82,6 +84,8 @@ class TimerEvent : private NonCopyable { #endif }; +/** @}*/ + } // namespace mbed #endif diff --git a/drivers/UARTSerial.h b/drivers/UARTSerial.h index 5f6d6faee60..e23a4a65b03 100644 --- a/drivers/UARTSerial.h +++ b/drivers/UARTSerial.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2017 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,10 +23,9 @@ #if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY) #include "platform/FileHandle.h" -#include "SerialBase.h" -#include "InterruptIn.h" +#include "drivers/SerialBase.h" +#include "drivers/InterruptIn.h" #include "platform/PlatformMutex.h" -#include "hal/serial_api.h" #include "platform/CircularBuffer.h" #include "platform/NonCopyable.h" @@ -39,12 +38,14 @@ #endif namespace mbed { - -/** \addtogroup drivers */ +/** + * \defgroup drivers_UARTSerial UARTSerial class + * \ingroup drivers-public-api-uart + * @{ + */ /** Class providing buffered UART communication functionality using separate circular buffer for send and receive channels * - * @ingroup drivers */ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable { @@ -312,6 +313,9 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable namespace mbed { +/** + * \defgroup drivers_Watchdog Watchdog class + * \ingroup drivers-public-api + * @{ + */ -/** \addtogroup drivers */ /** A hardware watchdog timer that resets the system in the case of system * failures or malfunctions. If you fail to refresh the Watchdog timer periodically, * it resets the system after a set period of time. @@ -56,7 +60,6 @@ namespace mbed { * @endcode * * @note Synchronization level: Interrupt safe - * @ingroup drivers */ class Watchdog : private NonCopyable { public: @@ -149,6 +152,8 @@ class Watchdog : private NonCopyable { bool _running; }; +/** @}*/ + } // namespace mbed #endif // DEVICE_WATCHDOG diff --git a/usb/device/utilities/AsyncOp.h b/drivers/internal/AsyncOp.h similarity index 89% rename from usb/device/utilities/AsyncOp.h rename to drivers/internal/AsyncOp.h index 625d6eddf13..9e858a102cf 100644 --- a/usb/device/utilities/AsyncOp.h +++ b/drivers/internal/AsyncOp.h @@ -25,6 +25,21 @@ #include "LinkEntry.h" #include "OperationListBase.h" +/** \defgroup mbed-os-internal Internal API */ + +/** \addtogroup drivers-internal-api Drivers + * \ingroup mbed-os-internal + */ + +/** \defgroup drivers-internal-api-usb USB + * \ingroup drivers-internal-api + */ + +/** + * \defgroup drivers_AsyncOp AsyncOp class + * \ingroup drivers-internal-api-usb + * @{ + */ class AsyncOp: public LinkEntry { public: @@ -109,4 +124,6 @@ class AsyncOp: public LinkEntry { static void _host_unlock(rtos::Mutex *host_mutex); }; +/** @}*/ + #endif diff --git a/usb/device/utilities/ByteBuffer.h b/drivers/internal/ByteBuffer.h similarity index 96% rename from usb/device/utilities/ByteBuffer.h rename to drivers/internal/ByteBuffer.h index 93514508708..45f2cb19b71 100644 --- a/usb/device/utilities/ByteBuffer.h +++ b/drivers/internal/ByteBuffer.h @@ -20,6 +20,11 @@ #include +/** + * \defgroup drivers_ByteBuffer ByteBuffer class + * \ingroup drivers-internal-api-usb + * @{ + */ class ByteBuffer { public: @@ -116,5 +121,6 @@ class ByteBuffer { uint8_t *_buf; }; +/** @}*/ #endif diff --git a/usb/device/USBDevice/EndpointResolver.h b/drivers/internal/EndpointResolver.h similarity index 95% rename from usb/device/USBDevice/EndpointResolver.h rename to drivers/internal/EndpointResolver.h index 53e241f020a..7ea13f4287c 100644 --- a/usb/device/USBDevice/EndpointResolver.h +++ b/drivers/internal/EndpointResolver.h @@ -20,6 +20,12 @@ #include "USBPhy.h" +/** + * \defgroup drivers_EndpointResolver EndpointResolver class + * \ingroup drivers-internal-api-usb + * @{ + */ + /** * Utility class for resolving endpoints * @@ -29,7 +35,6 @@ * to check if the device has enough resources for the * given configuration. * - * @ingroup usb_device_core */ class EndpointResolver { public: @@ -89,5 +94,6 @@ class EndpointResolver { bool _valid; }; +/** @}*/ #endif diff --git a/usb/device/utilities/LinkEntry.h b/drivers/internal/LinkEntry.h similarity index 89% rename from usb/device/utilities/LinkEntry.h rename to drivers/internal/LinkEntry.h index dadf07ddb67..f3fc9475716 100644 --- a/usb/device/utilities/LinkEntry.h +++ b/drivers/internal/LinkEntry.h @@ -20,6 +20,11 @@ #include +/** + * \defgroup drivers_LinkEntry LinkEntry class + * \ingroup drivers-internal-api-usb + * @{ + */ class LinkEntry { public: LinkEntry(): _next(NULL) @@ -32,5 +37,6 @@ class LinkEntry { LinkEntry *_next; }; +/** @}*/ #endif diff --git a/usb/device/utilities/LinkedList.h b/drivers/internal/LinkedList.h similarity index 93% rename from usb/device/utilities/LinkedList.h rename to drivers/internal/LinkedList.h index 03e7cff592f..23478619100 100644 --- a/usb/device/utilities/LinkedList.h +++ b/drivers/internal/LinkedList.h @@ -21,6 +21,11 @@ #include "LinkEntry.h" #include "LinkedListBase.h" +/** + * \defgroup drivers_LinkedList LinkedList class + * \ingroup drivers-internal-api-usb + * @{ + */ template class LinkedList: public LinkedListBase { public: @@ -58,4 +63,6 @@ class LinkedList: public LinkedListBase { } }; +/** @}*/ + #endif diff --git a/usb/device/utilities/LinkedListBase.h b/drivers/internal/LinkedListBase.h similarity index 92% rename from usb/device/utilities/LinkedListBase.h rename to drivers/internal/LinkedListBase.h index 63dab981c91..27d86103d98 100644 --- a/usb/device/utilities/LinkedListBase.h +++ b/drivers/internal/LinkedListBase.h @@ -20,6 +20,11 @@ #include "LinkEntry.h" +/** + * \defgroup drivers_LinkedListBase LinkedListBase class + * \ingroup drivers-internal-api-usb + * @{ + */ class LinkedListBase { public: LinkedListBase(); @@ -58,4 +63,6 @@ class LinkedListBase { LinkEntry *_tail; }; +/** @}*/ + #endif diff --git a/usb/device/USBMIDI/MIDIMessage.h b/drivers/internal/MIDIMessage.h similarity index 99% rename from usb/device/USBMIDI/MIDIMessage.h rename to drivers/internal/MIDIMessage.h index 74e8d25bd63..14b08a1e2b5 100644 --- a/usb/device/USBMIDI/MIDIMessage.h +++ b/drivers/internal/MIDIMessage.h @@ -40,6 +40,13 @@ #define CABLE_NUM (0<<4) + +/** + * \defgroup drivers_MIDIMessage MIDIMessage class + * \ingroup drivers-internal-usb + * @{ + */ + /** A MIDI message container */ class MIDIMessage { public: @@ -472,4 +479,6 @@ class MIDIMessage { uint16_t length; }; +/** @}*/ + #endif diff --git a/usb/device/utilities/OperationList.h b/drivers/internal/OperationList.h similarity index 92% rename from usb/device/utilities/OperationList.h rename to drivers/internal/OperationList.h index 9f82c6b2ee7..9f5e7563cba 100644 --- a/usb/device/utilities/OperationList.h +++ b/drivers/internal/OperationList.h @@ -21,6 +21,11 @@ #include "OperationListBase.h" #include "AsyncOp.h" +/** + * \defgroup drivers_OperationList OperationList class + * \ingroup drivers-internal-api-usb + * @{ + */ template class OperationList: public OperationListBase { public: @@ -75,7 +80,7 @@ class OperationList: public OperationListBase { * Additionally process() must be called on this object * 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() { @@ -84,4 +89,6 @@ class OperationList: public OperationListBase { }; +/** @}*/ + #endif diff --git a/usb/device/utilities/OperationListBase.h b/drivers/internal/OperationListBase.h similarity index 90% rename from usb/device/utilities/OperationListBase.h rename to drivers/internal/OperationListBase.h index 8c7bd6897cd..e964cc961e9 100644 --- a/usb/device/utilities/OperationListBase.h +++ b/drivers/internal/OperationListBase.h @@ -18,11 +18,15 @@ #ifndef MBED_OPERATION_LIST_BASE_H #define MBED_OPERATION_LIST_BASE_H -#include "LinkedListBase.h" -#include "Mutex.h" +#include "drivers/internal/LinkedListBase.h" class AsyncOp; +/** + * \defgroup drivers_OperationListBase OperationListBase class + * \ingroup drivers-internal-api-usb + * @{ + */ class OperationListBase { public: @@ -72,7 +76,7 @@ class OperationListBase { * Additionally process() must be called on this object * 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(); @@ -94,4 +98,6 @@ class OperationListBase { LinkedListBase _list; }; +/** @}*/ + #endif diff --git a/usb/device/utilities/events/PolledQueue.h b/drivers/internal/PolledQueue.h similarity index 91% rename from usb/device/utilities/events/PolledQueue.h rename to drivers/internal/PolledQueue.h index 61492b727d7..d8964218b03 100644 --- a/usb/device/utilities/events/PolledQueue.h +++ b/drivers/internal/PolledQueue.h @@ -18,18 +18,20 @@ #ifndef POLLED_QUEUE_H #define POLLED_QUEUE_H -#include "events/TaskQueue.h" +#include "drivers/internal/TaskQueue.h" #include "platform/Callback.h" #include "LinkedList.h" namespace events { -/** \addtogroup events */ - +/** + * \defgroup drivers_PolledQueue PolledQueue class + * \ingroup drivers-internal-api-usb + * @{ + */ /** PolledQueue * * This class is an implementation of TaskQueue which is * processed synchronously by calls to dispatch. - * @ingroup events */ class PolledQueue: public TaskQueue { public: @@ -67,6 +69,7 @@ class PolledQueue: public TaskQueue { }; +/** @}*/ + } #endif - diff --git a/drivers/TableCRC.h b/drivers/internal/TableCRC.h similarity index 94% rename from drivers/TableCRC.h rename to drivers/internal/TableCRC.h index 1ab5bf83656..4960bb478fe 100644 --- a/drivers/TableCRC.h +++ b/drivers/internal/TableCRC.h @@ -21,8 +21,10 @@ #include namespace mbed { -/** \addtogroup drivers */ -/** @{*/ +/** \addtogroup drivers-internal-api + * \ingroup mbed-os-internal + * @{ + */ #define MBED_CRC_TABLE_SIZE 256 #define MBED_OPTIMIZED_CRC_TABLE_SIZE 16 @@ -35,6 +37,7 @@ extern const uint32_t Table_CRC_32bit_ANSI[MBED_CRC_TABLE_SIZE]; extern const uint32_t Table_CRC_32bit_Rev_ANSI[MBED_OPTIMIZED_CRC_TABLE_SIZE]; /** @}*/ + } // namespace mbed #endif diff --git a/usb/device/utilities/events/Task.h b/drivers/internal/Task.h similarity index 99% rename from usb/device/utilities/events/Task.h rename to drivers/internal/Task.h index 966db971527..be2c932563c 100644 --- a/usb/device/utilities/events/Task.h +++ b/drivers/internal/Task.h @@ -19,12 +19,14 @@ #define MBED_TASK_H #include "events/EventQueue.h" -#include "events/TaskBase.h" +#include "drivers/internal/TaskBase.h" #include "platform/mbed_assert.h" #include "platform/Callback.h" namespace events { -/** \addtogroup events */ +/** \addtogroup drivers-internal-api-usb + * @{ + */ template @@ -583,7 +585,6 @@ class Task: public TaskBase { /** Task * * Representation of a postable task - * @ingroup events */ template class Task: public TaskBase { @@ -647,8 +648,8 @@ class Task: public TaskBase { All _args; }; -} - /** @}*/ +} + #endif diff --git a/usb/device/utilities/events/TaskBase.h b/drivers/internal/TaskBase.h similarity index 97% rename from usb/device/utilities/events/TaskBase.h rename to drivers/internal/TaskBase.h index b88e4d43366..e8a38b4adf7 100644 --- a/usb/device/utilities/events/TaskBase.h +++ b/drivers/internal/TaskBase.h @@ -27,15 +27,18 @@ class Semaphore; } namespace events { -/** \addtogroup events */ - class TaskQueue; +/** + * \defgroup drivers_TaskBase TaskBase class + * \ingroup drivers-internal-api-usb + * @{ + */ + /** TaskBase * * Representation of a caller allocated task - * @ingroup events */ class TaskBase : public LinkEntry { public: @@ -158,8 +161,8 @@ class TaskBase : public LinkEntry { void _wake_check(); }; +/** @}*/ + } #endif - -/** @}*/ diff --git a/usb/device/utilities/events/TaskQueue.h b/drivers/internal/TaskQueue.h similarity index 94% rename from usb/device/utilities/events/TaskQueue.h rename to drivers/internal/TaskQueue.h index 5623fd65e0f..530a9204406 100644 --- a/usb/device/utilities/events/TaskQueue.h +++ b/drivers/internal/TaskQueue.h @@ -18,21 +18,23 @@ #ifndef TASK_QUEUE_H #define TASK_QUEUE_H -#include "events/TaskBase.h" +#include "drivers/internal/TaskBase.h" #include "platform/Callback.h" #include "mbed_critical.h" #define MBED_MAX_TASK_SIZE 32 namespace events { -/** \addtogroup events */ - +/** + * \defgroup drivers_TaskQueue TaskQueue class + * \ingroup drivers-internal-api-usb + * @{ + */ /** TaskQueue * * Flexible task queue for dispatching tasks - * @ingroup events */ class TaskQueue { public: @@ -67,7 +69,7 @@ class TaskQueue { * * 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 * function does not guarantee that the event will not execute after it @@ -134,6 +136,7 @@ class TaskQueue { } }; +/** @}*/ + } #endif - diff --git a/usb/device/USBAudio/USBAudio_Types.h b/drivers/internal/USBAudio_Types.h similarity index 100% rename from usb/device/USBAudio/USBAudio_Types.h rename to drivers/internal/USBAudio_Types.h diff --git a/usb/device/USBDevice/USBDescriptor.h b/drivers/internal/USBDescriptor.h similarity index 100% rename from usb/device/USBDevice/USBDescriptor.h rename to drivers/internal/USBDescriptor.h diff --git a/usb/device/USBDevice/USBDevice.h b/drivers/internal/USBDevice.h similarity index 98% rename from usb/device/USBDevice/USBDevice.h rename to drivers/internal/USBDevice.h index 01e25141411..91a603e6617 100644 --- a/usb/device/USBDevice/USBDevice.h +++ b/drivers/internal/USBDevice.h @@ -24,22 +24,15 @@ #include "mbed_critical.h" /** - * \defgroup usb_device USB Device - * - */ - -/** - * \defgroup usb_device_core Core - * - * @ingroup usb_device + * \defgroup drivers_USBDevice USBDevice class + * \ingroup drivers-internal-api-usb + * @{ */ /** * Core USB Device driver * * USB driver which wraps and provides synchronization for a USBPhy object. - * - * @ingroup usb_device_core */ class USBDevice: public USBPhyEvents { public: @@ -189,13 +182,13 @@ class USBDevice: public USBPhyEvents { 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 * 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 */ void endpoint_unstall(usb_ep_t endpoint); @@ -617,4 +610,6 @@ class USBDevice: public USBPhyEvents { uint32_t _locked; }; +/** @}*/ + #endif diff --git a/usb/device/USBDevice/USBDevice_Types.h b/drivers/internal/USBDevice_Types.h similarity index 100% rename from usb/device/USBDevice/USBDevice_Types.h rename to drivers/internal/USBDevice_Types.h diff --git a/usb/device/USBHID/USBHID_Types.h b/drivers/internal/USBHID_Types.h similarity index 100% rename from usb/device/USBHID/USBHID_Types.h rename to drivers/internal/USBHID_Types.h diff --git a/drivers/source/AnalogIn.cpp b/drivers/source/AnalogIn.cpp new file mode 100644 index 00000000000..97b1b8e1386 --- /dev/null +++ b/drivers/source/AnalogIn.cpp @@ -0,0 +1,51 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "drivers/AnalogIn.h" + +#if DEVICE_ANALOGIN + +namespace mbed { + +SingletonPtr AnalogIn::_mutex; + +AnalogIn::AnalogIn(PinName pin) +{ + lock(); + analogin_init(&_adc, pin); + unlock(); +} + +float AnalogIn::read() +{ + lock(); + float ret = analogin_read(&_adc); + unlock(); + return ret; +} + +unsigned short AnalogIn::read_u16() +{ + lock(); + unsigned short ret = analogin_read_u16(&_adc); + unlock(); + return ret; +} + +} // namespace mbed + +#endif diff --git a/drivers/source/AnalogOut.cpp b/drivers/source/AnalogOut.cpp new file mode 100644 index 00000000000..aaba38088e4 --- /dev/null +++ b/drivers/source/AnalogOut.cpp @@ -0,0 +1,48 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "drivers/AnalogOut.h" + +#if DEVICE_ANALOGOUT + +namespace mbed { + +void AnalogOut::write(float value) +{ + lock(); + analogout_write(&_dac, value); + unlock(); +} + +void AnalogOut::write_u16(unsigned short value) +{ + lock(); + analogout_write_u16(&_dac, value); + unlock(); +} + +float AnalogOut::read() +{ + lock(); + float ret = analogout_read(&_dac); + unlock(); + return ret; +} + +} // namespace mbed + +#endif // DEVICE_ANALOGOUT diff --git a/drivers/BusIn.cpp b/drivers/source/BusIn.cpp similarity index 100% rename from drivers/BusIn.cpp rename to drivers/source/BusIn.cpp diff --git a/drivers/BusInOut.cpp b/drivers/source/BusInOut.cpp similarity index 100% rename from drivers/BusInOut.cpp rename to drivers/source/BusInOut.cpp diff --git a/drivers/BusOut.cpp b/drivers/source/BusOut.cpp similarity index 100% rename from drivers/BusOut.cpp rename to drivers/source/BusOut.cpp diff --git a/drivers/CAN.cpp b/drivers/source/CAN.cpp similarity index 98% rename from drivers/CAN.cpp rename to drivers/source/CAN.cpp index a3699e3919d..19e5f94b639 100644 --- a/drivers/CAN.cpp +++ b/drivers/source/CAN.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/drivers/AnalogIn.cpp b/drivers/source/DigitalIn.cpp similarity index 70% rename from drivers/AnalogIn.cpp rename to drivers/source/DigitalIn.cpp index dd9d22f306f..064503eee49 100644 --- a/drivers/AnalogIn.cpp +++ b/drivers/source/DigitalIn.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,14 +15,17 @@ * limitations under the License. */ -#include "drivers/AnalogIn.h" +#include "drivers/DigitalIn.h" -#if DEVICE_ANALOGIN +#include "platform/mbed_critical.h" namespace mbed { -SingletonPtr AnalogIn::_mutex; +void DigitalIn::mode(PinMode pull) +{ + core_util_critical_section_enter(); + gpio_mode(&gpio, pull); + core_util_critical_section_exit(); +} -}; - -#endif +} // namespace mbed diff --git a/drivers/source/DigitalInOut.cpp b/drivers/source/DigitalInOut.cpp new file mode 100644 index 00000000000..418491e1650 --- /dev/null +++ b/drivers/source/DigitalInOut.cpp @@ -0,0 +1,53 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "drivers/DigitalInOut.h" + +#include "platform/mbed_critical.h" + +namespace mbed { + +void DigitalInOut::output() +{ + core_util_critical_section_enter(); + gpio_dir(&gpio, PIN_OUTPUT); + core_util_critical_section_exit(); +} + +void DigitalInOut::input() +{ + core_util_critical_section_enter(); + gpio_dir(&gpio, PIN_INPUT); + core_util_critical_section_exit(); +} + +void DigitalInOut::mode(PinMode pull) +{ + core_util_critical_section_enter(); + gpio_mode(&gpio, pull); + core_util_critical_section_exit(); +} + +DigitalInOut &DigitalInOut::operator= (DigitalInOut &rhs) +{ + core_util_critical_section_enter(); + write(rhs.read()); + core_util_critical_section_exit(); + return *this; +} + +} // namespace mbed diff --git a/drivers/source/DigitalOut.cpp b/drivers/source/DigitalOut.cpp new file mode 100644 index 00000000000..1d1855a9efc --- /dev/null +++ b/drivers/source/DigitalOut.cpp @@ -0,0 +1,32 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "drivers/DigitalOut.h" + +#include "platform/mbed_critical.h" + +namespace mbed { + +DigitalOut &DigitalOut::operator= (DigitalOut &rhs) +{ + core_util_critical_section_enter(); + write(rhs.read()); + core_util_critical_section_exit(); + return *this; +} + +} // namespace mbed diff --git a/drivers/Ethernet.cpp b/drivers/source/Ethernet.cpp similarity index 100% rename from drivers/Ethernet.cpp rename to drivers/source/Ethernet.cpp diff --git a/drivers/FlashIAP.cpp b/drivers/source/FlashIAP.cpp similarity index 99% rename from drivers/FlashIAP.cpp rename to drivers/source/FlashIAP.cpp index ff015092593..71565b80b0f 100644 --- a/drivers/FlashIAP.cpp +++ b/drivers/source/FlashIAP.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2017 ARM Limited + * Copyright (c) 2017-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/drivers/I2C.cpp b/drivers/source/I2C.cpp similarity index 99% rename from drivers/I2C.cpp rename to drivers/source/I2C.cpp index 3e06825c17d..7857d22c6d3 100644 --- a/drivers/I2C.cpp +++ b/drivers/source/I2C.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2015 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/drivers/I2CSlave.cpp b/drivers/source/I2CSlave.cpp similarity index 97% rename from drivers/I2CSlave.cpp rename to drivers/source/I2CSlave.cpp index f0697460be6..489926c1463 100644 --- a/drivers/I2CSlave.cpp +++ b/drivers/source/I2CSlave.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/drivers/InterruptIn.cpp b/drivers/source/InterruptIn.cpp similarity index 100% rename from drivers/InterruptIn.cpp rename to drivers/source/InterruptIn.cpp diff --git a/drivers/InterruptManager.cpp b/drivers/source/InterruptManager.cpp similarity index 100% rename from drivers/InterruptManager.cpp rename to drivers/source/InterruptManager.cpp diff --git a/drivers/MbedCRC.cpp b/drivers/source/MbedCRC.cpp similarity index 96% rename from drivers/MbedCRC.cpp rename to drivers/source/MbedCRC.cpp index 6353e052c3f..b6bfda976e2 100644 --- a/drivers/MbedCRC.cpp +++ b/drivers/source/MbedCRC.cpp @@ -16,12 +16,9 @@ */ #include -#include "drivers/TableCRC.h" #include "drivers/MbedCRC.h" namespace mbed { -/** \addtogroup drivers */ -/** @{*/ SingletonPtr mbed_crc_mutex; @@ -75,6 +72,4 @@ MbedCRC::MbedCRC(): mbed_crc_ctor(); } -/** @}*/ } // namespace mbed - diff --git a/drivers/source/PortIn.cpp b/drivers/source/PortIn.cpp new file mode 100644 index 00000000000..fc8577b8486 --- /dev/null +++ b/drivers/source/PortIn.cpp @@ -0,0 +1,43 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "drivers/PortIn.h" + + +#if DEVICE_PORTIN + +#include "platform/mbed_critical.h" + +namespace mbed { + +PortIn::PortIn(PortName port, int mask) +{ + core_util_critical_section_enter(); + port_init(&_port, port, mask, PIN_INPUT); + core_util_critical_section_exit(); +} + +void PortIn::mode(PinMode mode) +{ + core_util_critical_section_enter(); + port_mode(&_port, mode); + core_util_critical_section_exit(); +} + +} // namespace mbed + +#endif // #if DEVICE_PORTIN diff --git a/drivers/source/PortInOut.cpp b/drivers/source/PortInOut.cpp new file mode 100644 index 00000000000..bb496720317 --- /dev/null +++ b/drivers/source/PortInOut.cpp @@ -0,0 +1,57 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "drivers/PortInOut.h" + + +#if DEVICE_PORTINOUT + +#include "platform/mbed_critical.h" + +namespace mbed { + +PortInOut::PortInOut(PortName port, int mask) +{ + core_util_critical_section_enter(); + port_init(&_port, port, mask, PIN_INPUT); + core_util_critical_section_exit(); +} + +void PortInOut::output() +{ + core_util_critical_section_enter(); + port_dir(&_port, PIN_OUTPUT); + core_util_critical_section_exit(); +} + +void PortInOut::input() +{ + core_util_critical_section_enter(); + port_dir(&_port, PIN_INPUT); + core_util_critical_section_exit(); +} + +void PortInOut::mode(PinMode mode) +{ + core_util_critical_section_enter(); + port_mode(&_port, mode); + core_util_critical_section_exit(); +} + +} // namespace mbed + +#endif // #if DEVICE_PORTINOUT diff --git a/drivers/source/PortOut.cpp b/drivers/source/PortOut.cpp new file mode 100644 index 00000000000..12a23d00ecc --- /dev/null +++ b/drivers/source/PortOut.cpp @@ -0,0 +1,36 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "drivers/PortOut.h" + + +#if DEVICE_PORTOUT + +#include "platform/mbed_critical.h" + +namespace mbed { + +PortOut::PortOut(PortName port, int mask) +{ + core_util_critical_section_enter(); + port_init(&_port, port, mask, PIN_OUTPUT); + core_util_critical_section_exit(); +} + +} // namespace mbed + +#endif // #if DEVICE_PORTOUT diff --git a/drivers/source/PwmOut.cpp b/drivers/source/PwmOut.cpp new file mode 100644 index 00000000000..67e5f36b341 --- /dev/null +++ b/drivers/source/PwmOut.cpp @@ -0,0 +1,119 @@ +/* mbed Microcontroller Library + * Copyright (c) 2006-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "drivers/PwmOut.h" + + +#if DEVICE_PWMOUT + +#include "platform/mbed_critical.h" +#include "platform/mbed_power_mgmt.h" + +namespace mbed { + +PwmOut::PwmOut(PinName pin) : _deep_sleep_locked(false) +{ + core_util_critical_section_enter(); + pwmout_init(&_pwm, pin); + core_util_critical_section_exit(); +} + +PwmOut::~PwmOut() +{ + core_util_critical_section_enter(); + pwmout_free(&_pwm); + unlock_deep_sleep(); + core_util_critical_section_exit(); +} + +void PwmOut::write(float value) +{ + core_util_critical_section_enter(); + lock_deep_sleep(); + pwmout_write(&_pwm, value); + core_util_critical_section_exit(); +} + +float PwmOut::read() +{ + core_util_critical_section_enter(); + float val = pwmout_read(&_pwm); + core_util_critical_section_exit(); + return val; +} + +void PwmOut::period(float seconds) +{ + core_util_critical_section_enter(); + pwmout_period(&_pwm, seconds); + core_util_critical_section_exit(); +} + +void PwmOut::period_ms(int ms) +{ + core_util_critical_section_enter(); + pwmout_period_ms(&_pwm, ms); + core_util_critical_section_exit(); +} + +void PwmOut::period_us(int us) +{ + core_util_critical_section_enter(); + pwmout_period_us(&_pwm, us); + core_util_critical_section_exit(); +} + +void PwmOut::pulsewidth(float seconds) +{ + core_util_critical_section_enter(); + pwmout_pulsewidth(&_pwm, seconds); + core_util_critical_section_exit(); +} + +void PwmOut::pulsewidth_ms(int ms) +{ + core_util_critical_section_enter(); + pwmout_pulsewidth_ms(&_pwm, ms); + core_util_critical_section_exit(); +} + +void PwmOut::pulsewidth_us(int us) +{ + core_util_critical_section_enter(); + pwmout_pulsewidth_us(&_pwm, us); + core_util_critical_section_exit(); +} + +void PwmOut::lock_deep_sleep() +{ + if (_deep_sleep_locked == false) { + sleep_manager_lock_deep_sleep(); + _deep_sleep_locked = true; + } +} + +void PwmOut::unlock_deep_sleep() +{ + if (_deep_sleep_locked == true) { + sleep_manager_unlock_deep_sleep(); + _deep_sleep_locked = false; + } +} + +} // namespace mbed + +#endif // #if DEVICE_PWMOUT diff --git a/drivers/QSPI.cpp b/drivers/source/QSPI.cpp similarity index 100% rename from drivers/QSPI.cpp rename to drivers/source/QSPI.cpp diff --git a/drivers/RawSerial.cpp b/drivers/source/RawSerial.cpp similarity index 96% rename from drivers/RawSerial.cpp rename to drivers/source/RawSerial.cpp index 1424c6c9afb..8fab077f9a7 100644 --- a/drivers/RawSerial.cpp +++ b/drivers/source/RawSerial.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,9 +15,7 @@ * limitations under the License. */ #include "drivers/RawSerial.h" -#include "platform/mbed_wait_api.h" #include -#include #if DEVICE_SERIAL diff --git a/drivers/ResetReason.cpp b/drivers/source/ResetReason.cpp similarity index 100% rename from drivers/ResetReason.cpp rename to drivers/source/ResetReason.cpp diff --git a/drivers/SPI.cpp b/drivers/source/SPI.cpp similarity index 99% rename from drivers/SPI.cpp rename to drivers/source/SPI.cpp index ffe696bd6db..61d337dbf07 100644 --- a/drivers/SPI.cpp +++ b/drivers/source/SPI.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -243,7 +243,6 @@ void SPI::abort_transfer() #endif } - void SPI::clear_transfer_buffer() { #if TRANSACTION_QUEUE_SIZE_SPI diff --git a/drivers/SPISlave.cpp b/drivers/source/SPISlave.cpp similarity index 100% rename from drivers/SPISlave.cpp rename to drivers/source/SPISlave.cpp diff --git a/drivers/Serial.cpp b/drivers/source/Serial.cpp similarity index 94% rename from drivers/Serial.cpp rename to drivers/source/Serial.cpp index d0f87263b67..03ee49697ad 100644 --- a/drivers/Serial.cpp +++ b/drivers/source/Serial.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,7 +15,6 @@ * limitations under the License. */ #include "drivers/Serial.h" -#include "platform/mbed_wait_api.h" #if DEVICE_SERIAL diff --git a/drivers/SerialBase.cpp b/drivers/source/SerialBase.cpp similarity index 100% rename from drivers/SerialBase.cpp rename to drivers/source/SerialBase.cpp diff --git a/drivers/source/SerialWireOutput.cpp b/drivers/source/SerialWireOutput.cpp new file mode 100644 index 00000000000..92d6bd3c016 --- /dev/null +++ b/drivers/source/SerialWireOutput.cpp @@ -0,0 +1,41 @@ +/* mbed Microcontroller Library + * Copyright (c) 2017-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "drivers/SerialWireOutput.h" + +#if defined(DEVICE_ITM) + +#include "hal/itm_api.h" + +namespace mbed { + +SerialWireOutput::SerialWireOutput(void) +{ + /* Initialize ITM using internal init function. */ + mbed_itm_init(); +} + +ssize_t SerialWireOutput::write(const void *buffer, size_t size) +{ + mbed_itm_send_block(ITM_PORT_SWO, buffer, size); + + return size; +} + +} // namespace mbed + +#endif // DEVICE_ITM diff --git a/drivers/TableCRC.cpp b/drivers/source/TableCRC.cpp similarity index 99% rename from drivers/TableCRC.cpp rename to drivers/source/TableCRC.cpp index b0d316e4719..6cea67d94a3 100644 --- a/drivers/TableCRC.cpp +++ b/drivers/source/TableCRC.cpp @@ -16,11 +16,9 @@ */ #include -#include "drivers/TableCRC.h" +#include "drivers/internal/TableCRC.h" namespace mbed { -/** \addtogroup drivers */ -/** @{*/ extern const uint8_t Table_CRC_7Bit_SD[MBED_CRC_TABLE_SIZE] = { 0x0, 0x12, 0x24, 0x36, 0x48, 0x5a, 0x6c, 0x7e, 0x90, 0x82, 0xb4, 0xa6, 0xd8, 0xca, 0xfc, 0xee, @@ -151,6 +149,4 @@ extern const uint32_t Table_CRC_32bit_Rev_ANSI[MBED_OPTIMIZED_CRC_TABLE_SIZE] = 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c }; - -/** @}*/ } // namespace mbed diff --git a/drivers/Ticker.cpp b/drivers/source/Ticker.cpp similarity index 83% rename from drivers/Ticker.cpp rename to drivers/source/Ticker.cpp index b9540ec0fdd..fada56cf646 100644 --- a/drivers/Ticker.cpp +++ b/drivers/source/Ticker.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,9 +20,19 @@ #include "platform/FunctionPointer.h" #include "hal/ticker_api.h" #include "platform/mbed_critical.h" +#include "platform/mbed_power_mgmt.h" namespace mbed { +Ticker::Ticker() : TimerEvent(), _function(0), _lock_deepsleep(true) +{ +} + +// When low power ticker is in use, then do not disable deep sleep. +Ticker::Ticker(const ticker_data_t *data) : TimerEvent(data), _function(0), _lock_deepsleep(!data->interface->runs_in_deep_sleep) +{ +} + void Ticker::detach() { core_util_critical_section_enter(); diff --git a/drivers/Timeout.cpp b/drivers/source/Timeout.cpp similarity index 100% rename from drivers/Timeout.cpp rename to drivers/source/Timeout.cpp diff --git a/drivers/Timer.cpp b/drivers/source/Timer.cpp similarity index 97% rename from drivers/Timer.cpp rename to drivers/source/Timer.cpp index 072581087ae..d4f2276a416 100644 --- a/drivers/Timer.cpp +++ b/drivers/source/Timer.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,6 +18,7 @@ #include "hal/ticker_api.h" #include "hal/us_ticker_api.h" #include "platform/mbed_critical.h" +#include "platform/mbed_power_mgmt.h" namespace mbed { diff --git a/drivers/TimerEvent.cpp b/drivers/source/TimerEvent.cpp similarity index 95% rename from drivers/TimerEvent.cpp rename to drivers/source/TimerEvent.cpp index 9c77eb86f58..be3037e62f2 100644 --- a/drivers/TimerEvent.cpp +++ b/drivers/source/TimerEvent.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +17,6 @@ #include "drivers/TimerEvent.h" #include -#include "hal/ticker_api.h" #include "hal/us_ticker_api.h" namespace mbed { diff --git a/drivers/UARTSerial.cpp b/drivers/source/UARTSerial.cpp similarity index 99% rename from drivers/UARTSerial.cpp rename to drivers/source/UARTSerial.cpp index 37e992c7ffd..0475bf820ed 100644 --- a/drivers/UARTSerial.cpp +++ b/drivers/source/UARTSerial.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2017 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/drivers/Watchdog.cpp b/drivers/source/Watchdog.cpp similarity index 100% rename from drivers/Watchdog.cpp rename to drivers/source/Watchdog.cpp diff --git a/usb/device/utilities/AsyncOp.cpp b/drivers/source/usb/AsyncOp.cpp similarity index 100% rename from usb/device/utilities/AsyncOp.cpp rename to drivers/source/usb/AsyncOp.cpp diff --git a/usb/device/utilities/ByteBuffer.cpp b/drivers/source/usb/ByteBuffer.cpp similarity index 99% rename from usb/device/utilities/ByteBuffer.cpp rename to drivers/source/usb/ByteBuffer.cpp index cfe59260f17..87ee3dbd3b5 100644 --- a/usb/device/utilities/ByteBuffer.cpp +++ b/drivers/source/usb/ByteBuffer.cpp @@ -149,4 +149,3 @@ bool ByteBuffer::empty() { return _head == _tail; } - diff --git a/usb/device/USBDevice/EndpointResolver.cpp b/drivers/source/usb/EndpointResolver.cpp similarity index 100% rename from usb/device/USBDevice/EndpointResolver.cpp rename to drivers/source/usb/EndpointResolver.cpp diff --git a/usb/device/utilities/LinkedListBase.cpp b/drivers/source/usb/LinkedListBase.cpp similarity index 100% rename from usb/device/utilities/LinkedListBase.cpp rename to drivers/source/usb/LinkedListBase.cpp diff --git a/usb/device/utilities/OperationListBase.cpp b/drivers/source/usb/OperationListBase.cpp similarity index 100% rename from usb/device/utilities/OperationListBase.cpp rename to drivers/source/usb/OperationListBase.cpp diff --git a/usb/device/utilities/events/PolledQueue.cpp b/drivers/source/usb/PolledQueue.cpp similarity index 98% rename from usb/device/utilities/events/PolledQueue.cpp rename to drivers/source/usb/PolledQueue.cpp index ec79cfb4f1b..0f6e5e7f247 100644 --- a/usb/device/utilities/events/PolledQueue.cpp +++ b/drivers/source/usb/PolledQueue.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "events/PolledQueue.h" +#include "drivers/internal/PolledQueue.h" #include "events/mbed_events.h" #include "platform/Callback.h" diff --git a/usb/device/utilities/events/TaskBase.cpp b/drivers/source/usb/TaskBase.cpp similarity index 97% rename from usb/device/utilities/events/TaskBase.cpp rename to drivers/source/usb/TaskBase.cpp index ab52c2c69cc..feabb7af455 100644 --- a/usb/device/utilities/events/TaskBase.cpp +++ b/drivers/source/usb/TaskBase.cpp @@ -15,8 +15,8 @@ * limitations under the License. */ -#include "events/TaskBase.h" -#include "events/TaskQueue.h" +#include "drivers/internal/TaskBase.h" +#include "drivers/internal/TaskQueue.h" #include "events/mbed_events.h" #include "rtos/Semaphore.h" #include "platform/mbed_critical.h" diff --git a/usb/device/USBAudio/USBAudio.cpp b/drivers/source/usb/USBAudio.cpp similarity index 99% rename from usb/device/USBAudio/USBAudio.cpp rename to drivers/source/usb/USBAudio.cpp index a72c3a4071e..8409d840313 100644 --- a/usb/device/USBAudio/USBAudio.cpp +++ b/drivers/source/usb/USBAudio.cpp @@ -998,4 +998,3 @@ void USBAudio::_send_isr() _tx_done.call(Transfer); } } - diff --git a/usb/device/USBSerial/USBCDC.cpp b/drivers/source/usb/USBCDC.cpp similarity index 100% rename from usb/device/USBSerial/USBCDC.cpp rename to drivers/source/usb/USBCDC.cpp diff --git a/usb/device/USBCDC_ECM/USBCDC_ECM.cpp b/drivers/source/usb/USBCDC_ECM.cpp similarity index 100% rename from usb/device/USBCDC_ECM/USBCDC_ECM.cpp rename to drivers/source/usb/USBCDC_ECM.cpp diff --git a/usb/device/USBDevice/USBDevice.cpp b/drivers/source/usb/USBDevice.cpp similarity index 100% rename from usb/device/USBDevice/USBDevice.cpp rename to drivers/source/usb/USBDevice.cpp diff --git a/usb/device/USBHID/USBHID.cpp b/drivers/source/usb/USBHID.cpp similarity index 100% rename from usb/device/USBHID/USBHID.cpp rename to drivers/source/usb/USBHID.cpp diff --git a/usb/device/USBHID/USBKeyboard.cpp b/drivers/source/usb/USBKeyboard.cpp similarity index 100% rename from usb/device/USBHID/USBKeyboard.cpp rename to drivers/source/usb/USBKeyboard.cpp diff --git a/usb/device/USBMIDI/USBMIDI.cpp b/drivers/source/usb/USBMIDI.cpp similarity index 100% rename from usb/device/USBMIDI/USBMIDI.cpp rename to drivers/source/usb/USBMIDI.cpp diff --git a/usb/device/USBMSD/USBMSD.cpp b/drivers/source/usb/USBMSD.cpp similarity index 100% rename from usb/device/USBMSD/USBMSD.cpp rename to drivers/source/usb/USBMSD.cpp diff --git a/usb/device/USBHID/USBMouse.cpp b/drivers/source/usb/USBMouse.cpp similarity index 100% rename from usb/device/USBHID/USBMouse.cpp rename to drivers/source/usb/USBMouse.cpp diff --git a/usb/device/USBHID/USBMouseKeyboard.cpp b/drivers/source/usb/USBMouseKeyboard.cpp similarity index 100% rename from usb/device/USBHID/USBMouseKeyboard.cpp rename to drivers/source/usb/USBMouseKeyboard.cpp diff --git a/usb/device/USBSerial/USBSerial.cpp b/drivers/source/usb/USBSerial.cpp similarity index 100% rename from usb/device/USBSerial/USBSerial.cpp rename to drivers/source/usb/USBSerial.cpp diff --git a/drivers/source/usb/mbed_lib.json b/drivers/source/usb/mbed_lib.json new file mode 100644 index 00000000000..32a28d417d7 --- /dev/null +++ b/drivers/source/usb/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "drivers-usb" +} diff --git a/events/Event.h b/events/Event.h index 2ce282a7489..73f43286d16 100644 --- a/events/Event.h +++ b/events/Event.h @@ -1,5 +1,5 @@ -/* events - * Copyright (c) 2016 ARM Limited +/* + * Copyright (c) 2016-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,20 +21,27 @@ #include "platform/mbed_assert.h" namespace events { -/** \addtogroup events */ +/** + * \addtogroup events-public-api Events + * \ingroup mbed-os-public + * @{ + */ /** Event * * Representation of an event for fine-grain dispatch control - * @ingroup events */ template class Event; +/** + * \defgroup events_Event Event class + * @{ + */ + /** Event * * Representation of an event for fine-grain dispatch control - * @ingroup events */ template class Event { @@ -389,9 +396,8 @@ class Event { Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4) { } }; +/** @}*/ -/** \addtogroup events */ -/** @{ */ // Convenience functions declared here to avoid cyclic // dependency between Event and EventQueue @@ -610,8 +616,7 @@ Event EventQueue::event(mbed::Callback(this, cb, c0, c1, c2, c3, c4); } -} - -#endif /** @}*/ +} +#endif diff --git a/events/EventQueue.h b/events/EventQueue.h index b5d567943a4..ee501255a94 100644 --- a/events/EventQueue.h +++ b/events/EventQueue.h @@ -1,5 +1,5 @@ -/* events - * Copyright (c) 2016 ARM Limited +/* + * Copyright (c) 2016-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,14 +18,17 @@ #ifndef EVENT_QUEUE_H #define EVENT_QUEUE_H -#include "equeue/equeue.h" +#include "events/equeue.h" #include "platform/Callback.h" #include "platform/NonCopyable.h" #include #include namespace events { -/** \addtogroup events */ +/** + * \addtogroup events-public-api + * @{ + */ /** EVENTS_EVENT_SIZE * Minimum size of an event @@ -43,11 +46,14 @@ namespace events { template class Event; +/** + * \defgroup events_EventQueue EventQueue class + * @{ + */ /** EventQueue * * Flexible event queue for dispatching events - * @ingroup events */ class EventQueue : private mbed::NonCopyable { public: @@ -1186,7 +1192,9 @@ class EventQueue : private mbed::NonCopyable { #endif //!defined(DOXYGEN_ONLY) }; +/** @}*/ +/** @}*/ + } #endif - diff --git a/events/README.md b/events/README.md index 169d00065aa..9ef90fe3ea9 100644 --- a/events/README.md +++ b/events/README.md @@ -150,4 +150,215 @@ b.chain(&a); a.dispatch(); ``` +## Underlying C API ## + +The `mbed-events` C++ library is the recommended library for scheduling events. However, for occasions where C++ cannot be used for a project (e.g bare metal), the underlying C API `equeue` used by `mbed-events` can be accessed directly. + +The `equeue` library is designed as a simple but powerful library for scheduling +events on composable queues. + +``` c +#include "equeue.h" +#include + +int main() { + // creates a queue with space for 32 basic events + equeue_t queue; + equeue_create(&queue, 32*EQUEUE_EVENT_SIZE); + + // events can be simple callbacks + equeue_call(&queue, print, "called immediately"); + equeue_call_in(&queue, 2000, print, "called in 2 seconds"); + equeue_call_every(&queue, 1000, print, "called every 1 seconds"); + + // events are executed in equeue_dispatch + equeue_dispatch(&queue, 3000); + + print("called after 3 seconds"); + + equeue_destroy(&queue); +} +``` + +The equeue library can be used as a normal event loop, or it can be +backgrounded on a single hardware timer or even another event loop. It +is both thread and irq safe, and provides functions for easily composing +multiple queues. + +The equeue library can act as a drop-in scheduler, provide synchronization +between multiple threads, or just act as a mechanism for moving events +out of interrupt contexts. + +## Documentation ## + +The in-depth documentation on specific functions can be found in +[equeue.h](equeue.h). + +The core of the equeue library is the `equeue_t` type which represents a +single event queue, and the `equeue_dispatch` function which runs the equeue, +providing the context for executing events. + +On top of this, `equeue_call`, `equeue_call_in`, and `equeue_call_every` +provide easy methods for posting events to execute in the context of the +`equeue_dispatch` function. + +``` c +#include "equeue.h" +#include "game.h" + +equeue_t queue; +struct game game; + +// button_isr may be in interrupt context +void button_isr(void) { + equeue_call(&queue, game_button_update, &game); +} + +// a simple user-interface framework +int main() { + equeue_create(&queue, 4096); + game_create(&game); + + // call game_screen_udpate at 60 Hz + equeue_call_every(&queue, 1000/60, game_screen_update, &game); + + // dispatch forever + equeue_dispatch(&queue, -1); +} +``` + +In addition to simple callbacks, an event can be manually allocated with +`equeue_alloc` and posted with `equeue_post` to allow passing an arbitrary +amount of context to the execution of the event. This memory is allocated out +of the equeue's buffer, and dynamic memory can be completely avoided. + +The equeue allocator is designed to minimize jitter in interrupt contexts as +well as avoid memory fragmentation on small devices. The allocator achieves +both constant-runtime and zero-fragmentation for fixed-size events, however +grows linearly as the quantity of differently-sized allocations increases. + +``` c +#include "equeue.h" + +equeue_t queue; + +// arbitrary data can be moved to a different context +int enet_consume(void *buffer, int size) { + if (size > 512) { + size = 512; + } + + void *data = equeue_alloc(&queue, 512); + memcpy(data, buffer, size); + equeue_post(&queue, handle_data_elsewhere, data); + + return size; +} +``` + +Additionally, in-flight events can be cancelled with `equeue_cancel`. Events +are given unique ids on post, allowing safe cancellation of expired events. + +``` c +#include "equeue.h" + +equeue_t queue; +int sonar_value; +int sonar_timeout_id; + +void sonar_isr(int value) { + equeue_cancel(&queue, sonar_timeout_id); + sonar_value = value; +} + +void sonar_timeout(void *) { + sonar_value = -1; +} + +void sonar_read(void) { + sonar_timeout_id = equeue_call_in(&queue, 300, sonar_timeout, 0); + sonar_start(); +} +``` + +From an architectural standpoint, event queues easily align with module +boundaries, where internal state can be implicitly synchronized through +event dispatch. + +On platforms where multiple threads are unavailable, multiple modules +can use independent event queues and still be composed through the +`equeue_chain` function. + +``` c +#include "equeue.h" + +// run a simultaneous localization and mapping loop in one queue +struct slam { + equeue_t queue; +}; + +void slam_create(struct slam *s, equeue_t *target) { + equeue_create(&s->queue, 4096); + equeue_chain(&s->queue, target); + equeue_call_every(&s->queue, 100, slam_filter); +} + +// run a sonar with it's own queue +struct sonar { + equeue_t equeue; + struct slam *slam; +}; + +void sonar_create(struct sonar *s, equeue_t *target) { + equeue_create(&s->queue, 64); + equeue_chain(&s->queue, target); + equeue_call_in(&s->queue, 5, sonar_update, s); +} + +// all of the above queues can be combined into a single thread of execution +int main() { + equeue_t queue; + equeue_create(&queue, 1024); + + struct sonar s1, s2, s3; + sonar_create(&s1, &queue); + sonar_create(&s2, &queue); + sonar_create(&s3, &queue); + + struct slam slam; + slam_create(&slam, &queue); + + // dispatches events from all of the modules + equeue_dispatch(&queue, -1); +} +``` + +## Platform ## + +The equeue library has a minimal porting layer that is flexible depending +on the requirements of the underlying platform. Platform specific declarations +and more information can be found in [equeue_platform.h](equeue_platform.h). + +## Tests ## + +The equeue library uses a set of local tests based on the posix implementation. + +Runtime tests are located in [tests.c](tests/tests.c): + +``` bash +make test +``` + +Profiling tests based on rdtsc are located in [prof.c](tests/prof.c): + +``` bash +make prof +``` + +To make profiling results more tangible, the profiler also supports percentage +comparison with previous runs: +``` bash +make prof | tee results.txt +cat results.txt | make prof +``` diff --git a/events/equeue/equeue.h b/events/equeue.h similarity index 98% rename from events/equeue/equeue.h rename to events/equeue.h index a2c56e3fc82..ab25e16098b 100644 --- a/events/equeue/equeue.h +++ b/events/equeue.h @@ -1,10 +1,8 @@ -/** \addtogroup events */ -/** @{*/ /* * Flexible event queue for dispatching events * - * Copyright (c) 2016 Christopher Haster + * Copyright (c) 2016-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,11 +24,15 @@ extern "C" { #endif // Platform specific files -#include "equeue/equeue_platform.h" +#include "events/internal/equeue_platform.h" #include #include +/** + * \addtogroup events-public-api + * @{ + */ // The minimum size of an event // This size is guaranteed to fit events created by event_call @@ -225,11 +227,10 @@ void equeue_background(equeue_t *queue, // platform-specific error code. int equeue_chain(equeue_t *queue, equeue_t *target); +/** @}*/ #ifdef __cplusplus } #endif #endif - -/** @}*/ diff --git a/events/equeue/README.md b/events/equeue/README.md deleted file mode 100644 index 10f500c56f8..00000000000 --- a/events/equeue/README.md +++ /dev/null @@ -1,210 +0,0 @@ -## The equeue library ## - -The equeue library is designed as a simple but powerful library for scheduling -events on composable queues. - -``` c -#include "equeue.h" -#include - -int main() { - // creates a queue with space for 32 basic events - equeue_t queue; - equeue_create(&queue, 32*EQUEUE_EVENT_SIZE); - - // events can be simple callbacks - equeue_call(&queue, print, "called immediately"); - equeue_call_in(&queue, 2000, print, "called in 2 seconds"); - equeue_call_every(&queue, 1000, print, "called every 1 seconds"); - - // events are executed in equeue_dispatch - equeue_dispatch(&queue, 3000); - - print("called after 3 seconds"); - - equeue_destroy(&queue); -} -``` - -The equeue library can be used as a normal event loop, or it can be -backgrounded on a single hardware timer or even another event loop. It -is both thread and irq safe, and provides functions for easily composing -multiple queues. - -The equeue library can act as a drop-in scheduler, provide synchronization -between multiple threads, or just act as a mechanism for moving events -out of interrupt contexts. - -## Documentation ## - -The in-depth documentation on specific functions can be found in -[equeue.h](equeue.h). - -The core of the equeue library is the `equeue_t` type which represents a -single event queue, and the `equeue_dispatch` function which runs the equeue, -providing the context for executing events. - -On top of this, `equeue_call`, `equeue_call_in`, and `equeue_call_every` -provide easy methods for posting events to execute in the context of the -`equeue_dispatch` function. - -``` c -#include "equeue.h" -#include "game.h" - -equeue_t queue; -struct game game; - -// button_isr may be in interrupt context -void button_isr(void) { - equeue_call(&queue, game_button_update, &game); -} - -// a simple user-interface framework -int main() { - equeue_create(&queue, 4096); - game_create(&game); - - // call game_screen_udpate at 60 Hz - equeue_call_every(&queue, 1000/60, game_screen_update, &game); - - // dispatch forever - equeue_dispatch(&queue, -1); -} -``` - -In addition to simple callbacks, an event can be manually allocated with -`equeue_alloc` and posted with `equeue_post` to allow passing an arbitrary -amount of context to the execution of the event. This memory is allocated out -of the equeue's buffer, and dynamic memory can be completely avoided. - -The equeue allocator is designed to minimize jitter in interrupt contexts as -well as avoid memory fragmentation on small devices. The allocator achieves -both constant-runtime and zero-fragmentation for fixed-size events, however -grows linearly as the quantity of differently-sized allocations increases. - -``` c -#include "equeue.h" - -equeue_t queue; - -// arbitrary data can be moved to a different context -int enet_consume(void *buffer, int size) { - if (size > 512) { - size = 512; - } - - void *data = equeue_alloc(&queue, 512); - memcpy(data, buffer, size); - equeue_post(&queue, handle_data_elsewhere, data); - - return size; -} -``` - -Additionally, in-flight events can be cancelled with `equeue_cancel`. Events -are given unique ids on post, allowing safe cancellation of expired events. - -``` c -#include "equeue.h" - -equeue_t queue; -int sonar_value; -int sonar_timeout_id; - -void sonar_isr(int value) { - equeue_cancel(&queue, sonar_timeout_id); - sonar_value = value; -} - -void sonar_timeout(void *) { - sonar_value = -1; -} - -void sonar_read(void) { - sonar_timeout_id = equeue_call_in(&queue, 300, sonar_timeout, 0); - sonar_start(); -} -``` - -From an architectural standpoint, event queues easily align with module -boundaries, where internal state can be implicitly synchronized through -event dispatch. - -On platforms where multiple threads are unavailable, multiple modules -can use independent event queues and still be composed through the -`equeue_chain` function. - -``` c -#include "equeue.h" - -// run a simultaneous localization and mapping loop in one queue -struct slam { - equeue_t queue; -}; - -void slam_create(struct slam *s, equeue_t *target) { - equeue_create(&s->queue, 4096); - equeue_chain(&s->queue, target); - equeue_call_every(&s->queue, 100, slam_filter); -} - -// run a sonar with it's own queue -struct sonar { - equeue_t equeue; - struct slam *slam; -}; - -void sonar_create(struct sonar *s, equeue_t *target) { - equeue_create(&s->queue, 64); - equeue_chain(&s->queue, target); - equeue_call_in(&s->queue, 5, sonar_update, s); -} - -// all of the above queues can be combined into a single thread of execution -int main() { - equeue_t queue; - equeue_create(&queue, 1024); - - struct sonar s1, s2, s3; - sonar_create(&s1, &queue); - sonar_create(&s2, &queue); - sonar_create(&s3, &queue); - - struct slam slam; - slam_create(&slam, &queue); - - // dispatches events from all of the modules - equeue_dispatch(&queue, -1); -} -``` - -## Platform ## - -The equeue library has a minimal porting layer that is flexible depending -on the requirements of the underlying platform. Platform specific declarations -and more information can be found in [equeue_platform.h](equeue_platform.h). - -## Tests ## - -The equeue library uses a set of local tests based on the posix implementation. - -Runtime tests are located in [tests.c](tests/tests.c): - -``` bash -make test -``` - -Profiling tests based on rdtsc are located in [prof.c](tests/prof.c): - -``` bash -make prof -``` - -To make profiling results more tangible, the profiler also supports percentage -comparison with previous runs: -``` bash -make prof | tee results.txt -cat results.txt | make prof -``` - diff --git a/events/equeue/equeue_platform.h b/events/internal/equeue_platform.h similarity index 98% rename from events/equeue/equeue_platform.h rename to events/internal/equeue_platform.h index a63a7400e9b..aebd70a3647 100644 --- a/events/equeue/equeue_platform.h +++ b/events/internal/equeue_platform.h @@ -1,10 +1,7 @@ - -/** \addtogroup events */ -/** @{*/ /* * System specific implementation * - * Copyright (c) 2016 Christopher Haster + * Copyright (c) 2016-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -150,11 +147,8 @@ void equeue_sema_destroy(equeue_sema_t *sema); void equeue_sema_signal(equeue_sema_t *sema); bool equeue_sema_wait(equeue_sema_t *sema, int ms); - #ifdef __cplusplus } #endif #endif - -/** @}*/ diff --git a/events/mbed_events.h b/events/mbed_events.h index 466b82bb17b..6243c7ab21d 100644 --- a/events/mbed_events.h +++ b/events/mbed_events.h @@ -1,8 +1,4 @@ - -/** \addtogroup events */ -/** @{*/ -/* events - * Copyright (c) 2016 ARM Limited +/* Copyright (c) 2016-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,10 +16,6 @@ #ifndef MBED_EVENTS_H #define MBED_EVENTS_H - -#include "equeue/equeue.h" - - #ifdef __cplusplus #include "events/EventQueue.h" @@ -31,13 +23,13 @@ #include "events/mbed_shared_queues.h" +/** \addtogroup events-public-api */ +/** @{*/ #ifndef MBED_NO_GLOBAL_USING_DIRECTIVE using namespace events; #endif +/** @}*/ #endif - #endif - -/** @}*/ diff --git a/events/mbed_shared_queues.h b/events/mbed_shared_queues.h index eb8d91e7910..acd83a6a290 100644 --- a/events/mbed_shared_queues.h +++ b/events/mbed_shared_queues.h @@ -1,8 +1,5 @@ - -/** \addtogroup events */ -/** @{*/ -/* events - * Copyright (c) 2017 ARM Limited +/* + * Copyright (c) 2016-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +19,9 @@ #include "events/EventQueue.h" namespace mbed { +/** \ingroup mbed-os-public */ +/** \addtogroup events-public-api */ +/** @{*/ /** * Return a pointer to an EventQueue, on which normal tasks can be queued. @@ -85,8 +85,8 @@ events::EventQueue *mbed_highprio_event_queue(); #endif // MBED_CONF_RTOS_PRESENT -}; +/** @}*/ -#endif +} -/** @}*/ +#endif diff --git a/events/equeue/.mbedignore b/events/source/.mbedignore similarity index 100% rename from events/equeue/.mbedignore rename to events/source/.mbedignore diff --git a/events/EventQueue.cpp b/events/source/EventQueue.cpp similarity index 100% rename from events/EventQueue.cpp rename to events/source/EventQueue.cpp diff --git a/events/equeue/Makefile b/events/source/Makefile similarity index 96% rename from events/equeue/Makefile rename to events/source/Makefile index 1323c96bf00..6e636bc87b1 100644 --- a/events/equeue/Makefile +++ b/events/source/Makefile @@ -17,7 +17,7 @@ endif ifdef WORD CFLAGS += -m$(WORD) endif -CFLAGS += -I. -I.. +CFLAGS += -I. -I.. -I../.. CFLAGS += -std=c99 CFLAGS += -Wall CFLAGS += -D_XOPEN_SOURCE=600 diff --git a/events/equeue/equeue.c b/events/source/equeue.c similarity index 99% rename from events/equeue/equeue.c rename to events/source/equeue.c index 3c89b5cfb92..653e1c8c739 100644 --- a/events/equeue/equeue.c +++ b/events/source/equeue.c @@ -1,7 +1,7 @@ /* * Flexible event queue for dispatching events * - * Copyright (c) 2016 Christopher Haster + * Copyright (c) 2016-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "equeue/equeue.h" +#include "events/equeue.h" #include #include diff --git a/events/equeue/equeue_mbed.cpp b/events/source/equeue_mbed.cpp similarity index 97% rename from events/equeue/equeue_mbed.cpp rename to events/source/equeue_mbed.cpp index 8f2e5f3f7a8..394e12efbbf 100644 --- a/events/equeue/equeue_mbed.cpp +++ b/events/source/equeue_mbed.cpp @@ -2,7 +2,7 @@ * Implementation for the mbed library * https://github.com/mbedmicro/mbed * - * Copyright (c) 2016 Christopher Haster + * Copyright (c) 2016-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "equeue/equeue_platform.h" +#include "events/internal/equeue_platform.h" #if defined(EQUEUE_PLATFORM_MBED) @@ -24,6 +24,7 @@ #include #include "cmsis.h" #include "platform/mbed_critical.h" +#include "platform/mbed_power_mgmt.h" #include "drivers/Timer.h" #include "drivers/Ticker.h" #include "drivers/Timeout.h" diff --git a/events/equeue/equeue_posix.c b/events/source/equeue_posix.c similarity index 96% rename from events/equeue/equeue_posix.c rename to events/source/equeue_posix.c index a39b1e11936..5053223ff51 100644 --- a/events/equeue/equeue_posix.c +++ b/events/source/equeue_posix.c @@ -1,7 +1,7 @@ /* * Implementation for Posix compliant platforms * - * Copyright (c) 2016 Christopher Haster + * Copyright (c) 2016-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "equeue/equeue_platform.h" +#include "events/internal/equeue_platform.h" #if defined(EQUEUE_PLATFORM_POSIX) diff --git a/events/mbed_shared_queues.cpp b/events/source/mbed_shared_queues.cpp similarity index 100% rename from events/mbed_shared_queues.cpp rename to events/source/mbed_shared_queues.cpp diff --git a/events/equeue/tests/prof.c b/events/source/tests/prof.c similarity index 99% rename from events/equeue/tests/prof.c rename to events/source/tests/prof.c index 82b5c93e0c1..f7b8f903f75 100644 --- a/events/equeue/tests/prof.c +++ b/events/source/tests/prof.c @@ -1,7 +1,7 @@ /* * Profiling framework for the events library * - * Copyright (c) 2016 Christopher Haster + * Copyright (c) 2016 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "equeue.h" +#include "events/equeue.h" #include #include #include diff --git a/events/equeue/tests/tests.c b/events/source/tests/tests.c similarity index 99% rename from events/equeue/tests/tests.c rename to events/source/tests/tests.c index 96f18429623..941d706f921 100644 --- a/events/equeue/tests/tests.c +++ b/events/source/tests/tests.c @@ -1,7 +1,7 @@ /* * Testing framework for the events library * - * Copyright (c) 2016 Christopher Haster + * Copyright (c) 2016 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "equeue.h" +#include "events/equeue.h" #include #include #include diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/NRFCordioHCIDriver.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/NRFCordioHCIDriver.cpp index e639f7794db..ccccdf65886 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/NRFCordioHCIDriver.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/NRFCordioHCIDriver.cpp @@ -21,7 +21,7 @@ // mbed Includes #include "mbed_assert.h" -#include "rtos/rtos_idle.h" +#include "rtos/source/rtos_idle.h" #include "platform/mbed_power_mgmt.h" #include "mbed_critical.h" @@ -368,7 +368,7 @@ bool NRFCordioHCIDriver::get_random_static_address(ble::address_t& address) return true; } -ble::vendor::cordio::CordioHCIDriver& ble_cordio_get_hci_driver() { +ble::vendor::cordio::CordioHCIDriver& ble_cordio_get_hci_driver() { static NRFCordioHCITransportDriver transport_driver; static NRFCordioHCIDriver hci_driver( diff --git a/features/device_key/source/DeviceKey.h b/features/device_key/source/DeviceKey.h index 6ca024127e6..9d17aaf1510 100644 --- a/features/device_key/source/DeviceKey.h +++ b/features/device_key/source/DeviceKey.h @@ -32,7 +32,11 @@ #if (DEVICEKEY_ENABLED) || defined(DOXYGEN_ONLY) namespace mbed { -/** \addtogroup drivers */ +/** \addtogroup device-security Device Key + * \ingroup mbed-os-public + * @{ + */ + #define DEVICE_KEY_16BYTE 16 #define DEVICE_KEY_32BYTE 32 @@ -56,9 +60,13 @@ enum DeviceKeyStatus { /** Use this singleton if you need to derive a new key from the device root of trust. * * @note Synchronization level: Thread safe - * @ingroup drivers + * @ingroup device-key + */ +/** + * \defgroup device-security_DeviceKey DeviceKey class + * \addtogroup device-security + * @{ */ - class DeviceKey : private mbed::NonCopyable { public: @@ -143,6 +151,8 @@ class DeviceKey : private mbed::NonCopyable { int generate_key_by_random(uint32_t *output, size_t size); }; + +/** @}*/ /** @}*/ } diff --git a/hal/LowPowerTickerWrapper.h b/hal/LowPowerTickerWrapper.h index 5ce81c59e32..7a59261726d 100644 --- a/hal/LowPowerTickerWrapper.h +++ b/hal/LowPowerTickerWrapper.h @@ -2,7 +2,7 @@ /** \addtogroup hal */ /** @{*/ /* mbed Microcontroller Library - * Copyright (c) 2018 ARM Limited + * Copyright (c) 2018-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,6 +26,8 @@ #include "hal/us_ticker_api.h" #include "drivers/Timeout.h" +#include "platform/mbed_critical.h" + class LowPowerTickerWrapper { public: diff --git a/hal/ethernet_api.h b/hal/ethernet_api.h index 1a14fda06e7..46e89ea5f0b 100644 --- a/hal/ethernet_api.h +++ b/hal/ethernet_api.h @@ -21,6 +21,7 @@ #define MBED_ETHERNET_API_H #include "device.h" +#include "platform/mbed_toolchain.h" #if DEVICE_ETHERNET @@ -29,32 +30,67 @@ extern "C" { #endif // Connection constants - +MBED_DEPRECATED( + "Ethernet drivers are provided by a class derived from `EMAC` attached to" + " either lwIP or Nanostack." +) int ethernet_init(void); +MBED_DEPRECATED( + "Ethernet drivers are provided by a class derived from `EMAC` attached to" + " either lwIP or Nanostack." +) void ethernet_free(void); // write size bytes from data to ethernet buffer // return num bytes written // or -1 if size is too big +MBED_DEPRECATED( + "Ethernet drivers are provided by a class derived from `EMAC` attached to" + " either lwIP or Nanostack." +) int ethernet_write(const char *data, int size); // send ethernet write buffer, returning the packet size sent +MBED_DEPRECATED( + "Ethernet drivers are provided by a class derived from `EMAC` attached to" + " either lwIP or Nanostack." +) int ethernet_send(void); // receive from ethernet buffer, returning packet size, or 0 if no packet +MBED_DEPRECATED( + "Ethernet drivers are provided by a class derived from `EMAC` attached to" + " either lwIP or Nanostack." +) int ethernet_receive(void); // read size bytes in to data, return actual num bytes read (0..size) // if data == NULL, throw the bytes away +MBED_DEPRECATED( + "Ethernet drivers are provided by a class derived from `EMAC` attached to" + " either lwIP or Nanostack." +) int ethernet_read(char *data, int size); // get the ethernet address +MBED_DEPRECATED( + "Ethernet drivers are provided by a class derived from `EMAC` attached to" + " either lwIP or Nanostack." +) void ethernet_address(char *mac); // see if the link is up +MBED_DEPRECATED( + "Ethernet drivers are provided by a class derived from `EMAC` attached to" + " either lwIP or Nanostack." +) int ethernet_link(void); // force link settings +MBED_DEPRECATED( + "Ethernet drivers are provided by a class derived from `EMAC` attached to" + " either lwIP or Nanostack." +) void ethernet_set_link(int speed, int duplex); #ifdef __cplusplus diff --git a/usb/device/USBPhy/USBPhy.h b/hal/usb/USBPhy.h similarity index 99% rename from usb/device/USBPhy/USBPhy.h rename to hal/usb/USBPhy.h index a1b5a9930d0..c7c69bb9b6d 100644 --- a/usb/device/USBPhy/USBPhy.h +++ b/hal/usb/USBPhy.h @@ -259,7 +259,7 @@ class USBPhy { 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 * resume. diff --git a/usb/device/USBPhy/USBPhyEvents.h b/hal/usb/USBPhyEvents.h similarity index 100% rename from usb/device/USBPhy/USBPhyEvents.h rename to hal/usb/USBPhyEvents.h diff --git a/usb/device/USBPhy/USBPhyTypes.h b/hal/usb/USBPhyTypes.h similarity index 100% rename from usb/device/USBPhy/USBPhyTypes.h rename to hal/usb/USBPhyTypes.h diff --git a/usb/device/hal/mbed_usb_phy.cpp b/hal/usb/mbed_usb_phy.cpp similarity index 100% rename from usb/device/hal/mbed_usb_phy.cpp rename to hal/usb/mbed_usb_phy.cpp diff --git a/usb/device/hal/usb_phy_api.h b/hal/usb/usb_phy_api.h similarity index 100% rename from usb/device/hal/usb_phy_api.h rename to hal/usb/usb_phy_api.h diff --git a/platform/ATCmdParser.h b/platform/ATCmdParser.h index ee608138348..f183cb64e1c 100644 --- a/platform/ATCmdParser.h +++ b/platform/ATCmdParser.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 ARM Limited +/* Copyright (c) 2017-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,13 +22,14 @@ #define MBED_ATCMDPARSER_H #include -#include "Callback.h" -#include "NonCopyable.h" -#include "FileHandle.h" +#include "platform/Callback.h" +#include "platform/NonCopyable.h" +#include "platform/FileHandle.h" namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api Platform */ /** @{*/ /** * \defgroup platform_ATCmdParser ATCmdParser class diff --git a/platform/CThunk.h b/platform/CThunk.h index 288cac141e0..6e350c671d7 100644 --- a/platform/CThunk.h +++ b/platform/CThunk.h @@ -1,5 +1,5 @@ - -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_CThunk CThunk class @@ -12,7 +12,7 @@ * - supports an optional context parameter for the called function * - ideally suited for class object receiving interrupts (NVIC_SetVector) * - * Copyright (c) 2014-2015 ARM Limited + * Copyright (c) 2014-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -39,7 +39,7 @@ #ifndef __CTHUNK_H__ #define __CTHUNK_H__ -#include "CThunkBase.h" +#include "platform/internal/CThunkBase.h" /** * Class for created a pointer with data bound to it @@ -47,7 +47,7 @@ * @note Synchronization level: Not protected */ template -class CThunk: public CThunkBase { +class CThunk: private CThunkBase { public: typedef void (T::*CCallbackSimple)(void); typedef void (T::*CCallback)(void *context); diff --git a/platform/CallChain.h b/platform/CallChain.h index 0f35dc1b5e7..cd9e67af869 100644 --- a/platform/CallChain.h +++ b/platform/CallChain.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,10 +28,9 @@ namespace mbed { typedef Callback *pFunctionPointer_t; class CallChainLink; -/** \addtogroup platform */ -/** @{*/ /** * \defgroup platform_CallChain CallChain class + * \ingroup platform-public-api * @{ */ @@ -73,7 +72,9 @@ class CallChainLink; * } * @endcode */ -class CallChain : private NonCopyable { +class + MBED_DEPRECATED("CallChain has been deprecated and will be removed.") + CallChain : private NonCopyable { public: /** Create an empty chain * @deprecated @@ -257,9 +258,6 @@ class CallChain : private NonCopyable { /**@}*/ -/**@}*/ - } // namespace mbed #endif - diff --git a/platform/Callback.h b/platform/Callback.h index a72143a8ea2..78f299ae590 100644 --- a/platform/Callback.h +++ b/platform/Callback.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2015 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,8 @@ #include "platform/mbed_toolchain.h" namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_Callback Callback class diff --git a/platform/CircularBuffer.h b/platform/CircularBuffer.h index 77e8bb400d5..d5d862a3f20 100644 --- a/platform/CircularBuffer.h +++ b/platform/CircularBuffer.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2015 ARM Limited + * Copyright (c) 2015-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -51,7 +51,8 @@ struct is_unsigned { }; }; -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_CircularBuffer CircularBuffer functions diff --git a/platform/CriticalSectionLock.h b/platform/CriticalSectionLock.h index cf861f93a2d..2d2291d816b 100644 --- a/platform/CriticalSectionLock.h +++ b/platform/CriticalSectionLock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited + * Copyright (c) 2017-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,12 +18,12 @@ #ifndef MBED_CRITICALSECTIONLOCK_H #define MBED_CRITICALSECTIONLOCK_H -#include "platform/mbed_critical.h" #include "platform/mbed_toolchain.h" namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_CriticalSectionLock CriticalSectionLock functions @@ -57,15 +57,9 @@ namespace mbed { */ class CriticalSectionLock { public: - CriticalSectionLock() - { - core_util_critical_section_enter(); - } + CriticalSectionLock(); - ~CriticalSectionLock() - { - core_util_critical_section_exit(); - } + ~CriticalSectionLock(); /** Mark the start of a critical section * @deprecated This function is inconsistent with RAII and is being removed in the future. Replaced by static function CriticalSectionLock::enable. @@ -74,10 +68,7 @@ class CriticalSectionLock { MBED_DEPRECATED_SINCE("mbed-os-5.8", "This function is inconsistent with RAII and is being removed in the future." "Replaced by static function CriticalSectionLock::enable.") - void lock() - { - core_util_critical_section_enter(); - } + void lock(); /** Mark the end of a critical section * @deprecated This function is inconsistent with RAII and is being removed in the future. Replaced by static function CriticalSectionLock::enable. @@ -86,24 +77,15 @@ class CriticalSectionLock { MBED_DEPRECATED_SINCE("mbed-os-5.8", "This function is inconsistent with RAII and is being removed in the future." "Replaced by static function CriticalSectionLock::disable.") - void unlock() - { - core_util_critical_section_exit(); - } + void unlock(); /** Mark the start of a critical section */ - static void enable() - { - core_util_critical_section_enter(); - } + static void enable(); /** Mark the end of a critical section */ - static void disable() - { - core_util_critical_section_exit(); - } + static void disable(); }; /**@}*/ diff --git a/platform/DeepSleepLock.h b/platform/DeepSleepLock.h index 1fe95db2650..6211f2d74fc 100644 --- a/platform/DeepSleepLock.h +++ b/platform/DeepSleepLock.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2017 ARM Limited + * Copyright (c) 2017-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,12 +18,12 @@ #define MBED_DEEPSLEEPLOCK_H #include -#include "platform/mbed_power_mgmt.h" -#include "platform/mbed_atomic.h" +#include namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_DeepSleepLock DeepSleepLock functions @@ -49,44 +49,17 @@ class DeepSleepLock { uint16_t _lock_count; public: - DeepSleepLock(): _lock_count(1) - { - sleep_manager_lock_deep_sleep(); - } + DeepSleepLock(); - ~DeepSleepLock() - { - if (_lock_count) { - sleep_manager_unlock_deep_sleep(); - } - } + ~DeepSleepLock(); /** Mark the start of a locked deep sleep section */ - void lock() - { - uint16_t count = core_util_atomic_incr_u16(&_lock_count, 1); - if (1 == count) { - sleep_manager_lock_deep_sleep(); - } - if (0 == count) { - MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_OVERFLOW), "DeepSleepLock overflow (> USHRT_MAX)", count); - } - } + void lock(); /** Mark the end of a locked deep sleep section */ - void unlock() - { - uint16_t count = core_util_atomic_decr_u16(&_lock_count, 1); - if (count == 0) { - sleep_manager_unlock_deep_sleep(); - } - if (count == USHRT_MAX) { - core_util_critical_section_exit(); - MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_UNDERFLOW), "DeepSleepLock underflow (< 0)", count); - } - } + void unlock(); }; /**@}*/ diff --git a/platform/DirHandle.h b/platform/DirHandle.h index 859d833428e..60b9e08dde1 100644 --- a/platform/DirHandle.h +++ b/platform/DirHandle.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,12 +18,12 @@ #define MBED_DIRHANDLE_H #include -#include "platform/platform.h" -#include "platform/FileHandle.h" +#include "platform/mbed_toolchain.h" #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_DirHandle DirHandle functions diff --git a/platform/FileBase.h b/platform/FileBase.h index 68b74ed9682..f4aac58a17e 100644 --- a/platform/FileBase.h +++ b/platform/FileBase.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,12 +31,16 @@ typedef enum { FileSystemPathType } PathType; -/** \addtogroup platform */ -/** @{*/ +/** \defgroup platform-public-api-file File + * \ingroup platform-public-api + */ + /** * \defgroup platform_FileBase FileBase class + * \ingroup platform-public-api-file * @{ */ + /** Class FileBase * */ @@ -67,9 +71,6 @@ class FileBase : private NonCopyable { /**@}*/ -/**@}*/ - } // namespace mbed #endif - diff --git a/platform/FileHandle.h b/platform/FileHandle.h index 54881696671..e1523edb548 100644 --- a/platform/FileHandle.h +++ b/platform/FileHandle.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2017 ARM Limited + * Copyright (c) 2017-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,16 +20,16 @@ typedef int FILEHANDLE; #include -#include "Callback.h" +#include "platform/Callback.h" #include "platform/mbed_poll.h" #include "platform/platform.h" #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup platform */ -/** @{*/ + /** * \defgroup platform_FileHandle FileHandle functions + * \ingroup platform-public-api-file * @{ */ @@ -319,9 +319,6 @@ class FileHandle : private NonCopyable { /**@}*/ -/**@}*/ - - } // namespace mbed #endif diff --git a/platform/FileLike.h b/platform/FileLike.h index f4e1911f237..5f4409a8e03 100644 --- a/platform/FileLike.h +++ b/platform/FileLike.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,18 +17,17 @@ #ifndef MBED_FILELIKE_H #define MBED_FILELIKE_H -#include "platform/mbed_toolchain.h" #include "platform/FileBase.h" #include "platform/FileHandle.h" #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup platform */ -/** @{*/ /** * \defgroup platform_FileLike FileLike class + * \ingroup platform-public-api-file * @{ */ + /** Class FileLike * * A file-like object is one that can be opened with fopen by @@ -48,8 +47,6 @@ class FileLike : public FileHandle, public FileBase, private NonCopyable { }; /**@}*/ -/**@}*/ - } // namespace mbed #endif diff --git a/platform/FileSystemLike.h b/platform/FileSystemLike.h index ce6df438813..a8b616b0275 100644 --- a/platform/FileSystemLike.h +++ b/platform/FileSystemLike.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,16 +19,16 @@ #include "platform/platform.h" +#include "platform/FileBase.h" #include "platform/FileSystemHandle.h" #include "platform/FileHandle.h" #include "platform/DirHandle.h" #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup platform */ -/** @{*/ /** * \defgroup platform_FileSystemLike FileSystemLike functions + * \ingroup platform-public-api-file * @{ */ @@ -86,8 +86,6 @@ class FileSystemLike : public FileSystemHandle, public FileBase, private NonCopy /**@}*/ -/**@}*/ - } // namespace mbed #endif diff --git a/platform/FunctionPointer.h b/platform/FunctionPointer.h index 90a808015ca..e3fb94fe4d8 100644 --- a/platform/FunctionPointer.h +++ b/platform/FunctionPointer.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2015 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,8 @@ #include namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_FunctionPointer FunctionPointer class diff --git a/platform/LocalFileSystem.h b/platform/LocalFileSystem.h index 7314320d449..0061ef9f2bf 100644 --- a/platform/LocalFileSystem.h +++ b/platform/LocalFileSystem.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +26,8 @@ #include "platform/NonCopyable.h" namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_LocalFileSystem LocalFileSystem functions diff --git a/platform/NonCopyable.h b/platform/NonCopyable.h index 70f76e71776..4d78e834274 100644 --- a/platform/NonCopyable.h +++ b/platform/NonCopyable.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 ARM Limited +/* Copyright (c) 2017-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,13 +18,14 @@ #define MBED_NONCOPYABLE_H_ #if (!defined(MBED_DEBUG) && (MBED_CONF_PLATFORM_FORCE_NON_COPYABLE_ERROR == 0)) -#include "mbed_toolchain.h" -#include "mbed_debug.h" +#include "platform/mbed_toolchain.h" +#include "platform/mbed_debug.h" #endif namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_NonCopyable NonCopyable class diff --git a/platform/PlatformMutex.h b/platform/PlatformMutex.h index 3f751c4149d..7f26c800db6 100644 --- a/platform/PlatformMutex.h +++ b/platform/PlatformMutex.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,9 +19,9 @@ #include "platform/NonCopyable.h" -/** \addtogroup platform - * @{ - */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ +/** @{*/ /** \defgroup platform_PlatformMutex PlatformMutex class * @{ diff --git a/platform/ScopedLock.h b/platform/ScopedLock.h index d6d1854d9ac..e1ddf3bfc93 100644 --- a/platform/ScopedLock.h +++ b/platform/ScopedLock.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2018 ARM Limited + * Copyright (c) 2018-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,8 @@ namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_ScopedLock ScopedLock functions diff --git a/platform/ScopedRamExecutionLock.h b/platform/ScopedRamExecutionLock.h index d45b3f90668..72e1874cca0 100644 --- a/platform/ScopedRamExecutionLock.h +++ b/platform/ScopedRamExecutionLock.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2018 ARM Limited + * Copyright (c) 2018-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,8 @@ namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** RAII object for disabling, then restoring RAM execute never mode diff --git a/platform/ScopedRomWriteLock.h b/platform/ScopedRomWriteLock.h index 7cd6d5f355a..4e39382d927 100644 --- a/platform/ScopedRomWriteLock.h +++ b/platform/ScopedRomWriteLock.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2018 ARM Limited + * Copyright (c) 2018-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,8 @@ namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** RAII object for disabling, then restoring ROM write never mode diff --git a/platform/SingletonPtr.h b/platform/SingletonPtr.h index ed3f8e33e1f..a71e0873cec 100644 --- a/platform/SingletonPtr.h +++ b/platform/SingletonPtr.h @@ -1,12 +1,13 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_SingletonPtr SingletonPtr class * @{ */ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/Span.h b/platform/Span.h index 9859402aa27..889cddc333f 100644 --- a/platform/Span.h +++ b/platform/Span.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2018-2018 ARM Limited + * Copyright (c) 2018-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +26,8 @@ namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_Span Span class diff --git a/platform/Stream.h b/platform/Stream.h index e8783038f43..ef03d71a8ea 100644 --- a/platform/Stream.h +++ b/platform/Stream.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,14 +19,14 @@ #include "platform/platform.h" #include "platform/FileLike.h" -#include "platform/FileHandle.h" #include "platform/NonCopyable.h" -#include "mbed_toolchain.h" +#include "platform/mbed_toolchain.h" #include #include namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_Stream Stream class diff --git a/platform/Transaction.h b/platform/Transaction.h index 6917c4d12ba..8b30ef494c2 100644 --- a/platform/Transaction.h +++ b/platform/Transaction.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2015 ARM Limited + * Copyright (c) 2015-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,10 +18,10 @@ #define MBED_TRANSACTION_H #include "platform/platform.h" -#include "platform/FunctionPointer.h" namespace mbed { -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_Transaction Transaction class diff --git a/platform/CThunkBase.h b/platform/internal/CThunkBase.h similarity index 91% rename from platform/CThunkBase.h rename to platform/internal/CThunkBase.h index c2ae68c28c3..ef0f326646f 100644 --- a/platform/CThunkBase.h +++ b/platform/internal/CThunkBase.h @@ -18,9 +18,18 @@ #ifndef __CTHUNK_BASE_H__ #define __CTHUNK_BASE_H__ +/** \addtogroup platform-internal-api Platform + * \ingroup mbed-os-internal + */ + /* IRQ/Exception compatible thunk entry function */ typedef void (*CThunkEntry)(void); +/** + * \defgroup platform_CThunkBase CThunkBase class + * \ingroup platform-internal-api + * @{ + */ class CThunkBase { protected: typedef void (*Trampoline)(CThunkBase *); @@ -74,5 +83,6 @@ class CThunkBase { } }; -#endif/*__CTHUNK_BASE_H__*/ +/**@}*/ +#endif/*__CTHUNK_BASE_H__*/ diff --git a/platform/mbed_assert.h b/platform/mbed_assert.h index 7b2be2cfaac..f43aa8b4bf1 100644 --- a/platform/mbed_assert.h +++ b/platform/mbed_assert.h @@ -1,12 +1,13 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_Assert Assert macros * @{ */ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,8 +25,7 @@ #ifndef MBED_ASSERT_H #define MBED_ASSERT_H -#include "mbed_preprocessor.h" -#include "mbed_toolchain.h" +#include "platform/mbed_toolchain.h" #ifdef __cplusplus extern "C" { diff --git a/platform/mbed_atomic.h b/platform/mbed_atomic.h index e10f6f52861..ca9f8df799c 100644 --- a/platform/mbed_atomic.h +++ b/platform/mbed_atomic.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2015-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -24,9 +24,10 @@ #include #include #include -#include "mbed_toolchain.h" +#include "platform/mbed_toolchain.h" -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** diff --git a/platform/mbed_critical.h b/platform/mbed_critical.h index b6e68f533c9..f1a152ef77e 100644 --- a/platform/mbed_critical.h +++ b/platform/mbed_critical.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2015-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -25,7 +25,8 @@ extern "C" { #endif -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_critical critical section function @@ -96,6 +97,3 @@ bool core_util_in_critical_section(void); #endif #endif // __MBED_UTIL_CRITICAL_H__ - - - diff --git a/platform/mbed_debug.h b/platform/mbed_debug.h index f560f3db33e..cfa52bfebb8 100644 --- a/platform/mbed_debug.h +++ b/platform/mbed_debug.h @@ -1,5 +1,6 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_debug Debug functions @@ -7,7 +8,7 @@ */ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,7 +29,7 @@ #include #include #endif -#include "mbed_toolchain.h" +#include "platform/mbed_toolchain.h" #ifdef __cplusplus extern "C" { diff --git a/platform/mbed_error.h b/platform/mbed_error.h index 8ff8abc9428..7a1f7012887 100644 --- a/platform/mbed_error.h +++ b/platform/mbed_error.h @@ -1,11 +1,12 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_error Error functions * @{ */ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/mbed_interface.h b/platform/mbed_interface.h index ac12b600365..44c1f262ea7 100644 --- a/platform/mbed_interface.h +++ b/platform/mbed_interface.h @@ -1,5 +1,6 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_interface Network interface and other utility functions @@ -7,7 +8,7 @@ */ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,7 +28,7 @@ #include -#include "mbed_toolchain.h" +#include "platform/mbed_toolchain.h" #include "device.h" /* Mbed interface mac address @@ -58,7 +59,7 @@ extern "C" { * * mbed Microcontrollers have a built-in interface to provide functionality such as * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file - * system. These functions provide means to control the interface suing semihost + * system. These functions provide means to control the interface using semihost * calls it supports. */ diff --git a/platform/mbed_mem_trace.h b/platform/mbed_mem_trace.h index 28760b86074..12e2c104df7 100644 --- a/platform/mbed_mem_trace.h +++ b/platform/mbed_mem_trace.h @@ -1,9 +1,10 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /* mbed Microcontroller Library - * Copyright (c) 2006-2016 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/mbed_mktime.h b/platform/mbed_mktime.h index 58b76249696..21448eaaad0 100644 --- a/platform/mbed_mktime.h +++ b/platform/mbed_mktime.h @@ -1,8 +1,9 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /* mbed Microcontroller Library - * Copyright (c) 2017-2017 ARM Limited + * Copyright (c) 2017-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/mbed_mpu_mgmt.h b/platform/mbed_mpu_mgmt.h index 8364941d79e..c3a1cc96c26 100644 --- a/platform/mbed_mpu_mgmt.h +++ b/platform/mbed_mpu_mgmt.h @@ -1,4 +1,5 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_mpu_mgmt MPU management functions @@ -6,7 +7,7 @@ */ /* mbed Microcontroller Library - * Copyright (c) 2006-2018 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +24,7 @@ #ifndef MBED_MPU_MGMT_H #define MBED_MPU_MGMT_H -#include "mbed_toolchain.h" #include "hal/mpu_api.h" -#include #ifdef __cplusplus extern "C" { diff --git a/platform/mbed_poll.h b/platform/mbed_poll.h index 43d7cce57c5..e293f77edb3 100644 --- a/platform/mbed_poll.h +++ b/platform/mbed_poll.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2017 ARM Limited + * Copyright (c) 2017-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,7 +27,8 @@ namespace mbed { class FileHandle; -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_poll poll functions diff --git a/platform/mbed_power_mgmt.h b/platform/mbed_power_mgmt.h index 3b8791f2b1a..dc476ffaf70 100644 --- a/platform/mbed_power_mgmt.h +++ b/platform/mbed_power_mgmt.h @@ -1,4 +1,5 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_power_mgmt Power management functions @@ -6,7 +7,7 @@ */ /* mbed Microcontroller Library - * Copyright (c) 2006-2018 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,8 +25,8 @@ #ifndef MBED_POWER_MGMT_H #define MBED_POWER_MGMT_H -#include "hal/sleep_api.h" -#include "mbed_toolchain.h" + +#include "platform/mbed_toolchain.h" #include "hal/ticker_api.h" #include diff --git a/platform/mbed_preprocessor.h b/platform/mbed_preprocessor.h index 42685cda1c3..1b5607ef582 100644 --- a/platform/mbed_preprocessor.h +++ b/platform/mbed_preprocessor.h @@ -1,4 +1,5 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_preprocessor preprocessor macros @@ -6,7 +7,7 @@ */ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/mbed_retarget.h b/platform/mbed_retarget.h index 5875d0474f8..f8aac6e9c4d 100644 --- a/platform/mbed_retarget.h +++ b/platform/mbed_retarget.h @@ -1,6 +1,6 @@ /* * mbed Microcontroller Library - * Copyright (c) 2006-2016 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -79,7 +79,8 @@ typedef unsigned int gid_t; ///< Group ID #include -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_retarget Retarget functions diff --git a/platform/mbed_rtc_time.h b/platform/mbed_rtc_time.h index 14ead3339f8..935ff8d3e2b 100644 --- a/platform/mbed_rtc_time.h +++ b/platform/mbed_rtc_time.h @@ -1,12 +1,13 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_rtc_time rtc_time functions * @{ */ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/mbed_semihost_api.h b/platform/mbed_semihost_api.h index dde34f8a53a..977696f3bac 100644 --- a/platform/mbed_semihost_api.h +++ b/platform/mbed_semihost_api.h @@ -1,6 +1,6 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +19,6 @@ #define MBED_SEMIHOST_H #include "device.h" -#include "platform/mbed_toolchain.h" #ifdef __cplusplus extern "C" { diff --git a/platform/mbed_stats.h b/platform/mbed_stats.h index 1f93f42d952..8bb8056830f 100644 --- a/platform/mbed_stats.h +++ b/platform/mbed_stats.h @@ -1,12 +1,13 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_stats stats functions * @{ */ /* mbed Microcontroller Library - * Copyright (c) 2016-2018 ARM Limited + * Copyright (c) 2016-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/mbed_toolchain.h b/platform/mbed_toolchain.h index 12c18b32419..04752ba4f1c 100644 --- a/platform/mbed_toolchain.h +++ b/platform/mbed_toolchain.h @@ -1,5 +1,6 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_toolchain Toolchain functions @@ -7,7 +8,7 @@ */ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +26,7 @@ #ifndef MBED_TOOLCHAIN_H #define MBED_TOOLCHAIN_H -#include "mbed_preprocessor.h" +#include "platform/mbed_preprocessor.h" // Warning for unsupported compilers diff --git a/platform/mbed_version.h b/platform/mbed_version.h index a1785793691..007c57a46e0 100644 --- a/platform/mbed_version.h +++ b/platform/mbed_version.h @@ -1,12 +1,13 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_version Version macros * @{ */ /* mbed Microcontroller Library - * Copyright (c) 2018 ARM Limited + * Copyright (c) 2018-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/mbed_wait_api.h b/platform/mbed_wait_api.h index f6e72266a88..edf5075f838 100644 --- a/platform/mbed_wait_api.h +++ b/platform/mbed_wait_api.h @@ -1,5 +1,6 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /** * \defgroup platform_wait_api wait_api functions @@ -7,7 +8,7 @@ */ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/platform.h b/platform/platform.h index 33a48c94996..da2431ab7d7 100644 --- a/platform/platform.h +++ b/platform/platform.h @@ -1,6 +1,4 @@ -/** \addtogroup platform */ -/** @{*/ /* mbed Microcontroller Library * Copyright (c) 2006-2013 ARM Limited * SPDX-License-Identifier: Apache-2.0 @@ -32,5 +30,3 @@ #include "PeripheralNames.h" #endif - -/** @}*/ diff --git a/platform/ATCmdParser.cpp b/platform/source/ATCmdParser.cpp similarity index 99% rename from platform/ATCmdParser.cpp rename to platform/source/ATCmdParser.cpp index 7ff2ae00ac9..7a54f55fbad 100644 --- a/platform/ATCmdParser.cpp +++ b/platform/source/ATCmdParser.cpp @@ -402,4 +402,3 @@ bool ATCmdParser::process_oob() } } - diff --git a/platform/CThunkBase.cpp b/platform/source/CThunkBase.cpp similarity index 98% rename from platform/CThunkBase.cpp rename to platform/source/CThunkBase.cpp index ce9271bc535..ddae39c4bc9 100644 --- a/platform/CThunkBase.cpp +++ b/platform/source/CThunkBase.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2018-2018 ARM Limited + * Copyright (c) 2018-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ #include "platform/mbed_error.h" -#include "CThunkBase.h" +#include "platform/internal/CThunkBase.h" MBED_STATIC_ASSERT(MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX < 256, "MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX must be less than 256"); MBED_STATIC_ASSERT(MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX > 0, "MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX must be greater than 0"); diff --git a/platform/CallChain.cpp b/platform/source/CallChain.cpp similarity index 98% rename from platform/CallChain.cpp rename to platform/source/CallChain.cpp index db8be12f7ec..90d00acd02c 100644 --- a/platform/CallChain.cpp +++ b/platform/source/CallChain.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited + * Copyright (c) 2018-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/source/CriticalSectionLock.cpp b/platform/source/CriticalSectionLock.cpp new file mode 100644 index 00000000000..61e775ce391 --- /dev/null +++ b/platform/source/CriticalSectionLock.cpp @@ -0,0 +1,53 @@ +/* mbed Microcontroller Library + * Copyright (c) 2017-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "platform/CriticalSectionLock.h" + +#include "platform/mbed_critical.h" + +namespace mbed { + +CriticalSectionLock::CriticalSectionLock() +{ + core_util_critical_section_enter(); +} + +CriticalSectionLock::~CriticalSectionLock() +{ + core_util_critical_section_exit(); +} + +void CriticalSectionLock::lock() +{ + core_util_critical_section_enter(); +} + +void CriticalSectionLock::unlock() +{ + core_util_critical_section_exit(); +} + +void CriticalSectionLock::enable() +{ + core_util_critical_section_enter(); +} + +void CriticalSectionLock::disable() +{ + core_util_critical_section_exit(); +} + +} // namespace mbed diff --git a/platform/source/DeepSleepLock.cpp b/platform/source/DeepSleepLock.cpp new file mode 100644 index 00000000000..fac9c6fe8b0 --- /dev/null +++ b/platform/source/DeepSleepLock.cpp @@ -0,0 +1,62 @@ +/* mbed Microcontroller Library + * Copyright (c) 2017-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "platform/DeepSleepLock.h" + +#include "platform/mbed_atomic.h" +#include "platform/mbed_critical.h" +#include "platform/mbed_error.h" +#include "platform/mbed_power_mgmt.h" + +namespace mbed { + +DeepSleepLock::DeepSleepLock(): _lock_count(1) +{ + sleep_manager_lock_deep_sleep(); +} + +DeepSleepLock::~DeepSleepLock() +{ + if (_lock_count) { + sleep_manager_unlock_deep_sleep(); + } +} + +void DeepSleepLock::lock() +{ + uint16_t count = core_util_atomic_incr_u16(&_lock_count, 1); + if (1 == count) { + sleep_manager_lock_deep_sleep(); + } + if (0 == count) { + MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_OVERFLOW), "DeepSleepLock overflow (> USHRT_MAX)", count); + } +} + +void DeepSleepLock::unlock() +{ + uint16_t count = core_util_atomic_decr_u16(&_lock_count, 1); + if (count == 0) { + sleep_manager_unlock_deep_sleep(); + } + if (count == USHRT_MAX) { + core_util_critical_section_exit(); + MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_UNDERFLOW), "DeepSleepLock underflow (< 0)", count); + } +} + +} // namespace mbed diff --git a/platform/FileBase.cpp b/platform/source/FileBase.cpp similarity index 99% rename from platform/FileBase.cpp rename to platform/source/FileBase.cpp index 7a6f0a32b71..cc0be5b62c8 100644 --- a/platform/FileBase.cpp +++ b/platform/source/FileBase.cpp @@ -127,4 +127,3 @@ PathType FileBase::getPathType(void) } } // namespace mbed - diff --git a/platform/FileHandle.cpp b/platform/source/FileHandle.cpp similarity index 87% rename from platform/FileHandle.cpp rename to platform/source/FileHandle.cpp index be8b9cef45d..8f103489296 100644 --- a/platform/FileHandle.cpp +++ b/platform/source/FileHandle.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2016 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,9 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "FileHandle.h" -#include "platform/mbed_retarget.h" -#include "platform/mbed_critical.h" +#include "platform/FileHandle.h" namespace mbed { diff --git a/platform/FilePath.cpp b/platform/source/FilePath.cpp similarity index 100% rename from platform/FilePath.cpp rename to platform/source/FilePath.cpp diff --git a/platform/FileSystemHandle.cpp b/platform/source/FileSystemHandle.cpp similarity index 93% rename from platform/FileSystemHandle.cpp rename to platform/source/FileSystemHandle.cpp index 24dc0b2acb6..836c48f8ef6 100644 --- a/platform/FileSystemHandle.cpp +++ b/platform/source/FileSystemHandle.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,8 +15,7 @@ * limitations under the License. */ -#include "FileSystemHandle.h" -#include +#include "platform/FileSystemHandle.h" namespace mbed { diff --git a/platform/LocalFileSystem.cpp b/platform/source/LocalFileSystem.cpp similarity index 100% rename from platform/LocalFileSystem.cpp rename to platform/source/LocalFileSystem.cpp diff --git a/platform/Stream.cpp b/platform/source/Stream.cpp similarity index 100% rename from platform/Stream.cpp rename to platform/source/Stream.cpp diff --git a/platform/mbed_alloc_wrappers.cpp b/platform/source/mbed_alloc_wrappers.cpp similarity index 100% rename from platform/mbed_alloc_wrappers.cpp rename to platform/source/mbed_alloc_wrappers.cpp diff --git a/platform/mbed_application.c b/platform/source/mbed_application.c similarity index 99% rename from platform/mbed_application.c rename to platform/source/mbed_application.c index 53eb08d7ef4..5cd70c6c4dd 100644 --- a/platform/mbed_application.c +++ b/platform/source/mbed_application.c @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2017-2017 ARM Limited + * Copyright (c) 2017 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/mbed_assert.c b/platform/source/mbed_assert.c similarity index 92% rename from platform/mbed_assert.c rename to platform/source/mbed_assert.c index 0871bab9e91..d0e8f78b9e6 100644 --- a/platform/mbed_assert.c +++ b/platform/source/mbed_assert.c @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,11 +18,9 @@ #include #include "platform/mbed_assert.h" -#include "platform/mbed_critical.h" #include "platform/mbed_error.h" MBED_NORETURN void mbed_assert_internal(const char *expr, const char *file, int line) { mbed_error(MBED_ERROR_ASSERTION_FAILED, expr, 0, file, line); } - diff --git a/platform/internal/mbed_atomic_impl.c b/platform/source/mbed_atomic_impl.c similarity index 100% rename from platform/internal/mbed_atomic_impl.c rename to platform/source/mbed_atomic_impl.c diff --git a/platform/mbed_board.c b/platform/source/mbed_board.c similarity index 100% rename from platform/mbed_board.c rename to platform/source/mbed_board.c diff --git a/platform/mbed_crash_data_offsets.h b/platform/source/mbed_crash_data_offsets.h similarity index 93% rename from platform/mbed_crash_data_offsets.h rename to platform/source/mbed_crash_data_offsets.h index 657682ce421..c29f5cd3d87 100644 --- a/platform/mbed_crash_data_offsets.h +++ b/platform/source/mbed_crash_data_offsets.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ #ifndef MBED_CRASH_DATA_INFO_H #define MBED_CRASH_DATA_INFO_H -#include "platform/mbed_retarget.h" -#include "platform/mbed_toolchain.h" - #ifdef __cplusplus extern "C" { #endif #if MBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED +/** \ingroup mbed-os-internal */ +/** \addtogroup platform-internal-api */ +/** @{*/ #if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) extern uint32_t Image$$RW_m_crash_data$$ZI$$Base[]; extern uint32_t Image$$RW_m_crash_data$$ZI$$Size; @@ -43,6 +43,7 @@ extern uint32_t __CRASH_DATA_RAM_END__[]; #define ERROR_CONTEXT_SIZE (0x80 / 4) //32 words(128 bytes) bytes for Error Context #define FAULT_CONTEXT_LOCATION (__CRASH_DATA_RAM_START__ + FAULT_CONTEXT_OFFSET) #define ERROR_CONTEXT_LOCATION (__CRASH_DATA_RAM_START__ + ERROR_CONTEXT_OFFSET) +/**@}*/ #endif #ifdef __cplusplus @@ -50,6 +51,3 @@ extern uint32_t __CRASH_DATA_RAM_END__[]; #endif #endif - - - diff --git a/platform/mbed_critical.c b/platform/source/mbed_critical.c similarity index 95% rename from platform/mbed_critical.c rename to platform/source/mbed_critical.c index 4fe7e6abff7..8d2ded86999 100644 --- a/platform/mbed_critical.c +++ b/platform/source/mbed_critical.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2015-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -22,7 +22,6 @@ #include "cmsis.h" #include "platform/mbed_assert.h" #include "platform/mbed_critical.h" -#include "platform/mbed_toolchain.h" static uint32_t critical_section_reentrancy_counter = 0; diff --git a/platform/mbed_error.c b/platform/source/mbed_error.c similarity index 99% rename from platform/mbed_error.c rename to platform/source/mbed_error.c index b50b86b8ab4..3ffc22f5b1f 100644 --- a/platform/mbed_error.c +++ b/platform/source/mbed_error.c @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,12 +18,11 @@ #include #include #include "device.h" -#include "platform/mbed_crash_data_offsets.h" -#include "platform/mbed_retarget.h" +#include "platform/source/mbed_crash_data_offsets.h" #include "platform/mbed_atomic.h" #include "platform/mbed_critical.h" #include "platform/mbed_error.h" -#include "platform/mbed_error_hist.h" +#include "platform/source/mbed_error_hist.h" #include "platform/mbed_interface.h" #include "platform/mbed_power_mgmt.h" #include "platform/mbed_stats.h" @@ -635,4 +634,3 @@ mbed_error_status_t mbed_save_error_hist(const char *path) return ret; } #endif - diff --git a/platform/mbed_error_hist.c b/platform/source/mbed_error_hist.c similarity index 95% rename from platform/mbed_error_hist.c rename to platform/source/mbed_error_hist.c index 9a618e5ddae..4a686885f72 100644 --- a/platform/mbed_error_hist.c +++ b/platform/source/mbed_error_hist.c @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,12 +18,10 @@ #include #include "device.h" #include "platform/mbed_error.h" -#include "platform/mbed_toolchain.h" #include "platform/mbed_critical.h" -#include "platform/mbed_interface.h" #if MBED_CONF_PLATFORM_ERROR_HIST_ENABLED -#include "platform/mbed_error_hist.h" +#include "platform/source/mbed_error_hist.h" static mbed_error_ctx mbed_error_ctx_log[MBED_CONF_PLATFORM_ERROR_HIST_SIZE] = {0}; static int error_log_count = -1; diff --git a/platform/mbed_error_hist.h b/platform/source/mbed_error_hist.h similarity index 97% rename from platform/mbed_error_hist.h rename to platform/source/mbed_error_hist.h index 791b562b655..0bec541ca3d 100644 --- a/platform/mbed_error_hist.h +++ b/platform/source/mbed_error_hist.h @@ -28,6 +28,11 @@ #ifdef __cplusplus extern "C" { #endif + +/** \ingroup mbed-os-internal */ +/** \addtogroup platform-internal-api */ +/** @{*/ + /* * Puts/Adds an error entry into the error history list * @@ -112,6 +117,6 @@ mbed_error_status_t mbed_save_error_hist(const char *path); } #endif -#endif - +/**@}*/ +#endif diff --git a/platform/mbed_interface.c b/platform/source/mbed_interface.c similarity index 94% rename from platform/mbed_interface.c rename to platform/source/mbed_interface.c index ddacbb99ae0..d275537c50c 100644 --- a/platform/mbed_interface.c +++ b/platform/source/mbed_interface.c @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,11 +17,7 @@ #include #include "platform/mbed_interface.h" -#include "hal/gpio_api.h" -#include "platform/mbed_wait_api.h" #include "platform/mbed_semihost_api.h" -#include "platform/mbed_error.h" -#include "platform/mbed_toolchain.h" #if DEVICE_SEMIHOST diff --git a/platform/mbed_mem_trace.cpp b/platform/source/mbed_mem_trace.cpp similarity index 98% rename from platform/mbed_mem_trace.cpp rename to platform/source/mbed_mem_trace.cpp index 8ba4dd80956..75a61c4c9ae 100644 --- a/platform/mbed_mem_trace.cpp +++ b/platform/source/mbed_mem_trace.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2016 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +19,6 @@ #include #include #include "platform/mbed_mem_trace.h" -#include "platform/mbed_critical.h" #include "platform/SingletonPtr.h" #include "platform/PlatformMutex.h" @@ -152,4 +151,3 @@ void mbed_mem_trace_default_callback(uint8_t op, void *res, void *caller, ...) } va_end(va); } - diff --git a/platform/mbed_mktime.c b/platform/source/mbed_mktime.c similarity index 98% rename from platform/mbed_mktime.c rename to platform/source/mbed_mktime.c index 7c282325a44..9691fd23a05 100644 --- a/platform/mbed_mktime.c +++ b/platform/source/mbed_mktime.c @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2017-2017 ARM Limited + * Copyright (c) 2017-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "mbed_mktime.h" +#include "platform/mbed_mktime.h" /* Time constants. */ #define SECONDS_BY_MINUTES 60 diff --git a/platform/mbed_mpu_mgmt.c b/platform/source/mbed_mpu_mgmt.c similarity index 96% rename from platform/mbed_mpu_mgmt.c rename to platform/source/mbed_mpu_mgmt.c index d34eb30aa5e..ebdfb2d5fac 100644 --- a/platform/mbed_mpu_mgmt.c +++ b/platform/source/mbed_mpu_mgmt.c @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2018 ARM Limited + * Copyright (c) 2018-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ #include "platform/mbed_mpu_mgmt.h" #include "platform/mbed_critical.h" #include "platform/mbed_assert.h" -#include "hal/mpu_api.h" #include +#include #if DEVICE_MPU && MBED_CONF_PLATFORM_USE_MPU diff --git a/platform/mbed_poll.cpp b/platform/source/mbed_poll.cpp similarity index 100% rename from platform/mbed_poll.cpp rename to platform/source/mbed_poll.cpp diff --git a/platform/mbed_sleep_manager.c b/platform/source/mbed_power_mgmt.c similarity index 96% rename from platform/mbed_sleep_manager.c rename to platform/source/mbed_power_mgmt.c index 01ce380a396..9d7724aea3f 100644 --- a/platform/mbed_sleep_manager.c +++ b/platform/source/mbed_power_mgmt.c @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2017 ARM Limited + * Copyright (c) 2017-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,14 +15,14 @@ * limitations under the License. */ -#include "mbed_power_mgmt.h" -#include "mbed_interface.h" -#include "mbed_atomic.h" -#include "mbed_critical.h" -#include "mbed_assert.h" -#include "mbed_error.h" -#include "mbed_stats.h" +#include "platform/mbed_power_mgmt.h" +#include "platform/mbed_interface.h" +#include "platform/mbed_atomic.h" +#include "platform/mbed_critical.h" +#include "platform/mbed_error.h" +#include "platform/mbed_stats.h" +#include "hal/sleep_api.h" #include "hal/us_ticker_api.h" #include "hal/lp_ticker_api.h" #include "platform/mbed_wait_api.h" diff --git a/platform/mbed_retarget.cpp b/platform/source/mbed_retarget.cpp similarity index 99% rename from platform/mbed_retarget.cpp rename to platform/source/mbed_retarget.cpp index fa4951bfbb1..b55902a4e2b 100644 --- a/platform/mbed_retarget.cpp +++ b/platform/source/mbed_retarget.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2015 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,14 +26,12 @@ #include "platform/SingletonPtr.h" #include "platform/PlatformMutex.h" #include "platform/mbed_error.h" -#include "platform/mbed_stats.h" #include "platform/mbed_atomic.h" #include "platform/mbed_critical.h" #include "platform/mbed_poll.h" -#include "platform/PlatformMutex.h" #include "drivers/UARTSerial.h" -#include "us_ticker_api.h" -#include "lp_ticker_api.h" +#include "hal/us_ticker_api.h" +#include "hal/lp_ticker_api.h" #include #include #include diff --git a/platform/mbed_rtc_time.cpp b/platform/source/mbed_rtc_time.cpp similarity index 97% rename from platform/mbed_rtc_time.cpp rename to platform/source/mbed_rtc_time.cpp index b481ef908b5..2465ae2bbc4 100644 --- a/platform/mbed_rtc_time.cpp +++ b/platform/source/mbed_rtc_time.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +16,6 @@ */ #include "hal/rtc_api.h" -#include "platform/mbed_critical.h" #include "platform/mbed_rtc_time.h" #include "platform/SingletonPtr.h" #include "platform/PlatformMutex.h" diff --git a/platform/mbed_sdk_boot.c b/platform/source/mbed_sdk_boot.c similarity index 100% rename from platform/mbed_sdk_boot.c rename to platform/source/mbed_sdk_boot.c diff --git a/platform/mbed_semihost_api.c b/platform/source/mbed_semihost_api.c similarity index 99% rename from platform/mbed_semihost_api.c rename to platform/source/mbed_semihost_api.c index c9975519fc6..f88c1fbf51a 100644 --- a/platform/mbed_semihost_api.c +++ b/platform/source/mbed_semihost_api.c @@ -181,4 +181,3 @@ int semihost_disabledebug(void) } #endif - diff --git a/platform/mbed_stats.c b/platform/source/mbed_stats.c similarity index 86% rename from platform/mbed_stats.c rename to platform/source/mbed_stats.c index e2d0a6bf001..f7d9ad101d1 100644 --- a/platform/mbed_stats.c +++ b/platform/source/mbed_stats.c @@ -1,7 +1,23 @@ -#include "mbed_assert.h" -#include "mbed_stats.h" -#include "mbed_power_mgmt.h" -#include "mbed_version.h" +/* mbed Microcontroller Library + * Copyright (c) 2006-2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "platform/mbed_assert.h" +#include "platform/mbed_stats.h" +#include "platform/mbed_power_mgmt.h" +#include "platform/mbed_version.h" #include #include diff --git a/platform/mbed_wait_api_no_rtos.c b/platform/source/mbed_wait_api_no_rtos.c similarity index 100% rename from platform/mbed_wait_api_no_rtos.c rename to platform/source/mbed_wait_api_no_rtos.c diff --git a/platform/mbed_wait_api_rtos.cpp b/platform/source/mbed_wait_api_rtos.cpp similarity index 97% rename from platform/mbed_wait_api_rtos.cpp rename to platform/source/mbed_wait_api_rtos.cpp index da2c0f464eb..163054753bb 100644 --- a/platform/mbed_wait_api_rtos.cpp +++ b/platform/source/mbed_wait_api_rtos.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,7 +28,6 @@ #include "platform/mbed_critical.h" #include "platform/mbed_power_mgmt.h" #include "platform/mbed_error.h" -#include "rtos/ThisThread.h" void wait(float s) { @@ -67,4 +66,3 @@ void wait_ms(int ms) } #endif // #if MBED_CONF_RTOS_PRESENT - diff --git a/platform/toolchain.h b/platform/toolchain.h index cf561fca75e..c69c981178a 100644 --- a/platform/toolchain.h +++ b/platform/toolchain.h @@ -1,8 +1,9 @@ -/** \addtogroup platform */ +/** \ingroup mbed-os-public */ +/** \addtogroup platform-public-api */ /** @{*/ /* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/rtos/ConditionVariable.h b/rtos/ConditionVariable.h index 35ecbf57096..7bd46049eec 100644 --- a/rtos/ConditionVariable.h +++ b/rtos/ConditionVariable.h @@ -1,5 +1,5 @@ /* Mbed Microcontroller Library - * Copyright (c) 2017-2018 ARM Limited + * Copyright (c) 2017-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -32,10 +32,15 @@ #if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) namespace rtos { -/** \addtogroup rtos */ +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api RTOS */ /** @{*/ struct Waiter; +/** + * \defgroup rtos_ConditionVariable ConditionVariable class + * @{ + */ /** The ConditionVariable class is a synchronization primitive that allows * threads to wait until a particular condition occurs. @@ -327,9 +332,9 @@ class ConditionVariable : private mbed::NonCopyable { #endif // !defined(DOXYGEN_ONLY) }; -} +/** @}*/ +/** @}*/ +} // namespace rtos #endif #endif - -/** @}*/ diff --git a/rtos/EventFlags.h b/rtos/EventFlags.h index 2ac7c1ee2fd..e4db8efa8c6 100644 --- a/rtos/EventFlags.h +++ b/rtos/EventFlags.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2017 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,7 +30,8 @@ #include "platform/NonCopyable.h" namespace rtos { -/** \addtogroup rtos */ +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api */ /** @{*/ /** * \defgroup rtos_EventFlags EventFlags class @@ -127,4 +128,3 @@ class EventFlags : private mbed::NonCopyable { } #endif - diff --git a/rtos/Kernel.h b/rtos/Kernel.h index 5a73aadf408..b5a4ad4086b 100644 --- a/rtos/Kernel.h +++ b/rtos/Kernel.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2017 ARM Limited + * Copyright (c) 2017-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,7 +26,8 @@ #include "rtos/mbed_rtos_types.h" namespace rtos { -/** \addtogroup rtos */ +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api */ /** @{*/ /** Functions in the Kernel namespace control RTOS kernel information. */ @@ -60,7 +61,6 @@ void attach_thread_terminate_hook(void (*fptr)(osThreadId_t id)); } // namespace Kernel +/** @}*/ } // namespace rtos #endif - -/** @}*/ diff --git a/rtos/Mail.h b/rtos/Mail.h index 67b6b0212a4..a747a9e6649 100644 --- a/rtos/Mail.h +++ b/rtos/Mail.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2017 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -41,7 +41,8 @@ using namespace rtos; #if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) namespace rtos { -/** \addtogroup rtos */ +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api */ /** @{*/ /** * \defgroup rtos_Mail Mail class diff --git a/rtos/MemoryPool.h b/rtos/MemoryPool.h index 6196096a84a..595734b952c 100644 --- a/rtos/MemoryPool.h +++ b/rtos/MemoryPool.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2012 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,10 +29,14 @@ #include "rtos/mbed_rtos1_types.h" #include "rtos/mbed_rtos_storage.h" #include "platform/NonCopyable.h" +#include "platform/mbed_assert.h" +#include "Kernel.h" + #if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) namespace rtos { -/** \addtogroup rtos */ +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api */ /** @{*/ /** * \defgroup rtos_MemoryPool MemoryPool class diff --git a/rtos/Mutex.h b/rtos/Mutex.h index 2a48e2dec24..34d5f58a41a 100644 --- a/rtos/Mutex.h +++ b/rtos/Mutex.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2012 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -32,7 +32,8 @@ #include "platform/mbed_toolchain.h" namespace rtos { -/** \addtogroup rtos */ +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api */ /** @{*/ class Mutex; @@ -227,5 +228,3 @@ inline void Mutex::unlock() /** @}*/ } #endif - - diff --git a/rtos/Queue.h b/rtos/Queue.h index 7e0149634fb..42fb49219a4 100644 --- a/rtos/Queue.h +++ b/rtos/Queue.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2012 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -31,7 +31,8 @@ #if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) namespace rtos { -/** \addtogroup rtos */ +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api */ /** @{*/ /** * \defgroup rtos_Queue Queue class diff --git a/rtos/RtosTimer.h b/rtos/RtosTimer.h index dfff7955746..3628722ef57 100644 --- a/rtos/RtosTimer.h +++ b/rtos/RtosTimer.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2012 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -33,7 +33,8 @@ #if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) namespace rtos { -/** \addtogroup rtos */ +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api */ /** @{*/ /** * \defgroup rtos_RtosTimer RtosTimer class diff --git a/rtos/Semaphore.h b/rtos/Semaphore.h index 8b89e7b48d3..f3dba32ec76 100644 --- a/rtos/Semaphore.h +++ b/rtos/Semaphore.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2012 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,7 +30,8 @@ #include "platform/NonCopyable.h" namespace rtos { -/** \addtogroup rtos */ +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api */ /** @{*/ /** * \defgroup rtos_Semaphore Semaphore class @@ -156,5 +157,3 @@ class Semaphore : private mbed::NonCopyable { /** @}*/ } #endif - - diff --git a/rtos/TARGET_CORTEX/mbed_boot.h b/rtos/TARGET_CORTEX/mbed_boot.h index 65f7af6fcbe..1be08b59a19 100644 --- a/rtos/TARGET_CORTEX/mbed_boot.h +++ b/rtos/TARGET_CORTEX/mbed_boot.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2018-2018 ARM Limited + * Copyright (c) 2018-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,6 +25,10 @@ extern "C" { #include "mbed_rtx.h" +/** \ingroup mbed-os-internal */ +/** \addtogroup rtos-internal-api */ +/** @{*/ + /** * \defgroup boot Boot sequence * Boot sequence overview @@ -158,6 +162,7 @@ void mbed_sdk_init(void); */ void mbed_main(void); +/**@}*/ /**@}*/ #ifdef __cplusplus diff --git a/rtos/TARGET_CORTEX/mbed_rtx_handlers.c b/rtos/TARGET_CORTEX/mbed_rtx_handlers.c index 31ce7f81d70..b5e46f812e8 100644 --- a/rtos/TARGET_CORTEX/mbed_rtx_handlers.c +++ b/rtos/TARGET_CORTEX/mbed_rtx_handlers.c @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2016 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,8 +22,8 @@ #include "mbed_error.h" #include "mbed_interface.h" #include "RTX_Config.h" -#include "rtos/rtos_handlers.h" -#include "rtos/rtos_idle.h" +#include "rtos/source/rtos_handlers.h" +#include "rtos/source/rtos_idle.h" #ifdef RTE_Compiler_EventRecorder #include "EventRecorder.h" // Keil::Compiler:Event Recorder diff --git a/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp b/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp index 6d4431d8d9c..27b6d5e4786 100644 --- a/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp +++ b/rtos/TARGET_CORTEX/mbed_rtx_idle.cpp @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2012 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -20,7 +20,7 @@ * SOFTWARE. */ -#include "rtos/rtos_idle.h" +#include "rtos/source/rtos_idle.h" #include "platform/mbed_power_mgmt.h" #include "platform/mbed_os_timer.h" #include "TimerEvent.h" diff --git a/rtos/TARGET_CORTEX/mbed_rtx_storage.h b/rtos/TARGET_CORTEX/mbed_rtx_storage.h index d14f78abc2e..3fd01bcc508 100644 --- a/rtos/TARGET_CORTEX/mbed_rtx_storage.h +++ b/rtos/TARGET_CORTEX/mbed_rtx_storage.h @@ -26,31 +26,48 @@ extern "C" { #endif -/** \addtogroup rtos */ -/** @{*/ +#include "rtx_os.h" +#include "mbed_rtx_conf.h" -/** @brief RTOS primitives storage types for RTX +/** \ingroup mbed-os-internal */ +/** \addtogroup rtos-internal-api */ +/** @{*/ +/** \defgroup rtos_storage RTOS primitives storage types for RTX Types defined in this file should be utilized, when the direct RTOS C API usage is required, to provide backing memory for internal RTX data. Allocated object should be wrapped in attribute struct and passed to os*New call, for details see CMSIS-RTOS2 documentation. - @note This file breaks abstraction layers and uses RTX internal types, but it limits the contamination to single, RTOS implementation specific, header file, therefore limiting scope of possible changes. - */ - -#include "rtx_os.h" -#include "mbed_rtx_conf.h" + @{ +*/ +/** RTX Mutex storage */ typedef osRtxMutex_t mbed_rtos_storage_mutex_t; + +/** RTX Semaphore storage */ typedef osRtxSemaphore_t mbed_rtos_storage_semaphore_t; + +/** RTX Thread storage */ typedef osRtxThread_t mbed_rtos_storage_thread_t; + +/** RTX Memory Pool storage */ typedef osRtxMemoryPool_t mbed_rtos_storage_mem_pool_t; + +/** RTX Message Queue storage */ typedef osRtxMessageQueue_t mbed_rtos_storage_msg_queue_t; + +/** RTX Event Flags storage */ typedef osRtxEventFlags_t mbed_rtos_storage_event_flags_t; + +/** RTX Message storage */ typedef osRtxMessage_t mbed_rtos_storage_message_t; + +/** RTX Timer storage */ typedef osRtxTimer_t mbed_rtos_storage_timer_t; +/** @}*/ +/** @}*/ #define MBED_RTOS_STORAGE_MEM_POOL_MEM_SIZE(block_count, block_size) \ osRtxMemoryPoolMemSize(block_count, block_size) @@ -60,5 +77,3 @@ typedef osRtxTimer_t mbed_rtos_storage_timer_t; #endif #endif - -/** @}*/ diff --git a/rtos/ThisThread.h b/rtos/ThisThread.h index b3a67a62f28..f4dbc4ace00 100644 --- a/rtos/ThisThread.h +++ b/rtos/ThisThread.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2018 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,7 +26,8 @@ #include "rtos/mbed_rtos_types.h" namespace rtos { -/** \addtogroup rtos */ +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api */ /** @{*/ /** * \defgroup rtos_ThisThread ThisThread namespace @@ -198,5 +199,3 @@ bool non_rtos_check_flags(void *handle); } } #endif - - diff --git a/rtos/Thread.h b/rtos/Thread.h index f272a5d6009..3d90b76e235 100644 --- a/rtos/Thread.h +++ b/rtos/Thread.h @@ -1,5 +1,5 @@ /* mbed Microcontroller Library - * Copyright (c) 2006-2012 ARM Limited + * Copyright (c) 2006-2019 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -35,7 +35,8 @@ #if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) || defined(UNITTEST) namespace rtos { -/** \addtogroup rtos */ +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api */ /** @{*/ /** * \defgroup rtos_Thread Thread class diff --git a/rtos/rtos.h b/rtos/rtos.h index b480d25dfcc..22bc2318a94 100644 --- a/rtos/rtos.h +++ b/rtos/rtos.h @@ -1,6 +1,4 @@ -/** \addtogroup rtos */ -/** @{*/ /* mbed Microcontroller Library * Copyright (c) 2006-2012 ARM Limited * @@ -38,12 +36,12 @@ #include "rtos/EventFlags.h" #include "rtos/ConditionVariable.h" +/** \ingroup mbed-os-public */ +/** \addtogroup rtos-public-api */ +/** @{*/ #ifndef MBED_NO_GLOBAL_USING_DIRECTIVE using namespace rtos; #endif - -#include "platform/mbed_version.h" +/** @}*/ #endif - -/** @}*/ diff --git a/rtos/ConditionVariable.cpp b/rtos/source/ConditionVariable.cpp similarity index 98% rename from rtos/ConditionVariable.cpp rename to rtos/source/ConditionVariable.cpp index f4e03701d58..87810464eaf 100644 --- a/rtos/ConditionVariable.cpp +++ b/rtos/source/ConditionVariable.cpp @@ -23,8 +23,8 @@ #include "rtos/Kernel.h" #include "rtos/ThisThread.h" -#include "mbed_error.h" -#include "mbed_assert.h" +#include "platform/mbed_error.h" +#include "platform/mbed_assert.h" #if MBED_CONF_RTOS_PRESENT diff --git a/rtos/EventFlags.cpp b/rtos/source/EventFlags.cpp similarity index 98% rename from rtos/EventFlags.cpp rename to rtos/source/EventFlags.cpp index df4a273e26a..7543fb647f4 100644 --- a/rtos/EventFlags.cpp +++ b/rtos/source/EventFlags.cpp @@ -23,8 +23,8 @@ #include "rtos/ThisThread.h" #include "mbed_os_timer.h" #include -#include "mbed_error.h" -#include "mbed_assert.h" +#include "platform/mbed_error.h" +#include "platform/mbed_assert.h" namespace rtos { diff --git a/rtos/Kernel.cpp b/rtos/source/Kernel.cpp similarity index 98% rename from rtos/Kernel.cpp rename to rtos/source/Kernel.cpp index 21664292a15..e5e34433000 100644 --- a/rtos/Kernel.cpp +++ b/rtos/source/Kernel.cpp @@ -21,8 +21,8 @@ */ #include "rtos/Kernel.h" -#include "rtos/rtos_idle.h" -#include "rtos/rtos_handlers.h" +#include "rtos_idle.h" +#include "rtos_handlers.h" #include "platform/mbed_critical.h" #include "platform/mbed_os_timer.h" diff --git a/rtos/Mutex.cpp b/rtos/source/Mutex.cpp similarity index 98% rename from rtos/Mutex.cpp rename to rtos/source/Mutex.cpp index 8316168b6cc..7752f6670cd 100644 --- a/rtos/Mutex.cpp +++ b/rtos/source/Mutex.cpp @@ -23,8 +23,8 @@ #include "rtos/Kernel.h" #include -#include "mbed_error.h" -#include "mbed_assert.h" +#include "platform/mbed_error.h" +#include "platform/mbed_assert.h" #if MBED_CONF_RTOS_PRESENT diff --git a/rtos/RtosTimer.cpp b/rtos/source/RtosTimer.cpp similarity index 100% rename from rtos/RtosTimer.cpp rename to rtos/source/RtosTimer.cpp diff --git a/rtos/Semaphore.cpp b/rtos/source/Semaphore.cpp similarity index 100% rename from rtos/Semaphore.cpp rename to rtos/source/Semaphore.cpp diff --git a/rtos/ThisThread.cpp b/rtos/source/ThisThread.cpp similarity index 99% rename from rtos/ThisThread.cpp rename to rtos/source/ThisThread.cpp index 4d7fb052e31..0ee2d73f297 100644 --- a/rtos/ThisThread.cpp +++ b/rtos/source/ThisThread.cpp @@ -252,5 +252,3 @@ const char *get_name() } } - - diff --git a/rtos/Thread.cpp b/rtos/source/Thread.cpp similarity index 99% rename from rtos/Thread.cpp rename to rtos/source/Thread.cpp index c3eb83dd50d..1a7a5f13773 100644 --- a/rtos/Thread.cpp +++ b/rtos/source/Thread.cpp @@ -21,8 +21,8 @@ */ #include "rtos/Thread.h" #include "rtos/ThisThread.h" -#include "rtos/rtos_idle.h" -#include "rtos/rtos_handlers.h" +#include "rtos_idle.h" +#include "rtos_handlers.h" #include "platform/mbed_assert.h" #include "platform/mbed_error.h" diff --git a/rtos/rtos_handlers.h b/rtos/source/rtos_handlers.h similarity index 95% rename from rtos/rtos_handlers.h rename to rtos/source/rtos_handlers.h index 351682b12b6..62b7d545bf6 100644 --- a/rtos/rtos_handlers.h +++ b/rtos/source/rtos_handlers.h @@ -1,6 +1,3 @@ - -/** \addtogroup rtos */ -/** @{*/ /* mbed Microcontroller Library * Copyright (c) 2006-2012 ARM Limited * @@ -31,6 +28,10 @@ extern "C" { #endif +/** \ingroup mbed-os-internal */ +/** \addtogroup rtos-internal-api RTOS */ +/** @{*/ + /** * \defgroup rtos_handlers RTOS hook functions * @{ @@ -42,12 +43,10 @@ extern "C" { */ void rtos_attach_thread_terminate_hook(void (*fptr)(osThreadId_t id)); /** @}*/ +/** @}*/ #ifdef __cplusplus } #endif #endif - -/** @}*/ - diff --git a/rtos/rtos_idle.h b/rtos/source/rtos_idle.h similarity index 95% rename from rtos/rtos_idle.h rename to rtos/source/rtos_idle.h index f1f5d6fc3dc..447f68a9d32 100644 --- a/rtos/rtos_idle.h +++ b/rtos/source/rtos_idle.h @@ -1,6 +1,3 @@ - -/** \addtogroup rtos */ -/** @{*/ /* mbed Microcontroller Library * Copyright (c) 2006-2012 ARM Limited * @@ -26,12 +23,16 @@ #define RTOS_IDLE_H #include "mbed_toolchain.h" -#include #ifdef __cplusplus extern "C" { #endif + +/** \ingroup mbed-os-internal */ +/** \addtogroup rtos-internal-api */ +/** @{*/ + /** * \defgroup rtos_Idle Idle hook function * @{ @@ -46,6 +47,7 @@ void rtos_attach_idle_hook(void (*fptr)(void)); /** @private */ MBED_NORETURN void rtos_idle_loop(void); +/** @}*/ /** @}*/ #ifdef __cplusplus @@ -53,6 +55,3 @@ MBED_NORETURN void rtos_idle_loop(void); #endif #endif - -/** @}*/ - diff --git a/tools/build_api.py b/tools/build_api.py index d4b94e24edd..8aeb3537c64 100755 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -1068,10 +1068,16 @@ def build_mbed_libs(target, toolchain_name, clean=False, macros=None, incdirs = cmsis_res.inc_dirs + hal_res.inc_dirs + library_incdirs + # Exclude USB related source files from Mbed OS 2 build as they contain + # references to RTOS API which is also not included. + exclude_paths = [join(MBED_DRIVERS, "source", "usb")] + # Build Things notify.info("Building library %s (%s, %s)" % ('MBED', target.name, toolchain_name)) - objects = toolchain.compile_sources(mbed_resources, incdirs) + objects = toolchain.compile_legacy_sources( + mbed_resources, incdirs, exclude_paths + ) separate_objects = [] for obj in objects: diff --git a/tools/test/build_api/build_api_test.py b/tools/test/build_api/build_api_test.py index 8b36d01ade6..b67ffae9278 100755 --- a/tools/test/build_api/build_api_test.py +++ b/tools/test/build_api/build_api_test.py @@ -20,8 +20,8 @@ from mock import patch, MagicMock from tools.build_api import prepare_toolchain, build_project, build_library from tools.regions import merge_region_list -from tools.resources import Resources -from tools.toolchains import TOOLCHAINS +from tools.resources import Resources, FileRef +from tools.toolchains import TOOLCHAINS, mbedToolchain from tools.notifier.mock import MockNotifier from tools.config import Region, Config, ConfigException from tools.utils import ToolException @@ -84,6 +84,53 @@ def test_always_complete_build(self, *_): assert any('percent' in msg and msg['percent'] == 100.0 for msg in notify.messages if msg) + @patch('tools.toolchains.arm.ARM_STD.parse_dependencies', + return_value=["foo"]) + @patch('tools.toolchains.mbedToolchain.need_update', + side_effect=[i % 2 for i in range(3000)]) + @patch('os.mkdir') + @patch('tools.toolchains.mbedToolchain.dump_build_profile') + @patch('tools.utils.run_cmd', return_value=(b'', b'', 0)) + def test_compile_legacy_sources_always_complete_build(self, *_): + """Test that compile_legacy_sources() completes.""" + notify = MockNotifier() + toolchain = prepare_toolchain(self.src_paths, self.build_path, self.target, + self.toolchain_name, notify=notify) + + res = Resources(MockNotifier()).scan_with_toolchain( + self.src_paths, toolchain) + + toolchain.RESPONSE_FILES=False + toolchain.config_processed = True + toolchain.config_file = "junk" + toolchain.compile_legacy_sources(res) + + assert any('percent' in msg and msg['percent'] == 100.0 + for msg in notify.messages if msg) + + def test_dirs_exclusion_from_file_to_compile(self): + """Test that dirs can be excluded from the build.""" + files_to_compile = [ + FileRef( + name="platform/TARGET_CORTEX_M/TOOLCHAIN_ARM/except.S", + path="./platform/TARGET_CORTEX_M/TOOLCHAIN_ARM/except.S", + ), + FileRef( + name="rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/targets_irq_cm4f.S", + path="./rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/targets_irq_cm4f.S", + ), + ] + exclude_dirs = ["platform/", "drivers/", "targets/"] + expected_compilation_queue = [ + FileRef( + name="rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/targets_irq_cm4f.S", + path="./rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/targets_irq_cm4f.S", + ) + ] + compilation_queue = mbedToolchain._exclude_files_from_build( + files_to_compile, exclude_dirs + ) + self.assertEqual(compilation_queue, expected_compilation_queue) @patch('tools.build_api.Config') def test_prepare_toolchain_app_config(self, mock_config_init): diff --git a/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws b/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws index b9058b661e2..c4b9cefb6ad 100644 --- a/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws +++ b/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws @@ -99,4 +99,5 @@ TCPSocket UDPSocket Socket unregister -_doxy_ \ No newline at end of file +deinit +_doxy_ diff --git a/tools/test/travis-ci/doxy-spellchecker/spell.sh b/tools/test/travis-ci/doxy-spellchecker/spell.sh index e56c33e646b..9574e69eb6a 100755 --- a/tools/test/travis-ci/doxy-spellchecker/spell.sh +++ b/tools/test/travis-ci/doxy-spellchecker/spell.sh @@ -20,6 +20,7 @@ while read file; do # matched. start_tokens=( "/@code" "/addtogroup" + "ingroup" "defgroup" "<" "()" @@ -28,6 +29,7 @@ while read file; do formats=( 'strip_between' 'strip_between' 'strip_line' + 'strip_line' 'strip_between_sameline' 'strip_token' ) @@ -35,6 +37,7 @@ while read file; do end_tokens=( "/@endcode" "/\*" "" + "" ">" "" ) diff --git a/tools/toolchains/mbed_toolchain.py b/tools/toolchains/mbed_toolchain.py index 91104722672..7352338831f 100755 --- a/tools/toolchains/mbed_toolchain.py +++ b/tools/toolchains/mbed_toolchain.py @@ -395,16 +395,49 @@ def get_arch_file(self, objects): cmd_list = (c.replace("\\", "/") for c in objects if c) return self.make_option_file(list(cmd_list), ".archive_files.txt") + def compile_legacy_sources( + self, resources, inc_dirs=None, exclude_dirs=None + ): + """Compile source files with option to exclude some directories. + + This method only exists to not break API compatibility and provide a + way to exclude directories for Mbed OS 2 builds. + """ + return self._compile_sources( + resources, inc_dirs=inc_dirs, exclude_dirs=exclude_dirs + ) + # THIS METHOD IS BEING CALLED BY THE MBED ONLINE BUILD SYSTEM # ANY CHANGE OF PARAMETERS OR RETURN VALUES WILL BREAK COMPATIBILITY def compile_sources(self, resources, inc_dirs=None): + """Compile source files.""" + return self._compile_sources(resources, inc_dirs=inc_dirs) + + @staticmethod + def _exclude_files_from_build(files_to_compile, exclude_dirs): + """Remove files from dirs to be excluded for the build.""" + return [ + file_to_compile + for file_to_compile in files_to_compile + if all( + exclude_dir not in file_to_compile.path + for exclude_dir in exclude_dirs + ) + ] + + def _compile_sources(self, resources, inc_dirs=None, exclude_dirs=None): # Web IDE progress bar for project build files_to_compile = ( resources.get_file_refs(FileType.ASM_SRC) + resources.get_file_refs(FileType.C_SRC) + resources.get_file_refs(FileType.CPP_SRC) ) - self.to_be_compiled = len(files_to_compile) + if exclude_dirs: + compilation_queue = self._exclude_files_from_build(files_to_compile, exclude_dirs) + else: + compilation_queue = files_to_compile + + self.to_be_compiled = len(compilation_queue) self.compiled = 0 self.notify.cc_verbose("Macros: " + ' '.join([ @@ -434,8 +467,8 @@ def compile_sources(self, resources, inc_dirs=None): self.dump_build_profile() # Sort compile queue for consistency - files_to_compile.sort() - for source in files_to_compile: + compilation_queue.sort() + for source in compilation_queue: object = self.relative_object_path(self.build_dir, source) # Queue mode (multiprocessing) diff --git a/usb/device/targets/TARGET_RENESAS/TARGET_RZ_A1XX/USBPhy_RZ_A1_Def.h b/usb/device/targets/TARGET_RENESAS/TARGET_RZ_A1XX/USBPhy_RZ_A1_Def.h index 5506260e585..f00f0847d80 100644 --- a/usb/device/targets/TARGET_RENESAS/TARGET_RZ_A1XX/USBPhy_RZ_A1_Def.h +++ b/usb/device/targets/TARGET_RENESAS/TARGET_RZ_A1XX/USBPhy_RZ_A1_Def.h @@ -498,7 +498,7 @@ /* Host L1 Control Register 1 */ /* HL1CTRL1 */ #define USB_L1STATUS (0x0006u) /* b2-1: L1 request completion state */ -#define USB_L1REQ (0x0001u) /* b0: L1 changes request bit +#define USB_L1REQ (0x0001u) /* b0: L1 changes request bit */ /* Host L1 Control Register 2 */ diff --git a/usb/device/targets/mbed_lib.json b/usb/device/targets/mbed_lib.json new file mode 100644 index 00000000000..7e1564fde37 --- /dev/null +++ b/usb/device/targets/mbed_lib.json @@ -0,0 +1,3 @@ +{ + "name": "usb-device-targets" +} diff --git a/usb/mbed_lib.json b/usb/mbed_lib.json deleted file mode 100644 index dc0cd0d8b62..00000000000 --- a/usb/mbed_lib.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "usb" -}