DECwiz (Fred van Kempen) <decwiz@...> schrieb am Tue, 19 Jul 2005
01:14:33 -0700 (PDT):
> Hi All,
>
> I've stumbled into something very weird this weekend, and I can't seem
> to figure out what the problem is. Here is a snippet of code:
>
> /* Write a value to a CS8900A I/O register. */
> static void
> lan_iow(unsigned char *base, int reg, unsigned short val)
> {
> unsigned char *p;
> unsigned char x;
>
> /* Write low and high byte of register number. */
> p = (base + reg);
> printf(" IOW(%d, %d) P=%08lx\n", reg, val, p);
> x = (val & 0xff);
> *p = x;
> p++;
> x = ((val >> 8) & 0xff);
> *p = x;
> printf(" done\n");
> }
One note: Make pointers volatile otherwise the compiler might do things
_you_ do not intend (like removing code).
This might not be related to your problem.
--
42Bastian SchickMessage
Re: [lpc2000] GNUARM weirdness ?
2005-07-19 by 42Bastian Schick
Attachments
- No local attachments were found for this message.