From: <luc...@em...> - 2003-03-03 09:11:05
|
Hi Juras, > how to install a task scheduler? using pit_init(0,TMR_MD2,1) (from > the sources of xlib dir...) or by using events? This is your choice ;) OSLib provides you the low-level functionalities from xlib (l1_irq_bind() and pit_init()), or the higher level functionalities from kl (the events). If you use events, you don't have to care about programming the PIT, or explicitly setting an irq handler: you simply call the event_post() interface (after calling event_init(), of course ;), and it will do everything for you... If you prefer the ``do it by yourself'' strategy, you can avoid using events, and you can program the PIT and handle the PIT interrutp by yourself... But this will be more complex, of course. > if using events, then the event handler must post another event, > then exception 13 is generated... Have a look at examples/scheddem.c: it does exactly what you need... And it worked, last time that I checked ;-) > could you explain the parameters of pit_init? what mode should I > take, what channel, how to calculate appropriate const? I was > looking through the sources but the lack of comments... pit_init(c, m, t) programs the PIT channel c to mode m and constant t. The channel connected to the timer interrupt is channel 0 (i think ;), and the modes that I generally use are mode 4 for generating periodic interrupts, and mode 2 for generating one-shot interrupts. The value of the time constant can be computed as <time in us> * 1197 / 1000. Everything is explained a little bit better in the Intel docs ;) Anyway, if you use events you do not have to care about these details. Luca -- _________________________________________________________________________ Add this to your signature, if you think it is important N O W A R ! ! ! |