45#include "sys/cooja_mt.h"
59LIST(pre_tick_actions);
60LIST(post_tick_actions);
63cooja_add_pre_tick_action(
struct cooja_tick_action *handler)
66 static bool initialized =
false;
75cooja_add_post_tick_action(
struct cooja_tick_action *handler)
78 static bool initialized =
false;
83 list_add(post_tick_actions, handler);
89static struct cooja_mt_thread cooja_thread;
90static struct cooja_mt_thread rtimer_thread;
91static struct cooja_mt_thread process_run_thread;
94extern int macos_data_start __asm(
"section$start$__DATA$__data");
95extern int macos_data_end __asm(
"section$end$__DATA$__data");
96extern int macos_bss_start __asm(
"section$start$__DATA$__bss");
97extern int macos_bss_end __asm(
"section$end$__DATA$__bss");
98extern int macos_common_start __asm(
"section$start$__DATA$__common");
99extern int macos_common_end __asm(
"section$end$__DATA$__common");
102cooja_data_start(
void)
104 return (uintptr_t)&macos_data_start;
110 return (
int)((uintptr_t)&macos_data_end - (uintptr_t)&macos_data_start);
116 return (uintptr_t)&macos_bss_start;
122 return (
int)((uintptr_t)&macos_bss_end - (uintptr_t)&macos_bss_start);
126cooja_common_start(
void)
128 return (uintptr_t)&macos_common_start;
132cooja_common_size(
void)
134 return (
int)((uintptr_t)&macos_common_end - (uintptr_t)&macos_common_start);
139rtimer_thread_loop(
void)
150process_run_thread_loop(
void)
153 simProcessRunValue = 1;
164 if((rv = cooja_mt_init(&cooja_thread))) {
167 cooja_mt_start(&cooja_thread, &rtimer_thread, rtimer_thread_loop);
168 cooja_mt_start(&cooja_thread, &process_run_thread, process_run_thread_loop);
175 simProcessRunValue = 0;
178 for(
struct cooja_tick_action *r =
list_head(pre_tick_actions);
179 r != NULL; r = r->next) {
190 cooja_mt_exec(&cooja_thread, &rtimer_thread);
192 if(simProcessRunValue == 0) {
195 cooja_mt_exec(&cooja_thread, &process_run_thread);
199 for(
struct cooja_tick_action *r =
list_head(post_tick_actions);
200 r != NULL; r = r->next) {
Default definitions of C compiler quirk work-arounds.
int etimer_pending(void)
Check if there are any non-expired event timers.
void etimer_request_poll(void)
Make the event timer aware that the clock has changed.
clock_time_t etimer_next_expiration_time(void)
Get next event timer expiration time.
static void list_init(list_t list)
Initialize a list.
#define LIST(name)
Declare a linked list.
void list_add(list_t list, void *item)
Add an item at the end of a list.
static void * list_head(const_list_t list)
Get a pointer to the first element of a list.
Linked list manipulation routines.