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?
Wait for specific amount of time
Re: Wait for specific amount of time
Hi,
Cheers,
Brendan
Did you declare "timer_ticks" as volatile? If you didn't the compiler probably caches "timer_ticks" in a register.Nessphoro wrote: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?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Wait for specific amount of time
You're right sir, I didn't.
It works now.
Thanks
It works now.
Thanks