Page 1 of 1

where should i stick my init routine at?

PostPosted: Wed Apr 05, 2006 5:45 am
by aek
I'd recommend putting them before the OS calls -- that way, you know that interrupts have not yet been enabled.

In general it won't make much difference, simply because the tasks don't run until the scheduler is called via OSSched().

The main thing is to ensure that anything that vectors from an ISR is already properly initialized. By doing the I/O init prior to the call to OSEnable(), you're avoiding any potential pitfalls in that area ...

------------------


Re: where should i stick my init routine at?

PostPosted: Wed Apr 05, 2006 5:46 am
by seulater
thank you.

Re: where should i stick my init routine at?

PostPosted: Wed Apr 05, 2006 11:13 am
by seulater
Below is my startup code in Main, i would like to know where the proper & safe place for me to call my I/O initalize routines at "io_init()".


void Main()
{
OSCreateTask(Task_One, TASK_1, OSDONT_START_TASK |2);
OSCreateTask(Task_Two, TASK_2, OSDONT_START_TASK |12);
OSCreateTask(Task_Three,TASK_3, OSDONT_START_TASK |14);
OSCreateTask(Task_Four, TASK_4, OSDONT_START_TASK |16);


OSEnable();


OSStartTask(TASK_1);
OSStartTask(TASK_2);
OSStartTask(TASK_3);
OSStartTask(TASK_4);


}