Understanding fastio.h

Hi everybody,

I am trying to understand in deep the fastio.h file from Marlin code (REPRAP printers). Although I know what finally happens ("magic I/O routines"), I don't know the meaning of each step, and in fact the meaning of this head (in my projects, I use direct assignment for pins). I want to know the meaning and the utility. For example:

#define TXD DIO1

and then

#define DIO0_PIN PINE0
#define DIO0_RPORT PINE
#define DIO0_WPORT PORTE
#define DIO0_DDR DDRE
#define DIO0_PWM NULL

and after

#define _WRITE(IO, v) do { if (&(DIO ## IO ## _RPORT) >= (uint8_t *)0x100) {_WRITE_C(IO, v); } else {_WRITE_NC(IO, v); }; } while (0)

finally

#define WRITE(IO, v) _WRITE(IO, v)

What is the utility for using DIOn definition?

Thank you very much,
regards.

Antonio

Start here: C preprocessor - Wikipedia

This is a batch of C macrology(*) for using direct port manipulation
transparently from in code.

http://www.retrologic.com/jargon/M/macrology.html