Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Trying to understand the workings of a Memory Mapped I/O





Las wrote:
Here is the sample area:

#define P0 ((*(__R volatile unsigned char *)(unsigned char)0x0))
#define P1 ((*(__R volatile unsigned char *)(unsigned char)0x1))
#define P2 ((*(__R volatile unsigned char *)(unsigned char)0x2))
#define P3 ((*(__R volatile unsigned char *)(unsigned char)0x3))


How would you describe what this is or does? If someone could break it down so I could understand what is going on I would be in your debt.



Why would your teacher assign you something he had not discussed?


Anyway, when confused about declarations, read from R to L

// #define P0 ((*(__R volatile unsigned char *)(unsigned char)0x0))

// (unsigned char)0x0

You have a character constant of 0

// (__R volatile unsigned char *)

It is cast to a volatile pointer for some bad reason, and who knows what __R is,
because it is a user's macro.

// *(..)

Take the contents of the (nonsense) pointer.

// #define P0

Might as well compound the nonsense with bad practice by using a gratuitous macro.

Good luck on your homework.








<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.