Skip to content

Fix storage rtos types - remove including internal header file #7364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion TESTS/mbed_hal/common_tickers/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
#include "hal/us_ticker_api.h"
#include "hal/lp_ticker_api.h"

#ifdef __cplusplus
extern "C" {
#endif
#include "os_tick.h"
#ifdef __cplusplus
}
#endif // __cplusplus

#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#endif
Expand Down Expand Up @@ -117,7 +125,7 @@ void ticker_event_handler_stub(const ticker_data_t * const ticker)
}

/* Indicate that ISR has been executed in interrupt context. */
if (IsIrqMode()) {
if (core_util_is_isr_active()) {
intFlag++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion TESTS/mbed_hal/lp_ticker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void overflow_protect()
void ticker_event_handler_stub(const ticker_data_t * const ticker)
{
/* Indicate that ISR has been executed in interrupt context. */
if (IsIrqMode()) {
if (core_util_is_isr_active()) {
intFlag++;
}

Expand Down
2 changes: 1 addition & 1 deletion TESTS/mbedmicro-rtos-mbed/heap_and_stack/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void test_heap_in_range(void)
*/
void test_main_stack_in_range(void)
{
os_thread_t *thread = (os_thread_t*) osThreadGetId();
mbed_rtos_storage_thread_t *thread = (mbed_rtos_storage_thread_t *) osThreadGetId();

uint32_t psp = __get_PSP();
uint8_t *stack_mem = (uint8_t*) thread->stack_mem;
Expand Down
2 changes: 2 additions & 0 deletions features/device_key/source/DeviceKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "mbed_wait_api.h"
#include "stdlib.h"

#include <string.h>

#if !defined(MBEDTLS_CMAC_C)
#error [NOT_SUPPORTED] MBEDTLS_CMAC_C needs to be enabled for this driver
#else
Expand Down
10 changes: 5 additions & 5 deletions features/lwipstack/LWIPStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,20 @@ class LWIP : public OnboardNetworkStack, private mbed::NonCopyable<LWIP> {
void *hw; /**< alternative implementation pointer - used for PPP */
};

os_semaphore_t linked_sem;
mbed_rtos_storage_semaphore_t linked_sem;
osSemaphoreId_t linked;
os_semaphore_t unlinked_sem;
mbed_rtos_storage_semaphore_t unlinked_sem;
osSemaphoreId_t unlinked;
os_semaphore_t has_any_addr_sem;
mbed_rtos_storage_semaphore_t has_any_addr_sem;
osSemaphoreId_t has_any_addr;
#define HAS_ANY_ADDR 1
#if PREF_ADDR_TIMEOUT
os_semaphore_t has_pref_addr_sem;
mbed_rtos_storage_semaphore_t has_pref_addr_sem;
osSemaphoreId_t has_pref_addr;
#define HAS_PREF_ADDR 2
#endif
#if BOTH_ADDR_TIMEOUT
os_semaphore_t has_both_addr_sem;
mbed_rtos_storage_semaphore_t has_both_addr_sem;
osSemaphoreId_t has_both_addr;
#define HAS_BOTH_ADDR 4
#endif
Expand Down
2 changes: 2 additions & 0 deletions features/lwipstack/lwip-sys/arch/sys_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "lwip/opt.h"
#include "mbed_rtos_storage.h"

#include <stdbool.h>

extern u8_t lwip_ram_heap[];

#if NO_SYS == 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ Kinetis_EMAC::Kinetis_EMAC() : xTXDCountSem(ENET_TX_RING_LEN, ENET_TX_RING_LEN),
{
}

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)
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)
{
osThreadAttr_t attr = {0};
attr.name = threadName;
attr.stack_mem = malloc(stacksize);
attr.cb_mem = thread_cb;
attr.stack_size = stacksize;
attr.cb_size = sizeof(os_thread_t);
attr.cb_size = sizeof(mbed_rtos_storage_thread_t);
attr.priority = priority;
return osThreadNew(thread, arg, &attr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class Kinetis_EMAC : public EMAC {
void phy_task();
static void ethernet_callback(ENET_Type *base, enet_handle_t *handle, enet_event_t event, void *param);

os_thread_t thread_cb;
mbed_rtos_storage_thread_t thread_cb;
osThreadId_t thread; /**< Processing thread */
rtos::Mutex TXLockMutex;/**< TX critical section mutex */
rtos::Semaphore xTXDCountSem; /**< TX free buffer counting semaphore */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ NUMAKER_EMAC::NUMAKER_EMAC() : thread(0), hwaddr()
{
}

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)
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)
{
osThreadAttr_t attr = {0};
attr.name = threadName;
attr.stack_mem = malloc(stacksize);
attr.cb_mem = thread_cb;
attr.stack_size = stacksize;
attr.cb_size = sizeof(os_thread_t);
attr.cb_size = sizeof(mbed_rtos_storage_thread_t);
attr.priority = priority;
return osThreadNew(thread, arg, &attr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class NUMAKER_EMAC : public EMAC {
void phy_task();
static void ethernet_callback(char event, void *param);

os_thread_t thread_cb;
mbed_rtos_storage_thread_t thread_cb;
osThreadId_t thread; /**< Processing thread */
rtos::Mutex TXLockMutex;/**< TX critical section mutex */
rtos::Semaphore xTXDCountSem; /**< TX free buffer counting semaphore */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ LPC546XX_EMAC::LPC546XX_EMAC() : xTXDCountSem(ENET_TX_RING_LEN, ENET_TX_RING_LEN
{
}

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)
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)
{
osThreadAttr_t attr = {0};
attr.name = threadName;
attr.stack_mem = malloc(stacksize);
attr.cb_mem = thread_cb;
attr.stack_size = stacksize;
attr.cb_size = sizeof(os_thread_t);
attr.cb_size = sizeof(mbed_rtos_storage_thread_t);
attr.priority = priority;
return osThreadNew(thread, arg, &attr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class LPC546XX_EMAC : public EMAC {
void phy_task();
static void ethernet_callback(ENET_Type *base, enet_handle_t *handle, enet_event_t event, uint8_t channel, void *param);

os_thread_t thread_cb;
mbed_rtos_storage_thread_t thread_cb;
osThreadId_t thread; /**< Processing thread */
rtos::Mutex TXLockMutex;/**< TX critical section mutex */
rtos::Semaphore xTXDCountSem; /**< TX free buffer counting semaphore */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ ETHMEM_SECTION uint8_t tx_clean_thread_stack[DEFAULT_THREAD_STACKSIZE];
#endif
ETHMEM_SECTION uint8_t phy_thread_stack[DEFAULT_THREAD_STACKSIZE];

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)
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)
{
osThreadAttr_t attr = {0};
attr.name = threadName;
attr.stack_mem = stack_ptr;
attr.cb_mem = thread_cb;
attr.stack_size = stacksize;
attr.cb_size = sizeof(os_thread_t);
attr.cb_size = sizeof(mbed_rtos_storage_thread_t);
attr.priority = priority;
return osThreadNew(thread, arg, &attr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class LPC17_EMAC : public EMAC {
void update_link_status(bool up);

osThreadId_t RxThread;
os_thread_t RxThread_cb;
mbed_rtos_storage_thread_t RxThread_cb;
rtos::Semaphore TxCleanSem;

private:
Expand All @@ -176,9 +176,9 @@ class LPC17_EMAC : public EMAC {
uint8_t hwaddr[6];

osThreadId_t TxCleanThread;
os_thread_t TxCleanThread_cb;
mbed_rtos_storage_thread_t TxCleanThread_cb;
osThreadId_t PhyThread;
os_thread_t PhyThread_cb;
mbed_rtos_storage_thread_t PhyThread_cb;
rtos::Mutex TXLockMutex;
rtos::Semaphore xTXDCountSem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ STM32_EMAC::STM32_EMAC()
{
}

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)
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)
{
osThreadAttr_t attr = {0};
attr.name = threadName;
attr.stack_mem = malloc(stacksize);
attr.cb_mem = thread_cb;
attr.stack_size = stacksize;
attr.cb_size = sizeof(os_thread_t);
attr.cb_size = sizeof(mbed_rtos_storage_thread_t);
attr.priority = priority;
return osThreadNew(thread, arg, &attr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ class STM32_EMAC : public EMAC {
void enable_interrupts();
void disable_interrupts();

os_thread_t thread_cb;
mbed_rtos_storage_thread_t thread_cb;
#if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx)\
|| defined (STM32F779xx)
os_thread_t rmii_watchdog_thread_cb;
mbed_rtos_storage_thread_t rmii_watchdog_thread_cb;
osThreadId_t rmii_watchdog_thread; /**< Watchdog processing thread */
#endif
rtos::Mutex TXLockMutex;/**< TX critical section mutex */
Expand Down
18 changes: 9 additions & 9 deletions rtos/TARGET_CORTEX/mbed_rtos_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ extern "C" {
implementation specific, header file, therefore limiting scope of possible changes.
*/

#include "rtx_lib.h"
#include "rtx_os.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I like it.

#include "mbed_rtx_conf.h"

typedef os_mutex_t mbed_rtos_storage_mutex_t;
typedef os_semaphore_t mbed_rtos_storage_semaphore_t;
typedef os_thread_t mbed_rtos_storage_thread_t;
typedef os_memory_pool_t mbed_rtos_storage_mem_pool_t;
typedef os_message_queue_t mbed_rtos_storage_msg_queue_t;
typedef os_event_flags_t mbed_rtos_storage_event_flags_t;
typedef os_message_t mbed_rtos_storage_message_t;
typedef os_timer_t mbed_rtos_storage_timer_t;
typedef osRtxMutex_t mbed_rtos_storage_mutex_t;
typedef osRtxSemaphore_t mbed_rtos_storage_semaphore_t;
typedef osRtxThread_t mbed_rtos_storage_thread_t;
typedef osRtxMemoryPool_t mbed_rtos_storage_mem_pool_t;
typedef osRtxMessageQueue_t mbed_rtos_storage_msg_queue_t;
typedef osRtxEventFlags_t mbed_rtos_storage_event_flags_t;
typedef osRtxMessage_t mbed_rtos_storage_message_t;
typedef osRtxTimer_t mbed_rtos_storage_timer_t;

#ifdef __cplusplus
}
Expand Down
2 changes: 2 additions & 0 deletions rtos/TARGET_CORTEX/mbed_rtx_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
// Don't adopt default multi-thread support for ARM/ARMC6 toolchains from RTX code base.
// Provide Mbed-specific instead.
#define RTX_NO_MULTITHREAD_CLIB
// LIBSPACE default value set for ARMCC
#define OS_THREAD_LIBSPACE_NUM 4

#define OS_IDLE_THREAD_NAME "idle_thread"
#define OS_TIMER_THREAD_NAME "timer_thread"
Expand Down
6 changes: 3 additions & 3 deletions rtos/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ uint32_t Thread::free_stack() {

#if defined(MBED_OS_BACKEND_RTX5)
if (_tid != NULL) {
os_thread_t *thread = (os_thread_t *)_tid;
mbed_rtos_storage_thread_t *thread = (mbed_rtos_storage_thread_t *)_tid;
size = (uint32_t)thread->sp - (uint32_t)thread->stack_mem;
}
#endif
Expand All @@ -289,7 +289,7 @@ uint32_t Thread::used_stack() {

#if defined(MBED_OS_BACKEND_RTX5)
if (_tid != NULL) {
os_thread_t *thread = (os_thread_t *)_tid;
mbed_rtos_storage_thread_t *thread = (mbed_rtos_storage_thread_t *)_tid;
size = ((uint32_t)thread->stack_mem + thread->stack_size) - thread->sp;
}
#endif
Expand All @@ -304,7 +304,7 @@ uint32_t Thread::max_stack() {

if (_tid != NULL) {
#if defined(MBED_OS_BACKEND_RTX5)
os_thread_t *thread = (os_thread_t *)_tid;
mbed_rtos_storage_thread_t *thread = (mbed_rtos_storage_thread_t *)_tid;
uint32_t high_mark = 0;
while (((uint32_t *)(thread->stack_mem))[high_mark] == 0xE25A2EA5)
high_mark++;
Expand Down