39 #include <avr/interrupt.h>
42 #include "dev/rs232.h"
53 void (*
function)(
void *),
void *data)
59 for(i = 0; i < MTARCH_STACKSIZE; ++i) {
77 t->stack[MTARCH_STACKSIZE - 1] = (
unsigned char)((
unsigned short)
mt_exit) & 0xff;
78 t->stack[MTARCH_STACKSIZE - 2] = (
unsigned char)((
unsigned short)
mt_exit >> 8) & 0xff;
81 t->stack[MTARCH_STACKSIZE - 3] = (
unsigned char)((
unsigned short)
function) & 0xff;
82 t->stack[MTARCH_STACKSIZE - 4] = (
unsigned char)((
unsigned short)
function >> 8) & 0xff;
90 t->stack[MTARCH_STACKSIZE - 29] = (
unsigned char)((
unsigned short)data) & 0xff;
91 t->stack[MTARCH_STACKSIZE - 30] = (
unsigned char)((
unsigned short)data >> 8) & 0xff;
95 t->sp = &t->stack[MTARCH_STACKSIZE - 1 - 4 - 32];
99 static unsigned char *sptmp;
144 running->sp = (
unsigned char*)SP;
145 SP = (
unsigned short)sptmp;
225 mtarch_stack_usage(
struct mt_thread *t)
228 for(i = 0; i < MTARCH_STACKSIZE; ++i) {
229 if(t->thread.stack[i] != i) {
233 return MTARCH_STACKSIZE - i;
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.