From 665dc9909674235d5e237d2e0bf2bfa8267ac55b Mon Sep 17 00:00:00 2001 From: cyliangtw Date: Tue, 22 May 2018 17:19:47 +0800 Subject: [PATCH] Support default tz_module for event loop & lwip --- .../lwip-interface/lwip-sys/arch/lwip_sys_arch.c | 7 ++++++- .../nanostack-hal-mbed-cmsis-rtos/ns_event_loop.c | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.c b/features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.c index f46d5e6133..f789d968c8 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.c @@ -502,7 +502,11 @@ static sys_thread_data_t thread_pool[SYS_THREAD_POOL_N]; * Outputs: * sys_thread_t -- Pointer to thread handle. *---------------------------------------------------------------------------*/ -sys_thread_t sys_thread_new(const char *pcName, +#ifndef MBED_TZ_DEFAULT_ACCESS +#define MBED_TZ_DEFAULT_ACCESS 0 +#endif + + sys_thread_t sys_thread_new(const char *pcName, void (*thread)(void *arg), void *arg, int stacksize, int priority) { LWIP_DEBUGF(SYS_DEBUG, ("New Thread: %s\n", pcName)); @@ -519,6 +523,7 @@ sys_thread_t sys_thread_new(const char *pcName, t->attr.cb_mem = &t->data; t->attr.stack_size = stacksize; t->attr.stack_mem = malloc(stacksize); + t->attr.tz_module = MBED_TZ_DEFAULT_ACCESS; if (t->attr.stack_mem == NULL) { error("Error allocating the stack memory"); } diff --git a/features/nanostack/nanostack-hal-mbed-cmsis-rtos/ns_event_loop.c b/features/nanostack/nanostack-hal-mbed-cmsis-rtos/ns_event_loop.c index 45508ecf69..5883fe623e 100644 --- a/features/nanostack/nanostack-hal-mbed-cmsis-rtos/ns_event_loop.c +++ b/features/nanostack/nanostack-hal-mbed-cmsis-rtos/ns_event_loop.c @@ -27,6 +27,10 @@ static osEventFlagsId_t event_flag_id; #else +#ifndef MBED_TZ_DEFAULT_ACCESS +#define MBED_TZ_DEFAULT_ACCESS 0 +#endif + static void event_loop_thread(void *arg); static uint64_t event_thread_stk[MBED_CONF_NANOSTACK_HAL_EVENT_LOOP_THREAD_STACK_SIZE/8]; @@ -38,6 +42,7 @@ static const osThreadAttr_t event_thread_attr = { .stack_size = sizeof event_thread_stk, .cb_mem = &event_thread_tcb, .cb_size = sizeof event_thread_tcb, + .tz_module = MBED_TZ_DEFAULT_ACCESS, }; #endif