From aff49d8d1e3b5d4dc18286b0510336c36ae9603c Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Fri, 27 Jan 2017 05:10:28 -0600 Subject: [PATCH] Renamed files in platform to match source names critical.h -> mbed_critical.h sleep.h -> mbed_sleep.h toolchain.h -> mbed_toolchain.h rtc_time.h -> mbed_rtc_time.h semihost_api.h -> mbed_semihost_api.h wait_api.h -> mbed_wait_api.h --- TESTS/mbedmicro-mbed/attributes/attributes.c | 2 +- TESTS/mbedmicro-mbed/attributes/main.cpp | 2 +- TESTS/mbedmicro-mbed/attributes/weak.c | 2 +- TESTS/mbedmicro-mbed/static_assert/main.cpp | 2 +- drivers/DigitalIn.h | 2 +- drivers/DigitalInOut.h | 2 +- drivers/DigitalOut.h | 2 +- drivers/InterruptIn.h | 4 +- drivers/InterruptManager.cpp | 2 +- drivers/LocalFileSystem.cpp | 2 +- drivers/PortIn.h | 2 +- drivers/PortInOut.h | 2 +- drivers/PortOut.h | 2 +- drivers/PwmOut.h | 2 +- drivers/RawSerial.cpp | 2 +- drivers/SPI.cpp | 2 +- drivers/Serial.cpp | 2 +- drivers/SerialBase.cpp | 4 +- drivers/SerialBase.h | 2 +- drivers/Ticker.cpp | 2 +- drivers/Ticker.h | 2 +- drivers/Timer.cpp | 2 +- .../TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c | 2 +- .../stm32f4_eth_init.c | 2 +- features/frameworks/utest/mbed-utest-shim.cpp | 2 +- .../TARGET_SL_RAIL/NanostackRfPhyEfr32.cpp | 2 +- features/netsocket/Socket.h | 2 +- features/netsocket/SocketAddress.h | 2 +- .../unsupported/USBDevice/USBDevice/USBHAL.h | 2 +- .../USBHost/USBHost/USBHostTypes.h | 2 +- features/unsupported/fs/fat/FATFileSystem.cpp | 2 +- .../SerialHalfDuplex/SerialHalfDuplex.cpp | 2 +- features/unsupported/tests/mbed/file/main.cpp | 2 +- .../unsupported/tests/mbed/semihost/main.cpp | 2 +- .../tests/mbed/vtor_reloc/main.cpp | 2 +- .../tests/utest/general/general.cpp | 2 +- .../tests/utest/semihost_fs/semihost_fs.cpp | 2 +- .../flash_common_algo.c | 2 +- hal/mbed_ticker_api.c | 2 +- mbed.h | 8 +- platform/CallChain.cpp | 2 +- platform/CallChain.h | 2 +- platform/Callback.h | 2 +- platform/CircularBuffer.h | 2 +- platform/FunctionPointer.h | 2 +- platform/critical.h | 343 +---------------- platform/mbed_alloc_wrappers.cpp | 2 +- platform/mbed_assert.c | 2 +- platform/mbed_board.c | 6 +- platform/mbed_critical.c | 4 +- platform/mbed_critical.h | 359 ++++++++++++++++++ platform/mbed_error.c | 2 +- platform/mbed_interface.c | 6 +- platform/mbed_mem_trace.c | 2 +- platform/{retarget.cpp => mbed_retarget.cpp} | 4 +- platform/mbed_rtc_time.cpp | 4 +- platform/mbed_rtc_time.h | 92 +++++ platform/mbed_semihost_api.c | 2 +- platform/mbed_semihost_api.h | 98 +++++ platform/mbed_sleep.h | 85 +++++ platform/mbed_toolchain.h | 305 +++++++++++++++ platform/mbed_wait_api.h | 71 ++++ platform/mbed_wait_api_no_rtos.c | 2 +- platform/mbed_wait_api_rtos.cpp | 4 +- platform/rtc_time.h | 94 +---- platform/semihost_api.h | 98 +---- platform/sleep.h | 85 +---- platform/toolchain.h | 287 +------------- platform/wait_api.h | 71 +--- rtos/RtosTimer.h | 2 +- rtos/Thread.h | 2 +- rtos/rtos_idle.c | 2 +- .../TARGET_BEETLE/analogin_api.c | 2 +- .../TARGET_ARM_SSG/TARGET_BEETLE/i2c_api.c | 2 +- .../TARGET_ARM_SSG/TARGET_BEETLE/spi_api.c | 2 +- .../TARGET_IOTSS/SDK/ETH_MPS2.c | 2 +- .../TARGET_IOTSS/SDK/mps2_ethernet_api.c | 4 +- .../TARGET_IOTSS/ethernet_api.c | 4 +- targets/TARGET_ARM_SSG/TARGET_IOTSS/i2c_api.c | 2 +- targets/TARGET_ARM_SSG/TARGET_IOTSS/spi_api.c | 2 +- .../TARGET_ARM_SSG/TARGET_MPS2/SDK/ETH_MPS2.c | 2 +- .../TARGET_MPS2/SDK/mps2_ethernet_api.c | 4 +- .../TARGET_ARM_SSG/TARGET_MPS2/ethernet_api.c | 4 +- targets/TARGET_ARM_SSG/TARGET_MPS2/i2c_api.c | 2 +- targets/TARGET_ARM_SSG/TARGET_MPS2/spi_api.c | 2 +- .../TARGET_SAM_CortexM4/drivers/pmc/sleep.c | 2 +- .../TARGET_KLXX/TARGET_KL46Z/flash_api.c | 2 +- .../TARGET_MCU_K64F/flash_api.c | 2 +- .../TARGET_NORDIC/TARGET_MCU_NRF51822/sleep.c | 2 +- .../TARGET_MCU_NRF51822/us_ticker.c | 2 +- targets/TARGET_NORDIC/TARGET_NRF5/us_ticker.c | 2 +- targets/TARGET_NUVOTON/TARGET_M451/can_api.c | 2 +- targets/TARGET_NUVOTON/TARGET_M451/i2c_api.c | 2 +- .../TARGET_NUVOTON/TARGET_M451/lp_ticker.c | 2 +- targets/TARGET_NUVOTON/TARGET_M451/rtc_api.c | 2 +- .../TARGET_NUVOTON/TARGET_M451/us_ticker.c | 2 +- .../TARGET_NUVOTON/TARGET_NUC472/can_api.c | 2 +- .../TARGET_NUC472/crypto/aes/aes_alt.c | 2 +- .../TARGET_NUC472/crypto/des/des_alt.c | 2 +- .../TARGET_NUVOTON/TARGET_NUC472/i2c_api.c | 2 +- .../TARGET_NUVOTON/TARGET_NUC472/lp_ticker.c | 2 +- .../TARGET_NUVOTON/TARGET_NUC472/rtc_api.c | 2 +- .../TARGET_NUVOTON/TARGET_NUC472/us_ticker.c | 2 +- targets/TARGET_NXP/TARGET_LPC15XX/us_ticker.c | 2 +- .../TARGET_UBLOX_C027/C027_api.c | 2 +- .../TARGET_NXP/TARGET_LPC176X/ethernet_api.c | 2 +- .../TARGET_NXP/TARGET_LPC23XX/ethernet_api.c | 2 +- .../TARGET_NXP/TARGET_LPC2460/ethernet_api.c | 2 +- .../TARGET_LPC4088/ethernet_api.c | 2 +- .../TARGET_LPC4088_DM/ethernet_api.c | 2 +- .../TARGET_NXP/TARGET_LPC43XX/ethernet_api.c | 2 +- .../TARGET_ONSEMI/TARGET_NCS36510/i2c_api.c | 2 +- .../TARGET_NCS36510/ncs36510_i2c.c | 2 +- .../TARGET_NCS36510/ncs36510_trng_api.c | 2 +- targets/TARGET_ONSEMI/TARGET_NCS36510/sleep.c | 2 +- .../TARGET_RZ_A1H/ethernet_api.c | 2 +- .../TARGET_VK_RZ_A1H/ethernet_api.c | 2 +- .../TARGET_STM/TARGET_STM32F0/analogin_api.c | 2 +- .../TARGET_STM/TARGET_STM32F1/analogin_api.c | 2 +- .../TARGET_STM/TARGET_STM32F2/analogin_api.c | 2 +- .../TARGET_STM/TARGET_STM32F3/analogin_api.c | 2 +- .../TARGET_STM32F429xI/device/flash_api.c | 2 +- .../TARGET_STM32F439xI/device/flash_api.c | 2 +- .../TARGET_UBLOX_EVK_ODIN_W2/flash_api.c | 2 +- .../TARGET_STM/TARGET_STM32F4/analogin_api.c | 2 +- .../TARGET_STM/TARGET_STM32F7/analogin_api.c | 2 +- .../TARGET_STM/TARGET_STM32L0/analogin_api.c | 2 +- .../TARGET_STM/TARGET_STM32L1/analogin_api.c | 2 +- .../TARGET_STM/TARGET_STM32L4/analogin_api.c | 2 +- targets/TARGET_STM/i2c_api.c | 2 +- .../TARGET_EFM32/lp_ticker.c | 2 +- .../TARGET_Silicon_Labs/TARGET_EFM32/sleep.c | 2 +- .../TARGET_W7500x/analogin_api.c | 2 +- targets/TARGET_WIZNET/TARGET_W7500x/i2c_api.c | 2 +- .../TARGET_ublox/TARGET_HI2110/lp_ticker.c | 2 +- .../TARGET_ublox/TARGET_HI2110/us_ticker.c | 2 +- 136 files changed, 1208 insertions(+), 1062 deletions(-) create mode 100644 platform/mbed_critical.h rename platform/{retarget.cpp => mbed_retarget.cpp} (99%) create mode 100644 platform/mbed_rtc_time.h create mode 100644 platform/mbed_semihost_api.h create mode 100644 platform/mbed_sleep.h create mode 100644 platform/mbed_toolchain.h create mode 100644 platform/mbed_wait_api.h diff --git a/TESTS/mbedmicro-mbed/attributes/attributes.c b/TESTS/mbedmicro-mbed/attributes/attributes.c index ae2e8589be..e08f124f0c 100644 --- a/TESTS/mbedmicro-mbed/attributes/attributes.c +++ b/TESTS/mbedmicro-mbed/attributes/attributes.c @@ -1,4 +1,4 @@ -#include "toolchain.h" +#include "mbed_toolchain.h" #include #include diff --git a/TESTS/mbedmicro-mbed/attributes/main.cpp b/TESTS/mbedmicro-mbed/attributes/main.cpp index c006e904db..faf3209f47 100644 --- a/TESTS/mbedmicro-mbed/attributes/main.cpp +++ b/TESTS/mbedmicro-mbed/attributes/main.cpp @@ -1,7 +1,7 @@ #include #include -#include "toolchain.h" +#include "mbed_toolchain.h" #include "greentea-client/test_env.h" #include "unity.h" #include "utest.h" diff --git a/TESTS/mbedmicro-mbed/attributes/weak.c b/TESTS/mbedmicro-mbed/attributes/weak.c index 05db78dbea..4bf279614b 100644 --- a/TESTS/mbedmicro-mbed/attributes/weak.c +++ b/TESTS/mbedmicro-mbed/attributes/weak.c @@ -1,4 +1,4 @@ -#include "toolchain.h" +#include "mbed_toolchain.h" int testWeak1() { return 0; diff --git a/TESTS/mbedmicro-mbed/static_assert/main.cpp b/TESTS/mbedmicro-mbed/static_assert/main.cpp index ceabc15eff..969452b93e 100644 --- a/TESTS/mbedmicro-mbed/static_assert/main.cpp +++ b/TESTS/mbedmicro-mbed/static_assert/main.cpp @@ -1,7 +1,7 @@ #include #include -#include "toolchain.h" +#include "mbed_toolchain.h" #include "greentea-client/test_env.h" #include "unity.h" #include "utest.h" diff --git a/drivers/DigitalIn.h b/drivers/DigitalIn.h index acc9fac342..75b51260ca 100644 --- a/drivers/DigitalIn.h +++ b/drivers/DigitalIn.h @@ -19,7 +19,7 @@ #include "platform/platform.h" #include "hal/gpio_api.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" namespace mbed { /** \addtogroup drivers */ diff --git a/drivers/DigitalInOut.h b/drivers/DigitalInOut.h index a8d00af1ef..f5b4e7ac3a 100644 --- a/drivers/DigitalInOut.h +++ b/drivers/DigitalInOut.h @@ -19,7 +19,7 @@ #include "platform/platform.h" #include "hal/gpio_api.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" namespace mbed { /** \addtogroup drivers */ diff --git a/drivers/DigitalOut.h b/drivers/DigitalOut.h index 52210dfbd9..0a98518c8d 100644 --- a/drivers/DigitalOut.h +++ b/drivers/DigitalOut.h @@ -18,7 +18,7 @@ #include "platform/platform.h" #include "hal/gpio_api.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" namespace mbed { /** \addtogroup drivers */ diff --git a/drivers/InterruptIn.h b/drivers/InterruptIn.h index c0f0aed9c9..17ccf1ab35 100644 --- a/drivers/InterruptIn.h +++ b/drivers/InterruptIn.h @@ -23,8 +23,8 @@ #include "hal/gpio_api.h" #include "hal/gpio_irq_api.h" #include "platform/Callback.h" -#include "platform/critical.h" -#include "platform/toolchain.h" +#include "platform/mbed_critical.h" +#include "platform/mbed_toolchain.h" namespace mbed { /** \addtogroup drivers */ diff --git a/drivers/InterruptManager.cpp b/drivers/InterruptManager.cpp index f87342e5bc..ac8c83d88c 100644 --- a/drivers/InterruptManager.cpp +++ b/drivers/InterruptManager.cpp @@ -17,7 +17,7 @@ #if defined(NVIC_NUM_VECTORS) #include "drivers/InterruptManager.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" #include #define CHAIN_INITIAL_SIZE 4 diff --git a/drivers/LocalFileSystem.cpp b/drivers/LocalFileSystem.cpp index d856b3c29a..0e11be4cd4 100644 --- a/drivers/LocalFileSystem.cpp +++ b/drivers/LocalFileSystem.cpp @@ -17,7 +17,7 @@ #if DEVICE_LOCALFILESYSTEM -#include "platform/semihost_api.h" +#include "platform/mbed_semihost_api.h" #include #include diff --git a/drivers/PortIn.h b/drivers/PortIn.h index 79cab04fbd..a7b59831da 100644 --- a/drivers/PortIn.h +++ b/drivers/PortIn.h @@ -21,7 +21,7 @@ #if DEVICE_PORTIN #include "hal/port_api.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" namespace mbed { /** \addtogroup drivers */ diff --git a/drivers/PortInOut.h b/drivers/PortInOut.h index 55ce67c81b..3000c8d68e 100644 --- a/drivers/PortInOut.h +++ b/drivers/PortInOut.h @@ -21,7 +21,7 @@ #if DEVICE_PORTINOUT #include "hal/port_api.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" namespace mbed { /** \addtogroup drivers */ diff --git a/drivers/PortOut.h b/drivers/PortOut.h index bda1eab626..3df721cfa8 100644 --- a/drivers/PortOut.h +++ b/drivers/PortOut.h @@ -21,7 +21,7 @@ #if DEVICE_PORTOUT #include "hal/port_api.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" namespace mbed { /** \addtogroup drivers */ diff --git a/drivers/PwmOut.h b/drivers/PwmOut.h index 73e60d229d..0b4bd9ec76 100644 --- a/drivers/PwmOut.h +++ b/drivers/PwmOut.h @@ -20,7 +20,7 @@ #if DEVICE_PWMOUT #include "hal/pwmout_api.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" namespace mbed { /** \addtogroup drivers */ diff --git a/drivers/RawSerial.cpp b/drivers/RawSerial.cpp index e8e4c2a2e2..e7e6884c3a 100644 --- a/drivers/RawSerial.cpp +++ b/drivers/RawSerial.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ #include "drivers/RawSerial.h" -#include "platform/wait_api.h" +#include "platform/mbed_wait_api.h" #include #if DEVICE_SERIAL diff --git a/drivers/SPI.cpp b/drivers/SPI.cpp index 3d79a03461..a3b66eee5b 100644 --- a/drivers/SPI.cpp +++ b/drivers/SPI.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ #include "drivers/SPI.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" #if DEVICE_SPI diff --git a/drivers/Serial.cpp b/drivers/Serial.cpp index d92d4a8df1..8e3ce518a5 100644 --- a/drivers/Serial.cpp +++ b/drivers/Serial.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ #include "drivers/Serial.h" -#include "platform/wait_api.h" +#include "platform/mbed_wait_api.h" #if DEVICE_SERIAL diff --git a/drivers/SerialBase.cpp b/drivers/SerialBase.cpp index 1a7110f752..2c4cb7ae04 100644 --- a/drivers/SerialBase.cpp +++ b/drivers/SerialBase.cpp @@ -14,8 +14,8 @@ * limitations under the License. */ #include "drivers/SerialBase.h" -#include "platform/wait_api.h" -#include "platform/critical.h" +#include "platform/mbed_wait_api.h" +#include "platform/mbed_critical.h" #if DEVICE_SERIAL diff --git a/drivers/SerialBase.h b/drivers/SerialBase.h index 2af82e2847..d13c1e6138 100644 --- a/drivers/SerialBase.h +++ b/drivers/SerialBase.h @@ -23,7 +23,7 @@ #include "Stream.h" #include "Callback.h" #include "serial_api.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #if DEVICE_SERIAL_ASYNCH #include "CThunk.h" diff --git a/drivers/Ticker.cpp b/drivers/Ticker.cpp index f497c3a9fc..d7dabf5494 100644 --- a/drivers/Ticker.cpp +++ b/drivers/Ticker.cpp @@ -18,7 +18,7 @@ #include "drivers/TimerEvent.h" #include "platform/FunctionPointer.h" #include "hal/ticker_api.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" namespace mbed { diff --git a/drivers/Ticker.h b/drivers/Ticker.h index 15c171c2cb..fe79c3a9f9 100644 --- a/drivers/Ticker.h +++ b/drivers/Ticker.h @@ -18,7 +18,7 @@ #include "drivers/TimerEvent.h" #include "platform/Callback.h" -#include "platform/toolchain.h" +#include "platform/mbed_toolchain.h" namespace mbed { /** \addtogroup drivers */ diff --git a/drivers/Timer.cpp b/drivers/Timer.cpp index 243440ead3..2de1eed0b6 100644 --- a/drivers/Timer.cpp +++ b/drivers/Timer.cpp @@ -16,7 +16,7 @@ #include "drivers/Timer.h" #include "hal/ticker_api.h" #include "hal/us_ticker_api.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" namespace mbed { diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c index 9175a9793a..1101f5b1e5 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c @@ -24,7 +24,7 @@ #include "nuc472_eth.h" #include "lwip/opt.h" #include "lwip/def.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #define ETH_TRIGGER_RX() do{EMAC->RXST = 0;}while(0) #define ETH_TRIGGER_TX() do{EMAC->TXST = 0;}while(0) diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/stm32f4_eth_init.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/stm32f4_eth_init.c index 227d7d5843..89fd896139 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/stm32f4_eth_init.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/stm32f4_eth_init.c @@ -1,6 +1,6 @@ #include #include "stm32f4xx_hal.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #define C029_OTP_START_ADDRESS (0x1FFF7800U) #define C029_OTP_END_ADDRESS (C029_OTP_START_ADDRESS + (16*32)) diff --git a/features/frameworks/utest/mbed-utest-shim.cpp b/features/frameworks/utest/mbed-utest-shim.cpp index 96a4ba5edf..b2676ce8dc 100644 --- a/features/frameworks/utest/mbed-utest-shim.cpp +++ b/features/frameworks/utest/mbed-utest-shim.cpp @@ -16,7 +16,7 @@ */ #include "mbed.h" -#include "critical.h" +#include "mbed_critical.h" #include "utest/utest.h" using namespace utest::v1; diff --git a/features/nanostack/FEATURE_NANOSTACK/targets/TARGET_SL_RAIL/NanostackRfPhyEfr32.cpp b/features/nanostack/FEATURE_NANOSTACK/targets/TARGET_SL_RAIL/NanostackRfPhyEfr32.cpp index 16a350367c..e4a7dfb4cd 100644 --- a/features/nanostack/FEATURE_NANOSTACK/targets/TARGET_SL_RAIL/NanostackRfPhyEfr32.cpp +++ b/features/nanostack/FEATURE_NANOSTACK/targets/TARGET_SL_RAIL/NanostackRfPhyEfr32.cpp @@ -17,7 +17,7 @@ #include "ns_types.h" #include "platform/arm_hal_interrupt.h" #include "nanostack/platform/arm_hal_phy.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include #include "mbed-trace/mbed_trace.h" diff --git a/features/netsocket/Socket.h b/features/netsocket/Socket.h index 3482349f94..7edeeb8033 100644 --- a/features/netsocket/Socket.h +++ b/features/netsocket/Socket.h @@ -24,7 +24,7 @@ #include "netsocket/NetworkStack.h" #include "rtos/Mutex.h" #include "Callback.h" -#include "toolchain.h" +#include "mbed_toolchain.h" /** Abstract socket class diff --git a/features/netsocket/SocketAddress.h b/features/netsocket/SocketAddress.h index 4aa7f30ecc..270b676000 100644 --- a/features/netsocket/SocketAddress.h +++ b/features/netsocket/SocketAddress.h @@ -21,7 +21,7 @@ #define SOCKET_ADDRESS_H #include "nsapi_types.h" -#include "toolchain.h" +#include "mbed_toolchain.h" // Predeclared classes class NetworkStack; diff --git a/features/unsupported/USBDevice/USBDevice/USBHAL.h b/features/unsupported/USBDevice/USBDevice/USBHAL.h index a1bf27a84d..1a98427de7 100644 --- a/features/unsupported/USBDevice/USBDevice/USBHAL.h +++ b/features/unsupported/USBDevice/USBDevice/USBHAL.h @@ -21,7 +21,7 @@ #include "mbed.h" #include "USBEndpoints.h" -#include "toolchain.h" +#include "mbed_toolchain.h" //#ifdef __GNUC__ //#define __packed __attribute__ ((__packed__)) diff --git a/features/unsupported/USBHost/USBHost/USBHostTypes.h b/features/unsupported/USBHost/USBHost/USBHostTypes.h index c2dedb40dc..b4c68b77de 100644 --- a/features/unsupported/USBHost/USBHost/USBHostTypes.h +++ b/features/unsupported/USBHost/USBHost/USBHostTypes.h @@ -18,7 +18,7 @@ #define USB_INC_H #include "mbed.h" -#include "toolchain.h" +#include "mbed_toolchain.h" enum USB_TYPE { USB_TYPE_OK = 0, diff --git a/features/unsupported/fs/fat/FATFileSystem.cpp b/features/unsupported/fs/fat/FATFileSystem.cpp index db33546bff..49cb13054e 100644 --- a/features/unsupported/fs/fat/FATFileSystem.cpp +++ b/features/unsupported/fs/fat/FATFileSystem.cpp @@ -27,7 +27,7 @@ #include "FATFileSystem.h" #include "FATFileHandle.h" #include "FATDirHandle.h" -#include "critical.h" +#include "mbed_critical.h" DWORD get_fattime(void) { time_t rawtime; diff --git a/features/unsupported/tests/libs/SerialHalfDuplex/SerialHalfDuplex.cpp b/features/unsupported/tests/libs/SerialHalfDuplex/SerialHalfDuplex.cpp index ee39462254..18ac272ef5 100644 --- a/features/unsupported/tests/libs/SerialHalfDuplex/SerialHalfDuplex.cpp +++ b/features/unsupported/tests/libs/SerialHalfDuplex/SerialHalfDuplex.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2010-2011 ARM Limited. All rights reserved. */ #include "SerialHalfDuplex.h" -#include "critical.h" +#include "mbed_critical.h" #if DEVICE_SERIAL diff --git a/features/unsupported/tests/mbed/file/main.cpp b/features/unsupported/tests/mbed/file/main.cpp index 8f573f4e30..8c85711f96 100644 --- a/features/unsupported/tests/mbed/file/main.cpp +++ b/features/unsupported/tests/mbed/file/main.cpp @@ -1,5 +1,5 @@ #include "test_env.h" -#include "semihost_api.h" +#include "mbed_semihost_api.h" Serial pc(USBTX, USBRX); diff --git a/features/unsupported/tests/mbed/semihost/main.cpp b/features/unsupported/tests/mbed/semihost/main.cpp index 2ef91d12a4..2dc9702f80 100644 --- a/features/unsupported/tests/mbed/semihost/main.cpp +++ b/features/unsupported/tests/mbed/semihost/main.cpp @@ -1,5 +1,5 @@ #include "test_env.h" -#include "semihost_api.h" +#include "mbed_semihost_api.h" #define MAC_VENDOR_ARM_0 0x00 #define MAC_VENDOR_ARM_1 0x02 diff --git a/features/unsupported/tests/mbed/vtor_reloc/main.cpp b/features/unsupported/tests/mbed/vtor_reloc/main.cpp index a1c4033ba0..c4273f931a 100644 --- a/features/unsupported/tests/mbed/vtor_reloc/main.cpp +++ b/features/unsupported/tests/mbed/vtor_reloc/main.cpp @@ -4,7 +4,7 @@ #include "test_env.h" #include "cmsis_nvic.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include #if defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A) || defined(TARGET_SAMD21G18A) diff --git a/features/unsupported/tests/utest/general/general.cpp b/features/unsupported/tests/utest/general/general.cpp index ba56a0f181..b5b665290e 100644 --- a/features/unsupported/tests/utest/general/general.cpp +++ b/features/unsupported/tests/utest/general/general.cpp @@ -65,7 +65,7 @@ TEST(C_String_Format, Sprintf_Negative_Integers) } #ifdef DEVICE_SEMIHOST -#include "semihost_api.h" +#include "mbed_semihost_api.h" TEST_GROUP(Device_Semihost) { diff --git a/features/unsupported/tests/utest/semihost_fs/semihost_fs.cpp b/features/unsupported/tests/utest/semihost_fs/semihost_fs.cpp index adb49025fb..50847af3b3 100644 --- a/features/unsupported/tests/utest/semihost_fs/semihost_fs.cpp +++ b/features/unsupported/tests/utest/semihost_fs/semihost_fs.cpp @@ -1,6 +1,6 @@ #include "TestHarness.h" #include "mbed.h" -#include "semihost_api.h" +#include "mbed_semihost_api.h" #include #define FILENAME "/local/out.txt" diff --git a/hal/TARGET_FLASH_CMSIS_ALGO/flash_common_algo.c b/hal/TARGET_FLASH_CMSIS_ALGO/flash_common_algo.c index 05c6660716..6bb9b4f7f8 100644 --- a/hal/TARGET_FLASH_CMSIS_ALGO/flash_common_algo.c +++ b/hal/TARGET_FLASH_CMSIS_ALGO/flash_common_algo.c @@ -16,7 +16,7 @@ #include "flash_api.h" #include "flash_data.h" -#include "critical.h" +#include "mbed_critical.h" #define MBED_FLASH_ALGO_ERASE 1UL #define MBED_FLASH_ALGO_PROGRAM 2UL diff --git a/hal/mbed_ticker_api.c b/hal/mbed_ticker_api.c index d7a9af6296..f1cf3cc9a9 100644 --- a/hal/mbed_ticker_api.c +++ b/hal/mbed_ticker_api.c @@ -15,7 +15,7 @@ */ #include #include "hal/ticker_api.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" void ticker_set_handler(const ticker_data_t *const data, ticker_event_handler handler) { data->interface->init(); diff --git a/mbed.h b/mbed.h index 587bfca9e1..b4092fb84f 100644 --- a/mbed.h +++ b/mbed.h @@ -47,7 +47,7 @@ #include "events/mbed_events.h" #endif -#include "platform/toolchain.h" +#include "platform/mbed_toolchain.h" #include "platform/platform.h" #include "platform/mbed_application.h" @@ -92,10 +92,10 @@ #include "drivers/LowPowerTimer.h" #include "drivers/LocalFileSystem.h" #include "drivers/InterruptIn.h" -#include "platform/wait_api.h" +#include "platform/mbed_wait_api.h" #include "hal/sleep_api.h" -#include "platform/sleep.h" -#include "platform/rtc_time.h" +#include "platform/mbed_sleep.h" +#include "platform/mbed_rtc_time.h" // mbed Non-hardware components #include "platform/Callback.h" diff --git a/platform/CallChain.cpp b/platform/CallChain.cpp index 0eb5393891..c9ee38c6e2 100644 --- a/platform/CallChain.cpp +++ b/platform/CallChain.cpp @@ -1,6 +1,6 @@ #include "platform/CallChain.h" #include "cmsis.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" namespace mbed { diff --git a/platform/CallChain.h b/platform/CallChain.h index a60d33288e..0a36cfe5c2 100644 --- a/platform/CallChain.h +++ b/platform/CallChain.h @@ -17,7 +17,7 @@ #define MBED_CALLCHAIN_H #include "platform/Callback.h" -#include "platform/toolchain.h" +#include "platform/mbed_toolchain.h" #include namespace mbed { diff --git a/platform/Callback.h b/platform/Callback.h index 5a12e1020a..e6462571a1 100644 --- a/platform/Callback.h +++ b/platform/Callback.h @@ -20,7 +20,7 @@ #include #include #include "platform/mbed_assert.h" -#include "platform/toolchain.h" +#include "platform/mbed_toolchain.h" namespace mbed { /** \addtogroup platform */ diff --git a/platform/CircularBuffer.h b/platform/CircularBuffer.h index 8b40081cc8..c87c209101 100644 --- a/platform/CircularBuffer.h +++ b/platform/CircularBuffer.h @@ -16,7 +16,7 @@ #ifndef MBED_CIRCULARBUFFER_H #define MBED_CIRCULARBUFFER_H -#include "platform/critical.h" +#include "platform/mbed_critical.h" namespace mbed { /** \addtogroup platform */ diff --git a/platform/FunctionPointer.h b/platform/FunctionPointer.h index b67451baa4..8d685479a1 100644 --- a/platform/FunctionPointer.h +++ b/platform/FunctionPointer.h @@ -17,7 +17,7 @@ #define MBED_FUNCTIONPOINTER_H #include "platform/Callback.h" -#include "platform/toolchain.h" +#include "platform/mbed_toolchain.h" #include #include diff --git a/platform/critical.h b/platform/critical.h index 57816d1cac..c790e830ed 100644 --- a/platform/critical.h +++ b/platform/critical.h @@ -1,6 +1,3 @@ - -/** \addtogroup platform */ -/** @{*/ /* * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 @@ -18,342 +15,10 @@ * limitations under the License. */ -#ifndef __MBED_UTIL_CRITICAL_H__ -#define __MBED_UTIL_CRITICAL_H__ +#ifndef MBED_OLD_CRITICAL_H +#define MBED_OLD_CRITICAL_H -#include -#include -#include +#warning critical.h has been replaced by mbed_critical.h, please update to mbed_critical.h [since mbed-os-5.3] +#include "platform/mbed_critical.h" -#ifdef __cplusplus -extern "C" { #endif - - -/** Determine the current interrupts enabled state - * - * This function can be called to determine whether or not interrupts are currently enabled. - * \note - * NOTE: - * This function works for both cortex-A and cortex-M, although the underlyng implementation - * differs. - * @return true if interrupts are enabled, false otherwise - */ -bool core_util_are_interrupts_enabled(void); - -/** Mark the start of a critical section - * - * This function should be called to mark the start of a critical section of code. - * \note - * NOTES: - * 1) The use of this style of critical section is targetted at C based implementations. - * 2) These critical sections can be nested. - * 3) The interrupt enable state on entry to the first critical section (of a nested set, or single - * section) will be preserved on exit from the section. - * 4) This implementation will currently only work on code running in privileged mode. - */ -void core_util_critical_section_enter(void); - -/** Mark the end of a critical section - * - * This function should be called to mark the end of a critical section of code. - * \note - * NOTES: - * 1) The use of this style of critical section is targetted at C based implementations. - * 2) These critical sections can be nested. - * 3) The interrupt enable state on entry to the first critical section (of a nested set, or single - * section) will be preserved on exit from the section. - * 4) This implementation will currently only work on code running in privileged mode. - */ -void core_util_critical_section_exit(void); - -/** - * Atomic compare and set. It compares the contents of a memory location to a - * given value and, only if they are the same, modifies the contents of that - * memory location to a given new value. This is done as a single atomic - * operation. The atomicity guarantees that the new value is calculated based on - * up-to-date information; if the value had been updated by another thread in - * the meantime, the write would fail due to a mismatched expectedCurrentValue. - * - * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect - * you to the article on compare-and swap]. - * - * @param ptr The target memory location. - * @param[in,out] expectedCurrentValue A pointer to some location holding the - * expected current value of the data being set atomically. - * The computed 'desiredValue' should be a function of this current value. - * @Note: This is an in-out parameter. In the - * failure case of atomic_cas (where the - * destination isn't set), the pointee of expectedCurrentValue is - * updated with the current value. - * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'. - * - * @return true if the memory location was atomically - * updated with the desired value (after verifying - * that it contained the expectedCurrentValue), - * false otherwise. In the failure case, - * exepctedCurrentValue is updated with the new - * value of the target memory location. - * - * pseudocode: - * function cas(p : pointer to int, old : pointer to int, new : int) returns bool { - * if *p != *old { - * *old = *p - * return false - * } - * *p = new - * return true - * } - * - * @Note: In the failure case (where the destination isn't set), the value - * pointed to by expectedCurrentValue is still updated with the current value. - * This property helps writing concise code for the following incr: - * - * function incr(p : pointer to int, a : int) returns int { - * done = false - * value = *p // This fetch operation need not be atomic. - * while not done { - * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success - * } - * return value + a - * } - */ -bool core_util_atomic_cas_u8(uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_t desiredValue); - -/** - * Atomic compare and set. It compares the contents of a memory location to a - * given value and, only if they are the same, modifies the contents of that - * memory location to a given new value. This is done as a single atomic - * operation. The atomicity guarantees that the new value is calculated based on - * up-to-date information; if the value had been updated by another thread in - * the meantime, the write would fail due to a mismatched expectedCurrentValue. - * - * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect - * you to the article on compare-and swap]. - * - * @param ptr The target memory location. - * @param[in,out] expectedCurrentValue A pointer to some location holding the - * expected current value of the data being set atomically. - * The computed 'desiredValue' should be a function of this current value. - * @Note: This is an in-out parameter. In the - * failure case of atomic_cas (where the - * destination isn't set), the pointee of expectedCurrentValue is - * updated with the current value. - * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'. - * - * @return true if the memory location was atomically - * updated with the desired value (after verifying - * that it contained the expectedCurrentValue), - * false otherwise. In the failure case, - * exepctedCurrentValue is updated with the new - * value of the target memory location. - * - * pseudocode: - * function cas(p : pointer to int, old : pointer to int, new : int) returns bool { - * if *p != *old { - * *old = *p - * return false - * } - * *p = new - * return true - * } - * - * @Note: In the failure case (where the destination isn't set), the value - * pointed to by expectedCurrentValue is still updated with the current value. - * This property helps writing concise code for the following incr: - * - * function incr(p : pointer to int, a : int) returns int { - * done = false - * value = *p // This fetch operation need not be atomic. - * while not done { - * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success - * } - * return value + a - * } - */ -bool core_util_atomic_cas_u16(uint16_t *ptr, uint16_t *expectedCurrentValue, uint16_t desiredValue); - -/** - * Atomic compare and set. It compares the contents of a memory location to a - * given value and, only if they are the same, modifies the contents of that - * memory location to a given new value. This is done as a single atomic - * operation. The atomicity guarantees that the new value is calculated based on - * up-to-date information; if the value had been updated by another thread in - * the meantime, the write would fail due to a mismatched expectedCurrentValue. - * - * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect - * you to the article on compare-and swap]. - * - * @param ptr The target memory location. - * @param[in,out] expectedCurrentValue A pointer to some location holding the - * expected current value of the data being set atomically. - * The computed 'desiredValue' should be a function of this current value. - * @Note: This is an in-out parameter. In the - * failure case of atomic_cas (where the - * destination isn't set), the pointee of expectedCurrentValue is - * updated with the current value. - * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'. - * - * @return true if the memory location was atomically - * updated with the desired value (after verifying - * that it contained the expectedCurrentValue), - * false otherwise. In the failure case, - * exepctedCurrentValue is updated with the new - * value of the target memory location. - * - * pseudocode: - * function cas(p : pointer to int, old : pointer to int, new : int) returns bool { - * if *p != *old { - * *old = *p - * return false - * } - * *p = new - * return true - * } - * - * @Note: In the failure case (where the destination isn't set), the value - * pointed to by expectedCurrentValue is still updated with the current value. - * This property helps writing concise code for the following incr: - * - * function incr(p : pointer to int, a : int) returns int { - * done = false - * value = *p // This fetch operation need not be atomic. - * while not done { - * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success - * } - * return value + a - * } - */ -bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uint32_t desiredValue); - -/** - * Atomic compare and set. It compares the contents of a memory location to a - * given value and, only if they are the same, modifies the contents of that - * memory location to a given new value. This is done as a single atomic - * operation. The atomicity guarantees that the new value is calculated based on - * up-to-date information; if the value had been updated by another thread in - * the meantime, the write would fail due to a mismatched expectedCurrentValue. - * - * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect - * you to the article on compare-and swap]. - * - * @param ptr The target memory location. - * @param[in,out] expectedCurrentValue A pointer to some location holding the - * expected current value of the data being set atomically. - * The computed 'desiredValue' should be a function of this current value. - * @Note: This is an in-out parameter. In the - * failure case of atomic_cas (where the - * destination isn't set), the pointee of expectedCurrentValue is - * updated with the current value. - * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'. - * - * @return true if the memory location was atomically - * updated with the desired value (after verifying - * that it contained the expectedCurrentValue), - * false otherwise. In the failure case, - * exepctedCurrentValue is updated with the new - * value of the target memory location. - * - * pseudocode: - * function cas(p : pointer to int, old : pointer to int, new : int) returns bool { - * if *p != *old { - * *old = *p - * return false - * } - * *p = new - * return true - * } - * - * @Note: In the failure case (where the destination isn't set), the value - * pointed to by expectedCurrentValue is still updated with the current value. - * This property helps writing concise code for the following incr: - * - * function incr(p : pointer to int, a : int) returns int { - * done = false - * value = *p // This fetch operation need not be atomic. - * while not done { - * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success - * } - * return value + a - * } - */ -bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue); - -/** - * Atomic increment. - * @param valuePtr Target memory location being incremented. - * @param delta The amount being incremented. - * @return The new incremented value. - */ -uint8_t core_util_atomic_incr_u8(uint8_t *valuePtr, uint8_t delta); - -/** - * Atomic increment. - * @param valuePtr Target memory location being incremented. - * @param delta The amount being incremented. - * @return The new incremented value. - */ -uint16_t core_util_atomic_incr_u16(uint16_t *valuePtr, uint16_t delta); - -/** - * Atomic increment. - * @param valuePtr Target memory location being incremented. - * @param delta The amount being incremented. - * @return The new incremented value. - */ -uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta); - -/** - * Atomic increment. - * @param valuePtr Target memory location being incremented. - * @param delta The amount being incremented in bytes. - * @return The new incremented value. - * - * @note The type of the pointer argument is not taken into account - * and the pointer is incremented by bytes. - */ -void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta); - -/** - * Atomic decrement. - * @param valuePtr Target memory location being decremented. - * @param delta The amount being decremented. - * @return The new decremented value. - */ -uint8_t core_util_atomic_decr_u8(uint8_t *valuePtr, uint8_t delta); - -/** - * Atomic decrement. - * @param valuePtr Target memory location being decremented. - * @param delta The amount being decremented. - * @return The new decremented value. - */ -uint16_t core_util_atomic_decr_u16(uint16_t *valuePtr, uint16_t delta); - -/** - * Atomic decrement. - * @param valuePtr Target memory location being decremented. - * @param delta The amount being decremented. - * @return The new decremented value. - */ -uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta); - -/** - * Atomic decrement. - * @param valuePtr Target memory location being decremented. - * @param delta The amount being decremented in bytes. - * @return The new decremented value. - * - * @note The type of the pointer argument is not taken into account - * and the pointer is decremented by bytes - */ -void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta); - -#ifdef __cplusplus -} // extern "C" -#endif - - -#endif // __MBED_UTIL_CRITICAL_H__ - -/** @}*/ diff --git a/platform/mbed_alloc_wrappers.cpp b/platform/mbed_alloc_wrappers.cpp index aaa9d95539..ab6394e5c0 100644 --- a/platform/mbed_alloc_wrappers.cpp +++ b/platform/mbed_alloc_wrappers.cpp @@ -16,7 +16,7 @@ #include "platform/mbed_mem_trace.h" #include "platform/mbed_stats.h" -#include "platform/toolchain.h" +#include "platform/mbed_toolchain.h" #include "platform/SingletonPtr.h" #include "platform/PlatformMutex.h" #include diff --git a/platform/mbed_assert.c b/platform/mbed_assert.c index acf30acdfe..8a698abdd9 100644 --- a/platform/mbed_assert.c +++ b/platform/mbed_assert.c @@ -17,7 +17,7 @@ #include "device.h" #include "platform/mbed_interface.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" void mbed_assert_internal(const char *expr, const char *file, int line) { diff --git a/platform/mbed_board.c b/platform/mbed_board.c index efa5f50f7d..16ca2944a6 100644 --- a/platform/mbed_board.c +++ b/platform/mbed_board.c @@ -15,10 +15,10 @@ */ #include #include "hal/gpio_api.h" -#include "platform/wait_api.h" -#include "platform/toolchain.h" +#include "platform/mbed_wait_api.h" +#include "platform/mbed_toolchain.h" #include "platform/mbed_interface.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" #include "hal/serial_api.h" #if DEVICE_SERIAL diff --git a/platform/mbed_critical.c b/platform/mbed_critical.c index 844efb1512..75d97c14fc 100644 --- a/platform/mbed_critical.c +++ b/platform/mbed_critical.c @@ -17,11 +17,11 @@ /* Declare __STDC_LIMIT_MACROS so stdint.h defines UINT32_MAX when using C++ */ #define __STDC_LIMIT_MACROS -#include "platform/critical.h" +#include "platform/mbed_critical.h" #include "cmsis.h" #include "platform/mbed_assert.h" -#include "platform/toolchain.h" +#include "platform/mbed_toolchain.h" #define EXCLUSIVE_ACCESS (!defined (__CORTEX_M0) && !defined (__CORTEX_M0PLUS)) diff --git a/platform/mbed_critical.h b/platform/mbed_critical.h new file mode 100644 index 0000000000..57816d1cac --- /dev/null +++ b/platform/mbed_critical.h @@ -0,0 +1,359 @@ + +/** \addtogroup platform */ +/** @{*/ +/* + * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved + * 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. + */ + +#ifndef __MBED_UTIL_CRITICAL_H__ +#define __MBED_UTIL_CRITICAL_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/** Determine the current interrupts enabled state + * + * This function can be called to determine whether or not interrupts are currently enabled. + * \note + * NOTE: + * This function works for both cortex-A and cortex-M, although the underlyng implementation + * differs. + * @return true if interrupts are enabled, false otherwise + */ +bool core_util_are_interrupts_enabled(void); + +/** Mark the start of a critical section + * + * This function should be called to mark the start of a critical section of code. + * \note + * NOTES: + * 1) The use of this style of critical section is targetted at C based implementations. + * 2) These critical sections can be nested. + * 3) The interrupt enable state on entry to the first critical section (of a nested set, or single + * section) will be preserved on exit from the section. + * 4) This implementation will currently only work on code running in privileged mode. + */ +void core_util_critical_section_enter(void); + +/** Mark the end of a critical section + * + * This function should be called to mark the end of a critical section of code. + * \note + * NOTES: + * 1) The use of this style of critical section is targetted at C based implementations. + * 2) These critical sections can be nested. + * 3) The interrupt enable state on entry to the first critical section (of a nested set, or single + * section) will be preserved on exit from the section. + * 4) This implementation will currently only work on code running in privileged mode. + */ +void core_util_critical_section_exit(void); + +/** + * Atomic compare and set. It compares the contents of a memory location to a + * given value and, only if they are the same, modifies the contents of that + * memory location to a given new value. This is done as a single atomic + * operation. The atomicity guarantees that the new value is calculated based on + * up-to-date information; if the value had been updated by another thread in + * the meantime, the write would fail due to a mismatched expectedCurrentValue. + * + * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect + * you to the article on compare-and swap]. + * + * @param ptr The target memory location. + * @param[in,out] expectedCurrentValue A pointer to some location holding the + * expected current value of the data being set atomically. + * The computed 'desiredValue' should be a function of this current value. + * @Note: This is an in-out parameter. In the + * failure case of atomic_cas (where the + * destination isn't set), the pointee of expectedCurrentValue is + * updated with the current value. + * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'. + * + * @return true if the memory location was atomically + * updated with the desired value (after verifying + * that it contained the expectedCurrentValue), + * false otherwise. In the failure case, + * exepctedCurrentValue is updated with the new + * value of the target memory location. + * + * pseudocode: + * function cas(p : pointer to int, old : pointer to int, new : int) returns bool { + * if *p != *old { + * *old = *p + * return false + * } + * *p = new + * return true + * } + * + * @Note: In the failure case (where the destination isn't set), the value + * pointed to by expectedCurrentValue is still updated with the current value. + * This property helps writing concise code for the following incr: + * + * function incr(p : pointer to int, a : int) returns int { + * done = false + * value = *p // This fetch operation need not be atomic. + * while not done { + * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success + * } + * return value + a + * } + */ +bool core_util_atomic_cas_u8(uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_t desiredValue); + +/** + * Atomic compare and set. It compares the contents of a memory location to a + * given value and, only if they are the same, modifies the contents of that + * memory location to a given new value. This is done as a single atomic + * operation. The atomicity guarantees that the new value is calculated based on + * up-to-date information; if the value had been updated by another thread in + * the meantime, the write would fail due to a mismatched expectedCurrentValue. + * + * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect + * you to the article on compare-and swap]. + * + * @param ptr The target memory location. + * @param[in,out] expectedCurrentValue A pointer to some location holding the + * expected current value of the data being set atomically. + * The computed 'desiredValue' should be a function of this current value. + * @Note: This is an in-out parameter. In the + * failure case of atomic_cas (where the + * destination isn't set), the pointee of expectedCurrentValue is + * updated with the current value. + * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'. + * + * @return true if the memory location was atomically + * updated with the desired value (after verifying + * that it contained the expectedCurrentValue), + * false otherwise. In the failure case, + * exepctedCurrentValue is updated with the new + * value of the target memory location. + * + * pseudocode: + * function cas(p : pointer to int, old : pointer to int, new : int) returns bool { + * if *p != *old { + * *old = *p + * return false + * } + * *p = new + * return true + * } + * + * @Note: In the failure case (where the destination isn't set), the value + * pointed to by expectedCurrentValue is still updated with the current value. + * This property helps writing concise code for the following incr: + * + * function incr(p : pointer to int, a : int) returns int { + * done = false + * value = *p // This fetch operation need not be atomic. + * while not done { + * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success + * } + * return value + a + * } + */ +bool core_util_atomic_cas_u16(uint16_t *ptr, uint16_t *expectedCurrentValue, uint16_t desiredValue); + +/** + * Atomic compare and set. It compares the contents of a memory location to a + * given value and, only if they are the same, modifies the contents of that + * memory location to a given new value. This is done as a single atomic + * operation. The atomicity guarantees that the new value is calculated based on + * up-to-date information; if the value had been updated by another thread in + * the meantime, the write would fail due to a mismatched expectedCurrentValue. + * + * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect + * you to the article on compare-and swap]. + * + * @param ptr The target memory location. + * @param[in,out] expectedCurrentValue A pointer to some location holding the + * expected current value of the data being set atomically. + * The computed 'desiredValue' should be a function of this current value. + * @Note: This is an in-out parameter. In the + * failure case of atomic_cas (where the + * destination isn't set), the pointee of expectedCurrentValue is + * updated with the current value. + * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'. + * + * @return true if the memory location was atomically + * updated with the desired value (after verifying + * that it contained the expectedCurrentValue), + * false otherwise. In the failure case, + * exepctedCurrentValue is updated with the new + * value of the target memory location. + * + * pseudocode: + * function cas(p : pointer to int, old : pointer to int, new : int) returns bool { + * if *p != *old { + * *old = *p + * return false + * } + * *p = new + * return true + * } + * + * @Note: In the failure case (where the destination isn't set), the value + * pointed to by expectedCurrentValue is still updated with the current value. + * This property helps writing concise code for the following incr: + * + * function incr(p : pointer to int, a : int) returns int { + * done = false + * value = *p // This fetch operation need not be atomic. + * while not done { + * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success + * } + * return value + a + * } + */ +bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uint32_t desiredValue); + +/** + * Atomic compare and set. It compares the contents of a memory location to a + * given value and, only if they are the same, modifies the contents of that + * memory location to a given new value. This is done as a single atomic + * operation. The atomicity guarantees that the new value is calculated based on + * up-to-date information; if the value had been updated by another thread in + * the meantime, the write would fail due to a mismatched expectedCurrentValue. + * + * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect + * you to the article on compare-and swap]. + * + * @param ptr The target memory location. + * @param[in,out] expectedCurrentValue A pointer to some location holding the + * expected current value of the data being set atomically. + * The computed 'desiredValue' should be a function of this current value. + * @Note: This is an in-out parameter. In the + * failure case of atomic_cas (where the + * destination isn't set), the pointee of expectedCurrentValue is + * updated with the current value. + * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'. + * + * @return true if the memory location was atomically + * updated with the desired value (after verifying + * that it contained the expectedCurrentValue), + * false otherwise. In the failure case, + * exepctedCurrentValue is updated with the new + * value of the target memory location. + * + * pseudocode: + * function cas(p : pointer to int, old : pointer to int, new : int) returns bool { + * if *p != *old { + * *old = *p + * return false + * } + * *p = new + * return true + * } + * + * @Note: In the failure case (where the destination isn't set), the value + * pointed to by expectedCurrentValue is still updated with the current value. + * This property helps writing concise code for the following incr: + * + * function incr(p : pointer to int, a : int) returns int { + * done = false + * value = *p // This fetch operation need not be atomic. + * while not done { + * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success + * } + * return value + a + * } + */ +bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue); + +/** + * Atomic increment. + * @param valuePtr Target memory location being incremented. + * @param delta The amount being incremented. + * @return The new incremented value. + */ +uint8_t core_util_atomic_incr_u8(uint8_t *valuePtr, uint8_t delta); + +/** + * Atomic increment. + * @param valuePtr Target memory location being incremented. + * @param delta The amount being incremented. + * @return The new incremented value. + */ +uint16_t core_util_atomic_incr_u16(uint16_t *valuePtr, uint16_t delta); + +/** + * Atomic increment. + * @param valuePtr Target memory location being incremented. + * @param delta The amount being incremented. + * @return The new incremented value. + */ +uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta); + +/** + * Atomic increment. + * @param valuePtr Target memory location being incremented. + * @param delta The amount being incremented in bytes. + * @return The new incremented value. + * + * @note The type of the pointer argument is not taken into account + * and the pointer is incremented by bytes. + */ +void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta); + +/** + * Atomic decrement. + * @param valuePtr Target memory location being decremented. + * @param delta The amount being decremented. + * @return The new decremented value. + */ +uint8_t core_util_atomic_decr_u8(uint8_t *valuePtr, uint8_t delta); + +/** + * Atomic decrement. + * @param valuePtr Target memory location being decremented. + * @param delta The amount being decremented. + * @return The new decremented value. + */ +uint16_t core_util_atomic_decr_u16(uint16_t *valuePtr, uint16_t delta); + +/** + * Atomic decrement. + * @param valuePtr Target memory location being decremented. + * @param delta The amount being decremented. + * @return The new decremented value. + */ +uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta); + +/** + * Atomic decrement. + * @param valuePtr Target memory location being decremented. + * @param delta The amount being decremented in bytes. + * @return The new decremented value. + * + * @note The type of the pointer argument is not taken into account + * and the pointer is decremented by bytes + */ +void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta); + +#ifdef __cplusplus +} // extern "C" +#endif + + +#endif // __MBED_UTIL_CRITICAL_H__ + +/** @}*/ diff --git a/platform/mbed_error.c b/platform/mbed_error.c index dd026f32cf..686355f933 100644 --- a/platform/mbed_error.c +++ b/platform/mbed_error.c @@ -16,7 +16,7 @@ #include #include #include "device.h" -#include "platform/toolchain.h" +#include "platform/mbed_toolchain.h" #include "platform/mbed_error.h" #include "platform/mbed_interface.h" #if DEVICE_STDIO_MESSAGES diff --git a/platform/mbed_interface.c b/platform/mbed_interface.c index 26a3799dbd..84ab20cd8a 100644 --- a/platform/mbed_interface.c +++ b/platform/mbed_interface.c @@ -17,10 +17,10 @@ #include "platform/mbed_interface.h" #include "hal/gpio_api.h" -#include "platform/wait_api.h" -#include "platform/semihost_api.h" +#include "platform/mbed_wait_api.h" +#include "platform/mbed_semihost_api.h" #include "platform/mbed_error.h" -#include "platform/toolchain.h" +#include "platform/mbed_toolchain.h" #if DEVICE_SEMIHOST diff --git a/platform/mbed_mem_trace.c b/platform/mbed_mem_trace.c index 18b5be79fe..ee00760a8c 100644 --- a/platform/mbed_mem_trace.c +++ b/platform/mbed_mem_trace.c @@ -18,7 +18,7 @@ #include #include #include "platform/mbed_mem_trace.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" /****************************************************************************** * Internal variables, functions and helpers diff --git a/platform/retarget.cpp b/platform/mbed_retarget.cpp similarity index 99% rename from platform/retarget.cpp rename to platform/mbed_retarget.cpp index 56dc02b2ca..9cf0641b66 100644 --- a/platform/retarget.cpp +++ b/platform/mbed_retarget.cpp @@ -18,8 +18,8 @@ #include "drivers/FileSystemLike.h" #include "drivers/FilePath.h" #include "hal/serial_api.h" -#include "platform/toolchain.h" -#include "platform/semihost_api.h" +#include "platform/mbed_toolchain.h" +#include "platform/mbed_semihost_api.h" #include "platform/mbed_interface.h" #include "platform/SingletonPtr.h" #include "platform/PlatformMutex.h" diff --git a/platform/mbed_rtc_time.cpp b/platform/mbed_rtc_time.cpp index 4f912fbf6c..5f4b24a0eb 100644 --- a/platform/mbed_rtc_time.cpp +++ b/platform/mbed_rtc_time.cpp @@ -16,8 +16,8 @@ #include "hal/rtc_api.h" #include -#include "platform/critical.h" -#include "platform/rtc_time.h" +#include "platform/mbed_critical.h" +#include "platform/mbed_rtc_time.h" #include "hal/us_ticker_api.h" #include "platform/SingletonPtr.h" #include "platform/PlatformMutex.h" diff --git a/platform/mbed_rtc_time.h b/platform/mbed_rtc_time.h new file mode 100644 index 0000000000..fef0292f1c --- /dev/null +++ b/platform/mbed_rtc_time.h @@ -0,0 +1,92 @@ + +/** \addtogroup platform */ +/** @{*/ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +/** Implementation of the C time.h functions + * + * Provides mechanisms to set and read the current time, based + * on the microcontroller Real-Time Clock (RTC), plus some + * standard C manipulation and formating functions. + * + * Example: + * @code + * #include "mbed.h" + * + * int main() { + * set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37 + * + * while(1) { + * time_t seconds = time(NULL); + * + * printf("Time as seconds since January 1, 1970 = %d\n", seconds); + * + * printf("Time as a basic string = %s", ctime(&seconds)); + * + * char buffer[32]; + * strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds)); + * printf("Time as a custom formatted string = %s", buffer); + * + * wait(1); + * } + * } + * @endcode + */ + +/** Set the current time + * + * Initialises and sets the time of the microcontroller Real-Time Clock (RTC) + * to the time represented by the number of seconds since January 1, 1970 + * (the UNIX timestamp). + * + * @param t Number of seconds since January 1, 1970 (the UNIX timestamp) + * + * @Note Synchronization level: Thread safe + * + * Example: + * @code + * #include "mbed.h" + * + * int main() { + * set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37 + * } + * @endcode + */ +void set_time(time_t t); + +/** Attach an external RTC to be used for the C time functions + * + * @Note Synchronization level: Thread safe + * + * @param read_rtc pointer to function which returns current UNIX timestamp + * @param write_rtc pointer to function which sets current UNIX timestamp, can be NULL + * @param init_rtc pointer to funtion which initializes RTC, can be NULL + * @param isenabled_rtc pointer to function wich returns if the rtc is enabled, can be NULL + */ +void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void)); + +#ifdef __cplusplus +} +#endif + +/** @}*/ diff --git a/platform/mbed_semihost_api.c b/platform/mbed_semihost_api.c index 187c6a70c0..ff1c6172f6 100644 --- a/platform/mbed_semihost_api.c +++ b/platform/mbed_semihost_api.c @@ -14,7 +14,7 @@ * limitations under the License. */ #include "cmsis.h" -#include "platform/semihost_api.h" +#include "platform/mbed_semihost_api.h" #include #include diff --git a/platform/mbed_semihost_api.h b/platform/mbed_semihost_api.h new file mode 100644 index 0000000000..6d1caf56a0 --- /dev/null +++ b/platform/mbed_semihost_api.h @@ -0,0 +1,98 @@ + +/** \addtogroup platform */ +/** @{*/ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * 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. + */ +#ifndef MBED_SEMIHOST_H +#define MBED_SEMIHOST_H + +#include "device.h" +#include "platform/mbed_toolchain.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if DEVICE_SEMIHOST + +#ifndef __CC_ARM + +#if defined(__ICCARM__) +static inline int __semihost(int reason, const void *arg) { + return __semihosting(reason, (void*)arg); +} +#else + +#ifdef __thumb__ +# define AngelSWI 0xAB +# define AngelSWIInsn "bkpt" +# define AngelSWIAsm bkpt +#else +# define AngelSWI 0x123456 +# define AngelSWIInsn "swi" +# define AngelSWIAsm swi +#endif + +static inline int __semihost(int reason, const void *arg) { + int value; + + asm volatile ( + "mov r0, %1" "\n\t" + "mov r1, %2" "\n\t" + AngelSWIInsn " %a3" "\n\t" + "mov %0, r0" + : "=r" (value) /* output operands */ + : "r" (reason), "r" (arg), "i" (AngelSWI) /* input operands */ + : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc" /* list of clobbered registers */ + ); + + return value; +} +#endif +#endif + +#if DEVICE_LOCALFILESYSTEM +FILEHANDLE semihost_open(const char* name, int openmode); +int semihost_close (FILEHANDLE fh); +int semihost_read (FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode); +int semihost_write (FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode); +int semihost_ensure(FILEHANDLE fh); +long semihost_flen (FILEHANDLE fh); +int semihost_seek (FILEHANDLE fh, long position); +int semihost_istty (FILEHANDLE fh); + +int semihost_remove(const char *name); +int semihost_rename(const char *old_name, const char *new_name); +#endif + +int semihost_uid(char *uid); +int semihost_reset(void); +int semihost_vbus(void); +int semihost_powerdown(void); +int semihost_exit(void); + +int semihost_connected(void); +int semihost_disabledebug(void); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @}*/ diff --git a/platform/mbed_sleep.h b/platform/mbed_sleep.h new file mode 100644 index 0000000000..013bef1db1 --- /dev/null +++ b/platform/mbed_sleep.h @@ -0,0 +1,85 @@ + +/** \addtogroup platform */ +/** @{*/ +/* mbed Microcontroller Library + * Copyright (c) 2006-2017 ARM Limited + * + * 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. + */ +#ifndef MBED_SLEEP_H +#define MBED_SLEEP_H + +#include "sleep_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** Send the microcontroller to sleep + * + * @note This function can be a noop if not implemented by the platform. + * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined). + * + * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the + * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates + * dynamic power used by the processor, memory systems and buses. The processor, peripheral and + * memory state are maintained, and the peripherals continue to work and can generate interrupts. + * + * The processor can be woken up by any internal peripheral interrupt or external pin interrupt. + * + * @note + * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. + * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be + * able to access the LocalFileSystem + */ +__INLINE static void sleep(void) +{ +#ifdef NDEBUG +#if DEVICE_SLEEP + hal_sleep(); +#endif /* DEVICE_SLEEP */ +#endif /* NDEBUG */ +} + +/** Send the microcontroller to deep sleep + * + * @note This function can be a noop if not implemented by the platform. + * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined). + * + * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode + * has the same sleep features as sleep plus it powers down peripherals and clocks. All state + * is still maintained. + * + * The processor can only be woken up by an external interrupt on a pin or a watchdog timer. + * + * @note + * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. + * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be + * able to access the LocalFileSystem + */ +__INLINE static void deepsleep(void) +{ +#ifdef NDEBUG +#if DEVICE_SLEEP + hal_deepsleep(); +#endif /* DEVICE_SLEEP */ +#endif /* NDEBUG */ +} + +#ifdef __cplusplus +} +#endif + +#endif + +/** @}*/ diff --git a/platform/mbed_toolchain.h b/platform/mbed_toolchain.h new file mode 100644 index 0000000000..9b2238fe97 --- /dev/null +++ b/platform/mbed_toolchain.h @@ -0,0 +1,305 @@ + +/** \addtogroup platform */ +/** @{*/ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * 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. + */ +#ifndef MBED_TOOLCHAIN_H +#define MBED_TOOLCHAIN_H + +#include "mbed_preprocessor.h" + + +// Warning for unsupported compilers +#if !defined(__GNUC__) /* GCC */ \ + && !defined(__CC_ARM) /* ARMCC */ \ + && !defined(__clang__) /* LLVM/Clang */ \ + && !defined(__ICCARM__) /* IAR */ +#warning "This compiler is not yet supported." +#endif + + +// Attributes + +/** MBED_PACKED + * Pack a structure, preventing any padding from being added between fields. + * + * @code + * #include "mbed_toolchain.h" + * + * MBED_PACKED(struct) foo { + * char x; + * int y; + * }; + * @endcode + */ +#ifndef MBED_PACKED +#if defined(__ICCARM__) +#define MBED_PACKED(struct) __packed struct +#else +#define MBED_PACKED(struct) struct __attribute__((packed)) +#endif +#endif + +/** MBED_ALIGN(N) + * Declare a variable to be aligned on an N-byte boundary. + * + * @note + * IAR does not support alignment greater than word size on the stack + * + * @code + * #include "mbed_toolchain.h" + * + * MBED_ALIGN(16) char a; + * @endcode + */ +#ifndef MBED_ALIGN +#if defined(__ICCARM__) +#define MBED_ALIGN(N) _Pragma(MBED_STRINGIFY(data_alignment=N)) +#else +#define MBED_ALIGN(N) __attribute__((aligned(N))) +#endif +#endif + +/** MBED_UNUSED + * Declare a function argument to be unused, suppressing compiler warnings + * + * @code + * #include "mbed_toolchain.h" + * + * void foo(MBED_UNUSED int arg) { + * + * } + * @endcode + */ +#ifndef MBED_UNUSED +#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) +#define MBED_UNUSED __attribute__((__unused__)) +#else +#define MBED_UNUSED +#endif +#endif + +/** MBED_WEAK + * Mark a function as being weak. + * + * @note + * weak functions are not friendly to making code re-usable, as they can only + * be overridden once (and if they are multiply overridden the linker will emit + * no warning). You should not normally use weak symbols as part of the API to + * re-usable modules. + * + * @code + * #include "mbed_toolchain.h" + * + * MBED_WEAK void foo() { + * // a weak implementation of foo that can be overriden by a definition + * // without __weak + * } + * @endcode + */ +#ifndef MBED_WEAK +#if defined(__ICCARM__) +#define MBED_WEAK __weak +#else +#define MBED_WEAK __attribute__((weak)) +#endif +#endif + +/** MBED_PURE + * Hint to the compiler that a function depends only on parameters + * + * @code + * #include "mbed_toolchain.h" + * + * MBED_PURE int foo(int arg){ + * // no access to global variables + * } + * @endcode + */ +#ifndef MBED_PURE +#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) +#define MBED_PURE __attribute__((const)) +#else +#define MBED_PURE +#endif +#endif + +/** MBED_FORCEINLINE + * Declare a function that must always be inlined. Failure to inline + * such a function will result in an error. + * + * @code + * #include "mbed_toolchain.h" + * + * MBED_FORCEINLINE void foo() { + * + * } + * @endcode + */ +#ifndef MBED_FORCEINLINE +#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) +#define MBED_FORCEINLINE static inline __attribute__((always_inline)) +#elif defined(__ICCARM__) +#define MBED_FORCEINLINE _Pragma("inline=forced") static +#else +#define MBED_FORCEINLINE static inline +#endif +#endif + +/** MBED_NORETURN + * Declare a function that will never return. + * + * @code + * #include "mbed_toolchain.h" + * + * MBED_NORETURN void foo() { + * // must never return + * while (1) {} + * } + * @endcode + */ +#ifndef MBED_NORETURN +#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) +#define MBED_NORETURN __attribute__((noreturn)) +#elif defined(__ICCARM__) +#define MBED_NORETURN __noreturn +#else +#define MBED_NORETURN +#endif +#endif + +/** MBED_UNREACHABLE + * An unreachable statement. If the statement is reached, + * behaviour is undefined. Useful in situations where the compiler + * cannot deduce the unreachability of code. + * + * @code + * #include "mbed_toolchain.h" + * + * void foo(int arg) { + * switch (arg) { + * case 1: return 1; + * case 2: return 2; + * ... + * } + * MBED_UNREACHABLE; + * } + * @endcode + */ +#ifndef MBED_UNREACHABLE +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM) +#define MBED_UNREACHABLE __builtin_unreachable() +#else +#define MBED_UNREACHABLE while (1) +#endif +#endif + +/** MBED_DEPRECATED("message string") + * Mark a function declaration as deprecated, if it used then a warning will be + * issued by the compiler possibly including the provided message. Note that not + * all compilers are able to display the message. + * + * @code + * #include "mbed_toolchain.h" + * + * MBED_DEPRECATED("don't foo any more, bar instead") + * void foo(int arg); + * @endcode + */ +#ifndef MBED_DEPRECATED +#if defined(__CC_ARM) +#define MBED_DEPRECATED(M) __attribute__((deprecated)) +#elif defined(__GNUC__) || defined(__clang__) +#define MBED_DEPRECATED(M) __attribute__((deprecated(M))) +#else +#define MBED_DEPRECATED(M) +#endif +#endif + +/** MBED_DEPRECATED_SINCE("version", "message string") + * Mark a function declaration as deprecated, noting that the declaration was + * deprecated on the specified version. If the function is used then a warning + * will be issued by the compiler possibly including the provided message. + * Note that not all compilers are able to display this message. + * + * @code + * #include "mbed_toolchain.h" + * + * MBED_DEPRECATED_SINCE("mbed-os-5.1", "don't foo any more, bar instead") + * void foo(int arg); + * @endcode + */ +#define MBED_DEPRECATED_SINCE(D, M) MBED_DEPRECATED(M " [since " D "]") + +/** MBED_CALLER_ADDR() + * Returns the caller of the current function. + * + * @note + * This macro is only implemented for GCC and ARMCC. + * + * @code + * #include "mbed_toolchain.h" + * + * printf("This function was called from %p", MBED_CALLER_ADDR()); + * @endcode + * + * @return Address of the calling function + */ +#ifndef MBED_CALLER_ADDR +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM) +#define MBED_CALLER_ADDR() __builtin_extract_return_addr(__builtin_return_address(0)) +#elif defined(__CC_ARM) +#define MBED_CALLER_ADDR() __builtin_return_address(0) +#else +#define MBED_CALLER_ADDR() (NULL) +#endif +#endif + +#ifndef MBED_SECTION +#if (defined(__GNUC__) || defined(__clang__)) || defined(__CC_ARM) +#define MBED_SECTION(name) __attribute__ ((section (name))) +#elif defined(__ICCARM__) +#define MBED_SECTION(name) _Pragma(MBED_STRINGIFY(location=name)) +#else +#error "Missing MBED_SECTION directive" +#endif +#endif + +// FILEHANDLE declaration +#if defined(TOOLCHAIN_ARM) +#include +#endif + +#ifndef FILEHANDLE +typedef int FILEHANDLE; +#endif + +// Backwards compatibility +#ifndef WEAK +#define WEAK MBED_WEAK +#endif + +#ifndef PACKED +#define PACKED MBED_PACKED() +#endif + +#ifndef EXTERN +#define EXTERN extern +#endif + +#endif + +/** @}*/ diff --git a/platform/mbed_wait_api.h b/platform/mbed_wait_api.h new file mode 100644 index 0000000000..39f03bfb0f --- /dev/null +++ b/platform/mbed_wait_api.h @@ -0,0 +1,71 @@ + +/** \addtogroup platform */ +/** @{*/ +/* mbed Microcontroller Library + * Copyright (c) 2006-2013 ARM Limited + * + * 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. + */ +#ifndef MBED_WAIT_API_H +#define MBED_WAIT_API_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** Generic wait functions. + * + * These provide simple NOP type wait capabilities. + * + * Example: + * @code + * #include "mbed.h" + * + * DigitalOut heartbeat(LED1); + * + * int main() { + * while (1) { + * heartbeat = 1; + * wait(0.5); + * heartbeat = 0; + * wait(0.5); + * } + * } + */ + +/** Waits for a number of seconds, with microsecond resolution (within + * the accuracy of single precision floating point). + * + * @param s number of seconds to wait + */ +void wait(float s); + +/** Waits a number of milliseconds. + * + * @param ms the whole number of milliseconds to wait + */ +void wait_ms(int ms); + +/** Waits a number of microseconds. + * + * @param us the whole number of microseconds to wait + */ +void wait_us(int us); + +#ifdef __cplusplus +} +#endif + +#endif + +/** @}*/ diff --git a/platform/mbed_wait_api_no_rtos.c b/platform/mbed_wait_api_no_rtos.c index a2f531fe1b..55820a4b99 100644 --- a/platform/mbed_wait_api_no_rtos.c +++ b/platform/mbed_wait_api_no_rtos.c @@ -18,7 +18,7 @@ // if the RTOS is not present. #ifndef MBED_CONF_RTOS_PRESENT -#include "platform/wait_api.h" +#include "platform/mbed_wait_api.h" #include "hal/us_ticker_api.h" void wait(float s) { diff --git a/platform/mbed_wait_api_rtos.cpp b/platform/mbed_wait_api_rtos.cpp index 9ee2ff9c7e..7ed609a143 100644 --- a/platform/mbed_wait_api_rtos.cpp +++ b/platform/mbed_wait_api_rtos.cpp @@ -18,10 +18,10 @@ // if the RTOS is present. #ifdef MBED_CONF_RTOS_PRESENT -#include "platform/wait_api.h" +#include "platform/mbed_wait_api.h" #include "hal/us_ticker_api.h" #include "rtos/rtos.h" -#include "platform/critical.h" +#include "platform/mbed_critical.h" void wait(float s) { wait_us(s * 1000000.0f); diff --git a/platform/rtc_time.h b/platform/rtc_time.h index fef0292f1c..a13f1bd82b 100644 --- a/platform/rtc_time.h +++ b/platform/rtc_time.h @@ -1,92 +1,24 @@ - -/** \addtogroup platform */ -/** @{*/ -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited +/* + * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved + * 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. + * 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 + * 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. + * 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 +#ifndef MBED_OLD_RTC_TIME_H +#define MBED_OLD_RTC_TIME_H + +#warning rtc_time.h has been replaced by mbed_rtc_time.h, please update to mbed_rtc_time.h [since mbed-os-5.3] +#include "platform/mbed_rtc_time.h" -#ifdef __cplusplus -extern "C" { #endif - -/** Implementation of the C time.h functions - * - * Provides mechanisms to set and read the current time, based - * on the microcontroller Real-Time Clock (RTC), plus some - * standard C manipulation and formating functions. - * - * Example: - * @code - * #include "mbed.h" - * - * int main() { - * set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37 - * - * while(1) { - * time_t seconds = time(NULL); - * - * printf("Time as seconds since January 1, 1970 = %d\n", seconds); - * - * printf("Time as a basic string = %s", ctime(&seconds)); - * - * char buffer[32]; - * strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds)); - * printf("Time as a custom formatted string = %s", buffer); - * - * wait(1); - * } - * } - * @endcode - */ - -/** Set the current time - * - * Initialises and sets the time of the microcontroller Real-Time Clock (RTC) - * to the time represented by the number of seconds since January 1, 1970 - * (the UNIX timestamp). - * - * @param t Number of seconds since January 1, 1970 (the UNIX timestamp) - * - * @Note Synchronization level: Thread safe - * - * Example: - * @code - * #include "mbed.h" - * - * int main() { - * set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37 - * } - * @endcode - */ -void set_time(time_t t); - -/** Attach an external RTC to be used for the C time functions - * - * @Note Synchronization level: Thread safe - * - * @param read_rtc pointer to function which returns current UNIX timestamp - * @param write_rtc pointer to function which sets current UNIX timestamp, can be NULL - * @param init_rtc pointer to funtion which initializes RTC, can be NULL - * @param isenabled_rtc pointer to function wich returns if the rtc is enabled, can be NULL - */ -void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void)); - -#ifdef __cplusplus -} -#endif - -/** @}*/ diff --git a/platform/semihost_api.h b/platform/semihost_api.h index b5851457ab..41811a3f9b 100644 --- a/platform/semihost_api.h +++ b/platform/semihost_api.h @@ -1,98 +1,24 @@ - -/** \addtogroup platform */ -/** @{*/ -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited +/* + * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved + * 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. + * 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 + * 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. + * 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. */ -#ifndef MBED_SEMIHOST_H -#define MBED_SEMIHOST_H -#include "device.h" -#include "platform/toolchain.h" +#ifndef MBED_OLD_SEMIHOST_API_H +#define MBED_OLD_SEMIHOST_API_H -#ifdef __cplusplus -extern "C" { -#endif - -#if DEVICE_SEMIHOST - -#ifndef __CC_ARM - -#if defined(__ICCARM__) -static inline int __semihost(int reason, const void *arg) { - return __semihosting(reason, (void*)arg); -} -#else - -#ifdef __thumb__ -# define AngelSWI 0xAB -# define AngelSWIInsn "bkpt" -# define AngelSWIAsm bkpt -#else -# define AngelSWI 0x123456 -# define AngelSWIInsn "swi" -# define AngelSWIAsm swi -#endif - -static inline int __semihost(int reason, const void *arg) { - int value; - - asm volatile ( - "mov r0, %1" "\n\t" - "mov r1, %2" "\n\t" - AngelSWIInsn " %a3" "\n\t" - "mov %0, r0" - : "=r" (value) /* output operands */ - : "r" (reason), "r" (arg), "i" (AngelSWI) /* input operands */ - : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc" /* list of clobbered registers */ - ); - - return value; -} -#endif -#endif - -#if DEVICE_LOCALFILESYSTEM -FILEHANDLE semihost_open(const char* name, int openmode); -int semihost_close (FILEHANDLE fh); -int semihost_read (FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode); -int semihost_write (FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode); -int semihost_ensure(FILEHANDLE fh); -long semihost_flen (FILEHANDLE fh); -int semihost_seek (FILEHANDLE fh, long position); -int semihost_istty (FILEHANDLE fh); - -int semihost_remove(const char *name); -int semihost_rename(const char *old_name, const char *new_name); -#endif - -int semihost_uid(char *uid); -int semihost_reset(void); -int semihost_vbus(void); -int semihost_powerdown(void); -int semihost_exit(void); - -int semihost_connected(void); -int semihost_disabledebug(void); +#warning semihost_api.h has been replaced by mbed_semihost_api.h, please update to mbed_semihost_api.h [since mbed-os-5.3] +#include "platform/mbed_semihost_api.h" #endif - -#ifdef __cplusplus -} -#endif - -#endif - -/** @}*/ diff --git a/platform/sleep.h b/platform/sleep.h index 013bef1db1..ac3e84b777 100644 --- a/platform/sleep.h +++ b/platform/sleep.h @@ -1,85 +1,24 @@ - -/** \addtogroup platform */ -/** @{*/ -/* mbed Microcontroller Library - * Copyright (c) 2006-2017 ARM Limited +/* + * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved + * 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. + * 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 + * 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. + * 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. */ -#ifndef MBED_SLEEP_H -#define MBED_SLEEP_H -#include "sleep_api.h" +#ifndef MBED_OLD_SLEEP_H +#define MBED_OLD_SLEEP_H -#ifdef __cplusplus -extern "C" { -#endif - -/** Send the microcontroller to sleep - * - * @note This function can be a noop if not implemented by the platform. - * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined). - * - * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the - * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates - * dynamic power used by the processor, memory systems and buses. The processor, peripheral and - * memory state are maintained, and the peripherals continue to work and can generate interrupts. - * - * The processor can be woken up by any internal peripheral interrupt or external pin interrupt. - * - * @note - * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. - * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be - * able to access the LocalFileSystem - */ -__INLINE static void sleep(void) -{ -#ifdef NDEBUG -#if DEVICE_SLEEP - hal_sleep(); -#endif /* DEVICE_SLEEP */ -#endif /* NDEBUG */ -} - -/** Send the microcontroller to deep sleep - * - * @note This function can be a noop if not implemented by the platform. - * @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined). - * - * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode - * has the same sleep features as sleep plus it powers down peripherals and clocks. All state - * is still maintained. - * - * The processor can only be woken up by an external interrupt on a pin or a watchdog timer. - * - * @note - * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. - * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be - * able to access the LocalFileSystem - */ -__INLINE static void deepsleep(void) -{ -#ifdef NDEBUG -#if DEVICE_SLEEP - hal_deepsleep(); -#endif /* DEVICE_SLEEP */ -#endif /* NDEBUG */ -} - -#ifdef __cplusplus -} -#endif +#warning sleep.h has been replaced by mbed_sleep.h, please update to mbed_sleep.h [since mbed-os-5.3] +#include "platform/mbed_sleep.h" #endif - -/** @}*/ diff --git a/platform/toolchain.h b/platform/toolchain.h index f7bfd533b3..5f1eafe2a9 100644 --- a/platform/toolchain.h +++ b/platform/toolchain.h @@ -16,290 +16,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef MBED_TOOLCHAIN_H -#define MBED_TOOLCHAIN_H -#include "mbed_preprocessor.h" +#ifndef MBED_OLD_TOOLCHAIN_H +#define MBED_OLD_TOOLCHAIN_H - -// Warning for unsupported compilers -#if !defined(__GNUC__) /* GCC */ \ - && !defined(__CC_ARM) /* ARMCC */ \ - && !defined(__clang__) /* LLVM/Clang */ \ - && !defined(__ICCARM__) /* IAR */ -#warning "This compiler is not yet supported." -#endif - - -// Attributes - -/** MBED_PACKED - * Pack a structure, preventing any padding from being added between fields. - * - * @code - * #include "toolchain.h" - * - * MBED_PACKED(struct) foo { - * char x; - * int y; - * }; - * @endcode - */ -#ifndef MBED_PACKED -#if defined(__ICCARM__) -#define MBED_PACKED(struct) __packed struct -#else -#define MBED_PACKED(struct) struct __attribute__((packed)) -#endif -#endif - -/** MBED_ALIGN(N) - * Declare a variable to be aligned on an N-byte boundary. - * - * @note - * IAR does not support alignment greater than word size on the stack - * - * @code - * #include "toolchain.h" - * - * MBED_ALIGN(16) char a; - * @endcode - */ -#ifndef MBED_ALIGN -#if defined(__ICCARM__) -#define MBED_ALIGN(N) _Pragma(MBED_STRINGIFY(data_alignment=N)) -#else -#define MBED_ALIGN(N) __attribute__((aligned(N))) -#endif -#endif - -/** MBED_UNUSED - * Declare a function argument to be unused, suppressing compiler warnings - * - * @code - * #include "toolchain.h" - * - * void foo(MBED_UNUSED int arg) { - * - * } - * @endcode - */ -#ifndef MBED_UNUSED -#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) -#define MBED_UNUSED __attribute__((__unused__)) -#else -#define MBED_UNUSED -#endif -#endif - -/** MBED_WEAK - * Mark a function as being weak. - * - * @note - * weak functions are not friendly to making code re-usable, as they can only - * be overridden once (and if they are multiply overridden the linker will emit - * no warning). You should not normally use weak symbols as part of the API to - * re-usable modules. - * - * @code - * #include "toolchain.h" - * - * MBED_WEAK void foo() { - * // a weak implementation of foo that can be overriden by a definition - * // without __weak - * } - * @endcode - */ -#ifndef MBED_WEAK -#if defined(__ICCARM__) -#define MBED_WEAK __weak -#else -#define MBED_WEAK __attribute__((weak)) -#endif -#endif - -/** MBED_PURE - * Hint to the compiler that a function depends only on parameters - * - * @code - * #include "toolchain.h" - * - * MBED_PURE int foo(int arg){ - * // no access to global variables - * } - * @endcode - */ -#ifndef MBED_PURE -#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) -#define MBED_PURE __attribute__((const)) -#else -#define MBED_PURE -#endif -#endif - -/** MBED_FORCEINLINE - * Declare a function that must always be inlined. Failure to inline - * such a function will result in an error. - * - * @code - * #include "toolchain.h" - * - * MBED_FORCEINLINE void foo() { - * - * } - * @endcode - */ -#ifndef MBED_FORCEINLINE -#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) -#define MBED_FORCEINLINE static inline __attribute__((always_inline)) -#elif defined(__ICCARM__) -#define MBED_FORCEINLINE _Pragma("inline=forced") static -#else -#define MBED_FORCEINLINE static inline -#endif -#endif - -/** MBED_NORETURN - * Declare a function that will never return. - * - * @code - * #include "toolchain.h" - * - * MBED_NORETURN void foo() { - * // must never return - * while (1) {} - * } - * @endcode - */ -#ifndef MBED_NORETURN -#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) -#define MBED_NORETURN __attribute__((noreturn)) -#elif defined(__ICCARM__) -#define MBED_NORETURN __noreturn -#else -#define MBED_NORETURN -#endif -#endif - -/** MBED_UNREACHABLE - * An unreachable statement. If the statement is reached, - * behaviour is undefined. Useful in situations where the compiler - * cannot deduce the unreachability of code. - * - * @code - * #include "toolchain.h" - * - * void foo(int arg) { - * switch (arg) { - * case 1: return 1; - * case 2: return 2; - * ... - * } - * MBED_UNREACHABLE; - * } - * @endcode - */ -#ifndef MBED_UNREACHABLE -#if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM) -#define MBED_UNREACHABLE __builtin_unreachable() -#else -#define MBED_UNREACHABLE while (1) -#endif -#endif - -/** MBED_DEPRECATED("message string") - * Mark a function declaration as deprecated, if it used then a warning will be - * issued by the compiler possibly including the provided message. Note that not - * all compilers are able to display the message. - * - * @code - * #include "toolchain.h" - * - * MBED_DEPRECATED("don't foo any more, bar instead") - * void foo(int arg); - * @endcode - */ -#ifndef MBED_DEPRECATED -#if defined(__CC_ARM) -#define MBED_DEPRECATED(M) __attribute__((deprecated)) -#elif defined(__GNUC__) || defined(__clang__) -#define MBED_DEPRECATED(M) __attribute__((deprecated(M))) -#else -#define MBED_DEPRECATED(M) -#endif -#endif - -/** MBED_DEPRECATED_SINCE("version", "message string") - * Mark a function declaration as deprecated, noting that the declaration was - * deprecated on the specified version. If the function is used then a warning - * will be issued by the compiler possibly including the provided message. - * Note that not all compilers are able to display this message. - * - * @code - * #include "toolchain.h" - * - * MBED_DEPRECATED_SINCE("mbed-os-5.1", "don't foo any more, bar instead") - * void foo(int arg); - * @endcode - */ -#define MBED_DEPRECATED_SINCE(D, M) MBED_DEPRECATED(M " [since " D "]") - -/** MBED_CALLER_ADDR() - * Returns the caller of the current function. - * - * @note - * This macro is only implemented for GCC and ARMCC. - * - * @code - * #include "toolchain.h" - * - * printf("This function was called from %p", MBED_CALLER_ADDR()); - * @endcode - * - * @return Address of the calling function - */ -#ifndef MBED_CALLER_ADDR -#if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM) -#define MBED_CALLER_ADDR() __builtin_extract_return_addr(__builtin_return_address(0)) -#elif defined(__CC_ARM) -#define MBED_CALLER_ADDR() __builtin_return_address(0) -#else -#define MBED_CALLER_ADDR() (NULL) -#endif -#endif - -#ifndef MBED_SECTION -#if (defined(__GNUC__) || defined(__clang__)) || defined(__CC_ARM) -#define MBED_SECTION(name) __attribute__ ((section (name))) -#elif defined(__ICCARM__) -#define MBED_SECTION(name) _Pragma(MBED_STRINGIFY(location=name)) -#else -#error "Missing MBED_SECTION directive" -#endif -#endif - -// FILEHANDLE declaration -#if defined(TOOLCHAIN_ARM) -#include -#endif - -#ifndef FILEHANDLE -typedef int FILEHANDLE; -#endif - -// Backwards compatibility -#ifndef WEAK -#define WEAK MBED_WEAK -#endif - -#ifndef PACKED -#define PACKED MBED_PACKED() -#endif - -#ifndef EXTERN -#define EXTERN extern -#endif +#warning toolchain.h has been replaced by mbed_toolchain.h, please update to mbed_toolchain.h [since mbed-os-5.3] +#include "platform/mbed_toolchain.h" #endif - -/** @}*/ diff --git a/platform/wait_api.h b/platform/wait_api.h index 39f03bfb0f..d725b5fa78 100644 --- a/platform/wait_api.h +++ b/platform/wait_api.h @@ -1,71 +1,24 @@ - -/** \addtogroup platform */ -/** @{*/ -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited +/* + * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved + * 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. + * 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 + * 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. + * 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. */ -#ifndef MBED_WAIT_API_H -#define MBED_WAIT_API_H -#ifdef __cplusplus -extern "C" { -#endif +#ifndef MBED_OLD_WAIT_API_H +#define MBED_OLD_WAIT_API_H -/** Generic wait functions. - * - * These provide simple NOP type wait capabilities. - * - * Example: - * @code - * #include "mbed.h" - * - * DigitalOut heartbeat(LED1); - * - * int main() { - * while (1) { - * heartbeat = 1; - * wait(0.5); - * heartbeat = 0; - * wait(0.5); - * } - * } - */ - -/** Waits for a number of seconds, with microsecond resolution (within - * the accuracy of single precision floating point). - * - * @param s number of seconds to wait - */ -void wait(float s); - -/** Waits a number of milliseconds. - * - * @param ms the whole number of milliseconds to wait - */ -void wait_ms(int ms); - -/** Waits a number of microseconds. - * - * @param us the whole number of microseconds to wait - */ -void wait_us(int us); - -#ifdef __cplusplus -} -#endif +#warning wait_api.h has been replaced by mbed_wait_api.h, please update to mbed_wait_api.h [since mbed-os-5.3] +#include "platform/mbed_wait_api.h" #endif - -/** @}*/ diff --git a/rtos/RtosTimer.h b/rtos/RtosTimer.h index baf8e351bc..0e39661e7d 100644 --- a/rtos/RtosTimer.h +++ b/rtos/RtosTimer.h @@ -25,7 +25,7 @@ #include #include "cmsis_os.h" #include "platform/Callback.h" -#include "platform/toolchain.h" +#include "platform/mbed_toolchain.h" namespace rtos { /** \addtogroup rtos */ diff --git a/rtos/Thread.h b/rtos/Thread.h index 7d565d77a4..6c480d74b7 100644 --- a/rtos/Thread.h +++ b/rtos/Thread.h @@ -25,7 +25,7 @@ #include #include "cmsis_os.h" #include "platform/Callback.h" -#include "platform/toolchain.h" +#include "platform/mbed_toolchain.h" #include "rtos/Semaphore.h" #include "rtos/Mutex.h" diff --git a/rtos/rtos_idle.c b/rtos/rtos_idle.c index 709e09f439..b13a6a670a 100644 --- a/rtos/rtos_idle.c +++ b/rtos/rtos_idle.c @@ -21,7 +21,7 @@ */ #include "rtos/rtos_idle.h" -#include "platform/sleep.h" +#include "platform/mbed_sleep.h" static void default_idle_hook(void) { diff --git a/targets/TARGET_ARM_SSG/TARGET_BEETLE/analogin_api.c b/targets/TARGET_ARM_SSG/TARGET_BEETLE/analogin_api.c index 76929547c6..af20c9564e 100644 --- a/targets/TARGET_ARM_SSG/TARGET_BEETLE/analogin_api.c +++ b/targets/TARGET_ARM_SSG/TARGET_BEETLE/analogin_api.c @@ -16,7 +16,7 @@ */ #include "cmsis.h" #include "mbed_assert.h" -#include "wait_api.h" +#include "mbed_wait_api.h" #include "analogin_api.h" #include "gpio_api.h" #include "spi_api.h" diff --git a/targets/TARGET_ARM_SSG/TARGET_BEETLE/i2c_api.c b/targets/TARGET_ARM_SSG/TARGET_BEETLE/i2c_api.c index 814be490b4..c8e86332fc 100644 --- a/targets/TARGET_ARM_SSG/TARGET_BEETLE/i2c_api.c +++ b/targets/TARGET_ARM_SSG/TARGET_BEETLE/i2c_api.c @@ -18,7 +18,7 @@ #include "cmsis.h" #include "pinmap.h" #include "mbed_error.h" -#include "wait_api.h" +#include "mbed_wait_api.h" /* States of a possibly combined I2C transfer */ typedef enum i2c_transfer_state_t { I2C_TRANSFER_SINGLE, /* Non combined transfer */ diff --git a/targets/TARGET_ARM_SSG/TARGET_BEETLE/spi_api.c b/targets/TARGET_ARM_SSG/TARGET_BEETLE/spi_api.c index 6bdf11c71b..714cf4598b 100644 --- a/targets/TARGET_ARM_SSG/TARGET_BEETLE/spi_api.c +++ b/targets/TARGET_ARM_SSG/TARGET_BEETLE/spi_api.c @@ -20,7 +20,7 @@ #include "cmsis.h" #include "pinmap.h" #include "mbed_error.h" -#include "wait_api.h" +#include "mbed_wait_api.h" /* * Driver private data structure that should not be shared by multiple diff --git a/targets/TARGET_ARM_SSG/TARGET_IOTSS/SDK/ETH_MPS2.c b/targets/TARGET_ARM_SSG/TARGET_IOTSS/SDK/ETH_MPS2.c index 68337ffac5..2e20cb7113 100644 --- a/targets/TARGET_ARM_SSG/TARGET_IOTSS/SDK/ETH_MPS2.c +++ b/targets/TARGET_ARM_SSG/TARGET_IOTSS/SDK/ETH_MPS2.c @@ -35,7 +35,7 @@ */ #include -#include "wait_api.h" +#include "mbed_wait_api.h" #include "ETH_MPS2.h" // SMSC9220 low-level operations diff --git a/targets/TARGET_ARM_SSG/TARGET_IOTSS/SDK/mps2_ethernet_api.c b/targets/TARGET_ARM_SSG/TARGET_IOTSS/SDK/mps2_ethernet_api.c index 1461ff5995..36f677985c 100644 --- a/targets/TARGET_ARM_SSG/TARGET_IOTSS/SDK/mps2_ethernet_api.c +++ b/targets/TARGET_ARM_SSG/TARGET_IOTSS/SDK/mps2_ethernet_api.c @@ -18,10 +18,10 @@ #include "mps2_ethernet_api.h" #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #include "ETH_MPS2.h" -#include "wait_api.h" +#include "mbed_wait_api.h" #define TX_PKT_SIZE 256 #define RX_PKT_SIZE 300 diff --git a/targets/TARGET_ARM_SSG/TARGET_IOTSS/ethernet_api.c b/targets/TARGET_ARM_SSG/TARGET_IOTSS/ethernet_api.c index e59c210243..78469a645f 100644 --- a/targets/TARGET_ARM_SSG/TARGET_IOTSS/ethernet_api.c +++ b/targets/TARGET_ARM_SSG/TARGET_IOTSS/ethernet_api.c @@ -19,10 +19,10 @@ #include "mps2_ethernet_api.h" #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #include "ETH_MPS2.h" -#include "wait_api.h" +#include "mbed_wait_api.h" #define TX_PKT_SIZE 256 #define RX_PKT_SIZE 300 diff --git a/targets/TARGET_ARM_SSG/TARGET_IOTSS/i2c_api.c b/targets/TARGET_ARM_SSG/TARGET_IOTSS/i2c_api.c index fba6a003ab..49e0e8c458 100644 --- a/targets/TARGET_ARM_SSG/TARGET_IOTSS/i2c_api.c +++ b/targets/TARGET_ARM_SSG/TARGET_IOTSS/i2c_api.c @@ -18,7 +18,7 @@ #include "pinmap.h" #include "mbed_error.h" #include "SMM_MPS2.h" -#include "wait_api.h" +#include "mbed_wait_api.h" #include "fpga.h" // Types diff --git a/targets/TARGET_ARM_SSG/TARGET_IOTSS/spi_api.c b/targets/TARGET_ARM_SSG/TARGET_IOTSS/spi_api.c index 99e501a4ab..533627033a 100644 --- a/targets/TARGET_ARM_SSG/TARGET_IOTSS/spi_api.c +++ b/targets/TARGET_ARM_SSG/TARGET_IOTSS/spi_api.c @@ -20,7 +20,7 @@ #include "cmsis.h" #include "pinmap.h" #include "mbed_error.h" -#include "wait_api.h" +#include "mbed_wait_api.h" static const PinMap PinMap_SPI_SCLK[] = { {SCLK_SPI , SPI_0, 0}, diff --git a/targets/TARGET_ARM_SSG/TARGET_MPS2/SDK/ETH_MPS2.c b/targets/TARGET_ARM_SSG/TARGET_MPS2/SDK/ETH_MPS2.c index 67abb13220..3910871cd9 100644 --- a/targets/TARGET_ARM_SSG/TARGET_MPS2/SDK/ETH_MPS2.c +++ b/targets/TARGET_ARM_SSG/TARGET_MPS2/SDK/ETH_MPS2.c @@ -35,7 +35,7 @@ */ #include -#include "wait_api.h" +#include "mbed_wait_api.h" #include "ETH_MPS2.h" // SMSC9220 low-level operations diff --git a/targets/TARGET_ARM_SSG/TARGET_MPS2/SDK/mps2_ethernet_api.c b/targets/TARGET_ARM_SSG/TARGET_MPS2/SDK/mps2_ethernet_api.c index 1461ff5995..36f677985c 100644 --- a/targets/TARGET_ARM_SSG/TARGET_MPS2/SDK/mps2_ethernet_api.c +++ b/targets/TARGET_ARM_SSG/TARGET_MPS2/SDK/mps2_ethernet_api.c @@ -18,10 +18,10 @@ #include "mps2_ethernet_api.h" #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #include "ETH_MPS2.h" -#include "wait_api.h" +#include "mbed_wait_api.h" #define TX_PKT_SIZE 256 #define RX_PKT_SIZE 300 diff --git a/targets/TARGET_ARM_SSG/TARGET_MPS2/ethernet_api.c b/targets/TARGET_ARM_SSG/TARGET_MPS2/ethernet_api.c index e59c210243..78469a645f 100644 --- a/targets/TARGET_ARM_SSG/TARGET_MPS2/ethernet_api.c +++ b/targets/TARGET_ARM_SSG/TARGET_MPS2/ethernet_api.c @@ -19,10 +19,10 @@ #include "mps2_ethernet_api.h" #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #include "ETH_MPS2.h" -#include "wait_api.h" +#include "mbed_wait_api.h" #define TX_PKT_SIZE 256 #define RX_PKT_SIZE 300 diff --git a/targets/TARGET_ARM_SSG/TARGET_MPS2/i2c_api.c b/targets/TARGET_ARM_SSG/TARGET_MPS2/i2c_api.c index 74d4f0190b..7873205d9d 100644 --- a/targets/TARGET_ARM_SSG/TARGET_MPS2/i2c_api.c +++ b/targets/TARGET_ARM_SSG/TARGET_MPS2/i2c_api.c @@ -18,7 +18,7 @@ #include "pinmap.h" #include "mbed_error.h" #include "SMM_MPS2.h" -#include "wait_api.h" +#include "mbed_wait_api.h" #include "fpga.h" // Types diff --git a/targets/TARGET_ARM_SSG/TARGET_MPS2/spi_api.c b/targets/TARGET_ARM_SSG/TARGET_MPS2/spi_api.c index 9aaf23bfe6..6219808730 100644 --- a/targets/TARGET_ARM_SSG/TARGET_MPS2/spi_api.c +++ b/targets/TARGET_ARM_SSG/TARGET_MPS2/spi_api.c @@ -20,7 +20,7 @@ #include "cmsis.h" #include "pinmap.h" #include "mbed_error.h" -#include "wait_api.h" +#include "mbed_wait_api.h" static const PinMap PinMap_SPI_SCLK[] = { {SCLK_SPI , SPI_0, 0}, diff --git a/targets/TARGET_Atmel/TARGET_SAM_CortexM4/drivers/pmc/sleep.c b/targets/TARGET_Atmel/TARGET_SAM_CortexM4/drivers/pmc/sleep.c index cc1cd20679..87f1b4d1fe 100644 --- a/targets/TARGET_Atmel/TARGET_SAM_CortexM4/drivers/pmc/sleep.c +++ b/targets/TARGET_Atmel/TARGET_SAM_CortexM4/drivers/pmc/sleep.c @@ -45,7 +45,7 @@ */ #include -#include "sleep.h" +#include "mbed_sleep.h" /* SAM3 and SAM4 series */ #if (SAM3S || SAM3N || SAM3XA || SAM3U || SAM4S || SAM4E || SAM4N || SAM4C || \ diff --git a/targets/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/flash_api.c b/targets/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/flash_api.c index 40414b0e2c..8671ad6158 100644 --- a/targets/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/flash_api.c +++ b/targets/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/flash_api.c @@ -16,7 +16,7 @@ #include "flash_api.h" #include "flash_data.h" -#include "critical.h" +#include "mbed_critical.h" // This file is automagically generated diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/flash_api.c b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/flash_api.c index d495281a96..a7c585515a 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/flash_api.c +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/flash_api.c @@ -16,7 +16,7 @@ #include "flash_api.h" #include "flash_data.h" -#include "critical.h" +#include "mbed_critical.h" // This file is automagically generated diff --git a/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sleep.c b/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sleep.c index c1a54f6db0..d8d2d7e38d 100644 --- a/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sleep.c +++ b/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sleep.c @@ -16,7 +16,7 @@ #include "sleep_api.h" #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" MBED_WEAK void hal_sleep(void) { diff --git a/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c b/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c index 0781f1689b..39fe4472b3 100644 --- a/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c @@ -19,7 +19,7 @@ #include "cmsis.h" #include "PeripheralNames.h" #include "nrf_delay.h" -#include "toolchain.h" +#include "mbed_toolchain.h" /* * Note: The micro-second timer API on the nRF51 platform is implemented using diff --git a/targets/TARGET_NORDIC/TARGET_NRF5/us_ticker.c b/targets/TARGET_NORDIC/TARGET_NRF5/us_ticker.c index d3a9c9d63e..903979e2a5 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5/us_ticker.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5/us_ticker.c @@ -233,7 +233,7 @@ void us_ticker_clear_interrupt(void) // alternative source of RTOS ticks. #if defined(TARGET_MCU_NRF51822) -#include "toolchain.h" +#include "mbed_toolchain.h" #define MAX_RTC_COUNTER_VAL ((1uL << RTC_COUNTER_BITS) - 1) diff --git a/targets/TARGET_NUVOTON/TARGET_M451/can_api.c b/targets/TARGET_NUVOTON/TARGET_M451/can_api.c index c0c6daad21..ba43d93b0b 100644 --- a/targets/TARGET_NUVOTON/TARGET_M451/can_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M451/can_api.c @@ -26,7 +26,7 @@ #include "nu_modutil.h" #include "nu_miscutil.h" #include "nu_bitutil.h" - #include "critical.h" + #include "mbed_critical.h" #define NU_CAN_DEBUG 0 #define CAN_NUM 1 diff --git a/targets/TARGET_NUVOTON/TARGET_M451/i2c_api.c b/targets/TARGET_NUVOTON/TARGET_M451/i2c_api.c index cb0a475117..8b05fe8627 100644 --- a/targets/TARGET_NUVOTON/TARGET_M451/i2c_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M451/i2c_api.c @@ -24,7 +24,7 @@ #include "nu_modutil.h" #include "nu_miscutil.h" #include "nu_bitutil.h" -#include "critical.h" +#include "mbed_critical.h" #define NU_I2C_DEBUG 0 diff --git a/targets/TARGET_NUVOTON/TARGET_M451/lp_ticker.c b/targets/TARGET_NUVOTON/TARGET_M451/lp_ticker.c index 9b3ddc356c..cdfb07887b 100644 --- a/targets/TARGET_NUVOTON/TARGET_M451/lp_ticker.c +++ b/targets/TARGET_NUVOTON/TARGET_M451/lp_ticker.c @@ -21,7 +21,7 @@ #include "sleep_api.h" #include "nu_modutil.h" #include "nu_miscutil.h" -#include "critical.h" +#include "mbed_critical.h" // lp_ticker tick = us = timestamp #define US_PER_TICK (1) diff --git a/targets/TARGET_NUVOTON/TARGET_M451/rtc_api.c b/targets/TARGET_NUVOTON/TARGET_M451/rtc_api.c index 9ee5dfd138..d114b7cff1 100644 --- a/targets/TARGET_NUVOTON/TARGET_M451/rtc_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M451/rtc_api.c @@ -18,7 +18,7 @@ #if DEVICE_RTC -#include "wait_api.h" +#include "mbed_wait_api.h" #include "mbed_error.h" #include "nu_modutil.h" #include "nu_miscutil.h" diff --git a/targets/TARGET_NUVOTON/TARGET_M451/us_ticker.c b/targets/TARGET_NUVOTON/TARGET_M451/us_ticker.c index 2dc12d2f1c..c82ea1364b 100644 --- a/targets/TARGET_NUVOTON/TARGET_M451/us_ticker.c +++ b/targets/TARGET_NUVOTON/TARGET_M451/us_ticker.c @@ -19,7 +19,7 @@ #include "mbed_assert.h" #include "nu_modutil.h" #include "nu_miscutil.h" -#include "critical.h" +#include "mbed_critical.h" // us_ticker tick = us = timestamp #define US_PER_TICK 1 diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/can_api.c b/targets/TARGET_NUVOTON/TARGET_NUC472/can_api.c index dd410b7e41..0f8fd1c295 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/can_api.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/can_api.c @@ -26,7 +26,7 @@ #include "nu_modutil.h" #include "nu_miscutil.h" #include "nu_bitutil.h" - #include "critical.h" + #include "mbed_critical.h" #define NU_CAN_DEBUG 0 #define CAN_NUM 2 diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/aes/aes_alt.c b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/aes/aes_alt.c index ff59e66237..82def0d1ee 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/aes/aes_alt.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/aes/aes_alt.c @@ -38,7 +38,7 @@ #include "mbedtls/aes.h" #include "NUC472_442.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_assert.h" //static int aes_init_done = 0; diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/des/des_alt.c b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/des/des_alt.c index 3643ffd691..86d12a27cf 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/des/des_alt.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/des/des_alt.c @@ -31,7 +31,7 @@ #include "des_alt.h" #include "crypto-misc.h" #include "nu_bitutil.h" -#include "toolchain.h" +#include "mbed_toolchain.h" // Must be a multiple of 64-bit block size #define MAXSIZE_DMABUF (8 * 5) diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/i2c_api.c b/targets/TARGET_NUVOTON/TARGET_NUC472/i2c_api.c index 4b5e9ef8c5..481f7d6bd0 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/i2c_api.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/i2c_api.c @@ -24,7 +24,7 @@ #include "nu_modutil.h" #include "nu_miscutil.h" #include "nu_bitutil.h" -#include "critical.h" +#include "mbed_critical.h" #define NU_I2C_DEBUG 0 diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/lp_ticker.c b/targets/TARGET_NUVOTON/TARGET_NUC472/lp_ticker.c index f581b5a910..232d230bcc 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/lp_ticker.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/lp_ticker.c @@ -21,7 +21,7 @@ #include "sleep_api.h" #include "nu_modutil.h" #include "nu_miscutil.h" -#include "critical.h" +#include "mbed_critical.h" // lp_ticker tick = us = timestamp #define US_PER_TICK (1) diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/rtc_api.c b/targets/TARGET_NUVOTON/TARGET_NUC472/rtc_api.c index 9ee5dfd138..d114b7cff1 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/rtc_api.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/rtc_api.c @@ -18,7 +18,7 @@ #if DEVICE_RTC -#include "wait_api.h" +#include "mbed_wait_api.h" #include "mbed_error.h" #include "nu_modutil.h" #include "nu_miscutil.h" diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/us_ticker.c b/targets/TARGET_NUVOTON/TARGET_NUC472/us_ticker.c index 386ee44d9b..c83164ab92 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/us_ticker.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/us_ticker.c @@ -19,7 +19,7 @@ #include "mbed_assert.h" #include "nu_modutil.h" #include "nu_miscutil.h" -#include "critical.h" +#include "mbed_critical.h" // us_ticker tick = us = timestamp #define US_PER_TICK 1 diff --git a/targets/TARGET_NXP/TARGET_LPC15XX/us_ticker.c b/targets/TARGET_NXP/TARGET_LPC15XX/us_ticker.c index 633e36b4f4..8d049ffb78 100644 --- a/targets/TARGET_NXP/TARGET_LPC15XX/us_ticker.c +++ b/targets/TARGET_NXP/TARGET_LPC15XX/us_ticker.c @@ -16,7 +16,7 @@ #include #include "us_ticker_api.h" #include "PeripheralNames.h" -#include "critical.h" +#include "mbed_critical.h" #define US_TICKER_TIMER_IRQn SCT3_IRQn diff --git a/targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/C027_api.c b/targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/C027_api.c index cb290d45e7..7fbe1e5360 100644 --- a/targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/C027_api.c +++ b/targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/C027_api.c @@ -14,7 +14,7 @@ * limitations under the License. */ #include "gpio_api.h" -#include "wait_api.h" +#include "mbed_wait_api.h" #include "C027_api.h" static gpio_t mdmEn, mdmLvlOe, mdmILvlOe, mdmUsbDet; diff --git a/targets/TARGET_NXP/TARGET_LPC176X/ethernet_api.c b/targets/TARGET_NXP/TARGET_LPC176X/ethernet_api.c index 6790249a90..0b4b7a8312 100644 --- a/targets/TARGET_NXP/TARGET_LPC176X/ethernet_api.c +++ b/targets/TARGET_NXP/TARGET_LPC176X/ethernet_api.c @@ -18,7 +18,7 @@ #include #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #define NEW_LOGIC 0 diff --git a/targets/TARGET_NXP/TARGET_LPC23XX/ethernet_api.c b/targets/TARGET_NXP/TARGET_LPC23XX/ethernet_api.c index ba76cbc916..ef88270233 100644 --- a/targets/TARGET_NXP/TARGET_LPC23XX/ethernet_api.c +++ b/targets/TARGET_NXP/TARGET_LPC23XX/ethernet_api.c @@ -18,7 +18,7 @@ #include "ethernet_api.h" #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #define NEW_LOGIC 0 diff --git a/targets/TARGET_NXP/TARGET_LPC2460/ethernet_api.c b/targets/TARGET_NXP/TARGET_LPC2460/ethernet_api.c index be65183a4e..793874c11b 100644 --- a/targets/TARGET_NXP/TARGET_LPC2460/ethernet_api.c +++ b/targets/TARGET_NXP/TARGET_LPC2460/ethernet_api.c @@ -18,7 +18,7 @@ #include "ethernet_api.h" #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #define NEW_LOGIC 0 diff --git a/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/ethernet_api.c b/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/ethernet_api.c index 0a20a10a2e..54d97dbb0d 100644 --- a/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/ethernet_api.c +++ b/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/ethernet_api.c @@ -18,7 +18,7 @@ #include "ethernet_api.h" #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #define NEW_LOGIC 0 diff --git a/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088_DM/ethernet_api.c b/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088_DM/ethernet_api.c index 5cde358b9a..67d344aa4e 100644 --- a/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088_DM/ethernet_api.c +++ b/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088_DM/ethernet_api.c @@ -18,7 +18,7 @@ #include "ethernet_api.h" #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #define NEW_LOGIC 0 diff --git a/targets/TARGET_NXP/TARGET_LPC43XX/ethernet_api.c b/targets/TARGET_NXP/TARGET_LPC43XX/ethernet_api.c index a95cd6669c..b947155941 100644 --- a/targets/TARGET_NXP/TARGET_LPC43XX/ethernet_api.c +++ b/targets/TARGET_NXP/TARGET_LPC43XX/ethernet_api.c @@ -20,7 +20,7 @@ #include #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #include "pinmap.h" diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/i2c_api.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/i2c_api.c index 1e134581a3..cc57ed834d 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/i2c_api.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/i2c_api.c @@ -31,7 +31,7 @@ #include "i2c.h" #include "i2c_api.h" -#include "wait_api.h" +#include "mbed_wait_api.h" #define I2C_READ_WRITE_BIT_MASK 0xFE diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_i2c.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_i2c.c index f4cae19428..1b3e5daf20 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_i2c.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_i2c.c @@ -60,7 +60,7 @@ */ #if DEVICE_I2C #include "i2c.h" -#include "wait_api.h" +#include "mbed_wait_api.h" /* See i2c.h for details */ void fI2cInit(i2c_t *obj,PinName sda,PinName scl) diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_trng_api.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_trng_api.c index d255a6eaf0..c9842e3842 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_trng_api.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_trng_api.c @@ -38,7 +38,7 @@ #include "memory_map.h" #include "ncs36510_trng.h" #include "clock.h" -#include "wait_api.h" +#include "mbed_wait_api.h" /************************************************************************************************* * * diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep.c index 27e1b598b2..a05f701260 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep.c @@ -31,7 +31,7 @@ * */ #if DEVICE_SLEEP -#include "sleep.h" +#include "mbed_sleep.h" #include "sleep_api.h" #include "cmsis_nvic.h" diff --git a/targets/TARGET_RENESAS/TARGET_RZ_A1H/ethernet_api.c b/targets/TARGET_RENESAS/TARGET_RZ_A1H/ethernet_api.c index 7c9b8add96..e8dddea30d 100644 --- a/targets/TARGET_RENESAS/TARGET_RZ_A1H/ethernet_api.c +++ b/targets/TARGET_RENESAS/TARGET_RZ_A1H/ethernet_api.c @@ -17,7 +17,7 @@ #include "ethernet_api.h" #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #include "ether_iodefine.h" #include "ethernetext_api.h" diff --git a/targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/ethernet_api.c b/targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/ethernet_api.c index ac392920e9..de43879c16 100644 --- a/targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/ethernet_api.c +++ b/targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/ethernet_api.c @@ -17,7 +17,7 @@ #include "ethernet_api.h" #include "cmsis.h" #include "mbed_interface.h" -#include "toolchain.h" +#include "mbed_toolchain.h" #include "mbed_error.h" #include "ether_iodefine.h" #include "ethernetext_api.h" diff --git a/targets/TARGET_STM/TARGET_STM32F0/analogin_api.c b/targets/TARGET_STM/TARGET_STM32F0/analogin_api.c index 07ea316e2b..50335b936f 100644 --- a/targets/TARGET_STM/TARGET_STM32F0/analogin_api.c +++ b/targets/TARGET_STM/TARGET_STM32F0/analogin_api.c @@ -30,7 +30,7 @@ #if DEVICE_ANALOGIN -#include "wait_api.h" +#include "mbed_wait_api.h" #include "cmsis.h" #include "pinmap.h" #include "PeripheralPins.h" diff --git a/targets/TARGET_STM/TARGET_STM32F1/analogin_api.c b/targets/TARGET_STM/TARGET_STM32F1/analogin_api.c index bd2da780f9..68d72d6251 100644 --- a/targets/TARGET_STM/TARGET_STM32F1/analogin_api.c +++ b/targets/TARGET_STM/TARGET_STM32F1/analogin_api.c @@ -30,7 +30,7 @@ #if DEVICE_ANALOGIN -#include "wait_api.h" +#include "mbed_wait_api.h" #include "cmsis.h" #include "pinmap.h" #include "PeripheralPins.h" diff --git a/targets/TARGET_STM/TARGET_STM32F2/analogin_api.c b/targets/TARGET_STM/TARGET_STM32F2/analogin_api.c index d6efdfb4cc..a71a4c285e 100644 --- a/targets/TARGET_STM/TARGET_STM32F2/analogin_api.c +++ b/targets/TARGET_STM/TARGET_STM32F2/analogin_api.c @@ -30,7 +30,7 @@ #if DEVICE_ANALOGIN -#include "wait_api.h" +#include "mbed_wait_api.h" #include "cmsis.h" #include "pinmap.h" #include "mbed_error.h" diff --git a/targets/TARGET_STM/TARGET_STM32F3/analogin_api.c b/targets/TARGET_STM/TARGET_STM32F3/analogin_api.c index 3a0c690640..92d3e244b9 100644 --- a/targets/TARGET_STM/TARGET_STM32F3/analogin_api.c +++ b/targets/TARGET_STM/TARGET_STM32F3/analogin_api.c @@ -30,7 +30,7 @@ #if DEVICE_ANALOGIN -#include "wait_api.h" +#include "mbed_wait_api.h" #include "cmsis.h" #include "pinmap.h" #include "mbed_error.h" diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/flash_api.c b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/flash_api.c index 9a79bc48f7..b88f51714a 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/flash_api.c +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/flash_api.c @@ -16,7 +16,7 @@ #include "flash_api.h" #include "flash_data.h" -#include "critical.h" +#include "mbed_critical.h" // This file is automagically generated diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/flash_api.c b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/flash_api.c index 9a79bc48f7..b88f51714a 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/flash_api.c +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/flash_api.c @@ -16,7 +16,7 @@ #include "flash_api.h" #include "flash_data.h" -#include "critical.h" +#include "mbed_critical.h" // This file is automagically generated diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/flash_api.c b/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/flash_api.c index 9a79bc48f7..b88f51714a 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/flash_api.c +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/flash_api.c @@ -16,7 +16,7 @@ #include "flash_api.h" #include "flash_data.h" -#include "critical.h" +#include "mbed_critical.h" // This file is automagically generated diff --git a/targets/TARGET_STM/TARGET_STM32F4/analogin_api.c b/targets/TARGET_STM/TARGET_STM32F4/analogin_api.c index 7dff9c986c..62fac45691 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/analogin_api.c +++ b/targets/TARGET_STM/TARGET_STM32F4/analogin_api.c @@ -30,7 +30,7 @@ #if DEVICE_ANALOGIN -#include "wait_api.h" +#include "mbed_wait_api.h" #include "cmsis.h" #include "pinmap.h" #include "mbed_error.h" diff --git a/targets/TARGET_STM/TARGET_STM32F7/analogin_api.c b/targets/TARGET_STM/TARGET_STM32F7/analogin_api.c index f98be3b642..dac331aeba 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/analogin_api.c +++ b/targets/TARGET_STM/TARGET_STM32F7/analogin_api.c @@ -30,7 +30,7 @@ #if DEVICE_ANALOGIN -#include "wait_api.h" +#include "mbed_wait_api.h" #include "cmsis.h" #include "pinmap.h" #include "PeripheralPins.h" diff --git a/targets/TARGET_STM/TARGET_STM32L0/analogin_api.c b/targets/TARGET_STM/TARGET_STM32L0/analogin_api.c index 3047d1fb87..5bf3200d4c 100644 --- a/targets/TARGET_STM/TARGET_STM32L0/analogin_api.c +++ b/targets/TARGET_STM/TARGET_STM32L0/analogin_api.c @@ -30,7 +30,7 @@ #if DEVICE_ANALOGIN -#include "wait_api.h" +#include "mbed_wait_api.h" #include "cmsis.h" #include "pinmap.h" #include "mbed_error.h" diff --git a/targets/TARGET_STM/TARGET_STM32L1/analogin_api.c b/targets/TARGET_STM/TARGET_STM32L1/analogin_api.c index 3d01fdf90c..9ae9b74d50 100644 --- a/targets/TARGET_STM/TARGET_STM32L1/analogin_api.c +++ b/targets/TARGET_STM/TARGET_STM32L1/analogin_api.c @@ -30,7 +30,7 @@ #if DEVICE_ANALOGIN -#include "wait_api.h" +#include "mbed_wait_api.h" #include "cmsis.h" #include "pinmap.h" #include "mbed_error.h" diff --git a/targets/TARGET_STM/TARGET_STM32L4/analogin_api.c b/targets/TARGET_STM/TARGET_STM32L4/analogin_api.c index 1ec39e83dd..b49ff1637f 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/analogin_api.c +++ b/targets/TARGET_STM/TARGET_STM32L4/analogin_api.c @@ -30,7 +30,7 @@ #if DEVICE_ANALOGIN -#include "wait_api.h" +#include "mbed_wait_api.h" #include "cmsis.h" #include "pinmap.h" #include "mbed_error.h" diff --git a/targets/TARGET_STM/i2c_api.c b/targets/TARGET_STM/i2c_api.c index ae64810315..e2ce23def3 100644 --- a/targets/TARGET_STM/i2c_api.c +++ b/targets/TARGET_STM/i2c_api.c @@ -31,7 +31,7 @@ #include "mbed_assert.h" #include "i2c_api.h" -#include "platform/wait_api.h" +#include "platform/mbed_wait_api.h" #if DEVICE_I2C diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c index 0717b42045..0d89e0962f 100644 --- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c +++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c @@ -29,7 +29,7 @@ #include "rtc_api_HAL.h" #include "lp_ticker_api.h" -#include "critical.h" +#include "mbed_critical.h" #if (defined RTCC_COUNT) && (RTCC_COUNT > 0) #include "em_rtcc.h" #endif diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/sleep.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/sleep.c index 951ec13447..39827f189c 100644 --- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/sleep.c +++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/sleep.c @@ -27,7 +27,7 @@ #include "sleep_api.h" #include "sleepmodes.h" #include "em_emu.h" -#include "critical.h" +#include "mbed_critical.h" uint32_t sleep_block_counter[NUM_SLEEP_MODES] = {0}; diff --git a/targets/TARGET_WIZNET/TARGET_W7500x/analogin_api.c b/targets/TARGET_WIZNET/TARGET_W7500x/analogin_api.c index 6b3b45961a..a6998b91e5 100644 --- a/targets/TARGET_WIZNET/TARGET_W7500x/analogin_api.c +++ b/targets/TARGET_WIZNET/TARGET_W7500x/analogin_api.c @@ -33,7 +33,7 @@ #if DEVICE_ANALOGIN -#include "wait_api.h" +#include "mbed_wait_api.h" #include "cmsis.h" #include "pinmap.h" #include "W7500x_adc.h" diff --git a/targets/TARGET_WIZNET/TARGET_W7500x/i2c_api.c b/targets/TARGET_WIZNET/TARGET_W7500x/i2c_api.c index e06a1a2acc..20fceb9618 100644 --- a/targets/TARGET_WIZNET/TARGET_W7500x/i2c_api.c +++ b/targets/TARGET_WIZNET/TARGET_W7500x/i2c_api.c @@ -38,7 +38,7 @@ #include "pinmap.h" #include "PeripheralPins.h" -#include "wait_api.h" +#include "mbed_wait_api.h" #include "us_ticker_api.h" #include "W7500x_i2c.h" diff --git a/targets/TARGET_ublox/TARGET_HI2110/lp_ticker.c b/targets/TARGET_ublox/TARGET_HI2110/lp_ticker.c index 205e68b898..4ac5763fb3 100644 --- a/targets/TARGET_ublox/TARGET_HI2110/lp_ticker.c +++ b/targets/TARGET_ublox/TARGET_HI2110/lp_ticker.c @@ -38,7 +38,7 @@ #include "lp_ticker_api.h" #include "sleep_api.h" -#include "critical.h" +#include "mbed_critical.h" /* ---------------------------------------------------------------- * MACROS diff --git a/targets/TARGET_ublox/TARGET_HI2110/us_ticker.c b/targets/TARGET_ublox/TARGET_HI2110/us_ticker.c index 72f5468385..053045c2b5 100644 --- a/targets/TARGET_ublox/TARGET_HI2110/us_ticker.c +++ b/targets/TARGET_ublox/TARGET_HI2110/us_ticker.c @@ -25,7 +25,7 @@ */ #include "us_ticker_api.h" -#include "critical.h" +#include "mbed_critical.h" /* ---------------------------------------------------------------- * MACROS