voiding schedule()
Posted: Wed Feb 22, 2006 7:57 pm
hi all, ok, first i use to put variables on the stack then my c code got passed them: regs *schedule(regs *all_my_regs); but this is no good in non timer functions that cant pass all regs, so i'm changing code to: void schedule(); so far i have this:
but this doesn't work for some reason, any idea's???
p.s. need more code just ask
Code: Select all
int front = 0;
int end = 0;
struct task_data rrq[QUE_SIZE];
int is_empty()
{
if(end == front)
return 1;
return 0;
}
int cur_task_pri()
{
if(is_empty())
return 0;
return rrq[front].priority;
}
void front_to_end()
{
if(is_empty())
return;
rrq[end] = rrq[front];
end++;
if(end >= QUE_SIZE)
end = 0;
front++;
if(front >= QUE_SIZE)
front = 0;
}
void cur_task_time_equ(int time)
{
if(is_empty())
return;
rrq[front].time = time;
}
int get_pri_time(int pri)
{
switch(pri)
{
case 0:
return 100;
break;
case 1:
return 10;
break;
case 2:
return 5;
break;
case 3:
return 2;
break;
case 4:
return 1;
break;
default:
return 0;
}
}
void schedule()
{
cur_task_time_equ(get_pri_time(cur_task_pri()));
rrq[front].stack = (struct stack_data *)old_task;
front_to_end();
new_task = (int)&rrq[front].stack;
// TSS.esp0 = (int)rrq[front].stack;
// return (stack_data_t *)TSS.esp0;
}
p.s. need more code just ask