Merge pull request #13264 from ashok-rao/rtos-refactor

Moving around a few items within \rtos
pull/13317/head
Martin Kojtal 2020-07-20 10:39:19 +01:00 committed by GitHub
commit 2b60c871d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 54 additions and 41 deletions

View File

@ -108,6 +108,7 @@ set(unittest-includes-base
"${PROJECT_SOURCE_DIR}/target_h/platform" "${PROJECT_SOURCE_DIR}/target_h/platform"
"${PROJECT_SOURCE_DIR}/target_h/platform/cxxsupport" "${PROJECT_SOURCE_DIR}/target_h/platform/cxxsupport"
"${PROJECT_SOURCE_DIR}/target_h/drivers" "${PROJECT_SOURCE_DIR}/target_h/drivers"
"${PROJECT_SOURCE_DIR}/target_h/rtos/include"
"${PROJECT_SOURCE_DIR}/stubs" "${PROJECT_SOURCE_DIR}/stubs"
"${PROJECT_SOURCE_DIR}/.." "${PROJECT_SOURCE_DIR}/.."
"${PROJECT_SOURCE_DIR}/../features" "${PROJECT_SOURCE_DIR}/../features"
@ -119,10 +120,7 @@ set(unittest-includes-base
"${PROJECT_SOURCE_DIR}/../events" "${PROJECT_SOURCE_DIR}/../events"
"${PROJECT_SOURCE_DIR}/../events/source" "${PROJECT_SOURCE_DIR}/../events/source"
"${PROJECT_SOURCE_DIR}/../events/internal" "${PROJECT_SOURCE_DIR}/../events/internal"
"${PROJECT_SOURCE_DIR}/../rtos" "${PROJECT_SOURCE_DIR}/../rtos/include"
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX"
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX/rtx5/Include"
"${PROJECT_SOURCE_DIR}/../cmsis"
"${PROJECT_SOURCE_DIR}/../features/frameworks" "${PROJECT_SOURCE_DIR}/../features/frameworks"
"${PROJECT_SOURCE_DIR}/../features/frameworks/mbed-trace" "${PROJECT_SOURCE_DIR}/../features/frameworks/mbed-trace"
"${PROJECT_SOURCE_DIR}/../connectivity/libraries/nanostack-libservice" "${PROJECT_SOURCE_DIR}/../connectivity/libraries/nanostack-libservice"

View File

@ -16,7 +16,7 @@
*/ */
#include "CellularUtil.h" #include "CellularUtil.h"
#include "ThisThread.h" #include "rtos/ThisThread.h"
#include "AT_ControlPlane_netif.h" #include "AT_ControlPlane_netif.h"
#include "CellularLog.h" #include "CellularLog.h"

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include "Kernel.h" #include "rtos/Kernel.h"
namespace rtos { namespace rtos {

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include "Semaphore.h" #include "rtos/Semaphore.h"
#include "Semaphore_stub.h" #include "Semaphore_stub.h"
int Semaphore_stub::wait_return_value = 0; int Semaphore_stub::wait_return_value = 0;

View File

@ -17,7 +17,7 @@
#ifndef THREAD_STUB_H_ #ifndef THREAD_STUB_H_
#define THREAD_STUB_H_ #define THREAD_STUB_H_
#include "Thread.h" #include "rtos/Thread.h"
namespace Thread_stub { namespace Thread_stub {
extern osStatus osStatus_value; extern osStatus osStatus_value;

View File

@ -18,8 +18,8 @@
#define __MUTEX_H__ #define __MUTEX_H__
#include <inttypes.h> #include <inttypes.h>
#include "mbed_rtos_types.h" #include "rtos/mbed_rtos_types.h"
#include "mbed_rtos1_types.h" #include "rtos/internal/mbed_rtos1_types.h"
namespace rtos { namespace rtos {

View File

@ -19,6 +19,7 @@
#include <stdint.h> #include <stdint.h>
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "rtos/Kernel.h"
namespace rtos { namespace rtos {
class Semaphore { class Semaphore {
@ -28,8 +29,13 @@ public:
void acquire(); void acquire();
bool try_acquire(); bool try_acquire();
bool try_acquire_for(uint32_t millisec); bool try_acquire_for(uint32_t millisec);
bool try_acquire_for(Kernel::Clock::duration_u32 rel_time);
bool try_acquire_until(uint64_t millisec); bool try_acquire_until(uint64_t millisec);
bool try_acquire_until(Kernel::Clock::time_point abs_time);
osStatus release(void); osStatus release(void);
~Semaphore();
private:
void constructor(int32_t count, uint16_t max_count);
}; };
} }

View File

@ -25,6 +25,9 @@
#include <stdint.h> #include <stdint.h>
#include "cmsis_os.h" #include "cmsis_os.h"
#include "platform/Callback.h"
#define OS_STACK_SIZE 0
namespace rtos { namespace rtos {
@ -43,12 +46,10 @@ public:
{ {
} }
osStatus start(mbed::Callback<void()> task) { osStatus start(mbed::Callback<void()> task);
return 0;
}
osStatus join() {return 0;}; osStatus join() {return 0;};
osStatus terminate(){return 0;}; osStatus terminate();
osStatus set_priority(osPriority priority){return 0;}; osStatus set_priority(osPriority priority){return 0;};
osPriority get_priority() const{return osPriorityNormal;}; osPriority get_priority() const{return osPriorityNormal;};
uint32_t flags_set(uint32_t flags){return 0;}; uint32_t flags_set(uint32_t flags){return 0;};
@ -97,6 +98,14 @@ public:
osThreadId_t get_id() const { osThreadId_t get_id() const {
return 0; return 0;
}; };
virtual ~Thread();
private:
// Required to share definitions without
// delegated constructors
void constructor(osPriority priority = osPriorityNormal,
uint32_t stack_size = OS_STACK_SIZE,
unsigned char *stack_mem = nullptr,
const char *name = nullptr);
}; };
} }
#endif #endif

View File

@ -40,7 +40,7 @@
#define AT_HANDLER_MUTEX #define AT_HANDLER_MUTEX
#if defined AT_HANDLER_MUTEX && defined MBED_CONF_RTOS_PRESENT #if defined AT_HANDLER_MUTEX && defined MBED_CONF_RTOS_PRESENT
#include "ConditionVariable.h" #include "rtos/ConditionVariable.h"
#endif #endif
namespace mbed { namespace mbed {

View File

@ -24,7 +24,7 @@
#include "PinNames.h" #include "PinNames.h"
#ifdef MBED_CONF_RTOS_PRESENT #ifdef MBED_CONF_RTOS_PRESENT
#include "Thread.h" #include "rtos/Thread.h"
#endif // MBED_CONF_RTOS_PRESENT #endif // MBED_CONF_RTOS_PRESENT
/** @file CellularDevice.h /** @file CellularDevice.h

View File

@ -25,7 +25,7 @@
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY) #if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
#include "drivers/BufferedSerial.h" #include "drivers/BufferedSerial.h"
#endif // #if DEVICE_SERIAL #endif // #if DEVICE_SERIAL
#include "ThisThread.h" #include "rtos/ThisThread.h"
#define NETWORK_TIMEOUT 30min #define NETWORK_TIMEOUT 30min
#define DEVICE_TIMEOUT 5min #define DEVICE_TIMEOUT 5min

View File

@ -19,7 +19,7 @@
#include "CellularContext.h" #include "CellularContext.h"
#include "ATHandler.h" #include "ATHandler.h"
#include "Semaphore.h" #include "rtos/Semaphore.h"
#include "AT_CellularDevice.h" #include "AT_CellularDevice.h"
const int MAX_APN_LENGTH = 63 + 1; const int MAX_APN_LENGTH = 63 + 1;

View File

@ -20,7 +20,7 @@
#include <time.h> #include <time.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "ThisThread.h" #include "rtos/ThisThread.h"
#include "AT_CellularSMS.h" #include "AT_CellularSMS.h"
#include "CellularUtil.h" #include "CellularUtil.h"
#include "CellularLog.h" #include "CellularLog.h"

View File

@ -18,7 +18,7 @@
#include "AT_CellularStack.h" #include "AT_CellularStack.h"
#include "CellularUtil.h" #include "CellularUtil.h"
#include "CellularLog.h" #include "CellularLog.h"
#include "ThisThread.h" #include "rtos/ThisThread.h"
#include "AT_CellularDevice.h" #include "AT_CellularDevice.h"
using namespace mbed_cellular_util; using namespace mbed_cellular_util;

View File

@ -16,7 +16,7 @@
*/ */
#include "CellularUtil.h" #include "CellularUtil.h"
#include "ThisThread.h" #include "rtos/ThisThread.h"
#include "AT_ControlPlane_netif.h" #include "AT_ControlPlane_netif.h"
#include "CellularLog.h" #include "CellularLog.h"

View File

@ -24,7 +24,7 @@
#include "FileHandle.h" #include "FileHandle.h"
#include "mbed_debug.h" #include "mbed_debug.h"
#include "rtos/ThisThread.h" #include "rtos/ThisThread.h"
#include "Kernel.h" #include "rtos/Kernel.h"
#include "CellularUtil.h" #include "CellularUtil.h"
#include "SingletonPtr.h" #include "SingletonPtr.h"
#include "ScopedLock.h" #include "ScopedLock.h"

View File

@ -16,7 +16,7 @@
*/ */
#include "CellularContext.h" #include "CellularContext.h"
#include "CellularLog.h" #include "CellularLog.h"
#include "ThisThread.h" #include "rtos/ThisThread.h"
using namespace std::chrono_literals; using namespace std::chrono_literals;

View File

@ -25,7 +25,7 @@
#include "mbedtls/debug.h" #include "mbedtls/debug.h"
#include "mbedtls/platform.h" #include "mbedtls/platform.h"
#include "mbed_error.h" #include "mbed_error.h"
#include "Kernel.h" #include "rtos/Kernel.h"
// This class requires Mbed TLS SSL/TLS client code // This class requires Mbed TLS SSL/TLS client code
#if defined(MBEDTLS_SSL_CLI_C) #if defined(MBEDTLS_SSL_CLI_C)

View File

@ -27,7 +27,7 @@
#include "mbed_shared_queues.h" #include "mbed_shared_queues.h"
#include "events/EventQueue.h" #include "events/EventQueue.h"
#include "OnboardNetworkStack.h" #include "OnboardNetworkStack.h"
#include "Kernel.h" #include "rtos/Kernel.h"
#include "PlatformMutex.h" #include "PlatformMutex.h"
#include "SingletonPtr.h" #include "SingletonPtr.h"

View File

@ -27,8 +27,8 @@
#include <stdint.h> #include <stdint.h>
#include "rtos/Kernel.h" #include "rtos/Kernel.h"
#include "rtos/mbed_rtos_types.h" #include "rtos/mbed_rtos_types.h"
#include "rtos/mbed_rtos1_types.h" #include "rtos/internal/mbed_rtos1_types.h"
#include "rtos/mbed_rtos_storage.h" #include "rtos/internal/mbed_rtos_storage.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"

View File

@ -29,8 +29,8 @@
#include "rtos/Queue.h" #include "rtos/Queue.h"
#include "rtos/MemoryPool.h" #include "rtos/MemoryPool.h"
#include "rtos/mbed_rtos_types.h" #include "rtos/mbed_rtos_types.h"
#include "rtos/mbed_rtos_storage.h" #include "rtos/internal/mbed_rtos_storage.h"
#include "rtos/mbed_rtos1_types.h" #include "rtos/internal/mbed_rtos1_types.h"
#include "platform/mbed_toolchain.h" #include "platform/mbed_toolchain.h"
#include "platform/mbed_assert.h" #include "platform/mbed_assert.h"

View File

@ -27,11 +27,11 @@
#include <string.h> #include <string.h>
#include "rtos/mbed_rtos_types.h" #include "rtos/mbed_rtos_types.h"
#include "rtos/mbed_rtos1_types.h" #include "rtos/internal/mbed_rtos1_types.h"
#include "rtos/mbed_rtos_storage.h" #include "rtos/internal/mbed_rtos_storage.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
#include "platform/mbed_assert.h" #include "platform/mbed_assert.h"
#include "Kernel.h" #include "rtos/Kernel.h"
#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) #if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY)

View File

@ -25,8 +25,8 @@
#include <stdint.h> #include <stdint.h>
#include "rtos/mbed_rtos_types.h" #include "rtos/mbed_rtos_types.h"
#include "rtos/mbed_rtos1_types.h" #include "rtos/internal/mbed_rtos1_types.h"
#include "rtos/mbed_rtos_storage.h" #include "rtos/internal/mbed_rtos_storage.h"
#include "rtos/Kernel.h" #include "rtos/Kernel.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"

View File

@ -24,8 +24,8 @@
#define QUEUE_H #define QUEUE_H
#include "rtos/mbed_rtos_types.h" #include "rtos/mbed_rtos_types.h"
#include "rtos/mbed_rtos1_types.h" #include "rtos/internal/mbed_rtos1_types.h"
#include "rtos/mbed_rtos_storage.h" #include "rtos/internal/mbed_rtos_storage.h"
#include "rtos/Kernel.h" #include "rtos/Kernel.h"
#include "platform/mbed_error.h" #include "platform/mbed_error.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"

View File

@ -26,8 +26,8 @@
#include <stdint.h> #include <stdint.h>
#include <chrono> #include <chrono>
#include "rtos/mbed_rtos_types.h" #include "rtos/mbed_rtos_types.h"
#include "rtos/mbed_rtos1_types.h" #include "rtos/internal/mbed_rtos1_types.h"
#include "rtos/mbed_rtos_storage.h" #include "rtos/internal/mbed_rtos_storage.h"
#include "rtos/Kernel.h" #include "rtos/Kernel.h"
#include "platform/mbed_toolchain.h" #include "platform/mbed_toolchain.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"

View File

@ -25,8 +25,8 @@
#include <stdint.h> #include <stdint.h>
#include "rtos/mbed_rtos_types.h" #include "rtos/mbed_rtos_types.h"
#include "rtos/mbed_rtos1_types.h" #include "rtos/internal/mbed_rtos1_types.h"
#include "rtos/mbed_rtos_storage.h" #include "rtos/internal/mbed_rtos_storage.h"
#include "platform/Callback.h" #include "platform/Callback.h"
#include "platform/mbed_toolchain.h" #include "platform/mbed_toolchain.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"

View File

@ -24,7 +24,7 @@
#ifndef RTOS_H #ifndef RTOS_H
#define RTOS_H #define RTOS_H
#include "rtos/mbed_rtos_storage.h" #include "rtos/internal/mbed_rtos_storage.h"
#include "rtos/Kernel.h" #include "rtos/Kernel.h"
#include "rtos/Thread.h" #include "rtos/Thread.h"
#include "rtos/ThisThread.h" #include "rtos/ThisThread.h"