Hello oslib-devel,
To clearfy I typed the simplest example of timer-using and
task-switching. The problem is that the timer IRQ handler
is called only once! :(
The make-file and the source follow:
=== makefile ===
BASE = /usr/local/oslib
include $(BASE)/config.mk
INCL = $(BASE)
LIB_PATH = $(BASE)/lib/
LIB_DIR = $(BASE)\lib
OBJS = mtask.o
all: mtask.bin
mtask.bin : $(OBJS)
$(LD) $(LINK_OPT) $(LIB_PATH)x0.o $(OBJS) --start-group -lhc -lhx -lhm -lcons -lkl --end-group -o $@
=== end of makefile ===
=== mtask.c ===
#include <ll/stdlib.h>
#include <ll/sys/ll/ll-func.h>
#include <ll/i386/pit.h>
#include <ll/i386/pic.h>
CONTEXT thm,th0,th1;
CONTEXT contexts[3];
long active_c=0;
char stk0[256];
char stk1[256];
void timer_ev()
{
active_c++;
if (active_c>2) active_c=0;
printf_xy(0,0,13,"T");
// ll_context_to(contexts[active_c]); - works, but timer int is
// called once :(
}
void killer()
{
}
void procth0(void*p)
{
while(1)
{
printf_xy(0,0,15,"0");
}
}
void procth1(void*p)
{
while(1)
{
printf_xy(0,0,15,"1");
}
}
int main()
{
ll_init();
thm=ll_context_save();
th0=ll_context_create(procth0,stk0,NULL,killer,0);
th1=ll_context_create(procth1,stk1,NULL,killer,0);
contexts[0]=thm;
contexts[1]=th0;
contexts[2]=th1;
cli();
pit_init(0,TMR_MD4,1000);
l1_irq_bind(0,timer_ev);
irq_unmask(0);
sti();
printf_xy(0,1,14,"Hello!");
while(1)
{
printf_xy(0,0,15,"m");
}
return 0;
}
=== end of mtask.c ===
Why the timer handler is called only once?
--
Best regards,
Juras mailto:yb...@tu...
|