mirror of https://github.com/ARMmbed/mbed-os.git
Fix ABI differences between mbed-baremetal and mbed-os, remove PlatformMutex
parent
9ada8fc433
commit
d83dbc2ac4
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
add_subdirectory(RTX)
|
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
|
INTERFACE
|
||||||
Include
|
Include
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@ if(${CMAKE_CROSSCOMPILING})
|
||||||
_mbed_get_cortex_m_exception_handlers(TOOLCHAIN_GCC)
|
_mbed_get_cortex_m_exception_handlers(TOOLCHAIN_GCC)
|
||||||
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
|
INTERFACE
|
||||||
Config
|
Config
|
||||||
Include
|
Include
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@ if(${CMAKE_CROSSCOMPILING})
|
||||||
endif()
|
endif()
|
||||||
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
|
INTERFACE
|
||||||
include
|
include
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "rtx_os.h"
|
|
||||||
#include "mbed_rtx_conf.h"
|
#include "mbed_rtx_conf.h"
|
||||||
|
#include "rtx_os.h"
|
||||||
|
|
||||||
/** \ingroup mbed-os-internal */
|
/** \ingroup mbed-os-internal */
|
||||||
/** \addtogroup rtos-internal-api */
|
/** \addtogroup rtos-internal-api */
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,7 @@ private: //Member variables
|
||||||
CellularNetwork *_nw;
|
CellularNetwork *_nw;
|
||||||
char _sim_pin[MAX_PIN_SIZE + 1];
|
char _sim_pin[MAX_PIN_SIZE + 1];
|
||||||
char _plmn[MAX_PLMN_SIZE + 1];
|
char _plmn[MAX_PLMN_SIZE + 1];
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
|
|
||||||
#ifdef MBED_CONF_RTOS_PRESENT
|
#ifdef MBED_CONF_RTOS_PRESENT
|
||||||
rtos::Thread _queue_thread;
|
rtos::Thread _queue_thread;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "ATHandler.h"
|
#include "ATHandler.h"
|
||||||
#include "netsocket/NetworkStack.h"
|
#include "netsocket/NetworkStack.h"
|
||||||
#include "PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "AT_CellularDevice.h"
|
#include "AT_CellularDevice.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
@ -209,7 +209,7 @@ protected:
|
||||||
nsapi_version_t _ip_ver_sendto;
|
nsapi_version_t _ip_ver_sendto;
|
||||||
|
|
||||||
// mutex for write/read to a _socket array, needed when multiple threads may use sockets simultaneously
|
// 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;
|
ATHandler &_at;
|
||||||
AT_CellularDevice &_device;
|
AT_CellularDevice &_device;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include "events/EventQueue.h"
|
#include "events/EventQueue.h"
|
||||||
#include "CellularNetwork.h"
|
#include "CellularNetwork.h"
|
||||||
#include "CellularCommon.h"
|
#include "CellularCommon.h"
|
||||||
#include "PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
|
|
@ -191,7 +191,7 @@ private:
|
||||||
cell_callback_data_t _cb_data;
|
cell_callback_data_t _cb_data;
|
||||||
cellular_connection_status_t _current_event;
|
cellular_connection_status_t _current_event;
|
||||||
int _status;
|
int _status;
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
|
|
||||||
// Cellular state timeouts
|
// Cellular state timeouts
|
||||||
std::chrono::duration<int, std::milli> _state_timeout_power_on;
|
std::chrono::duration<int, std::milli> _state_timeout_power_on;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ SPDX-License-Identifier: BSD-3-Clause
|
||||||
#include "DigitalIn.h"
|
#include "DigitalIn.h"
|
||||||
#include "AnalogIn.h"
|
#include "AnalogIn.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#ifdef MBED_CONF_RTOS_PRESENT
|
#ifdef MBED_CONF_RTOS_PRESENT
|
||||||
#include "rtos/Thread.h"
|
#include "rtos/Thread.h"
|
||||||
#include "rtos/ThisThread.h"
|
#include "rtos/ThisThread.h"
|
||||||
|
|
@ -340,7 +340,7 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Access protection
|
// Access protection
|
||||||
PlatformMutex mutex;
|
rtos::Mutex mutex;
|
||||||
|
|
||||||
// helper functions
|
// helper functions
|
||||||
void wakeup();
|
void wakeup();
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ SPDX-License-Identifier: BSD-3-Clause
|
||||||
#include "DigitalOut.h"
|
#include "DigitalOut.h"
|
||||||
#include "DigitalInOut.h"
|
#include "DigitalInOut.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#ifdef MBED_CONF_RTOS_PRESENT
|
#ifdef MBED_CONF_RTOS_PRESENT
|
||||||
#include "rtos/Thread.h"
|
#include "rtos/Thread.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -385,7 +385,7 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Access protection
|
// Access protection
|
||||||
PlatformMutex mutex;
|
rtos::Mutex mutex;
|
||||||
|
|
||||||
uint8_t radio_variant;
|
uint8_t radio_variant;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ SPDX-License-Identifier: BSD-3-Clause
|
||||||
#include "DigitalOut.h"
|
#include "DigitalOut.h"
|
||||||
#include "DigitalInOut.h"
|
#include "DigitalInOut.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#ifdef MBED_CONF_RTOS_PRESENT
|
#ifdef MBED_CONF_RTOS_PRESENT
|
||||||
#include "rtos/Thread.h"
|
#include "rtos/Thread.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -400,7 +400,7 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Access protection
|
// Access protection
|
||||||
PlatformMutex mutex;
|
rtos::Mutex mutex;
|
||||||
|
|
||||||
uint8_t radio_variant;
|
uint8_t radio_variant;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
#include "platform/mbed_critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
#include "drivers/DigitalOut.h"
|
#include "drivers/DigitalOut.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "lorawan/LoRaRadio.h"
|
#include "lorawan/LoRaRadio.h"
|
||||||
|
|
||||||
#include "STM32WL_radio_driver.h"
|
#include "STM32WL_radio_driver.h"
|
||||||
|
|
@ -314,7 +314,7 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Access protection
|
// Access protection
|
||||||
PlatformMutex mutex;
|
rtos::Mutex mutex;
|
||||||
|
|
||||||
// helper functions
|
// helper functions
|
||||||
void wakeup();
|
void wakeup();
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,10 @@
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#include "mbedtls/platform_util.h"
|
#include "mbedtls/platform_util.h"
|
||||||
|
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> aes_mutex;
|
static SingletonPtr<rtos::Mutex> aes_mutex;
|
||||||
|
|
||||||
#define MBEDTLS_DEBUG 0
|
#define MBEDTLS_DEBUG 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,10 @@
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#include "mbedtls/platform_util.h"
|
#include "mbedtls/platform_util.h"
|
||||||
|
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> ccm_mutex;
|
static SingletonPtr<rtos::Mutex> ccm_mutex;
|
||||||
|
|
||||||
#define MBEDTLS_DEBUG 0
|
#define MBEDTLS_DEBUG 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,10 @@
|
||||||
#include "mbedtls/platform_util.h"
|
#include "mbedtls/platform_util.h"
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
|
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> gcm_mutex;
|
static SingletonPtr<rtos::Mutex> gcm_mutex;
|
||||||
|
|
||||||
|
|
||||||
/* Parameter validation macros */
|
/* Parameter validation macros */
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#include "mbedtls/platform_util.h"
|
#include "mbedtls/platform_util.h"
|
||||||
|
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> md5_mutex;
|
static SingletonPtr<rtos::Mutex> md5_mutex;
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#include "mbedtls/platform_util.h"
|
#include "mbedtls/platform_util.h"
|
||||||
|
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> sha1_mutex;
|
static SingletonPtr<rtos::Mutex> sha1_mutex;
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#include "mbedtls/platform_util.h"
|
#include "mbedtls/platform_util.h"
|
||||||
|
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> sha256_mutex;
|
static SingletonPtr<rtos::Mutex> sha256_mutex;
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ typedef struct {
|
||||||
} ppp_sys_timeout_t;
|
} ppp_sys_timeout_t;
|
||||||
|
|
||||||
static ppp_sys_timeout_t *timeout[PPP_TIMER_NUM];
|
static ppp_sys_timeout_t *timeout[PPP_TIMER_NUM];
|
||||||
static SingletonPtr<PlatformMutex> ppp_service_if_mutex;
|
static SingletonPtr<rtos::Mutex> ppp_service_if_mutex;
|
||||||
static uint8_t ppp_service_sys_timeout_id = 0;
|
static uint8_t ppp_service_sys_timeout_id = 0;
|
||||||
static pbuf pbuf_handles[PPP_PBUF_HANDLE_NUM];
|
static pbuf pbuf_handles[PPP_PBUF_HANDLE_NUM];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@
|
||||||
|
|
||||||
#include "hal/trng_api.h"
|
#include "hal/trng_api.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
SingletonPtr<PlatformMutex> mbedtls_mutex;
|
SingletonPtr<rtos::Mutex> mbedtls_mutex;
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
int mbedtls_hardware_poll( void *data, unsigned char *output, size_t len, size_t *olen ) {
|
int mbedtls_hardware_poll( void *data, unsigned char *output, size_t len, size_t *olen ) {
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#if defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT)
|
#if defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT)
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
mbedtls_platform_context plat_ctx = { { 0 } };
|
mbedtls_platform_context plat_ctx = { { 0 } };
|
||||||
extern SingletonPtr<PlatformMutex> mbedtls_mutex;
|
extern SingletonPtr<rtos::Mutex> mbedtls_mutex;
|
||||||
|
|
||||||
int mbedtls_platform_setup( mbedtls_platform_context *unused_ctx )
|
int mbedtls_platform_setup( mbedtls_platform_context *unused_ctx )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#define SOCKET_STATS_H
|
#define SOCKET_STATS_H
|
||||||
|
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "netsocket/Socket.h"
|
#include "netsocket/Socket.h"
|
||||||
#include "SocketAddress.h"
|
#include "SocketAddress.h"
|
||||||
#include "hal/ticker_api.h"
|
#include "hal/ticker_api.h"
|
||||||
|
|
@ -144,7 +144,7 @@ public:
|
||||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||||
private:
|
private:
|
||||||
static mbed_stats_socket_t _stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
static mbed_stats_socket_t _stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<rtos::Mutex> _mutex;
|
||||||
static uint32_t _size;
|
static uint32_t _size;
|
||||||
|
|
||||||
/** Internal function to scan the array and get the position of the element in the list.
|
/** Internal function to scan the array and get the position of the element in the list.
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLED
|
||||||
SingletonPtr<PlatformMutex> SocketStats::_mutex;
|
SingletonPtr<rtos::Mutex> SocketStats::_mutex;
|
||||||
mbed_stats_socket_t SocketStats::_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
mbed_stats_socket_t SocketStats::_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||||
uint32_t SocketStats::_size = 0;
|
uint32_t SocketStats::_size = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
#include "events/EventQueue.h"
|
#include "events/EventQueue.h"
|
||||||
#include "netsocket/OnboardNetworkStack.h"
|
#include "netsocket/OnboardNetworkStack.h"
|
||||||
#include "rtos/Kernel.h"
|
#include "rtos/Kernel.h"
|
||||||
#include "PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "SingletonPtr.h"
|
#include "SingletonPtr.h"
|
||||||
|
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
|
@ -127,14 +127,14 @@ static nsapi_addr_t dns_servers[DNS_SERVERS_SIZE] = {
|
||||||
#if (MBED_CONF_NSAPI_DNS_CACHE_SIZE > 0)
|
#if (MBED_CONF_NSAPI_DNS_CACHE_SIZE > 0)
|
||||||
static DNS_CACHE *dns_cache[MBED_CONF_NSAPI_DNS_CACHE_SIZE];
|
static DNS_CACHE *dns_cache[MBED_CONF_NSAPI_DNS_CACHE_SIZE];
|
||||||
// Protects cache shared between blocking and asynchronous calls
|
// Protects cache shared between blocking and asynchronous calls
|
||||||
static SingletonPtr<PlatformMutex> dns_cache_mutex;
|
static SingletonPtr<rtos::Mutex> dns_cache_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint16_t dns_message_id = 1;
|
static uint16_t dns_message_id = 1;
|
||||||
static intptr_t dns_unique_id = 1;
|
static intptr_t dns_unique_id = 1;
|
||||||
static DNS_QUERY *dns_query_queue[DNS_QUERY_QUEUE_SIZE];
|
static DNS_QUERY *dns_query_queue[DNS_QUERY_QUEUE_SIZE];
|
||||||
// Protects from several threads running asynchronous DNS
|
// Protects from several threads running asynchronous DNS
|
||||||
static SingletonPtr<PlatformMutex> dns_mutex;
|
static SingletonPtr<rtos::Mutex> dns_mutex;
|
||||||
static SingletonPtr<call_in_callback_cb_t> dns_call_in;
|
static SingletonPtr<call_in_callback_cb_t> dns_call_in;
|
||||||
static bool dns_timer_running = false;
|
static bool dns_timer_running = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "hal/analogin_api.h"
|
#include "hal/analogin_api.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|
@ -169,7 +169,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
analogin_t _adc;
|
analogin_t _adc;
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<rtos::Mutex> _mutex;
|
||||||
|
|
||||||
float _vref;
|
float _vref;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#if DEVICE_ANALOGOUT || defined(DOXYGEN_ONLY)
|
#if DEVICE_ANALOGOUT || defined(DOXYGEN_ONLY)
|
||||||
|
|
||||||
#include "hal/analogout_api.h"
|
#include "hal/analogout_api.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/**
|
/**
|
||||||
|
|
@ -153,7 +153,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
dac_t _dac;
|
dac_t _dac;
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
#endif //!defined(DOXYGEN_ONLY)
|
#endif //!defined(DOXYGEN_ONLY)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include "platform/FileHandle.h"
|
#include "platform/FileHandle.h"
|
||||||
#include "drivers/SerialBase.h"
|
#include "drivers/SerialBase.h"
|
||||||
#include "drivers/InterruptIn.h"
|
#include "drivers/InterruptIn.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/CircularBuffer.h"
|
#include "platform/CircularBuffer.h"
|
||||||
#include "platform/NonCopyable.h"
|
#include "platform/NonCopyable.h"
|
||||||
|
|
||||||
|
|
@ -328,7 +328,7 @@ private:
|
||||||
CircularBuffer<char, MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE> _rxbuf;
|
CircularBuffer<char, MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE> _rxbuf;
|
||||||
CircularBuffer<char, MBED_CONF_DRIVERS_UART_SERIAL_TXBUF_SIZE> _txbuf;
|
CircularBuffer<char, MBED_CONF_DRIVERS_UART_SERIAL_TXBUF_SIZE> _txbuf;
|
||||||
|
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
|
|
||||||
Callback<void()> _sigio_cb;
|
Callback<void()> _sigio_cb;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "drivers/DigitalIn.h"
|
#include "drivers/DigitalIn.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/NonCopyable.h"
|
#include "platform/NonCopyable.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
@ -120,7 +120,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
int _nc_mask;
|
int _nc_mask;
|
||||||
|
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void lock();
|
virtual void lock();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#define MBED_BUSINOUT_H
|
#define MBED_BUSINOUT_H
|
||||||
|
|
||||||
#include "drivers/DigitalInOut.h"
|
#include "drivers/DigitalInOut.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/NonCopyable.h"
|
#include "platform/NonCopyable.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
@ -146,7 +146,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
int _nc_mask;
|
int _nc_mask;
|
||||||
|
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
#endif //!defined(DOXYGEN_ONLY)
|
#endif //!defined(DOXYGEN_ONLY)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#define MBED_BUSOUT_H
|
#define MBED_BUSOUT_H
|
||||||
|
|
||||||
#include "drivers/DigitalOut.h"
|
#include "drivers/DigitalOut.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/NonCopyable.h"
|
#include "platform/NonCopyable.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
@ -124,7 +124,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
int _nc_mask;
|
int _nc_mask;
|
||||||
|
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include "interfaces/InterfaceCAN.h"
|
#include "interfaces/InterfaceCAN.h"
|
||||||
#include "hal/can_api.h"
|
#include "hal/can_api.h"
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
|
|
@ -214,7 +214,7 @@ protected:
|
||||||
|
|
||||||
can_t _can;
|
can_t _can;
|
||||||
Callback<void()> _irq[IrqType::IrqCnt];
|
Callback<void()> _irq[IrqType::IrqCnt];
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "flash_api.h"
|
#include "flash_api.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/NonCopyable.h"
|
#include "platform/NonCopyable.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
@ -164,7 +164,7 @@ private:
|
||||||
|
|
||||||
flash_t _flash;
|
flash_t _flash;
|
||||||
uint8_t *_page_buf;
|
uint8_t *_page_buf;
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<rtos::Mutex> _mutex;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include "hal/i2c_api.h"
|
#include "hal/i2c_api.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/NonCopyable.h"
|
#include "platform/NonCopyable.h"
|
||||||
|
|
||||||
#if DEVICE_I2C_ASYNCH
|
#if DEVICE_I2C_ASYNCH
|
||||||
|
|
@ -234,7 +234,7 @@ protected:
|
||||||
|
|
||||||
i2c_t _i2c;
|
i2c_t _i2c;
|
||||||
int _hz;
|
int _hz;
|
||||||
SingletonPtr<PlatformMutex> _mutex;
|
SingletonPtr<rtos::Mutex> _mutex;
|
||||||
PinName _sda;
|
PinName _sda;
|
||||||
PinName _scl;
|
PinName _scl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
#include <mstd_type_traits>
|
#include <mstd_type_traits>
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ namespace mbed {
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern SingletonPtr<PlatformMutex> mbed_crc_mutex;
|
extern SingletonPtr<rtos::Mutex> mbed_crc_mutex;
|
||||||
|
|
||||||
/** CRC mode selection
|
/** CRC mode selection
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#if DEVICE_OSPI || defined(DOXYGEN_ONLY)
|
#if DEVICE_OSPI || defined(DOXYGEN_ONLY)
|
||||||
|
|
||||||
#include "hal/ospi_api.h"
|
#include "hal/ospi_api.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/NonCopyable.h"
|
#include "platform/NonCopyable.h"
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@ protected:
|
||||||
|
|
||||||
ospi_t _ospi;
|
ospi_t _ospi;
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<rtos::Mutex> _mutex;
|
||||||
ospi_bus_width_t _inst_width; //Bus width for Instruction phase
|
ospi_bus_width_t _inst_width; //Bus width for Instruction phase
|
||||||
ospi_inst_size_t _inst_size; //Instruction Size
|
ospi_inst_size_t _inst_size; //Instruction Size
|
||||||
ospi_bus_width_t _address_width; //Bus width for Address phase
|
ospi_bus_width_t _address_width; //Bus width for Address phase
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#if DEVICE_QSPI || defined(DOXYGEN_ONLY)
|
#if DEVICE_QSPI || defined(DOXYGEN_ONLY)
|
||||||
|
|
||||||
#include "hal/qspi_api.h"
|
#include "hal/qspi_api.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/NonCopyable.h"
|
#include "platform/NonCopyable.h"
|
||||||
|
|
||||||
|
|
@ -218,7 +218,7 @@ protected:
|
||||||
|
|
||||||
qspi_t _qspi;
|
qspi_t _qspi;
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<rtos::Mutex> _mutex;
|
||||||
qspi_bus_width_t _inst_width; //Bus width for Instruction phase
|
qspi_bus_width_t _inst_width; //Bus width for Instruction phase
|
||||||
qspi_bus_width_t _address_width; //Bus width for Address phase
|
qspi_bus_width_t _address_width; //Bus width for Address phase
|
||||||
qspi_address_size_t _address_size;
|
qspi_address_size_t _address_size;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include "interfaces/InterfaceCAN.h"
|
#include "interfaces/InterfaceCAN.h"
|
||||||
#include "hal/can_api.h"
|
#include "hal/can_api.h"
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
#ifndef FEATURE_EXPERIMENTAL_API
|
#ifndef FEATURE_EXPERIMENTAL_API
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#if DEVICE_SPI || defined(DOXYGEN_ONLY)
|
#if DEVICE_SPI || defined(DOXYGEN_ONLY)
|
||||||
|
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "hal/spi_api.h"
|
#include "hal/spi_api.h"
|
||||||
#include "drivers/DigitalOut.h"
|
#include "drivers/DigitalOut.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
|
|
@ -389,7 +389,7 @@ protected:
|
||||||
/* Internal SPI object handling the resources' state. */
|
/* Internal SPI object handling the resources' state. */
|
||||||
spi_t spi{};
|
spi_t spi{};
|
||||||
/* Used by lock and unlock for thread safety */
|
/* Used by lock and unlock for thread safety */
|
||||||
SingletonPtr<PlatformMutex> mutex;
|
SingletonPtr<rtos::Mutex> mutex;
|
||||||
/* Current user of the SPI */
|
/* Current user of the SPI */
|
||||||
SPI *owner = nullptr;
|
SPI *owner = nullptr;
|
||||||
#if DEVICE_SPI_ASYNCH && TRANSACTION_QUEUE_SIZE_SPI
|
#if DEVICE_SPI_ASYNCH && TRANSACTION_QUEUE_SIZE_SPI
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
SingletonPtr<PlatformMutex> AnalogIn::_mutex;
|
SingletonPtr<rtos::Mutex> AnalogIn::_mutex;
|
||||||
|
|
||||||
|
|
||||||
AnalogIn::AnalogIn(PinName pin, float vref) : _vref(vref)
|
AnalogIn::AnalogIn(PinName pin, float vref) : _vref(vref)
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ namespace mbed {
|
||||||
|
|
||||||
const unsigned int num_write_retries = 16;
|
const unsigned int num_write_retries = 16;
|
||||||
|
|
||||||
SingletonPtr<PlatformMutex> FlashIAP::_mutex;
|
SingletonPtr<rtos::Mutex> FlashIAP::_mutex;
|
||||||
|
|
||||||
static inline bool is_aligned(uint32_t number, uint32_t alignment)
|
static inline bool is_aligned(uint32_t number, uint32_t alignment)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
SingletonPtr<PlatformMutex> mbed_crc_mutex;
|
SingletonPtr<rtos::Mutex> mbed_crc_mutex;
|
||||||
|
|
||||||
static_assert(MBED_CRC_TABLE_SIZE == 0 || MBED_CRC_TABLE_SIZE == 16 || MBED_CRC_TABLE_SIZE == 256,
|
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");
|
"Configuration setting drivers.crc-table-size must be set to 0, 16 or 256");
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
SingletonPtr<PlatformMutex> OSPI::_mutex;
|
SingletonPtr<rtos::Mutex> OSPI::_mutex;
|
||||||
|
|
||||||
uint8_t convert_bus_width_to_line_count(ospi_bus_width_t width)
|
uint8_t convert_bus_width_to_line_count(ospi_bus_width_t width)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
SingletonPtr<PlatformMutex> QSPI::_mutex;
|
SingletonPtr<rtos::Mutex> QSPI::_mutex;
|
||||||
|
|
||||||
uint8_t convert_bus_width_to_line_count(qspi_bus_width_t width)
|
uint8_t convert_bus_width_to_line_count(qspi_bus_width_t width)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "USBHID.h"
|
#include "USBHID.h"
|
||||||
#include "platform/Stream.h"
|
#include "platform/Stream.h"
|
||||||
#include "PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
/* Modifiers, left keys then right keys. */
|
/* Modifiers, left keys then right keys. */
|
||||||
enum MODIFIER_KEY {
|
enum MODIFIER_KEY {
|
||||||
|
|
@ -211,7 +211,7 @@ private:
|
||||||
|
|
||||||
uint8_t _configuration_descriptor[41];
|
uint8_t _configuration_descriptor[41];
|
||||||
uint8_t _lock_status;
|
uint8_t _lock_status;
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#define USBMOUSE_H
|
#define USBMOUSE_H
|
||||||
|
|
||||||
#include "USBHID.h"
|
#include "USBHID.h"
|
||||||
#include "PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
#define REPORT_ID_MOUSE 2
|
#define REPORT_ID_MOUSE 2
|
||||||
|
|
||||||
|
|
@ -233,7 +233,7 @@ private:
|
||||||
MOUSE_TYPE _mouse_type;
|
MOUSE_TYPE _mouse_type;
|
||||||
uint8_t _button;
|
uint8_t _button;
|
||||||
uint8_t _configuration_descriptor[41];
|
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);
|
bool mouse_send(int8_t x, int8_t y, uint8_t buttons, int8_t z);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include "USBKeyboard.h"
|
#include "USBKeyboard.h"
|
||||||
#include "platform/Stream.h"
|
#include "platform/Stream.h"
|
||||||
#include "USBHID.h"
|
#include "USBHID.h"
|
||||||
#include "PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \defgroup drivers_USBMouseKeyboard USBMouseKeyboard class
|
* \defgroup drivers_USBMouseKeyboard USBMouseKeyboard class
|
||||||
|
|
@ -241,7 +241,7 @@ private:
|
||||||
MOUSE_TYPE _mouse_type;
|
MOUSE_TYPE _mouse_type;
|
||||||
uint8_t _button;
|
uint8_t _button;
|
||||||
uint8_t _lock_status;
|
uint8_t _lock_status;
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
|
|
||||||
bool _mouse_send(int8_t x, int8_t y, uint8_t buttons, int8_t z);
|
bool _mouse_send(int8_t x, int8_t y, uint8_t buttons, int8_t z);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ typedef int FILEHANDLE;
|
||||||
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/NonCopyable.h"
|
#include "platform/NonCopyable.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
@ -62,7 +62,7 @@ public:
|
||||||
private:
|
private:
|
||||||
static FileBase *_head;
|
static FileBase *_head;
|
||||||
static FileBase *_default;
|
static FileBase *_default;
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<rtos::Mutex> _mutex;
|
||||||
|
|
||||||
FileBase *_next;
|
FileBase *_next;
|
||||||
const char *const _name;
|
const char *const _name;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#if DEVICE_LOCALFILESYSTEM
|
#if DEVICE_LOCALFILESYSTEM
|
||||||
|
|
||||||
#include "platform/FileSystemLike.h"
|
#include "platform/FileSystemLike.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/NonCopyable.h"
|
#include "platform/NonCopyable.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
@ -63,7 +63,7 @@ protected:
|
||||||
virtual void unlock();
|
virtual void unlock();
|
||||||
FILEHANDLE _fh;
|
FILEHANDLE _fh;
|
||||||
int pos;
|
int pos;
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A filesystem for accessing the local mbed Microcontroller USB disk drive
|
/** A filesystem for accessing the local mbed Microcontroller USB disk drive
|
||||||
|
|
|
||||||
|
|
@ -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<PlatformMutex> {
|
|
||||||
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
|
|
||||||
|
|
||||||
/**@}*/
|
|
||||||
|
|
||||||
/**@}*/
|
|
||||||
|
|
@ -22,13 +22,7 @@
|
||||||
#include <new>
|
#include <new>
|
||||||
#include "platform/mbed_assert.h"
|
#include "platform/mbed_assert.h"
|
||||||
#include "platform/mbed_atomic.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 */
|
/** \addtogroup platform-public-api */
|
||||||
/** @{*/
|
/** @{*/
|
||||||
|
|
@ -44,16 +38,7 @@ extern osMutexId_t singleton_mutex_id;
|
||||||
* exclusive access when initializing a
|
* exclusive access when initializing a
|
||||||
* global object.
|
* global object.
|
||||||
*/
|
*/
|
||||||
inline static void singleton_lock(void)
|
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
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Unlock the singleton mutex
|
/** Unlock the singleton mutex
|
||||||
*
|
*
|
||||||
|
|
@ -61,16 +46,7 @@ inline static void singleton_lock(void)
|
||||||
* exclusive access when initializing a
|
* exclusive access when initializing a
|
||||||
* global object.
|
* global object.
|
||||||
*/
|
*/
|
||||||
inline static void singleton_unlock(void)
|
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
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Utility class for creating and using a singleton
|
/** Utility class for creating and using a singleton
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ target_sources(mbed-core-sources
|
||||||
FilePath.cpp
|
FilePath.cpp
|
||||||
FileSystemHandle.cpp
|
FileSystemHandle.cpp
|
||||||
LocalFileSystem.cpp
|
LocalFileSystem.cpp
|
||||||
|
SingletonPtr.cpp
|
||||||
Stream.cpp
|
Stream.cpp
|
||||||
SysTimer.cpp
|
SysTimer.cpp
|
||||||
mbed_alloc_wrappers.cpp
|
mbed_alloc_wrappers.cpp
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
FileBase *FileBase::_head = NULL;
|
FileBase *FileBase::_head = NULL;
|
||||||
SingletonPtr<PlatformMutex> FileBase::_mutex;
|
SingletonPtr<rtos::Mutex> FileBase::_mutex;
|
||||||
FileBase *FileBase::_default = NULL;
|
FileBase *FileBase::_default = NULL;
|
||||||
|
|
||||||
FileBase::FileBase(const char *name, PathType t) : _next(NULL),
|
FileBase::FileBase(const char *name, PathType t) : _next(NULL),
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
|
|
||||||
virtual void lock()
|
virtual void lock()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#include "platform/mbed_stats.h"
|
#include "platform/mbed_stats.h"
|
||||||
#include "platform/mbed_toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -49,7 +49,7 @@ typedef struct {
|
||||||
#if MBED_HEAP_STATS_ENABLED
|
#if MBED_HEAP_STATS_ENABLED
|
||||||
#define MBED_HEAP_STATS_SIGNATURE (0xdeadbeef)
|
#define MBED_HEAP_STATS_SIGNATURE (0xdeadbeef)
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> malloc_stats_mutex;
|
static SingletonPtr<rtos::Mutex> malloc_stats_mutex;
|
||||||
static mbed_stats_heap_t heap_stats = {0, 0, 0, 0, 0, 0, 0};
|
static mbed_stats_heap_t heap_stats = {0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
typedef struct mbed_heap_overhead {
|
typedef struct mbed_heap_overhead {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "platform/mbed_mem_trace.h"
|
#include "platform/mbed_mem_trace.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Internal variables, functions and helpers
|
* Internal variables, functions and helpers
|
||||||
|
|
@ -33,7 +33,7 @@ static mbed_mem_trace_cb_t mem_trace_cb_reserve;
|
||||||
* of realloc() might call malloc() internally, and since malloc() is also traced, this could
|
* 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. */
|
* result in two calls to the callback function instead of one. */
|
||||||
static uint8_t trace_lock_count;
|
static uint8_t trace_lock_count;
|
||||||
static SingletonPtr<PlatformMutex> mem_trace_mutex;
|
static SingletonPtr<rtos::Mutex> mem_trace_mutex;
|
||||||
|
|
||||||
#define TRACE_FIRST_LOCK() (trace_lock_count < 2)
|
#define TRACE_FIRST_LOCK() (trace_lock_count < 2)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
#include "platform/mbed_semihost_api.h"
|
#include "platform/mbed_semihost_api.h"
|
||||||
#include "platform/mbed_interface.h"
|
#include "platform/mbed_interface.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/mbed_error.h"
|
#include "platform/mbed_error.h"
|
||||||
#include "platform/mbed_atomic.h"
|
#include "platform/mbed_atomic.h"
|
||||||
#include "platform/mbed_critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "platform/mbed_retarget.h"
|
#include "platform/mbed_retarget.h"
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<rtos::Mutex> _mutex;
|
||||||
|
|
||||||
/* DIR is typedeffed to struct DIR_impl in header */
|
/* DIR is typedeffed to struct DIR_impl in header */
|
||||||
struct DIR_impl {
|
struct DIR_impl {
|
||||||
|
|
@ -121,7 +121,7 @@ uint32_t mbed_heap_size = 0;
|
||||||
* put it in a filehandles array and return the index into that array
|
* 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 FileHandle *filehandles[RETARGET_OPEN_MAX] = { FILE_HANDLE_RESERVED, FILE_HANDLE_RESERVED, FILE_HANDLE_RESERVED };
|
||||||
static SingletonPtr<PlatformMutex> filehandle_mutex;
|
static SingletonPtr<rtos::Mutex> filehandle_mutex;
|
||||||
#endif // !MBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY
|
#endif // !MBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY
|
||||||
|
|
||||||
static char stdio_in_prev[RETARGET_OPEN_MAX];
|
static char stdio_in_prev[RETARGET_OPEN_MAX];
|
||||||
|
|
@ -1939,7 +1939,8 @@ extern "C" MBED_WEAK long int _scanf_mbtowc(
|
||||||
return 0;
|
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) {
|
switch (value) {
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@
|
||||||
|
|
||||||
#include "platform/mbed_rtc_time.h"
|
#include "platform/mbed_rtc_time.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<rtos::Mutex> _mutex;
|
||||||
|
|
||||||
#if DEVICE_RTC
|
#if DEVICE_RTC
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,12 +160,12 @@ private:
|
||||||
uint32_t wait_for(uint32_t flags, uint32_t opt, Kernel::Clock::duration_u32 rel_time, bool clear);
|
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);
|
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;
|
osEventFlagsId_t _id;
|
||||||
mbed_rtos_storage_event_flags_t _obj_mem;
|
mbed_rtos_storage_event_flags_t _obj_mem;
|
||||||
#else
|
|
||||||
|
// Baremetal event flags
|
||||||
uint32_t _flags;
|
uint32_t _flags;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
|
|
|
||||||
|
|
@ -171,63 +171,14 @@ public:
|
||||||
~Mutex();
|
~Mutex();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if MBED_CONF_RTOS_PRESENT
|
|
||||||
void constructor(const char *name = nullptr);
|
void constructor(const char *name = nullptr);
|
||||||
friend class ConditionVariable;
|
friend class ConditionVariable;
|
||||||
|
|
||||||
osMutexId_t _id;
|
osMutexId_t _id;
|
||||||
mbed_rtos_storage_mutex_t _obj_mem;
|
mbed_rtos_storage_mutex_t _obj_mem;
|
||||||
uint32_t _count;
|
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
|
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
/** @}*/
|
/** @}*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,16 +142,17 @@ public:
|
||||||
private:
|
private:
|
||||||
void constructor(int32_t count, uint16_t max_count);
|
void constructor(int32_t count, uint16_t max_count);
|
||||||
|
|
||||||
#if MBED_CONF_RTOS_PRESENT
|
#if !MBED_CONF_RTOS_PRESENT
|
||||||
int32_t _wait(uint32_t millisec);
|
static bool semaphore_available(void *);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// RTOS semaphore type, used on mbed-os
|
||||||
osSemaphoreId_t _id;
|
osSemaphoreId_t _id;
|
||||||
mbed_rtos_storage_semaphore_t _obj_mem;
|
mbed_rtos_storage_semaphore_t _obj_mem;
|
||||||
#else
|
|
||||||
static bool semaphore_available(void *);
|
// Bare-metal semaphore data, used for mbed-baremetal
|
||||||
int32_t _count;
|
int32_t _count;
|
||||||
uint16_t _max_count;
|
uint16_t _max_count;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
/** @}*/
|
/** @}*/
|
||||||
/** @}*/
|
/** @}*/
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,6 @@
|
||||||
#ifndef MBED_RTOS_STORAGE_H
|
#ifndef MBED_RTOS_STORAGE_H
|
||||||
#define MBED_RTOS_STORAGE_H
|
#define MBED_RTOS_STORAGE_H
|
||||||
|
|
||||||
#if MBED_CONF_RTOS_PRESENT
|
|
||||||
|
|
||||||
#include "mbed_rtx_storage.h"
|
#include "mbed_rtx_storage.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -17,64 +17,6 @@
|
||||||
#ifndef RTOS_TYPES_H_
|
#ifndef RTOS_TYPES_H_
|
||||||
#define RTOS_TYPES_H_
|
#define RTOS_TYPES_H_
|
||||||
|
|
||||||
#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY)
|
|
||||||
#include "cmsis_os2.h"
|
#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_ */
|
#endif /* RTOS_TYPES_H_ */
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,16 @@
|
||||||
#include "platform/mbed_error.h"
|
#include "platform/mbed_error.h"
|
||||||
#include "platform/mbed_assert.h"
|
#include "platform/mbed_assert.h"
|
||||||
|
|
||||||
|
namespace rtos
|
||||||
|
{
|
||||||
|
|
||||||
#if MBED_CONF_RTOS_PRESENT
|
#if MBED_CONF_RTOS_PRESENT
|
||||||
|
// Actual Mutex implementation, enabled in Mbed OS
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
using std::milli;
|
using std::milli;
|
||||||
using std::chrono::duration;
|
using std::chrono::duration;
|
||||||
|
|
||||||
namespace rtos {
|
|
||||||
|
|
||||||
Mutex::Mutex()
|
Mutex::Mutex()
|
||||||
{
|
{
|
||||||
constructor();
|
constructor();
|
||||||
|
|
@ -145,6 +147,53 @@ Mutex::~Mutex()
|
||||||
osMutexDelete(_id);
|
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
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#ifndef MBED_DATAFLASH_BLOCK_DEVICE_H
|
#ifndef MBED_DATAFLASH_BLOCK_DEVICE_H
|
||||||
#define MBED_DATAFLASH_BLOCK_DEVICE_H
|
#define MBED_DATAFLASH_BLOCK_DEVICE_H
|
||||||
|
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "PinNames.h"
|
#include "PinNames.h"
|
||||||
#include "blockdevice/BlockDevice.h"
|
#include "blockdevice/BlockDevice.h"
|
||||||
#include "drivers/SPI.h"
|
#include "drivers/SPI.h"
|
||||||
|
|
@ -200,7 +200,7 @@ private:
|
||||||
uint32_t _translate_address(mbed::bd_addr_t addr);
|
uint32_t _translate_address(mbed::bd_addr_t addr);
|
||||||
|
|
||||||
// Mutex for thread safety
|
// Mutex for thread safety
|
||||||
mutable PlatformMutex _mutex;
|
mutable rtos::Mutex _mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,13 @@
|
||||||
*/
|
*/
|
||||||
#include "I2CEEBlockDevice.h"
|
#include "I2CEEBlockDevice.h"
|
||||||
#include "rtos/ThisThread.h"
|
#include "rtos/ThisThread.h"
|
||||||
|
#include "mbed_wait_api.h"
|
||||||
|
|
||||||
using namespace mbed;
|
using namespace mbed;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
#define I2CEE_TIMEOUT 10000
|
#define I2CEE_TIMEOUT 10000
|
||||||
|
|
||||||
|
|
||||||
I2CEEBlockDevice::I2CEEBlockDevice(
|
I2CEEBlockDevice::I2CEEBlockDevice(
|
||||||
PinName sda, PinName scl, uint8_t addr,
|
PinName sda, PinName scl, uint8_t addr,
|
||||||
bd_size_t size, bd_size_t block, int freq,
|
bd_size_t size, bd_size_t block, int freq,
|
||||||
|
|
@ -156,8 +157,7 @@ int I2CEEBlockDevice::_sync()
|
||||||
if (_i2c->write(_i2c_addr | 0, 0, 0) < 1) {
|
if (_i2c->write(_i2c_addr | 0, 0, 0) < 1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
wait_us(100);
|
||||||
rtos::ThisThread::sleep_for(1s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return BD_ERROR_DEVICE_ERROR;
|
return BD_ERROR_DEVICE_ERROR;
|
||||||
|
|
|
||||||
|
|
@ -407,7 +407,7 @@ private:
|
||||||
// Static List of different OSPI based Flash devices csel that already exist
|
// Static List of different OSPI based Flash devices csel that already exist
|
||||||
// Each OSPI Flash device csel can have only 1 OSPIFBlockDevice instance
|
// 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
|
// _devices_mutex is used to lock csel list - only one OSPIFBlockDevice instance per csel is allowed
|
||||||
static SingletonPtr<PlatformMutex> _devices_mutex;
|
static SingletonPtr<rtos::Mutex> _devices_mutex;
|
||||||
static int _number_of_active_ospif_flash_csel;
|
static int _number_of_active_ospif_flash_csel;
|
||||||
static PinName *_active_ospif_flash_csel_arr;
|
static PinName *_active_ospif_flash_csel_arr;
|
||||||
|
|
||||||
|
|
@ -416,7 +416,7 @@ private:
|
||||||
|
|
||||||
// Mutex is used to protect Flash device for some OSPI Driver commands that must be done sequentially with no other commands in between
|
// 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
|
// e.g. (1)Set Write Enable, (2)Program, (3)Wait Memory Ready
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
|
|
||||||
// Command Instructions
|
// Command Instructions
|
||||||
mbed::ospi_inst_t _read_instruction;
|
mbed::ospi_inst_t _read_instruction;
|
||||||
|
|
@ -471,7 +471,7 @@ private:
|
||||||
};
|
};
|
||||||
uint32_t _busy_bank; // Current busy bank
|
uint32_t _busy_bank; // Current busy bank
|
||||||
wait_flag _wait_flag; // wait flag
|
wait_flag _wait_flag; // wait flag
|
||||||
PlatformMutex _busy_mutex;
|
rtos::Mutex _busy_mutex;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ static const uint8_t _sfdp_4_byte_inst_table[8] = {0x7F, 0xEF, 0xFF, 0xFF, 0x21,
|
||||||
static PinName *generate_initialized_active_ospif_csel_arr();
|
static PinName *generate_initialized_active_ospif_csel_arr();
|
||||||
// Static Members for different devices csel
|
// Static Members for different devices csel
|
||||||
// _devices_mutex is used to lock csel list - only one OSPIFBlockDevice instance per csel is allowed
|
// _devices_mutex is used to lock csel list - only one OSPIFBlockDevice instance per csel is allowed
|
||||||
SingletonPtr<PlatformMutex> OSPIFBlockDevice::_devices_mutex;
|
SingletonPtr<rtos::Mutex> OSPIFBlockDevice::_devices_mutex;
|
||||||
int OSPIFBlockDevice::_number_of_active_ospif_flash_csel = 0;
|
int OSPIFBlockDevice::_number_of_active_ospif_flash_csel = 0;
|
||||||
PinName *OSPIFBlockDevice::_active_ospif_flash_csel_arr = generate_initialized_active_ospif_csel_arr();
|
PinName *OSPIFBlockDevice::_active_ospif_flash_csel_arr = generate_initialized_active_ospif_csel_arr();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,7 @@ private:
|
||||||
// Static List of different QSPI based Flash devices csel that already exist
|
// Static List of different QSPI based Flash devices csel that already exist
|
||||||
// Each QSPI Flash device csel can have only 1 QSPIFBlockDevice instance
|
// 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
|
// _devices_mutex is used to lock csel list - only one QSPIFBlockDevice instance per csel is allowed
|
||||||
static SingletonPtr<PlatformMutex> _devices_mutex;
|
static SingletonPtr<rtos::Mutex> _devices_mutex;
|
||||||
static int _number_of_active_qspif_flash_csel;
|
static int _number_of_active_qspif_flash_csel;
|
||||||
static PinName *_active_qspif_flash_csel_arr;
|
static PinName *_active_qspif_flash_csel_arr;
|
||||||
|
|
||||||
|
|
@ -355,7 +355,7 @@ private:
|
||||||
|
|
||||||
// Mutex is used to protect Flash device for some QSPI Driver commands that must be done sequentially with no other commands in between
|
// 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
|
// e.g. (1)Set Write Enable, (2)Program, (3)Wait Memory Ready
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
|
|
||||||
// Command Instructions
|
// Command Instructions
|
||||||
mbed::qspi_inst_t _read_instruction;
|
mbed::qspi_inst_t _read_instruction;
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ using namespace mbed;
|
||||||
static PinName *generate_initialized_active_qspif_csel_arr();
|
static PinName *generate_initialized_active_qspif_csel_arr();
|
||||||
// Static Members for different devices csel
|
// Static Members for different devices csel
|
||||||
// _devices_mutex is used to lock csel list - only one QSPIFBlockDevice instance per csel is allowed
|
// _devices_mutex is used to lock csel list - only one QSPIFBlockDevice instance per csel is allowed
|
||||||
SingletonPtr<PlatformMutex> QSPIFBlockDevice::_devices_mutex;
|
SingletonPtr<rtos::Mutex> QSPIFBlockDevice::_devices_mutex;
|
||||||
int QSPIFBlockDevice::_number_of_active_qspif_flash_csel = 0;
|
int QSPIFBlockDevice::_number_of_active_qspif_flash_csel = 0;
|
||||||
PinName *QSPIFBlockDevice::_active_qspif_flash_csel_arr = generate_initialized_active_qspif_csel_arr();
|
PinName *QSPIFBlockDevice::_active_qspif_flash_csel_arr = generate_initialized_active_qspif_csel_arr();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include "drivers/MbedCRC.h"
|
#include "drivers/MbedCRC.h"
|
||||||
#include "drivers/DigitalOut.h"
|
#include "drivers/DigitalOut.h"
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "hal/static_pinmap.h"
|
#include "hal/static_pinmap.h"
|
||||||
|
|
||||||
#ifndef MBED_CONF_SD_SPI_MOSI
|
#ifndef MBED_CONF_SD_SPI_MOSI
|
||||||
|
|
@ -285,7 +285,7 @@ private:
|
||||||
_mutex.unlock();
|
_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
static const uint32_t _block_size;
|
static const uint32_t _block_size;
|
||||||
uint32_t _erase_size;
|
uint32_t _erase_size;
|
||||||
bool _is_initialized;
|
bool _is_initialized;
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ private:
|
||||||
|
|
||||||
// Mutex is used to protect Flash device for some SPI Driver commands that must be done sequentially with no other commands in between
|
// 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
|
// e.g. (1)Set Write Enable, (2)Program, (3)Wait Memory Ready
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<rtos::Mutex> _mutex;
|
||||||
|
|
||||||
// Command Instructions
|
// Command Instructions
|
||||||
int _read_instruction;
|
int _read_instruction;
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ enum spif_default_instructions {
|
||||||
|
|
||||||
// Mutex is used for some SPI Driver commands that must be done sequentially with no other commands in between
|
// 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
|
// e.g. (1)Set Write Enable, (2)Program, (3)Wait Memory Ready
|
||||||
SingletonPtr<PlatformMutex> SPIFBlockDevice::_mutex;
|
SingletonPtr<rtos::Mutex> SPIFBlockDevice::_mutex;
|
||||||
|
|
||||||
//***********************
|
//***********************
|
||||||
// SPIF Block Device APIs
|
// SPIF Block Device APIs
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ private:
|
||||||
// Static List of different QSPI based Flash devices csel that already exist
|
// Static List of different QSPI based Flash devices csel that already exist
|
||||||
// Each QSPI Flash device csel can have only 1 SPINANDBlockDevice instance
|
// 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
|
// _devices_mutex is used to lock csel list - only one SPINANDBlockDevice instance per csel is allowed
|
||||||
static SingletonPtr<PlatformMutex> _devices_mutex;
|
static SingletonPtr<rtos::Mutex> _devices_mutex;
|
||||||
static int _number_of_active_spinand_flash_csel;
|
static int _number_of_active_spinand_flash_csel;
|
||||||
static PinName *_active_spinand_flash_csel_arr;
|
static PinName *_active_spinand_flash_csel_arr;
|
||||||
|
|
||||||
|
|
@ -301,7 +301,7 @@ private:
|
||||||
|
|
||||||
// Mutex is used to protect Flash device for some QSPI Driver commands that must be done sequentially with no other commands in between
|
// 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
|
// e.g. (1)Set Write Enable, (2)Program, (3)Wait Memory Ready
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
|
|
||||||
// Command Instructions
|
// Command Instructions
|
||||||
mbed::qspi_inst_t _read_instruction;
|
mbed::qspi_inst_t _read_instruction;
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ using namespace mbed;
|
||||||
static PinName *generate_initialized_active_spinand_csel_arr();
|
static PinName *generate_initialized_active_spinand_csel_arr();
|
||||||
// Static Members for different devices csel
|
// Static Members for different devices csel
|
||||||
// _devices_mutex is used to lock csel list - only one SPINANDBlockDevice instance per csel is allowed
|
// _devices_mutex is used to lock csel list - only one SPINANDBlockDevice instance per csel is allowed
|
||||||
SingletonPtr<PlatformMutex> SPINANDBlockDevice::_devices_mutex;
|
SingletonPtr<rtos::Mutex> SPINANDBlockDevice::_devices_mutex;
|
||||||
int SPINANDBlockDevice::_number_of_active_spinand_flash_csel = 0;
|
int SPINANDBlockDevice::_number_of_active_spinand_flash_csel = 0;
|
||||||
PinName *SPINANDBlockDevice::_active_spinand_flash_csel_arr = generate_initialized_active_spinand_csel_arr();
|
PinName *SPINANDBlockDevice::_active_spinand_flash_csel_arr = generate_initialized_active_spinand_csel_arr();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#define MBED_OBSERVING_BLOCK_DEVICE_H
|
#define MBED_OBSERVING_BLOCK_DEVICE_H
|
||||||
|
|
||||||
#include "BlockDevice.h"
|
#include "BlockDevice.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#define MBED_READ_ONLY_BLOCK_DEVICE_H
|
#define MBED_READ_ONLY_BLOCK_DEVICE_H
|
||||||
|
|
||||||
#include "BlockDevice.h"
|
#include "BlockDevice.h"
|
||||||
#include "PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ uint8_t bd_arr[6] = {0};
|
||||||
|
|
||||||
static uint8_t test_iteration = 0;
|
static uint8_t test_iteration = 0;
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> _mutex;
|
static SingletonPtr<rtos::Mutex> _mutex;
|
||||||
|
|
||||||
BlockDevice *block_device = NULL;
|
BlockDevice *block_device = NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include "blockdevice/BlockDevice.h"
|
#include "blockdevice/BlockDevice.h"
|
||||||
#include "FileHandle.h"
|
#include "FileHandle.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "storage/filesystem/fat/ChaN/ff.h"
|
#include "storage/filesystem/fat/ChaN/ff.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ static Deferred<const char *> fat_path_prefix(int id, const char *path)
|
||||||
|
|
||||||
// Global access to block device from FAT driver
|
// Global access to block device from FAT driver
|
||||||
static mbed::BlockDevice *_ffs[FF_VOLUMES] = {0};
|
static mbed::BlockDevice *_ffs[FF_VOLUMES] = {0};
|
||||||
static SingletonPtr<PlatformMutex> _ffs_mutex;
|
static SingletonPtr<rtos::Mutex> _ffs_mutex;
|
||||||
|
|
||||||
// FAT driver functions
|
// FAT driver functions
|
||||||
extern "C" DWORD get_fattime(void)
|
extern "C" DWORD get_fattime(void)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "filesystem/FileSystem.h"
|
#include "filesystem/FileSystem.h"
|
||||||
#include "blockdevice/BlockDevice.h"
|
#include "blockdevice/BlockDevice.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "littlefs/lfs.h"
|
#include "littlefs/lfs.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
@ -298,7 +298,7 @@ private:
|
||||||
const lfs_size_t _lookahead;
|
const lfs_size_t _lookahead;
|
||||||
|
|
||||||
// thread-safe locking
|
// thread-safe locking
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
#include "BlockDevice.h"
|
#include "BlockDevice.h"
|
||||||
#include "PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "lfs2.h"
|
#include "lfs2.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
@ -294,7 +294,7 @@ private:
|
||||||
mbed::BlockDevice *_bd; // The block device
|
mbed::BlockDevice *_bd; // The block device
|
||||||
|
|
||||||
// thread-safe locking
|
// thread-safe locking
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
||||||
|
|
@ -254,8 +254,8 @@ private:
|
||||||
int _verify_key_file(const char *key, key_metadata_t *key_metadata, File *kv_file);
|
int _verify_key_file(const char *key, key_metadata_t *key_metadata, File *kv_file);
|
||||||
|
|
||||||
FileSystem *_fs;
|
FileSystem *_fs;
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
PlatformMutex _inc_data_add_mutex;
|
rtos::Mutex _inc_data_add_mutex;
|
||||||
|
|
||||||
bool _is_initialized;
|
bool _is_initialized;
|
||||||
char *_cfg_fs_path; /* FileSystemStore path name on FileSystem */
|
char *_cfg_fs_path; /* FileSystemStore path name on FileSystem */
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ static const int STORE_SECTORS = 2;
|
||||||
/** Minimum number of internal flash pages required for TDBStore */
|
/** Minimum number of internal flash pages required for TDBStore */
|
||||||
static const int STORE_PAGES = 14;
|
static const int STORE_PAGES = 14;
|
||||||
|
|
||||||
static SingletonPtr<PlatformMutex> mutex;
|
static SingletonPtr<rtos::Mutex> mutex;
|
||||||
static bool is_kv_config_initialize = false;
|
static bool is_kv_config_initialize = false;
|
||||||
static kvstore_config_t kvstore_config;
|
static kvstore_config_t kvstore_config;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
#define _KV_MAP
|
#define _KV_MAP
|
||||||
|
|
||||||
#include "kvstore/KVStore.h"
|
#include "kvstore/KVStore.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "blockdevice/BlockDevice.h"
|
#include "blockdevice/BlockDevice.h"
|
||||||
#include "filesystem/FileSystem.h"
|
#include "filesystem/FileSystem.h"
|
||||||
|
|
@ -232,7 +232,7 @@ private:
|
||||||
kv_map_entry_t _kv_map_table[MAX_ATTACHED_KVS];
|
kv_map_entry_t _kv_map_table[MAX_ATTACHED_KVS];
|
||||||
int _kv_num_attached_kvs;
|
int _kv_num_attached_kvs;
|
||||||
int _is_initialized;
|
int _is_initialized;
|
||||||
SingletonPtr<PlatformMutex> _mutex;
|
SingletonPtr<rtos::Mutex> _mutex;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "KVStore.h"
|
#include "KVStore.h"
|
||||||
#include "PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
struct mbedtls_entropy_context;
|
struct mbedtls_entropy_context;
|
||||||
|
|
@ -275,7 +275,7 @@ private:
|
||||||
// Forward declaration
|
// Forward declaration
|
||||||
struct inc_set_handle_t;
|
struct inc_set_handle_t;
|
||||||
|
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
bool _is_initialized;
|
bool _is_initialized;
|
||||||
KVStore *_underlying_kv, *_rbp_kv;
|
KVStore *_underlying_kv, *_rbp_kv;
|
||||||
mbedtls_entropy_context *_entropy;
|
mbedtls_entropy_context *_entropy;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "kvstore/KVStore.h"
|
#include "kvstore/KVStore.h"
|
||||||
#include "blockdevice/BlockDevice.h"
|
#include "blockdevice/BlockDevice.h"
|
||||||
#include "blockdevice/BufferedBlockDevice.h"
|
#include "blockdevice/BufferedBlockDevice.h"
|
||||||
#include "PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
@ -288,8 +288,8 @@ private:
|
||||||
static const int _num_areas = 2;
|
static const int _num_areas = 2;
|
||||||
static const int _max_open_iterators = 16;
|
static const int _max_open_iterators = 16;
|
||||||
|
|
||||||
PlatformMutex _mutex;
|
rtos::Mutex _mutex;
|
||||||
PlatformMutex _inc_set_mutex;
|
rtos::Mutex _inc_set_mutex;
|
||||||
void *_ram_table;
|
void *_ram_table;
|
||||||
size_t _max_keys;
|
size_t _max_keys;
|
||||||
size_t _num_keys;
|
size_t _num_keys;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include "nu_bitutil.h"
|
#include "nu_bitutil.h"
|
||||||
#include "crypto-misc.h"
|
#include "crypto-misc.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_CONFIG_HW_SUPPORT)
|
#if defined(MBEDTLS_CONFIG_HW_SUPPORT)
|
||||||
|
|
||||||
|
|
@ -46,13 +46,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Mutex for crypto AES AC management */
|
/* Mutex for crypto AES AC management */
|
||||||
static SingletonPtr<PlatformMutex> crypto_aes_mutex;
|
static SingletonPtr<rtos::Mutex> crypto_aes_mutex;
|
||||||
|
|
||||||
/* Mutex for crypto DES AC management */
|
/* Mutex for crypto DES AC management */
|
||||||
static SingletonPtr<PlatformMutex> crypto_des_mutex;
|
static SingletonPtr<rtos::Mutex> crypto_des_mutex;
|
||||||
|
|
||||||
/* Mutex for crypto ECC AC management */
|
/* Mutex for crypto ECC AC management */
|
||||||
static SingletonPtr<PlatformMutex> crypto_ecc_mutex;
|
static SingletonPtr<rtos::Mutex> crypto_ecc_mutex;
|
||||||
|
|
||||||
/* Atomic flag for crypto SHA AC management */
|
/* Atomic flag for crypto SHA AC management */
|
||||||
static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT;
|
static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include "nu_bitutil.h"
|
#include "nu_bitutil.h"
|
||||||
#include "crypto-misc.h"
|
#include "crypto-misc.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
/* Consideration for choosing proper synchronization mechanism
|
/* Consideration for choosing proper synchronization mechanism
|
||||||
*
|
*
|
||||||
|
|
@ -45,13 +45,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Mutex for crypto AES AC management */
|
/* Mutex for crypto AES AC management */
|
||||||
static SingletonPtr<PlatformMutex> crypto_aes_mutex;
|
static SingletonPtr<rtos::Mutex> crypto_aes_mutex;
|
||||||
|
|
||||||
/* Mutex for crypto DES AC management */
|
/* Mutex for crypto DES AC management */
|
||||||
static SingletonPtr<PlatformMutex> crypto_des_mutex;
|
static SingletonPtr<rtos::Mutex> crypto_des_mutex;
|
||||||
|
|
||||||
/* Mutex for crypto ECC AC management */
|
/* Mutex for crypto ECC AC management */
|
||||||
static SingletonPtr<PlatformMutex> crypto_ecc_mutex;
|
static SingletonPtr<rtos::Mutex> crypto_ecc_mutex;
|
||||||
|
|
||||||
/* Atomic flag for crypto SHA AC management */
|
/* Atomic flag for crypto SHA AC management */
|
||||||
static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT;
|
static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include "nu_bitutil.h"
|
#include "nu_bitutil.h"
|
||||||
#include "crypto-misc.h"
|
#include "crypto-misc.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
/* Consideration for choosing proper synchronization mechanism
|
/* Consideration for choosing proper synchronization mechanism
|
||||||
*
|
*
|
||||||
|
|
@ -44,10 +44,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Mutex for crypto AES AC management */
|
/* Mutex for crypto AES AC management */
|
||||||
static SingletonPtr<PlatformMutex> crypto_aes_mutex;
|
static SingletonPtr<rtos::Mutex> crypto_aes_mutex;
|
||||||
|
|
||||||
/* Mutex for crypto DES AC management */
|
/* Mutex for crypto DES AC management */
|
||||||
static SingletonPtr<PlatformMutex> crypto_des_mutex;
|
static SingletonPtr<rtos::Mutex> crypto_des_mutex;
|
||||||
|
|
||||||
/* Atomic flag for crypto SHA AC management */
|
/* Atomic flag for crypto SHA AC management */
|
||||||
static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT;
|
static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue