|
From: | Paulo Marques |
Subject: | Re: [avr-libc-dev] Optimization safe access to the timers |
Date: | Fri, 22 Sep 2006 00:48:49 +0100 |
User-agent: | Mozilla Thunderbird 1.0.7 (Windows/20050923) |
Enoch H. Wexler wrote:
Hello libc maintainers,
Hi, Enoch. Not a libc maintainer, more of a lurker, but maybe I can help ;)
May I suggest adding to libc an optimization safe access method to the timers, for example: typedef volatile int16_t (*pTCNT); #define TCNT(n) *(pTCNT)(&TCNT ## n) /* e.g., TCNT(3) */ Without this a 100 "tick" delay loop like this would run forever:
Have you verified this?It shouldn't run forever since TCNT3 should already be declared as volatile, like all the hardware registers that can change value without the compiler knowing.
If for some reason it is not declared volatile, that would be a bug. -- Paulo Marques
[Prev in Thread] | Current Thread | [Next in Thread] |