Sonu
unread,Sep 28, 2005, 4:28:53 AM9/28/05Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to BangaloreWindowsCE
Hi,
The problem is that the registers are defined using the construct:
volatile PTYPE pReg;
where TYPE can be UCHAR like datatypes.
This is incorrect if PTYPE is typedef-ed as "typedef TYPE *PTYPE;"...
the compiler then interprets this as:
TYPE volatile *pReg;
ie. a volatile pointer to a non-volatile memory location.
not as it should be:
volatile TYPE *pReg;
ie. a non-volatile pointer to a volatile memory location.
If you have a construct in a driver which (as in the driver code
manifesting the error, is flushing a fifo containing errors):
volatile PULONG pReg = ....
ULONG ulFlush;
while( <error_data_available> )
{
ulFlush = *pReg;
}
In debug build this works correctly, in release build the optimiser
removes the access to the hardware register so you hang in the loop
forever.
So Only way to avoid this bug is avoid the usage of PXXX typedefs.
This topic is discussed extensively on other newsgroups.Earlier it was
thought that this is a compiler bug,but actually this is not a compiler
bug this is only a usage bug.