36 #ifdef __IAR_SYSTEMS_ICC__
40 static unsigned short *sptmp;
54 ((void (*)(
void *))running->function)((
void*)running->data);
59 void (*
function)(
void *),
void *data)
63 for(i = 0; i < MTARCH_STACKSIZE; ++i) {
67 t->sp = &t->stack[MTARCH_STACKSIZE - 1];
69 *t->sp = (
unsigned short)
mt_exit;
72 *t->sp = (
unsigned short)mtarch_wrapper;
80 t->function =
function;
103 #ifdef __IAR_SYSTEMS_ICC__
105 running->sp = (
unsigned short *) __get_SP_register();
106 __set_SP_register((
unsigned short) sptmp);
108 __asm__(
"mov.w r1,%0" :
"=r" (running->sp));
109 __asm__(
"mov.w %0,r1" : :
"m" (sptmp));
165 mtarch_stack_usage(
struct mt_thread *t)
169 for(i = 0; i < MTARCH_STACKSIZE; ++i) {
170 if(t->thread.stack[i] != (
unsigned short)i) {
171 return MTARCH_STACKSIZE - i;
175 return MTARCH_STACKSIZE;
void mtarch_init(void)
Initialize the architecture specific support functions for the multi-thread library.
void mtarch_yield(void)
Yield the processor.
Header file for the preemptive multitasking library for Contiki.
void mtarch_remove(void)
Uninstall library and clean up.
void mtarch_start(struct mtarch_thread *thread, void(*function)(void *data), void *data)
Setup the stack frame for a thread that is being started.
#define NULL
The null pointer.
void mtarch_exec(struct mtarch_thread *thread)
Start executing a thread.
void mt_exit(void)
Exit a thread.
void mtarch_stop(struct mtarch_thread *thread)
Clean up the stack of a thread.
Copyright (c) 2014, Analog Devices, Inc.