Skip to content

Commit 2b60c87

Browse files
authored
Merge pull request #13264 from ashok-rao/rtos-refactor
Moving around a few items within \rtos
2 parents e5e556f + f58c563 commit 2b60c87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+54
-41
lines changed

UNITTESTS/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ set(unittest-includes-base
108108
"${PROJECT_SOURCE_DIR}/target_h/platform"
109109
"${PROJECT_SOURCE_DIR}/target_h/platform/cxxsupport"
110110
"${PROJECT_SOURCE_DIR}/target_h/drivers"
111+
"${PROJECT_SOURCE_DIR}/target_h/rtos/include"
111112
"${PROJECT_SOURCE_DIR}/stubs"
112113
"${PROJECT_SOURCE_DIR}/.."
113114
"${PROJECT_SOURCE_DIR}/../features"
@@ -119,10 +120,7 @@ set(unittest-includes-base
119120
"${PROJECT_SOURCE_DIR}/../events"
120121
"${PROJECT_SOURCE_DIR}/../events/source"
121122
"${PROJECT_SOURCE_DIR}/../events/internal"
122-
"${PROJECT_SOURCE_DIR}/../rtos"
123-
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX"
124-
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX/rtx5/Include"
125-
"${PROJECT_SOURCE_DIR}/../cmsis"
123+
"${PROJECT_SOURCE_DIR}/../rtos/include"
126124
"${PROJECT_SOURCE_DIR}/../features/frameworks"
127125
"${PROJECT_SOURCE_DIR}/../features/frameworks/mbed-trace"
128126
"${PROJECT_SOURCE_DIR}/../connectivity/libraries/nanostack-libservice"

UNITTESTS/stubs/AT_ControlPlane_netif_stub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
#include "CellularUtil.h"
19-
#include "ThisThread.h"
19+
#include "rtos/ThisThread.h"
2020
#include "AT_ControlPlane_netif.h"
2121
#include "CellularLog.h"
2222

UNITTESTS/stubs/Kernel_stub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include "Kernel.h"
18+
#include "rtos/Kernel.h"
1919

2020
namespace rtos {
2121

UNITTESTS/stubs/Semaphore_stub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include "Semaphore.h"
18+
#include "rtos/Semaphore.h"
1919
#include "Semaphore_stub.h"
2020

2121
int Semaphore_stub::wait_return_value = 0;

UNITTESTS/stubs/Thread_stub.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef THREAD_STUB_H_
1818
#define THREAD_STUB_H_
1919

20-
#include "Thread.h"
20+
#include "rtos/Thread.h"
2121

2222
namespace Thread_stub {
2323
extern osStatus osStatus_value;

UNITTESTS/target_h/rtos/Mutex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#define __MUTEX_H__
1919

2020
#include <inttypes.h>
21-
#include "mbed_rtos_types.h"
22-
#include "mbed_rtos1_types.h"
21+
#include "rtos/mbed_rtos_types.h"
22+
#include "rtos/internal/mbed_rtos1_types.h"
2323

2424
namespace rtos {
2525

UNITTESTS/target_h/rtos/Semaphore.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <stdint.h>
2121
#include "cmsis_os2.h"
22+
#include "rtos/Kernel.h"
2223

2324
namespace rtos {
2425
class Semaphore {
@@ -28,8 +29,13 @@ class Semaphore {
2829
void acquire();
2930
bool try_acquire();
3031
bool try_acquire_for(uint32_t millisec);
32+
bool try_acquire_for(Kernel::Clock::duration_u32 rel_time);
3133
bool try_acquire_until(uint64_t millisec);
34+
bool try_acquire_until(Kernel::Clock::time_point abs_time);
3235
osStatus release(void);
36+
~Semaphore();
37+
private:
38+
void constructor(int32_t count, uint16_t max_count);
3339
};
3440
}
3541

UNITTESTS/target_h/rtos/Thread.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
#include <stdint.h>
2727
#include "cmsis_os.h"
28+
#include "platform/Callback.h"
29+
30+
#define OS_STACK_SIZE 0
2831

2932
namespace rtos {
3033

@@ -43,12 +46,10 @@ class Thread {
4346
{
4447
}
4548

46-
osStatus start(mbed::Callback<void()> task) {
47-
return 0;
48-
}
49+
osStatus start(mbed::Callback<void()> task);
4950

5051
osStatus join() {return 0;};
51-
osStatus terminate(){return 0;};
52+
osStatus terminate();
5253
osStatus set_priority(osPriority priority){return 0;};
5354
osPriority get_priority() const{return osPriorityNormal;};
5455
uint32_t flags_set(uint32_t flags){return 0;};
@@ -97,6 +98,14 @@ class Thread {
9798
osThreadId_t get_id() const {
9899
return 0;
99100
};
101+
virtual ~Thread();
102+
private:
103+
// Required to share definitions without
104+
// delegated constructors
105+
void constructor(osPriority priority = osPriorityNormal,
106+
uint32_t stack_size = OS_STACK_SIZE,
107+
unsigned char *stack_mem = nullptr,
108+
const char *name = nullptr);
100109
};
101110
}
102111
#endif

0 commit comments

Comments
 (0)