diff --git a/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt index b8d93bb..9a0c013 100644 --- a/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt +++ b/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt @@ -3,7 +3,8 @@ add_subdirectory(RTX) -target_include_directories(mbed-rtos-flags +# Note: RTOS headers needed even for mbed-baremetal in order to get type sizes +target_include_directories(mbed-core-flags INTERFACE Include ) diff --git a/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt index b37c34c..98f94a0 100644 --- a/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt +++ b/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt @@ -42,7 +42,8 @@ _mbed_get_cortex_m_exception_handlers(TOOLCHAIN_GCC) endif() -target_include_directories(mbed-rtos-flags +# Note: RTOS headers needed even for mbed-baremetal in order to get type sizes +target_include_directories(mbed-core-flags INTERFACE Config Include diff --git a/cmsis/device/rtos/CMakeLists.txt b/cmsis/device/rtos/CMakeLists.txt index 7c1c675..860a041 100644 --- a/cmsis/device/rtos/CMakeLists.txt +++ b/cmsis/device/rtos/CMakeLists.txt @@ -15,7 +15,8 @@ endif() endif() -target_include_directories(mbed-rtos-flags +# Note: RTOS headers needed even for mbed-baremetal in order to get type sizes +target_include_directories(mbed-core-flags INTERFACE include ) diff --git a/cmsis/device/rtos/include/mbed_rtx_storage.h b/cmsis/device/rtos/include/mbed_rtx_storage.h index 8f4374e..b6411b0 100644 --- a/cmsis/device/rtos/include/mbed_rtx_storage.h +++ b/cmsis/device/rtos/include/mbed_rtx_storage.h @@ -27,8 +27,8 @@ extern "C" { #endif -#include "rtx_os.h" #include "mbed_rtx_conf.h" +#include "rtx_os.h" /** \ingroup mbed-os-internal */ /** \addtogroup rtos-internal-api */ diff --git a/connectivity/cellular/include/cellular/framework/API/CellularDevice.h b/connectivity/cellular/include/cellular/framework/API/CellularDevice.h index 236f2d3..1fa2e2f 100644 --- a/connectivity/cellular/include/cellular/framework/API/CellularDevice.h +++ b/connectivity/cellular/include/cellular/framework/API/CellularDevice.h @@ -464,7 +464,7 @@ CellularNetwork *_nw; char _sim_pin[MAX_PIN_SIZE + 1]; char _plmn[MAX_PLMN_SIZE + 1]; - PlatformMutex _mutex; + rtos::Mutex _mutex; #ifdef MBED_CONF_RTOS_PRESENT rtos::Thread _queue_thread; diff --git a/connectivity/cellular/include/cellular/framework/AT/AT_CellularStack.h b/connectivity/cellular/include/cellular/framework/AT/AT_CellularStack.h index 11308f8..dac4827 100644 --- a/connectivity/cellular/include/cellular/framework/AT/AT_CellularStack.h +++ b/connectivity/cellular/include/cellular/framework/AT/AT_CellularStack.h @@ -20,7 +20,7 @@ #include "ATHandler.h" #include "netsocket/NetworkStack.h" -#include "PlatformMutex.h" +#include "rtos/Mutex.h" #include "AT_CellularDevice.h" namespace mbed { @@ -209,7 +209,7 @@ nsapi_version_t _ip_ver_sendto; // mutex for write/read to a _socket array, needed when multiple threads may use sockets simultaneously - PlatformMutex _socket_mutex; + rtos::Mutex _socket_mutex; ATHandler &_at; AT_CellularDevice &_device; diff --git a/connectivity/cellular/include/cellular/framework/device/CellularStateMachine.h b/connectivity/cellular/include/cellular/framework/device/CellularStateMachine.h index 67912e4..04d4ecf 100644 --- a/connectivity/cellular/include/cellular/framework/device/CellularStateMachine.h +++ b/connectivity/cellular/include/cellular/framework/device/CellularStateMachine.h @@ -20,7 +20,7 @@ #include "events/EventQueue.h" #include "CellularNetwork.h" #include "CellularCommon.h" -#include "PlatformMutex.h" +#include "rtos/Mutex.h" namespace mbed { @@ -191,7 +191,7 @@ cell_callback_data_t _cb_data; cellular_connection_status_t _current_event; int _status; - PlatformMutex _mutex; + rtos::Mutex _mutex; // Cellular state timeouts std::chrono::duration _state_timeout_power_on; diff --git a/connectivity/drivers/lora/COMPONENT_SX126X/SX126X_LoRaRadio.h b/connectivity/drivers/lora/COMPONENT_SX126X/SX126X_LoRaRadio.h index c9f672d..5b4daf3 100644 --- a/connectivity/drivers/lora/COMPONENT_SX126X/SX126X_LoRaRadio.h +++ b/connectivity/drivers/lora/COMPONENT_SX126X/SX126X_LoRaRadio.h @@ -35,7 +35,7 @@ #include "DigitalIn.h" #include "AnalogIn.h" #include "SPI.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #ifdef MBED_CONF_RTOS_PRESENT #include "rtos/Thread.h" #include "rtos/ThisThread.h" @@ -340,7 +340,7 @@ #endif // Access protection - PlatformMutex mutex; + rtos::Mutex mutex; // helper functions void wakeup(); diff --git a/connectivity/drivers/lora/COMPONENT_SX1272/SX1272_LoRaRadio.h b/connectivity/drivers/lora/COMPONENT_SX1272/SX1272_LoRaRadio.h index 41d4d15..932d2ab 100644 --- a/connectivity/drivers/lora/COMPONENT_SX1272/SX1272_LoRaRadio.h +++ b/connectivity/drivers/lora/COMPONENT_SX1272/SX1272_LoRaRadio.h @@ -33,7 +33,7 @@ #include "DigitalOut.h" #include "DigitalInOut.h" #include "SPI.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #ifdef MBED_CONF_RTOS_PRESENT #include "rtos/Thread.h" #endif @@ -385,7 +385,7 @@ #endif // Access protection - PlatformMutex mutex; + rtos::Mutex mutex; uint8_t radio_variant; diff --git a/connectivity/drivers/lora/COMPONENT_SX1276/SX1276_LoRaRadio.h b/connectivity/drivers/lora/COMPONENT_SX1276/SX1276_LoRaRadio.h index 0b6b2b4..26481e9 100644 --- a/connectivity/drivers/lora/COMPONENT_SX1276/SX1276_LoRaRadio.h +++ b/connectivity/drivers/lora/COMPONENT_SX1276/SX1276_LoRaRadio.h @@ -33,7 +33,7 @@ #include "DigitalOut.h" #include "DigitalInOut.h" #include "SPI.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #ifdef MBED_CONF_RTOS_PRESENT #include "rtos/Thread.h" #endif @@ -400,7 +400,7 @@ #endif // Access protection - PlatformMutex mutex; + rtos::Mutex mutex; uint8_t radio_variant; diff --git a/connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.h b/connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.h index a2835ce..9ff36a8 100644 --- a/connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.h +++ b/connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.h @@ -37,7 +37,7 @@ #include "platform/mbed_critical.h" #include "drivers/DigitalOut.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "lorawan/LoRaRadio.h" #include "STM32WL_radio_driver.h" @@ -314,7 +314,7 @@ private: // Access protection - PlatformMutex mutex; + rtos::Mutex mutex; // helper functions void wakeup(); diff --git a/connectivity/drivers/mbedtls/TARGET_STM/aes_alt.cpp b/connectivity/drivers/mbedtls/TARGET_STM/aes_alt.cpp index 38f0adc..1be0084 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/aes_alt.cpp +++ b/connectivity/drivers/mbedtls/TARGET_STM/aes_alt.cpp @@ -38,10 +38,10 @@ #include "mbedtls/platform.h" #include "mbedtls/platform_util.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/SingletonPtr.h" -static SingletonPtr aes_mutex; +static SingletonPtr aes_mutex; #define MBEDTLS_DEBUG 0 diff --git a/connectivity/drivers/mbedtls/TARGET_STM/ccm_alt.cpp b/connectivity/drivers/mbedtls/TARGET_STM/ccm_alt.cpp index ad077d2..c40ecf6 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/ccm_alt.cpp +++ b/connectivity/drivers/mbedtls/TARGET_STM/ccm_alt.cpp @@ -38,10 +38,10 @@ #include "mbedtls/platform.h" #include "mbedtls/platform_util.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/SingletonPtr.h" -static SingletonPtr ccm_mutex; +static SingletonPtr ccm_mutex; #define MBEDTLS_DEBUG 0 diff --git a/connectivity/drivers/mbedtls/TARGET_STM/gcm_alt.cpp b/connectivity/drivers/mbedtls/TARGET_STM/gcm_alt.cpp index 4488a73..f555fb5 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/gcm_alt.cpp +++ b/connectivity/drivers/mbedtls/TARGET_STM/gcm_alt.cpp @@ -29,10 +29,10 @@ #include "mbedtls/platform_util.h" #include "mbedtls/platform.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/SingletonPtr.h" -static SingletonPtr gcm_mutex; +static SingletonPtr gcm_mutex; /* Parameter validation macros */ diff --git a/connectivity/drivers/mbedtls/TARGET_STM/md5_alt.cpp b/connectivity/drivers/mbedtls/TARGET_STM/md5_alt.cpp index 90e5362..985d957 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/md5_alt.cpp +++ b/connectivity/drivers/mbedtls/TARGET_STM/md5_alt.cpp @@ -33,10 +33,10 @@ #include "mbedtls/platform.h" #include "mbedtls/platform_util.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/SingletonPtr.h" -static SingletonPtr md5_mutex; +static SingletonPtr md5_mutex; /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ diff --git a/connectivity/drivers/mbedtls/TARGET_STM/sha1_alt.cpp b/connectivity/drivers/mbedtls/TARGET_STM/sha1_alt.cpp index ebe3663..74210f2 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/sha1_alt.cpp +++ b/connectivity/drivers/mbedtls/TARGET_STM/sha1_alt.cpp @@ -33,10 +33,10 @@ #include "mbedtls/platform.h" #include "mbedtls/platform_util.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/SingletonPtr.h" -static SingletonPtr sha1_mutex; +static SingletonPtr sha1_mutex; /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ diff --git a/connectivity/drivers/mbedtls/TARGET_STM/sha256_alt.cpp b/connectivity/drivers/mbedtls/TARGET_STM/sha256_alt.cpp index 3cad252..fa777b1 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/sha256_alt.cpp +++ b/connectivity/drivers/mbedtls/TARGET_STM/sha256_alt.cpp @@ -33,10 +33,10 @@ #include "mbedtls/platform.h" #include "mbedtls/platform_util.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/SingletonPtr.h" -static SingletonPtr sha256_mutex; +static SingletonPtr sha256_mutex; /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ diff --git a/connectivity/libraries/ppp/source/ppp_service_if.cpp b/connectivity/libraries/ppp/source/ppp_service_if.cpp index aa58972..0da15e4 100644 --- a/connectivity/libraries/ppp/source/ppp_service_if.cpp +++ b/connectivity/libraries/ppp/source/ppp_service_if.cpp @@ -47,7 +47,7 @@ } ppp_sys_timeout_t; static ppp_sys_timeout_t *timeout[PPP_TIMER_NUM]; -static SingletonPtr ppp_service_if_mutex; +static SingletonPtr ppp_service_if_mutex; static uint8_t ppp_service_sys_timeout_id = 0; static pbuf pbuf_handles[PPP_PBUF_HANDLE_NUM]; diff --git a/connectivity/mbedtls/platform/src/mbed_trng.cpp b/connectivity/mbedtls/platform/src/mbed_trng.cpp index c0129f6..9e1b3f3 100644 --- a/connectivity/mbedtls/platform/src/mbed_trng.cpp +++ b/connectivity/mbedtls/platform/src/mbed_trng.cpp @@ -19,9 +19,9 @@ #include "hal/trng_api.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" -SingletonPtr mbedtls_mutex; +SingletonPtr mbedtls_mutex; extern "C" int mbedtls_hardware_poll( void *data, unsigned char *output, size_t len, size_t *olen ) { diff --git a/connectivity/mbedtls/platform/src/platform_alt.cpp b/connectivity/mbedtls/platform/src/platform_alt.cpp index c6f0abc..be6de39 100644 --- a/connectivity/mbedtls/platform/src/platform_alt.cpp +++ b/connectivity/mbedtls/platform/src/platform_alt.cpp @@ -21,10 +21,10 @@ #include "mbedtls/platform.h" #if defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT) #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" mbedtls_platform_context plat_ctx = { { 0 } }; -extern SingletonPtr mbedtls_mutex; +extern SingletonPtr mbedtls_mutex; int mbedtls_platform_setup( mbedtls_platform_context *unused_ctx ) { diff --git a/connectivity/netsocket/include/netsocket/SocketStats.h b/connectivity/netsocket/include/netsocket/SocketStats.h index 1f39b99..adbc0b1 100644 --- a/connectivity/netsocket/include/netsocket/SocketStats.h +++ b/connectivity/netsocket/include/netsocket/SocketStats.h @@ -19,7 +19,7 @@ #define SOCKET_STATS_H #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "netsocket/Socket.h" #include "SocketAddress.h" #include "hal/ticker_api.h" @@ -144,7 +144,7 @@ #if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED private: static mbed_stats_socket_t _stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT]; - static SingletonPtr _mutex; + static SingletonPtr _mutex; static uint32_t _size; /** Internal function to scan the array and get the position of the element in the list. diff --git a/connectivity/netsocket/source/SocketStats.cpp b/connectivity/netsocket/source/SocketStats.cpp index 80802eb..b4e7235 100644 --- a/connectivity/netsocket/source/SocketStats.cpp +++ b/connectivity/netsocket/source/SocketStats.cpp @@ -25,7 +25,7 @@ #include #if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED -SingletonPtr SocketStats::_mutex; +SingletonPtr SocketStats::_mutex; mbed_stats_socket_t SocketStats::_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT]; uint32_t SocketStats::_size = 0; diff --git a/connectivity/netsocket/source/nsapi_dns.cpp b/connectivity/netsocket/source/nsapi_dns.cpp index 2f6f8b5..8372be1 100644 --- a/connectivity/netsocket/source/nsapi_dns.cpp +++ b/connectivity/netsocket/source/nsapi_dns.cpp @@ -29,7 +29,7 @@ #include "events/EventQueue.h" #include "netsocket/OnboardNetworkStack.h" #include "rtos/Kernel.h" -#include "PlatformMutex.h" +#include "rtos/Mutex.h" #include "SingletonPtr.h" using namespace std::chrono; @@ -127,14 +127,14 @@ #if (MBED_CONF_NSAPI_DNS_CACHE_SIZE > 0) static DNS_CACHE *dns_cache[MBED_CONF_NSAPI_DNS_CACHE_SIZE]; // Protects cache shared between blocking and asynchronous calls -static SingletonPtr dns_cache_mutex; +static SingletonPtr dns_cache_mutex; #endif static uint16_t dns_message_id = 1; static intptr_t dns_unique_id = 1; static DNS_QUERY *dns_query_queue[DNS_QUERY_QUEUE_SIZE]; // Protects from several threads running asynchronous DNS -static SingletonPtr dns_mutex; +static SingletonPtr dns_mutex; static SingletonPtr dns_call_in; static bool dns_timer_running = false; diff --git a/drivers/include/drivers/AnalogIn.h b/drivers/include/drivers/AnalogIn.h index dd5d067..bf87aba 100644 --- a/drivers/include/drivers/AnalogIn.h +++ b/drivers/include/drivers/AnalogIn.h @@ -23,7 +23,7 @@ #include "hal/analogin_api.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include @@ -169,7 +169,7 @@ } analogin_t _adc; - static SingletonPtr _mutex; + static SingletonPtr _mutex; float _vref; diff --git a/drivers/include/drivers/AnalogOut.h b/drivers/include/drivers/AnalogOut.h index d7945d3..c6c34e9 100644 --- a/drivers/include/drivers/AnalogOut.h +++ b/drivers/include/drivers/AnalogOut.h @@ -22,7 +22,7 @@ #if DEVICE_ANALOGOUT || defined(DOXYGEN_ONLY) #include "hal/analogout_api.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" namespace mbed { /** @@ -153,7 +153,7 @@ } dac_t _dac; - PlatformMutex _mutex; + rtos::Mutex _mutex; #endif //!defined(DOXYGEN_ONLY) }; diff --git a/drivers/include/drivers/BufferedSerial.h b/drivers/include/drivers/BufferedSerial.h index 0b0803e..892ab47 100644 --- a/drivers/include/drivers/BufferedSerial.h +++ b/drivers/include/drivers/BufferedSerial.h @@ -25,7 +25,7 @@ #include "platform/FileHandle.h" #include "drivers/SerialBase.h" #include "drivers/InterruptIn.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/CircularBuffer.h" #include "platform/NonCopyable.h" @@ -328,7 +328,7 @@ CircularBuffer _rxbuf; CircularBuffer _txbuf; - PlatformMutex _mutex; + rtos::Mutex _mutex; Callback _sigio_cb; diff --git a/drivers/include/drivers/BusIn.h b/drivers/include/drivers/BusIn.h index 5752033..275b251 100644 --- a/drivers/include/drivers/BusIn.h +++ b/drivers/include/drivers/BusIn.h @@ -19,7 +19,7 @@ #include "platform/platform.h" #include "drivers/DigitalIn.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/NonCopyable.h" namespace mbed { @@ -120,7 +120,7 @@ */ int _nc_mask; - PlatformMutex _mutex; + rtos::Mutex _mutex; private: virtual void lock(); diff --git a/drivers/include/drivers/BusInOut.h b/drivers/include/drivers/BusInOut.h index 59bcbce..a9ee6ed 100644 --- a/drivers/include/drivers/BusInOut.h +++ b/drivers/include/drivers/BusInOut.h @@ -18,7 +18,7 @@ #define MBED_BUSINOUT_H #include "drivers/DigitalInOut.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/NonCopyable.h" namespace mbed { @@ -146,7 +146,7 @@ */ int _nc_mask; - PlatformMutex _mutex; + rtos::Mutex _mutex; #endif //!defined(DOXYGEN_ONLY) }; diff --git a/drivers/include/drivers/BusOut.h b/drivers/include/drivers/BusOut.h index f9c2fdc..c0a51cb 100644 --- a/drivers/include/drivers/BusOut.h +++ b/drivers/include/drivers/BusOut.h @@ -18,7 +18,7 @@ #define MBED_BUSOUT_H #include "drivers/DigitalOut.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/NonCopyable.h" namespace mbed { @@ -124,7 +124,7 @@ */ int _nc_mask; - PlatformMutex _mutex; + rtos::Mutex _mutex; #endif }; diff --git a/drivers/include/drivers/CAN.h b/drivers/include/drivers/CAN.h index b1fa704..d66aefb 100644 --- a/drivers/include/drivers/CAN.h +++ b/drivers/include/drivers/CAN.h @@ -24,7 +24,7 @@ #include "interfaces/InterfaceCAN.h" #include "hal/can_api.h" #include "platform/Callback.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" namespace mbed { @@ -214,7 +214,7 @@ can_t _can; Callback _irq[IrqType::IrqCnt]; - PlatformMutex _mutex; + rtos::Mutex _mutex; #endif }; diff --git a/drivers/include/drivers/FlashIAP.h b/drivers/include/drivers/FlashIAP.h index 43196e7..7d19981 100644 --- a/drivers/include/drivers/FlashIAP.h +++ b/drivers/include/drivers/FlashIAP.h @@ -28,7 +28,7 @@ #include "flash_api.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/NonCopyable.h" #include @@ -164,7 +164,7 @@ flash_t _flash; uint8_t *_page_buf; - static SingletonPtr _mutex; + static SingletonPtr _mutex; #endif }; diff --git a/drivers/include/drivers/I2C.h b/drivers/include/drivers/I2C.h index 664e699..030485e 100644 --- a/drivers/include/drivers/I2C.h +++ b/drivers/include/drivers/I2C.h @@ -24,7 +24,7 @@ #include "hal/i2c_api.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/NonCopyable.h" #if DEVICE_I2C_ASYNCH @@ -234,7 +234,7 @@ i2c_t _i2c; int _hz; - SingletonPtr _mutex; + SingletonPtr _mutex; PinName _sda; PinName _scl; diff --git a/drivers/include/drivers/MbedCRC.h b/drivers/include/drivers/MbedCRC.h index be8539b..4069337 100644 --- a/drivers/include/drivers/MbedCRC.h +++ b/drivers/include/drivers/MbedCRC.h @@ -27,7 +27,7 @@ #ifdef __cplusplus #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include @@ -39,7 +39,7 @@ * @{ */ -extern SingletonPtr mbed_crc_mutex; +extern SingletonPtr mbed_crc_mutex; /** CRC mode selection */ diff --git a/drivers/include/drivers/OSPI.h b/drivers/include/drivers/OSPI.h index 3483bcb..a426158 100644 --- a/drivers/include/drivers/OSPI.h +++ b/drivers/include/drivers/OSPI.h @@ -22,7 +22,7 @@ #if DEVICE_OSPI || defined(DOXYGEN_ONLY) #include "hal/ospi_api.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/SingletonPtr.h" #include "platform/NonCopyable.h" @@ -229,7 +229,7 @@ ospi_t _ospi; - static SingletonPtr _mutex; + static SingletonPtr _mutex; ospi_bus_width_t _inst_width; //Bus width for Instruction phase ospi_inst_size_t _inst_size; //Instruction Size ospi_bus_width_t _address_width; //Bus width for Address phase diff --git a/drivers/include/drivers/QSPI.h b/drivers/include/drivers/QSPI.h index 86beb2b..52ce925 100644 --- a/drivers/include/drivers/QSPI.h +++ b/drivers/include/drivers/QSPI.h @@ -22,7 +22,7 @@ #if DEVICE_QSPI || defined(DOXYGEN_ONLY) #include "hal/qspi_api.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/SingletonPtr.h" #include "platform/NonCopyable.h" @@ -218,7 +218,7 @@ qspi_t _qspi; - static SingletonPtr _mutex; + static SingletonPtr _mutex; qspi_bus_width_t _inst_width; //Bus width for Instruction phase qspi_bus_width_t _address_width; //Bus width for Address phase qspi_address_size_t _address_size; diff --git a/drivers/include/drivers/RawCAN.h b/drivers/include/drivers/RawCAN.h index edd8793..fd3c842 100644 --- a/drivers/include/drivers/RawCAN.h +++ b/drivers/include/drivers/RawCAN.h @@ -26,7 +26,7 @@ #include "interfaces/InterfaceCAN.h" #include "hal/can_api.h" #include "platform/Callback.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" namespace mbed { #ifndef FEATURE_EXPERIMENTAL_API diff --git a/drivers/include/drivers/SPI.h b/drivers/include/drivers/SPI.h index 1780f8d..d3eee5c 100644 --- a/drivers/include/drivers/SPI.h +++ b/drivers/include/drivers/SPI.h @@ -21,7 +21,7 @@ #if DEVICE_SPI || defined(DOXYGEN_ONLY) -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "hal/spi_api.h" #include "drivers/DigitalOut.h" #include "platform/SingletonPtr.h" @@ -389,7 +389,7 @@ /* Internal SPI object handling the resources' state. */ spi_t spi{}; /* Used by lock and unlock for thread safety */ - SingletonPtr mutex; + SingletonPtr mutex; /* Current user of the SPI */ SPI *owner = nullptr; #if DEVICE_SPI_ASYNCH && TRANSACTION_QUEUE_SIZE_SPI diff --git a/drivers/source/AnalogIn.cpp b/drivers/source/AnalogIn.cpp index 596d034..3cddfd2 100644 --- a/drivers/source/AnalogIn.cpp +++ b/drivers/source/AnalogIn.cpp @@ -21,7 +21,7 @@ namespace mbed { -SingletonPtr AnalogIn::_mutex; +SingletonPtr AnalogIn::_mutex; AnalogIn::AnalogIn(PinName pin, float vref) : _vref(vref) diff --git a/drivers/source/FlashIAP.cpp b/drivers/source/FlashIAP.cpp index b1c263d..c8f258c 100644 --- a/drivers/source/FlashIAP.cpp +++ b/drivers/source/FlashIAP.cpp @@ -37,7 +37,7 @@ const unsigned int num_write_retries = 16; -SingletonPtr FlashIAP::_mutex; +SingletonPtr FlashIAP::_mutex; static inline bool is_aligned(uint32_t number, uint32_t alignment) { diff --git a/drivers/source/MbedCRC.cpp b/drivers/source/MbedCRC.cpp index 9e56de2..7939d6a 100644 --- a/drivers/source/MbedCRC.cpp +++ b/drivers/source/MbedCRC.cpp @@ -21,7 +21,7 @@ namespace mbed { -SingletonPtr mbed_crc_mutex; +SingletonPtr mbed_crc_mutex; static_assert(MBED_CRC_TABLE_SIZE == 0 || MBED_CRC_TABLE_SIZE == 16 || MBED_CRC_TABLE_SIZE == 256, "Configuration setting drivers.crc-table-size must be set to 0, 16 or 256"); diff --git a/drivers/source/OSPI.cpp b/drivers/source/OSPI.cpp index aea087f..90bbef7 100644 --- a/drivers/source/OSPI.cpp +++ b/drivers/source/OSPI.cpp @@ -23,7 +23,7 @@ namespace mbed { -SingletonPtr OSPI::_mutex; +SingletonPtr OSPI::_mutex; uint8_t convert_bus_width_to_line_count(ospi_bus_width_t width) { diff --git a/drivers/source/QSPI.cpp b/drivers/source/QSPI.cpp index aa430e1..73c3c94 100644 --- a/drivers/source/QSPI.cpp +++ b/drivers/source/QSPI.cpp @@ -23,7 +23,7 @@ namespace mbed { -SingletonPtr QSPI::_mutex; +SingletonPtr QSPI::_mutex; uint8_t convert_bus_width_to_line_count(qspi_bus_width_t width) { diff --git a/drivers/usb/include/usb/USBKeyboard.h b/drivers/usb/include/usb/USBKeyboard.h index d9f6d0b..0ee8ab0 100644 --- a/drivers/usb/include/usb/USBKeyboard.h +++ b/drivers/usb/include/usb/USBKeyboard.h @@ -20,7 +20,7 @@ #include "USBHID.h" #include "platform/Stream.h" -#include "PlatformMutex.h" +#include "rtos/Mutex.h" /* Modifiers, left keys then right keys. */ enum MODIFIER_KEY { @@ -211,7 +211,7 @@ uint8_t _configuration_descriptor[41]; uint8_t _lock_status; - PlatformMutex _mutex; + rtos::Mutex _mutex; }; diff --git a/drivers/usb/include/usb/USBMouse.h b/drivers/usb/include/usb/USBMouse.h index f74e826..a83f6f8 100644 --- a/drivers/usb/include/usb/USBMouse.h +++ b/drivers/usb/include/usb/USBMouse.h @@ -19,7 +19,7 @@ #define USBMOUSE_H #include "USBHID.h" -#include "PlatformMutex.h" +#include "rtos/Mutex.h" #define REPORT_ID_MOUSE 2 @@ -233,7 +233,7 @@ MOUSE_TYPE _mouse_type; uint8_t _button; uint8_t _configuration_descriptor[41]; - PlatformMutex _mutex; + rtos::Mutex _mutex; bool mouse_send(int8_t x, int8_t y, uint8_t buttons, int8_t z); }; diff --git a/drivers/usb/include/usb/USBMouseKeyboard.h b/drivers/usb/include/usb/USBMouseKeyboard.h index 54144ba..ac49a70 100644 --- a/drivers/usb/include/usb/USBMouseKeyboard.h +++ b/drivers/usb/include/usb/USBMouseKeyboard.h @@ -26,7 +26,7 @@ #include "USBKeyboard.h" #include "platform/Stream.h" #include "USBHID.h" -#include "PlatformMutex.h" +#include "rtos/Mutex.h" /** * \defgroup drivers_USBMouseKeyboard USBMouseKeyboard class @@ -241,7 +241,7 @@ MOUSE_TYPE _mouse_type; uint8_t _button; uint8_t _lock_status; - PlatformMutex _mutex; + rtos::Mutex _mutex; bool _mouse_send(int8_t x, int8_t y, uint8_t buttons, int8_t z); diff --git a/platform/include/platform/FileBase.h b/platform/include/platform/FileBase.h index f4aac58..dbc7470 100644 --- a/platform/include/platform/FileBase.h +++ b/platform/include/platform/FileBase.h @@ -21,7 +21,7 @@ #include "platform/platform.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/NonCopyable.h" namespace mbed { @@ -62,7 +62,7 @@ private: static FileBase *_head; static FileBase *_default; - static SingletonPtr _mutex; + static SingletonPtr _mutex; FileBase *_next; const char *const _name; diff --git a/platform/include/platform/LocalFileSystem.h b/platform/include/platform/LocalFileSystem.h index 4ee6b6a..6d0870a 100644 --- a/platform/include/platform/LocalFileSystem.h +++ b/platform/include/platform/LocalFileSystem.h @@ -22,7 +22,7 @@ #if DEVICE_LOCALFILESYSTEM #include "platform/FileSystemLike.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/NonCopyable.h" namespace mbed { @@ -63,7 +63,7 @@ virtual void unlock(); FILEHANDLE _fh; int pos; - PlatformMutex _mutex; + rtos::Mutex _mutex; }; /** A filesystem for accessing the local mbed Microcontroller USB disk drive diff --git a/platform/include/platform/PlatformMutex.h b/platform/include/platform/PlatformMutex.h deleted file mode 100644 index d2e94e5..0000000 --- a/platform/include/platform/PlatformMutex.h +++ /dev/null @@ -1,92 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2006-2019 ARM Limited - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PLATFORM_MUTEX_H -#define PLATFORM_MUTEX_H - -#include "platform/NonCopyable.h" - -/** \addtogroup platform-public-api */ -/** @{*/ - -/** \defgroup platform_PlatformMutex PlatformMutex class - * @{ - */ - -/** The PlatformMutex class is used to synchronize the execution of threads. - * - * Mbed drivers use the PlatformMutex class instead of rtos::Mutex. - * This enables the use of drivers when the Mbed OS is compiled without the RTOS. - * - * @note - * - When the RTOS is present, the PlatformMutex becomes a typedef for rtos::Mutex. - * - When the RTOS is absent, all methods are defined as noop. - */ - -#ifdef MBED_CONF_RTOS_API_PRESENT - -// rtos::Mutex is itself a dummy class if the RTOS API is present, but not the RTOS -#include "rtos/Mutex.h" -typedef rtos::Mutex PlatformMutex; - -#else - -class PlatformMutex: private mbed::NonCopyable { -public: - /** Create a PlatformMutex object. - * - * @note When the RTOS is present, this is an alias for rtos::Mutex::Mutex(). - */ - PlatformMutex() - { - } - - /** PlatformMutex destructor. - * - * @note When the RTOS is present, this is an alias for rtos::Mutex::~Mutex(). - */ - ~PlatformMutex() - { - } - - /** Wait until a PlatformMutex becomes available. - * - * @note - * - When the RTOS is present, this is an alias for rtos::Mutex::lock(). - * - When the RTOS is absent, this is a noop. - */ - void lock() - { - } - - /** Unlock a PlatformMutex that the same thread has previously locked. - * - * @note - * - When the RTOS is present, this is an alias for rtos::Mutex::unlock(). - * - When the RTOS is absent, this is a noop. - */ - void unlock() - { - } -}; - -#endif - -#endif - -/**@}*/ - -/**@}*/ diff --git a/platform/include/platform/SingletonPtr.h b/platform/include/platform/SingletonPtr.h index 2b873a2..88310bd 100644 --- a/platform/include/platform/SingletonPtr.h +++ b/platform/include/platform/SingletonPtr.h @@ -22,13 +22,7 @@ #include #include "platform/mbed_assert.h" #include "platform/mbed_atomic.h" -#ifdef MBED_CONF_RTOS_PRESENT -#include "cmsis_os2.h" -#endif -#ifdef MBED_CONF_RTOS_PRESENT -extern osMutexId_t singleton_mutex_id; -#endif /** \addtogroup platform-public-api */ /** @{*/ @@ -44,16 +38,7 @@ * exclusive access when initializing a * global object. */ -inline static void singleton_lock(void) -{ -#ifdef MBED_CONF_RTOS_PRESENT - if (!singleton_mutex_id) { - // RTOS has not booted yet so no mutex is needed - return; - } - osMutexAcquire(singleton_mutex_id, osWaitForever); -#endif -} +void singleton_lock(void); /** Unlock the singleton mutex * @@ -61,16 +46,7 @@ * exclusive access when initializing a * global object. */ -inline static void singleton_unlock(void) -{ -#ifdef MBED_CONF_RTOS_PRESENT - if (!singleton_mutex_id) { - // RTOS has not booted yet so no mutex is needed - return; - } - osMutexRelease(singleton_mutex_id); -#endif -} +void singleton_unlock(void); /** Utility class for creating and using a singleton * diff --git a/platform/source/CMakeLists.txt b/platform/source/CMakeLists.txt index 48adbb1..152b37a 100644 --- a/platform/source/CMakeLists.txt +++ b/platform/source/CMakeLists.txt @@ -23,6 +23,7 @@ FilePath.cpp FileSystemHandle.cpp LocalFileSystem.cpp + SingletonPtr.cpp Stream.cpp SysTimer.cpp mbed_alloc_wrappers.cpp diff --git a/platform/source/FileBase.cpp b/platform/source/FileBase.cpp index cc0be5b..4ac57f2 100644 --- a/platform/source/FileBase.cpp +++ b/platform/source/FileBase.cpp @@ -23,7 +23,7 @@ namespace mbed { FileBase *FileBase::_head = NULL; -SingletonPtr FileBase::_mutex; +SingletonPtr FileBase::_mutex; FileBase *FileBase::_default = NULL; FileBase::FileBase(const char *name, PathType t) : _next(NULL), diff --git a/platform/source/LocalFileSystem.cpp b/platform/source/LocalFileSystem.cpp index 3a0ec41..0f48c6c 100644 --- a/platform/source/LocalFileSystem.cpp +++ b/platform/source/LocalFileSystem.cpp @@ -249,7 +249,7 @@ } protected: - PlatformMutex _mutex; + rtos::Mutex _mutex; virtual void lock() { diff --git a/platform/source/SingletonPtr.cpp b/platform/source/SingletonPtr.cpp new file mode 100644 index 0000000..f74f1ca --- /dev/null +++ b/platform/source/SingletonPtr.cpp @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2022 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. +*/ + +#ifdef MBED_CONF_RTOS_PRESENT +#include "cmsis_os2.h" +#endif + +#include "SingletonPtr.h" + +#ifdef MBED_CONF_RTOS_PRESENT +extern osMutexId_t singleton_mutex_id; +#endif + +void singleton_lock(void) +{ +#ifdef MBED_CONF_RTOS_PRESENT + if (!singleton_mutex_id) { + // RTOS has not booted yet so no mutex is needed + return; + } + osMutexAcquire(singleton_mutex_id, osWaitForever); +#endif +} + +void singleton_unlock(void) +{ +#ifdef MBED_CONF_RTOS_PRESENT + if (!singleton_mutex_id) { + // RTOS has not booted yet so no mutex is needed + return; + } + osMutexRelease(singleton_mutex_id); +#endif +} \ No newline at end of file diff --git a/platform/source/mbed_alloc_wrappers.cpp b/platform/source/mbed_alloc_wrappers.cpp index 37f6a70..f9c625a 100644 --- a/platform/source/mbed_alloc_wrappers.cpp +++ b/platform/source/mbed_alloc_wrappers.cpp @@ -19,7 +19,7 @@ #include "platform/mbed_stats.h" #include "platform/mbed_toolchain.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include #include #include @@ -49,7 +49,7 @@ #if MBED_HEAP_STATS_ENABLED #define MBED_HEAP_STATS_SIGNATURE (0xdeadbeef) -static SingletonPtr malloc_stats_mutex; +static SingletonPtr malloc_stats_mutex; static mbed_stats_heap_t heap_stats = {0, 0, 0, 0, 0, 0, 0}; typedef struct mbed_heap_overhead { diff --git a/platform/source/mbed_mem_trace.cpp b/platform/source/mbed_mem_trace.cpp index 75a61c4..f16fa6e 100644 --- a/platform/source/mbed_mem_trace.cpp +++ b/platform/source/mbed_mem_trace.cpp @@ -20,7 +20,7 @@ #include #include "platform/mbed_mem_trace.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" /****************************************************************************** * Internal variables, functions and helpers @@ -33,7 +33,7 @@ * of realloc() might call malloc() internally, and since malloc() is also traced, this could * result in two calls to the callback function instead of one. */ static uint8_t trace_lock_count; -static SingletonPtr mem_trace_mutex; +static SingletonPtr mem_trace_mutex; #define TRACE_FIRST_LOCK() (trace_lock_count < 2) diff --git a/platform/source/mbed_retarget.cpp b/platform/source/mbed_retarget.cpp index cf6dd3c..f1f6c13 100644 --- a/platform/source/mbed_retarget.cpp +++ b/platform/source/mbed_retarget.cpp @@ -30,7 +30,7 @@ #include "platform/mbed_semihost_api.h" #include "platform/mbed_interface.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/mbed_error.h" #include "platform/mbed_atomic.h" #include "platform/mbed_critical.h" @@ -49,7 +49,7 @@ #include #include "platform/mbed_retarget.h" -static SingletonPtr _mutex; +static SingletonPtr _mutex; /* DIR is typedeffed to struct DIR_impl in header */ struct DIR_impl { @@ -121,7 +121,7 @@ * put it in a filehandles array and return the index into that array */ static FileHandle *filehandles[RETARGET_OPEN_MAX] = { FILE_HANDLE_RESERVED, FILE_HANDLE_RESERVED, FILE_HANDLE_RESERVED }; -static SingletonPtr filehandle_mutex; +static SingletonPtr filehandle_mutex; #endif // !MBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY static char stdio_in_prev[RETARGET_OPEN_MAX]; @@ -1939,7 +1939,8 @@ return 0; } -static void validate_errno_values(int value) +// This function is not used, it's just to test the errno values exist +static void __attribute__((unused)) validate_errno_values(int value) { switch (value) { diff --git a/platform/source/mbed_rtc_time.cpp b/platform/source/mbed_rtc_time.cpp index 52a3a24..dbed689 100644 --- a/platform/source/mbed_rtc_time.cpp +++ b/platform/source/mbed_rtc_time.cpp @@ -18,9 +18,9 @@ #include "platform/mbed_rtc_time.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" -static SingletonPtr _mutex; +static SingletonPtr _mutex; #if DEVICE_RTC diff --git a/rtos/include/rtos/EventFlags.h b/rtos/include/rtos/EventFlags.h index 2cd2347..621e059 100644 --- a/rtos/include/rtos/EventFlags.h +++ b/rtos/include/rtos/EventFlags.h @@ -160,12 +160,12 @@ uint32_t wait_for(uint32_t flags, uint32_t opt, Kernel::Clock::duration_u32 rel_time, bool clear); uint32_t wait_until(uint32_t flags, uint32_t opt, Kernel::Clock::time_point abs_time, bool clear); -#if MBED_CONF_RTOS_PRESENT + // RTOS event flags type osEventFlagsId_t _id; mbed_rtos_storage_event_flags_t _obj_mem; -#else + + // Baremetal event flags uint32_t _flags; -#endif }; /** @}*/ diff --git a/rtos/include/rtos/Mutex.h b/rtos/include/rtos/Mutex.h index 1b3d387..553a430 100644 --- a/rtos/include/rtos/Mutex.h +++ b/rtos/include/rtos/Mutex.h @@ -171,63 +171,14 @@ ~Mutex(); private: -#if MBED_CONF_RTOS_PRESENT void constructor(const char *name = nullptr); friend class ConditionVariable; osMutexId_t _id; mbed_rtos_storage_mutex_t _obj_mem; uint32_t _count; -#endif }; -#if !MBED_CONF_RTOS_PRESENT -inline Mutex::Mutex() -{ -} - -inline Mutex::Mutex(const char *) -{ -} - -inline Mutex::~Mutex() -{ -} - -inline void Mutex::lock() -{ -} - -inline bool Mutex::trylock() -{ - return true; -} - -inline bool Mutex::trylock_for(uint32_t) -{ - return true; -} - -inline bool Mutex::trylock_for(Kernel::Clock::duration_u32) -{ - return true; -} - -inline bool Mutex::trylock_until(uint64_t) -{ - return true; -} - -inline bool Mutex::trylock_until(Kernel::Clock::time_point) -{ - return true; -} - -inline void Mutex::unlock() -{ -} -#endif - /** @}*/ /** @}*/ } diff --git a/rtos/include/rtos/Semaphore.h b/rtos/include/rtos/Semaphore.h index 5bf1a03..dd87e78 100644 --- a/rtos/include/rtos/Semaphore.h +++ b/rtos/include/rtos/Semaphore.h @@ -142,16 +142,17 @@ private: void constructor(int32_t count, uint16_t max_count); -#if MBED_CONF_RTOS_PRESENT - int32_t _wait(uint32_t millisec); +#if !MBED_CONF_RTOS_PRESENT + static bool semaphore_available(void *); +#endif + // RTOS semaphore type, used on mbed-os osSemaphoreId_t _id; mbed_rtos_storage_semaphore_t _obj_mem; -#else - static bool semaphore_available(void *); + + // Bare-metal semaphore data, used for mbed-baremetal int32_t _count; uint16_t _max_count; -#endif }; /** @}*/ /** @}*/ diff --git a/rtos/include/rtos/internal/mbed_rtos_storage.h b/rtos/include/rtos/internal/mbed_rtos_storage.h index c9b06fa..a47c7b6 100644 --- a/rtos/include/rtos/internal/mbed_rtos_storage.h +++ b/rtos/include/rtos/internal/mbed_rtos_storage.h @@ -17,10 +17,6 @@ #ifndef MBED_RTOS_STORAGE_H #define MBED_RTOS_STORAGE_H -#if MBED_CONF_RTOS_PRESENT - #include "mbed_rtx_storage.h" #endif - -#endif diff --git a/rtos/include/rtos/mbed_rtos_types.h b/rtos/include/rtos/mbed_rtos_types.h index 40bd9d9..b09430e 100644 --- a/rtos/include/rtos/mbed_rtos_types.h +++ b/rtos/include/rtos/mbed_rtos_types.h @@ -17,64 +17,6 @@ #ifndef RTOS_TYPES_H_ #define RTOS_TYPES_H_ -#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) #include "cmsis_os2.h" -#else - -#ifdef __cplusplus -extern "C" { -#endif - -/** \addtogroup rtos-public-api */ -/** @{*/ - -/* Minimal definitions for bare metal form of RTOS */ - -// Timeout value. -#define osWaitForever 0xFFFFFFFFU ///< Wait forever timeout value. - -// Flags options (\ref osThreadFlagsWait and \ref osEventFlagsWait). -#define osFlagsWaitAny 0x00000000U ///< Wait for any flag (default). -#define osFlagsWaitAll 0x00000001U ///< Wait for all flags. -#define osFlagsNoClear 0x00000002U ///< Do not clear flags which have been specified to wait for. - -// Flags errors (returned by osThreadFlagsXxxx and osEventFlagsXxxx). -#define osFlagsError 0x80000000U ///< Error indicator. -#define osFlagsErrorUnknown 0xFFFFFFFFU ///< osError (-1). -#define osFlagsErrorTimeout 0xFFFFFFFEU ///< osErrorTimeout (-2). -#define osFlagsErrorResource 0xFFFFFFFDU ///< osErrorResource (-3). -#define osFlagsErrorParameter 0xFFFFFFFCU ///< osErrorParameter (-4). -#define osFlagsErrorISR 0xFFFFFFFAU ///< osErrorISR (-6). - -// Status code values returned by CMSIS-RTOS functions. -typedef enum { - osOK = 0, ///< Operation completed successfully. - osError = -1, ///< Unspecified RTOS error: run-time error but no other error message fits. - osErrorTimeout = -2, ///< Operation not completed within the timeout period. - osErrorResource = -3, ///< Resource not available. - osErrorParameter = -4, ///< Parameter error. - osErrorNoMemory = -5, ///< System is out of memory: it was impossible to allocate or reserve memory for the operation. - osErrorISR = -6, ///< Not allowed in ISR context: the function cannot be called from interrupt service routines. - osStatusReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization. -} osStatus_t; - - -// \details Thread ID identifies the thread. -typedef void *osThreadId_t; - -// Set the specified Thread Flags of a thread. -// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId. -// \param[in] flags specifies the flags of the thread that shall be set. -// \return thread flags after setting or error code if highest bit set. -uint32_t osThreadFlagsSet(osThreadId_t thread_id, uint32_t flags); - -/** @}*/ - -#ifdef __cplusplus -} -#endif - -#endif - #endif /* RTOS_TYPES_H_ */ diff --git a/rtos/source/Mutex.cpp b/rtos/source/Mutex.cpp index 460485e..4902938 100644 --- a/rtos/source/Mutex.cpp +++ b/rtos/source/Mutex.cpp @@ -27,14 +27,16 @@ #include "platform/mbed_error.h" #include "platform/mbed_assert.h" +namespace rtos +{ + #if MBED_CONF_RTOS_PRESENT +// Actual Mutex implementation, enabled in Mbed OS using namespace std::chrono_literals; using std::milli; using std::chrono::duration; -namespace rtos { - Mutex::Mutex() { constructor(); @@ -145,6 +147,53 @@ osMutexDelete(_id); } +#else +// Stub Mutex implementation, enabled in Mbed Baremetal + +Mutex::Mutex() +{ } +Mutex::Mutex(const char *) +{ +} + +Mutex::~Mutex() +{ +} + +void Mutex::lock() +{ +} + +bool Mutex::trylock() +{ + return true; +} + +bool Mutex::trylock_for(uint32_t) +{ + return true; +} + +bool Mutex::trylock_for(Kernel::Clock::duration_u32) +{ + return true; +} + +bool Mutex::trylock_until(uint64_t) +{ + return true; +} + +bool Mutex::trylock_until(Kernel::Clock::time_point) +{ + return true; +} + +void Mutex::unlock() +{ +} #endif + +} \ No newline at end of file diff --git a/storage/blockdevice/COMPONENT_DATAFLASH/include/DataFlash/DataFlashBlockDevice.h b/storage/blockdevice/COMPONENT_DATAFLASH/include/DataFlash/DataFlashBlockDevice.h index 53dd0f1..6880d5b 100644 --- a/storage/blockdevice/COMPONENT_DATAFLASH/include/DataFlash/DataFlashBlockDevice.h +++ b/storage/blockdevice/COMPONENT_DATAFLASH/include/DataFlash/DataFlashBlockDevice.h @@ -18,7 +18,7 @@ #ifndef MBED_DATAFLASH_BLOCK_DEVICE_H #define MBED_DATAFLASH_BLOCK_DEVICE_H -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "PinNames.h" #include "blockdevice/BlockDevice.h" #include "drivers/SPI.h" @@ -200,7 +200,7 @@ uint32_t _translate_address(mbed::bd_addr_t addr); // Mutex for thread safety - mutable PlatformMutex _mutex; + mutable rtos::Mutex _mutex; }; diff --git a/storage/blockdevice/COMPONENT_I2CEE/source/I2CEEBlockDevice.cpp b/storage/blockdevice/COMPONENT_I2CEE/source/I2CEEBlockDevice.cpp index f2825ff..9f3fbf8 100644 --- a/storage/blockdevice/COMPONENT_I2CEE/source/I2CEEBlockDevice.cpp +++ b/storage/blockdevice/COMPONENT_I2CEE/source/I2CEEBlockDevice.cpp @@ -16,12 +16,13 @@ */ #include "I2CEEBlockDevice.h" #include "rtos/ThisThread.h" +#include "mbed_wait_api.h" + using namespace mbed; using namespace std::chrono_literals; #define I2CEE_TIMEOUT 10000 - I2CEEBlockDevice::I2CEEBlockDevice( PinName sda, PinName scl, uint8_t addr, bd_size_t size, bd_size_t block, int freq, @@ -156,8 +157,7 @@ if (_i2c->write(_i2c_addr | 0, 0, 0) < 1) { return 0; } - - rtos::ThisThread::sleep_for(1s); + wait_us(100); } return BD_ERROR_DEVICE_ERROR; diff --git a/storage/blockdevice/COMPONENT_OSPIF/include/OSPIF/OSPIFBlockDevice.h b/storage/blockdevice/COMPONENT_OSPIF/include/OSPIF/OSPIFBlockDevice.h index 801fe74..65cdc5e 100644 --- a/storage/blockdevice/COMPONENT_OSPIF/include/OSPIF/OSPIFBlockDevice.h +++ b/storage/blockdevice/COMPONENT_OSPIF/include/OSPIF/OSPIFBlockDevice.h @@ -407,7 +407,7 @@ // Static List of different OSPI based Flash devices csel that already exist // Each OSPI Flash device csel can have only 1 OSPIFBlockDevice instance // _devices_mutex is used to lock csel list - only one OSPIFBlockDevice instance per csel is allowed - static SingletonPtr _devices_mutex; + static SingletonPtr _devices_mutex; static int _number_of_active_ospif_flash_csel; static PinName *_active_ospif_flash_csel_arr; @@ -416,7 +416,7 @@ // Mutex is used to protect Flash device for some OSPI Driver commands that must be done sequentially with no other commands in between // e.g. (1)Set Write Enable, (2)Program, (3)Wait Memory Ready - PlatformMutex _mutex; + rtos::Mutex _mutex; // Command Instructions mbed::ospi_inst_t _read_instruction; @@ -471,7 +471,7 @@ }; uint32_t _busy_bank; // Current busy bank wait_flag _wait_flag; // wait flag - PlatformMutex _busy_mutex; + rtos::Mutex _busy_mutex; #endif }; diff --git a/storage/blockdevice/COMPONENT_OSPIF/source/OSPIFBlockDevice.cpp b/storage/blockdevice/COMPONENT_OSPIF/source/OSPIFBlockDevice.cpp index a0954b3..0476d6f 100644 --- a/storage/blockdevice/COMPONENT_OSPIF/source/OSPIFBlockDevice.cpp +++ b/storage/blockdevice/COMPONENT_OSPIF/source/OSPIFBlockDevice.cpp @@ -182,7 +182,7 @@ static PinName *generate_initialized_active_ospif_csel_arr(); // Static Members for different devices csel // _devices_mutex is used to lock csel list - only one OSPIFBlockDevice instance per csel is allowed -SingletonPtr OSPIFBlockDevice::_devices_mutex; +SingletonPtr OSPIFBlockDevice::_devices_mutex; int OSPIFBlockDevice::_number_of_active_ospif_flash_csel = 0; PinName *OSPIFBlockDevice::_active_ospif_flash_csel_arr = generate_initialized_active_ospif_csel_arr(); diff --git a/storage/blockdevice/COMPONENT_QSPIF/include/QSPIF/QSPIFBlockDevice.h b/storage/blockdevice/COMPONENT_QSPIF/include/QSPIF/QSPIFBlockDevice.h index 2903eca..57c1f6e 100644 --- a/storage/blockdevice/COMPONENT_QSPIF/include/QSPIF/QSPIFBlockDevice.h +++ b/storage/blockdevice/COMPONENT_QSPIF/include/QSPIF/QSPIFBlockDevice.h @@ -346,7 +346,7 @@ // Static List of different QSPI based Flash devices csel that already exist // Each QSPI Flash device csel can have only 1 QSPIFBlockDevice instance // _devices_mutex is used to lock csel list - only one QSPIFBlockDevice instance per csel is allowed - static SingletonPtr _devices_mutex; + static SingletonPtr _devices_mutex; static int _number_of_active_qspif_flash_csel; static PinName *_active_qspif_flash_csel_arr; @@ -355,7 +355,7 @@ // Mutex is used to protect Flash device for some QSPI Driver commands that must be done sequentially with no other commands in between // e.g. (1)Set Write Enable, (2)Program, (3)Wait Memory Ready - PlatformMutex _mutex; + rtos::Mutex _mutex; // Command Instructions mbed::qspi_inst_t _read_instruction; diff --git a/storage/blockdevice/COMPONENT_QSPIF/source/QSPIFBlockDevice.cpp b/storage/blockdevice/COMPONENT_QSPIF/source/QSPIFBlockDevice.cpp index 39b8c1c..90d61cb 100644 --- a/storage/blockdevice/COMPONENT_QSPIF/source/QSPIFBlockDevice.cpp +++ b/storage/blockdevice/COMPONENT_QSPIF/source/QSPIFBlockDevice.cpp @@ -119,7 +119,7 @@ static PinName *generate_initialized_active_qspif_csel_arr(); // Static Members for different devices csel // _devices_mutex is used to lock csel list - only one QSPIFBlockDevice instance per csel is allowed -SingletonPtr QSPIFBlockDevice::_devices_mutex; +SingletonPtr QSPIFBlockDevice::_devices_mutex; int QSPIFBlockDevice::_number_of_active_qspif_flash_csel = 0; PinName *QSPIFBlockDevice::_active_qspif_flash_csel_arr = generate_initialized_active_qspif_csel_arr(); diff --git a/storage/blockdevice/COMPONENT_SD/include/SD/SDBlockDevice.h b/storage/blockdevice/COMPONENT_SD/include/SD/SDBlockDevice.h index fef13f5..a309240 100644 --- a/storage/blockdevice/COMPONENT_SD/include/SD/SDBlockDevice.h +++ b/storage/blockdevice/COMPONENT_SD/include/SD/SDBlockDevice.h @@ -27,7 +27,7 @@ #include "drivers/MbedCRC.h" #include "drivers/DigitalOut.h" #include "platform/platform.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "hal/static_pinmap.h" #ifndef MBED_CONF_SD_SPI_MOSI @@ -285,7 +285,7 @@ _mutex.unlock(); } - PlatformMutex _mutex; + rtos::Mutex _mutex; static const uint32_t _block_size; uint32_t _erase_size; bool _is_initialized; diff --git a/storage/blockdevice/COMPONENT_SPIF/include/SPIF/SPIFBlockDevice.h b/storage/blockdevice/COMPONENT_SPIF/include/SPIF/SPIFBlockDevice.h index 76adeac..793d775 100644 --- a/storage/blockdevice/COMPONENT_SPIF/include/SPIF/SPIFBlockDevice.h +++ b/storage/blockdevice/COMPONENT_SPIF/include/SPIF/SPIFBlockDevice.h @@ -271,7 +271,7 @@ // Mutex is used to protect Flash device for some SPI Driver commands that must be done sequentially with no other commands in between // e.g. (1)Set Write Enable, (2)Program, (3)Wait Memory Ready - static SingletonPtr _mutex; + static SingletonPtr _mutex; // Command Instructions int _read_instruction; diff --git a/storage/blockdevice/COMPONENT_SPIF/source/SPIFBlockDevice.cpp b/storage/blockdevice/COMPONENT_SPIF/source/SPIFBlockDevice.cpp index bdbcae9..8171d1c 100644 --- a/storage/blockdevice/COMPONENT_SPIF/source/SPIFBlockDevice.cpp +++ b/storage/blockdevice/COMPONENT_SPIF/source/SPIFBlockDevice.cpp @@ -81,7 +81,7 @@ // Mutex is used for some SPI Driver commands that must be done sequentially with no other commands in between // e.g. (1)Set Write Enable, (2)Program, (3)Wait Memory Ready -SingletonPtr SPIFBlockDevice::_mutex; +SingletonPtr SPIFBlockDevice::_mutex; //*********************** // SPIF Block Device APIs diff --git a/storage/blockdevice/COMPONENT_SPINAND/include/SPINAND/SPINANDBlockDevice.h b/storage/blockdevice/COMPONENT_SPINAND/include/SPINAND/SPINANDBlockDevice.h index b310f53..c4d5f07 100644 --- a/storage/blockdevice/COMPONENT_SPINAND/include/SPINAND/SPINANDBlockDevice.h +++ b/storage/blockdevice/COMPONENT_SPINAND/include/SPINAND/SPINANDBlockDevice.h @@ -292,7 +292,7 @@ // Static List of different QSPI based Flash devices csel that already exist // Each QSPI Flash device csel can have only 1 SPINANDBlockDevice instance // _devices_mutex is used to lock csel list - only one SPINANDBlockDevice instance per csel is allowed - static SingletonPtr _devices_mutex; + static SingletonPtr _devices_mutex; static int _number_of_active_spinand_flash_csel; static PinName *_active_spinand_flash_csel_arr; @@ -301,7 +301,7 @@ // Mutex is used to protect Flash device for some QSPI Driver commands that must be done sequentially with no other commands in between // e.g. (1)Set Write Enable, (2)Program, (3)Wait Memory Ready - PlatformMutex _mutex; + rtos::Mutex _mutex; // Command Instructions mbed::qspi_inst_t _read_instruction; diff --git a/storage/blockdevice/COMPONENT_SPINAND/source/SPINANDBlockDevice.cpp b/storage/blockdevice/COMPONENT_SPINAND/source/SPINANDBlockDevice.cpp index 6f11d8b..c6f8cec 100644 --- a/storage/blockdevice/COMPONENT_SPINAND/source/SPINANDBlockDevice.cpp +++ b/storage/blockdevice/COMPONENT_SPINAND/source/SPINANDBlockDevice.cpp @@ -116,7 +116,7 @@ static PinName *generate_initialized_active_spinand_csel_arr(); // Static Members for different devices csel // _devices_mutex is used to lock csel list - only one SPINANDBlockDevice instance per csel is allowed -SingletonPtr SPINANDBlockDevice::_devices_mutex; +SingletonPtr SPINANDBlockDevice::_devices_mutex; int SPINANDBlockDevice::_number_of_active_spinand_flash_csel = 0; PinName *SPINANDBlockDevice::_active_spinand_flash_csel_arr = generate_initialized_active_spinand_csel_arr(); diff --git a/storage/blockdevice/include/blockdevice/ObservingBlockDevice.h b/storage/blockdevice/include/blockdevice/ObservingBlockDevice.h index 5c8c297..54b3918 100644 --- a/storage/blockdevice/include/blockdevice/ObservingBlockDevice.h +++ b/storage/blockdevice/include/blockdevice/ObservingBlockDevice.h @@ -22,7 +22,7 @@ #define MBED_OBSERVING_BLOCK_DEVICE_H #include "BlockDevice.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/Callback.h" namespace mbed { diff --git a/storage/blockdevice/include/blockdevice/ReadOnlyBlockDevice.h b/storage/blockdevice/include/blockdevice/ReadOnlyBlockDevice.h index dea7c25..52df55e 100644 --- a/storage/blockdevice/include/blockdevice/ReadOnlyBlockDevice.h +++ b/storage/blockdevice/include/blockdevice/ReadOnlyBlockDevice.h @@ -22,7 +22,7 @@ #define MBED_READ_ONLY_BLOCK_DEVICE_H #include "BlockDevice.h" -#include "PlatformMutex.h" +#include "rtos/Mutex.h" namespace mbed { diff --git a/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp b/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp index 11b3e11..c73f1f1 100644 --- a/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp +++ b/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp @@ -104,7 +104,7 @@ static uint8_t test_iteration = 0; -static SingletonPtr _mutex; +static SingletonPtr _mutex; BlockDevice *block_device = NULL; diff --git a/storage/filesystem/fat/include/fat/FATFileSystem.h b/storage/filesystem/fat/include/fat/FATFileSystem.h index 581662b..3c7577f 100644 --- a/storage/filesystem/fat/include/fat/FATFileSystem.h +++ b/storage/filesystem/fat/include/fat/FATFileSystem.h @@ -25,7 +25,7 @@ #include "blockdevice/BlockDevice.h" #include "FileHandle.h" #include -#include "PlatformMutex.h" +#include "rtos/Mutex.h" #include "storage/filesystem/fat/ChaN/ff.h" namespace mbed { diff --git a/storage/filesystem/fat/source/FATFileSystem.cpp b/storage/filesystem/fat/source/FATFileSystem.cpp index 98fa2a5..72d4157 100644 --- a/storage/filesystem/fat/source/FATFileSystem.cpp +++ b/storage/filesystem/fat/source/FATFileSystem.cpp @@ -137,7 +137,7 @@ // Global access to block device from FAT driver static mbed::BlockDevice *_ffs[FF_VOLUMES] = {0}; -static SingletonPtr _ffs_mutex; +static SingletonPtr _ffs_mutex; // FAT driver functions extern "C" DWORD get_fattime(void) diff --git a/storage/filesystem/littlefs/include/littlefs/LittleFileSystem.h b/storage/filesystem/littlefs/include/littlefs/LittleFileSystem.h index c1e3a3c..432379a 100644 --- a/storage/filesystem/littlefs/include/littlefs/LittleFileSystem.h +++ b/storage/filesystem/littlefs/include/littlefs/LittleFileSystem.h @@ -23,7 +23,7 @@ #include "filesystem/FileSystem.h" #include "blockdevice/BlockDevice.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "littlefs/lfs.h" namespace mbed { @@ -298,7 +298,7 @@ const lfs_size_t _lookahead; // thread-safe locking - PlatformMutex _mutex; + rtos::Mutex _mutex; }; } // namespace mbed diff --git a/storage/filesystem/littlefsv2/include/littlefsv2/LittleFileSystem2.h b/storage/filesystem/littlefsv2/include/littlefsv2/LittleFileSystem2.h index d753b3f..bc92281 100644 --- a/storage/filesystem/littlefsv2/include/littlefsv2/LittleFileSystem2.h +++ b/storage/filesystem/littlefsv2/include/littlefsv2/LittleFileSystem2.h @@ -23,7 +23,7 @@ #include "FileSystem.h" #include "BlockDevice.h" -#include "PlatformMutex.h" +#include "rtos/Mutex.h" #include "lfs2.h" namespace mbed { @@ -294,7 +294,7 @@ mbed::BlockDevice *_bd; // The block device // thread-safe locking - PlatformMutex _mutex; + rtos::Mutex _mutex; }; } // namespace mbed diff --git a/storage/kvstore/filesystemstore/include/filesystemstore/FileSystemStore.h b/storage/kvstore/filesystemstore/include/filesystemstore/FileSystemStore.h index ef1fc5d..e62b65f 100644 --- a/storage/kvstore/filesystemstore/include/filesystemstore/FileSystemStore.h +++ b/storage/kvstore/filesystemstore/include/filesystemstore/FileSystemStore.h @@ -254,8 +254,8 @@ int _verify_key_file(const char *key, key_metadata_t *key_metadata, File *kv_file); FileSystem *_fs; - PlatformMutex _mutex; - PlatformMutex _inc_data_add_mutex; + rtos::Mutex _mutex; + rtos::Mutex _inc_data_add_mutex; bool _is_initialized; char *_cfg_fs_path; /* FileSystemStore path name on FileSystem */ diff --git a/storage/kvstore/kv_config/source/kv_config.cpp b/storage/kvstore/kv_config/source/kv_config.cpp index 019cba9..8f39a99 100644 --- a/storage/kvstore/kv_config/source/kv_config.cpp +++ b/storage/kvstore/kv_config/source/kv_config.cpp @@ -165,7 +165,7 @@ /** Minimum number of internal flash pages required for TDBStore */ static const int STORE_PAGES = 14; -static SingletonPtr mutex; +static SingletonPtr mutex; static bool is_kv_config_initialize = false; static kvstore_config_t kvstore_config; diff --git a/storage/kvstore/kvstore_global_api/include/kvstore_global_api/KVMap.h b/storage/kvstore/kvstore_global_api/include/kvstore_global_api/KVMap.h index 0d030b9..5106b58 100644 --- a/storage/kvstore/kvstore_global_api/include/kvstore_global_api/KVMap.h +++ b/storage/kvstore/kvstore_global_api/include/kvstore_global_api/KVMap.h @@ -17,7 +17,7 @@ #define _KV_MAP #include "kvstore/KVStore.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #include "platform/SingletonPtr.h" #include "blockdevice/BlockDevice.h" #include "filesystem/FileSystem.h" @@ -232,7 +232,7 @@ kv_map_entry_t _kv_map_table[MAX_ATTACHED_KVS]; int _kv_num_attached_kvs; int _is_initialized; - SingletonPtr _mutex; + SingletonPtr _mutex; #endif }; } diff --git a/storage/kvstore/securestore/include/securestore/SecureStore.h b/storage/kvstore/securestore/include/securestore/SecureStore.h index 6e23b67..9edaf54 100644 --- a/storage/kvstore/securestore/include/securestore/SecureStore.h +++ b/storage/kvstore/securestore/include/securestore/SecureStore.h @@ -38,7 +38,7 @@ #include #include #include "KVStore.h" -#include "PlatformMutex.h" +#include "rtos/Mutex.h" // Forward declarations struct mbedtls_entropy_context; @@ -275,7 +275,7 @@ // Forward declaration struct inc_set_handle_t; - PlatformMutex _mutex; + rtos::Mutex _mutex; bool _is_initialized; KVStore *_underlying_kv, *_rbp_kv; mbedtls_entropy_context *_entropy; diff --git a/storage/kvstore/tdbstore/include/tdbstore/TDBStore.h b/storage/kvstore/tdbstore/include/tdbstore/TDBStore.h index bf7b4f0..e2842b2 100644 --- a/storage/kvstore/tdbstore/include/tdbstore/TDBStore.h +++ b/storage/kvstore/tdbstore/include/tdbstore/TDBStore.h @@ -22,7 +22,7 @@ #include "kvstore/KVStore.h" #include "blockdevice/BlockDevice.h" #include "blockdevice/BufferedBlockDevice.h" -#include "PlatformMutex.h" +#include "rtos/Mutex.h" #include "mbed_error.h" namespace mbed { @@ -288,8 +288,8 @@ static const int _num_areas = 2; static const int _max_open_iterators = 16; - PlatformMutex _mutex; - PlatformMutex _inc_set_mutex; + rtos::Mutex _mutex; + rtos::Mutex _inc_set_mutex; void *_ram_table; size_t _max_keys; size_t _num_keys; diff --git a/targets/TARGET_NUVOTON/TARGET_M261/crypto/crypto-misc.cpp b/targets/TARGET_NUVOTON/TARGET_M261/crypto/crypto-misc.cpp index 74943a4..b223c31 100644 --- a/targets/TARGET_NUVOTON/TARGET_M261/crypto/crypto-misc.cpp +++ b/targets/TARGET_NUVOTON/TARGET_M261/crypto/crypto-misc.cpp @@ -25,7 +25,7 @@ #include "nu_bitutil.h" #include "crypto-misc.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" #if defined(MBEDTLS_CONFIG_HW_SUPPORT) @@ -46,13 +46,13 @@ */ /* Mutex for crypto AES AC management */ -static SingletonPtr crypto_aes_mutex; +static SingletonPtr crypto_aes_mutex; /* Mutex for crypto DES AC management */ -static SingletonPtr crypto_des_mutex; +static SingletonPtr crypto_des_mutex; /* Mutex for crypto ECC AC management */ -static SingletonPtr crypto_ecc_mutex; +static SingletonPtr crypto_ecc_mutex; /* Atomic flag for crypto SHA AC management */ static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT; diff --git a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp index d67058e..6b64325 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp +++ b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.cpp @@ -26,7 +26,7 @@ #include "nu_bitutil.h" #include "crypto-misc.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" /* Consideration for choosing proper synchronization mechanism * @@ -45,13 +45,13 @@ */ /* Mutex for crypto AES AC management */ -static SingletonPtr crypto_aes_mutex; +static SingletonPtr crypto_aes_mutex; /* Mutex for crypto DES AC management */ -static SingletonPtr crypto_des_mutex; +static SingletonPtr crypto_des_mutex; /* Mutex for crypto ECC AC management */ -static SingletonPtr crypto_ecc_mutex; +static SingletonPtr crypto_ecc_mutex; /* Atomic flag for crypto SHA AC management */ static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT; diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp index 9a74a3c..567b131 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.cpp @@ -25,7 +25,7 @@ #include "nu_bitutil.h" #include "crypto-misc.h" #include "platform/SingletonPtr.h" -#include "platform/PlatformMutex.h" +#include "rtos/Mutex.h" /* Consideration for choosing proper synchronization mechanism * @@ -44,10 +44,10 @@ */ /* Mutex for crypto AES AC management */ -static SingletonPtr crypto_aes_mutex; +static SingletonPtr crypto_aes_mutex; /* Mutex for crypto DES AC management */ -static SingletonPtr crypto_des_mutex; +static SingletonPtr crypto_des_mutex; /* Atomic flag for crypto SHA AC management */ static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT;