Samraksh / eMote

eMote OS -- Multiple Ports (using .NET MF v4.3)
0 stars 0 forks source link

Timer callbacks on Adapt do not work #174

Closed AnanthAtSamraksh closed 10 years ago

AnanthAtSamraksh commented 10 years ago

When the interrupt is activated, a callback function is passed as one of the parameters. Upon enabling the interrupt, the function is called just once.

CPU_INTC_ActivateInterrupt(INT_DEBUG_TIMER_EXP, TIME_HANDLER, 0); CPU_INTC_InterruptEnable( INT_DEBUG_TIMER_EXP );

One workaround I did to test the VirtualTimers was to enable the interrupt after CPU_Timer_SetCompare is set with a timer (by the virtual timer).

AnanthAtSamraksh commented 10 years ago

This issue has now been fixed. The problematic line was this - writel(MAX_TIMER_ROLLOVER, DGT_MATCH_VAL); -- in the TIME_HANDLER function.

When the callback function is called the first time, the above line sets the timer interrupt to go off after a long time into the future (denoted by MAX_TIMER_ROLLOVER). This causes the callback to never happen (or happen too late). The workaround I did, overrode this by setting a smaller time into the future. Commenting out this line fixed the issue I had while testing virtual timers.

Nathan-Stohs commented 10 years ago

Ananth let's talk about this on Monday. What you are reporting is how it is supposed to work and you should not need a workaround. I don't see a the bug.

AnanthAtSamraksh commented 10 years ago

I tested with the line -- writel(MAX_TIMER_ROLLOVER, DGT_MATCH_VAL) -- and the timer callback does work. I did make a few other changes to the function that calls SetCompare that might have fixed the original issue. This is a non-issue now. Closing the ticket.