Wait for specific amount of time
Posted: Sat May 28, 2011 9:57 pm
Hello again,
In my wait function I want to wait for a specific amount of ticks.
void timer_wait(unsigned int t)
{
unsigned long long eticks=timer_ticks+t;
while(eticks>timer_ticks);
}
So I call this function and pass in lets say 18 (I didn't change the default PIC frequency)
As I see the IRQ is working and it increments timer_ticks
But nothing happens in wait. Kernel just gets stuck in an infinite lock.
So I tried to change the code to this to see if while works
void timer_wait(unsigned int t)
{
unsigned long long eticks=timer_ticks+t;
while(eticks>timer_ticks)
{
printf("Tick\n");
}
}
Okay I add this and it magically starts to work. I change it back again, and it doesn't.
Any thought on what might be wrong?
In my wait function I want to wait for a specific amount of ticks.
void timer_wait(unsigned int t)
{
unsigned long long eticks=timer_ticks+t;
while(eticks>timer_ticks);
}
So I call this function and pass in lets say 18 (I didn't change the default PIC frequency)
As I see the IRQ is working and it increments timer_ticks
But nothing happens in wait. Kernel just gets stuck in an infinite lock.
So I tried to change the code to this to see if while works
void timer_wait(unsigned int t)
{
unsigned long long eticks=timer_ticks+t;
while(eticks>timer_ticks)
{
printf("Tick\n");
}
}
Okay I add this and it magically starts to work. I change it back again, and it doesn't.
Any thought on what might be wrong?