40 #include <avr/interrupt.h>
43 #include "dev/rs232.h"
54 void (*
function)(
void *),
void *data)
60 for(i = 0; i < MTARCH_STACKSIZE; ++i) {
78 t->stack[MTARCH_STACKSIZE - 1] = (
unsigned char)((
unsigned short)
mt_exit) & 0xff;
79 t->stack[MTARCH_STACKSIZE - 2] = (
unsigned char)((
unsigned short)
mt_exit >> 8) & 0xff;
82 t->stack[MTARCH_STACKSIZE - 3] = (
unsigned char)((
unsigned short)
function) & 0xff;
83 t->stack[MTARCH_STACKSIZE - 4] = (
unsigned char)((
unsigned short)
function >> 8) & 0xff;
91 t->stack[MTARCH_STACKSIZE - 29] = (
unsigned char)((
unsigned short)data) & 0xff;
92 t->stack[MTARCH_STACKSIZE - 30] = (
unsigned char)((
unsigned short)data >> 8) & 0xff;
96 t->sp = &t->stack[MTARCH_STACKSIZE - 1 - 4 - 32];
100 static unsigned char *sptmp;
101 static struct mtarch_thread *running;
145 running->sp = (
unsigned char*)SP;
146 SP = (
unsigned short)sptmp;
220 mtarch_stack_usage(
struct mt_thread *t)
223 for(i = 0; i < MTARCH_STACKSIZE; ++i) {
224 if(t->thread.stack[i] != i) {
228 return MTARCH_STACKSIZE - i;