Skip to content

Commit 93233c4

Browse files
author
Cruz Monrreal
authored
Merge pull request #7364 from 0xc0170/fix_storage_rtos
Fix storage rtos types - remove including internal header file
2 parents 9f27672 + dd33247 commit 93233c4

File tree

19 files changed

+52
-38
lines changed

19 files changed

+52
-38
lines changed

TESTS/mbed_hal/common_tickers/main.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
#include "hal/us_ticker_api.h"
2222
#include "hal/lp_ticker_api.h"
2323

24+
#ifdef __cplusplus
25+
extern "C" {
26+
#endif
27+
#include "os_tick.h"
28+
#ifdef __cplusplus
29+
}
30+
#endif // __cplusplus
31+
2432
#if !DEVICE_USTICKER
2533
#error [NOT_SUPPORTED] test not supported
2634
#endif
@@ -118,7 +126,7 @@ void ticker_event_handler_stub(const ticker_data_t * const ticker)
118126
}
119127

120128
/* Indicate that ISR has been executed in interrupt context. */
121-
if (IsIrqMode()) {
129+
if (core_util_is_isr_active()) {
122130
intFlag++;
123131
}
124132
}

TESTS/mbed_hal/lp_ticker/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void overflow_protect()
6363
void ticker_event_handler_stub(const ticker_data_t * const ticker)
6464
{
6565
/* Indicate that ISR has been executed in interrupt context. */
66-
if (IsIrqMode()) {
66+
if (core_util_is_isr_active()) {
6767
intFlag++;
6868
}
6969

TESTS/mbedmicro-rtos-mbed/heap_and_stack/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void test_heap_in_range(void)
182182
*/
183183
void test_main_stack_in_range(void)
184184
{
185-
os_thread_t *thread = (os_thread_t*) osThreadGetId();
185+
mbed_rtos_storage_thread_t *thread = (mbed_rtos_storage_thread_t *) osThreadGetId();
186186

187187
uint32_t psp = __get_PSP();
188188
uint8_t *stack_mem = (uint8_t*) thread->stack_mem;

features/device_key/source/DeviceKey.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "mbed_wait_api.h"
2323
#include "stdlib.h"
2424

25+
#include <string.h>
26+
2527
#if !defined(MBEDTLS_CMAC_C)
2628
#error [NOT_SUPPORTED] MBEDTLS_CMAC_C needs to be enabled for this driver
2729
#else

features/lwipstack/LWIPStack.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,20 @@ class LWIP : public OnboardNetworkStack, private mbed::NonCopyable<LWIP> {
141141
void *hw; /**< alternative implementation pointer - used for PPP */
142142
};
143143

144-
os_semaphore_t linked_sem;
144+
mbed_rtos_storage_semaphore_t linked_sem;
145145
osSemaphoreId_t linked;
146-
os_semaphore_t unlinked_sem;
146+
mbed_rtos_storage_semaphore_t unlinked_sem;
147147
osSemaphoreId_t unlinked;
148-
os_semaphore_t has_any_addr_sem;
148+
mbed_rtos_storage_semaphore_t has_any_addr_sem;
149149
osSemaphoreId_t has_any_addr;
150150
#define HAS_ANY_ADDR 1
151151
#if PREF_ADDR_TIMEOUT
152-
os_semaphore_t has_pref_addr_sem;
152+
mbed_rtos_storage_semaphore_t has_pref_addr_sem;
153153
osSemaphoreId_t has_pref_addr;
154154
#define HAS_PREF_ADDR 2
155155
#endif
156156
#if BOTH_ADDR_TIMEOUT
157-
os_semaphore_t has_both_addr_sem;
157+
mbed_rtos_storage_semaphore_t has_both_addr_sem;
158158
osSemaphoreId_t has_both_addr;
159159
#define HAS_BOTH_ADDR 4
160160
#endif

features/lwipstack/lwip-sys/arch/sys_arch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "lwip/opt.h"
2222
#include "mbed_rtos_storage.h"
2323

24+
#include <stdbool.h>
25+
2426
extern u8_t lwip_ram_heap[];
2527

2628
#if NO_SYS == 0

features/netsocket/emac-drivers/TARGET_Freescale_EMAC/kinetis_emac.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ Kinetis_EMAC::Kinetis_EMAC() : xTXDCountSem(ENET_TX_RING_LEN, ENET_TX_RING_LEN),
8080
{
8181
}
8282

83-
static osThreadId_t create_new_thread(const char *threadName, void (*thread)(void *arg), void *arg, int stacksize, osPriority_t priority, os_thread_t *thread_cb)
83+
static osThreadId_t create_new_thread(const char *threadName, void (*thread)(void *arg), void *arg, int stacksize, osPriority_t priority, mbed_rtos_storage_thread_t *thread_cb)
8484
{
8585
osThreadAttr_t attr = {0};
8686
attr.name = threadName;
8787
attr.stack_mem = malloc(stacksize);
8888
attr.cb_mem = thread_cb;
8989
attr.stack_size = stacksize;
90-
attr.cb_size = sizeof(os_thread_t);
90+
attr.cb_size = sizeof(mbed_rtos_storage_thread_t);
9191
attr.priority = priority;
9292
return osThreadNew(thread, arg, &attr);
9393
}

features/netsocket/emac-drivers/TARGET_Freescale_EMAC/kinetis_emac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class Kinetis_EMAC : public EMAC {
149149
void phy_task();
150150
static void ethernet_callback(ENET_Type *base, enet_handle_t *handle, enet_event_t event, void *param);
151151

152-
os_thread_t thread_cb;
152+
mbed_rtos_storage_thread_t thread_cb;
153153
osThreadId_t thread; /**< Processing thread */
154154
rtos::Mutex TXLockMutex;/**< TX critical section mutex */
155155
rtos::Semaphore xTXDCountSem; /**< TX free buffer counting semaphore */

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/numaker_emac.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ NUMAKER_EMAC::NUMAKER_EMAC() : thread(0), hwaddr()
5858
{
5959
}
6060

61-
static osThreadId_t create_new_thread(const char *threadName, void (*thread)(void *arg), void *arg, int stacksize, osPriority_t priority, os_thread_t *thread_cb)
61+
static osThreadId_t create_new_thread(const char *threadName, void (*thread)(void *arg), void *arg, int stacksize, osPriority_t priority, mbed_rtos_storage_thread_t *thread_cb)
6262
{
6363
osThreadAttr_t attr = {0};
6464
attr.name = threadName;
6565
attr.stack_mem = malloc(stacksize);
6666
attr.cb_mem = thread_cb;
6767
attr.stack_size = stacksize;
68-
attr.cb_size = sizeof(os_thread_t);
68+
attr.cb_size = sizeof(mbed_rtos_storage_thread_t);
6969
attr.priority = priority;
7070
return osThreadNew(thread, arg, &attr);
7171
}

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/numaker_emac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class NUMAKER_EMAC : public EMAC {
146146
void phy_task();
147147
static void ethernet_callback(char event, void *param);
148148

149-
os_thread_t thread_cb;
149+
mbed_rtos_storage_thread_t thread_cb;
150150
osThreadId_t thread; /**< Processing thread */
151151
rtos::Mutex TXLockMutex;/**< TX critical section mutex */
152152
rtos::Semaphore xTXDCountSem; /**< TX free buffer counting semaphore */

features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_LPC546XX/lpc546xx_emac.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ LPC546XX_EMAC::LPC546XX_EMAC() : xTXDCountSem(ENET_TX_RING_LEN, ENET_TX_RING_LEN
6060
{
6161
}
6262

63-
static osThreadId_t create_new_thread(const char *threadName, void (*thread)(void *arg), void *arg, int stacksize, osPriority_t priority, os_thread_t *thread_cb)
63+
static osThreadId_t create_new_thread(const char *threadName, void (*thread)(void *arg), void *arg, int stacksize, osPriority_t priority, mbed_rtos_storage_thread_t *thread_cb)
6464
{
6565
osThreadAttr_t attr = {0};
6666
attr.name = threadName;
6767
attr.stack_mem = malloc(stacksize);
6868
attr.cb_mem = thread_cb;
6969
attr.stack_size = stacksize;
70-
attr.cb_size = sizeof(os_thread_t);
70+
attr.cb_size = sizeof(mbed_rtos_storage_thread_t);
7171
attr.priority = priority;
7272
return osThreadNew(thread, arg, &attr);
7373
}

features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_LPC546XX/lpc546xx_emac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class LPC546XX_EMAC : public EMAC {
149149
void phy_task();
150150
static void ethernet_callback(ENET_Type *base, enet_handle_t *handle, enet_event_t event, uint8_t channel, void *param);
151151

152-
os_thread_t thread_cb;
152+
mbed_rtos_storage_thread_t thread_cb;
153153
osThreadId_t thread; /**< Processing thread */
154154
rtos::Mutex TXLockMutex;/**< TX critical section mutex */
155155
rtos::Semaphore xTXDCountSem; /**< TX free buffer counting semaphore */

features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_LPCTarget/lpc17_emac.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@ ETHMEM_SECTION uint8_t tx_clean_thread_stack[DEFAULT_THREAD_STACKSIZE];
169169
#endif
170170
ETHMEM_SECTION uint8_t phy_thread_stack[DEFAULT_THREAD_STACKSIZE];
171171

172-
static osThreadId_t create_new_thread(const char *threadName, void (*thread)(void *arg), void *arg, void *stack_ptr, int stacksize, osPriority_t priority, os_thread_t *thread_cb)
172+
static osThreadId_t create_new_thread(const char *threadName, void (*thread)(void *arg), void *arg, void *stack_ptr, int stacksize, osPriority_t priority, mbed_rtos_storage_thread_t *thread_cb)
173173
{
174174
osThreadAttr_t attr = {0};
175175
attr.name = threadName;
176176
attr.stack_mem = stack_ptr;
177177
attr.cb_mem = thread_cb;
178178
attr.stack_size = stacksize;
179-
attr.cb_size = sizeof(os_thread_t);
179+
attr.cb_size = sizeof(mbed_rtos_storage_thread_t);
180180
attr.priority = priority;
181181
return osThreadNew(thread, arg, &attr);
182182
}

features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_LPCTarget/lpc17_emac.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class LPC17_EMAC : public EMAC {
151151
void update_link_status(bool up);
152152

153153
osThreadId_t RxThread;
154-
os_thread_t RxThread_cb;
154+
mbed_rtos_storage_thread_t RxThread_cb;
155155
rtos::Semaphore TxCleanSem;
156156

157157
private:
@@ -176,9 +176,9 @@ class LPC17_EMAC : public EMAC {
176176
uint8_t hwaddr[6];
177177

178178
osThreadId_t TxCleanThread;
179-
os_thread_t TxCleanThread_cb;
179+
mbed_rtos_storage_thread_t TxCleanThread_cb;
180180
osThreadId_t PhyThread;
181-
os_thread_t PhyThread_cb;
181+
mbed_rtos_storage_thread_t PhyThread_cb;
182182
rtos::Mutex TXLockMutex;
183183
rtos::Semaphore xTXDCountSem;
184184

features/netsocket/emac-drivers/TARGET_STM_EMAC/stm32xx_emac.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ STM32_EMAC::STM32_EMAC()
8989
{
9090
}
9191

92-
static osThreadId_t create_new_thread(const char *threadName, void (*thread)(void *arg), void *arg, int stacksize, osPriority_t priority, os_thread_t *thread_cb)
92+
static osThreadId_t create_new_thread(const char *threadName, void (*thread)(void *arg), void *arg, int stacksize, osPriority_t priority, mbed_rtos_storage_thread_t *thread_cb)
9393
{
9494
osThreadAttr_t attr = {0};
9595
attr.name = threadName;
9696
attr.stack_mem = malloc(stacksize);
9797
attr.cb_mem = thread_cb;
9898
attr.stack_size = stacksize;
99-
attr.cb_size = sizeof(os_thread_t);
99+
attr.cb_size = sizeof(mbed_rtos_storage_thread_t);
100100
attr.priority = priority;
101101
return osThreadNew(thread, arg, &attr);
102102
}

features/netsocket/emac-drivers/TARGET_STM_EMAC/stm32xx_emac.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ class STM32_EMAC : public EMAC {
161161
void enable_interrupts();
162162
void disable_interrupts();
163163

164-
os_thread_t thread_cb;
164+
mbed_rtos_storage_thread_t thread_cb;
165165
#if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx)\
166166
|| defined (STM32F779xx)
167-
os_thread_t rmii_watchdog_thread_cb;
167+
mbed_rtos_storage_thread_t rmii_watchdog_thread_cb;
168168
osThreadId_t rmii_watchdog_thread; /**< Watchdog processing thread */
169169
#endif
170170
rtos::Mutex TXLockMutex;/**< TX critical section mutex */

rtos/TARGET_CORTEX/mbed_rtos_storage.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ extern "C" {
4040
implementation specific, header file, therefore limiting scope of possible changes.
4141
*/
4242

43-
#include "rtx_lib.h"
43+
#include "rtx_os.h"
4444
#include "mbed_rtx_conf.h"
4545

46-
typedef os_mutex_t mbed_rtos_storage_mutex_t;
47-
typedef os_semaphore_t mbed_rtos_storage_semaphore_t;
48-
typedef os_thread_t mbed_rtos_storage_thread_t;
49-
typedef os_memory_pool_t mbed_rtos_storage_mem_pool_t;
50-
typedef os_message_queue_t mbed_rtos_storage_msg_queue_t;
51-
typedef os_event_flags_t mbed_rtos_storage_event_flags_t;
52-
typedef os_message_t mbed_rtos_storage_message_t;
53-
typedef os_timer_t mbed_rtos_storage_timer_t;
46+
typedef osRtxMutex_t mbed_rtos_storage_mutex_t;
47+
typedef osRtxSemaphore_t mbed_rtos_storage_semaphore_t;
48+
typedef osRtxThread_t mbed_rtos_storage_thread_t;
49+
typedef osRtxMemoryPool_t mbed_rtos_storage_mem_pool_t;
50+
typedef osRtxMessageQueue_t mbed_rtos_storage_msg_queue_t;
51+
typedef osRtxEventFlags_t mbed_rtos_storage_event_flags_t;
52+
typedef osRtxMessage_t mbed_rtos_storage_message_t;
53+
typedef osRtxTimer_t mbed_rtos_storage_timer_t;
5454

5555
#ifdef __cplusplus
5656
}

rtos/TARGET_CORTEX/mbed_rtx_conf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
// Don't adopt default multi-thread support for ARM/ARMC6 toolchains from RTX code base.
7575
// Provide Mbed-specific instead.
7676
#define RTX_NO_MULTITHREAD_CLIB
77+
// LIBSPACE default value set for ARMCC
78+
#define OS_THREAD_LIBSPACE_NUM 4
7779

7880
#define OS_IDLE_THREAD_NAME "idle_thread"
7981
#define OS_TIMER_THREAD_NAME "timer_thread"

rtos/Thread.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ uint32_t Thread::free_stack() {
274274

275275
#if defined(MBED_OS_BACKEND_RTX5)
276276
if (_tid != NULL) {
277-
os_thread_t *thread = (os_thread_t *)_tid;
277+
mbed_rtos_storage_thread_t *thread = (mbed_rtos_storage_thread_t *)_tid;
278278
size = (uint32_t)thread->sp - (uint32_t)thread->stack_mem;
279279
}
280280
#endif
@@ -289,7 +289,7 @@ uint32_t Thread::used_stack() {
289289

290290
#if defined(MBED_OS_BACKEND_RTX5)
291291
if (_tid != NULL) {
292-
os_thread_t *thread = (os_thread_t *)_tid;
292+
mbed_rtos_storage_thread_t *thread = (mbed_rtos_storage_thread_t *)_tid;
293293
size = ((uint32_t)thread->stack_mem + thread->stack_size) - thread->sp;
294294
}
295295
#endif
@@ -304,7 +304,7 @@ uint32_t Thread::max_stack() {
304304

305305
if (_tid != NULL) {
306306
#if defined(MBED_OS_BACKEND_RTX5)
307-
os_thread_t *thread = (os_thread_t *)_tid;
307+
mbed_rtos_storage_thread_t *thread = (mbed_rtos_storage_thread_t *)_tid;
308308
uint32_t high_mark = 0;
309309
while (((uint32_t *)(thread->stack_mem))[high_mark] == 0xE25A2EA5)
310310
high_mark++;

0 commit comments

Comments
 (0)