This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC23xx gpio code

Hello,
Can someone explain what it means??

#define IOPIN0 (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x00))

The controller using is LPC23xx/24xx.

BR Chethan

Parents
  • Not only can it be dereferenced. It already is.

    The middle * is for the type cast from integer to pointer.
    The left-most * is the dereference being done.

    So you can use IOPIN0 as if it was a normal 32-bit volatile unsigned integer. You can read from it and you can write to it.

    So the construct is kind of placing a variable at an absolute address, but without involving any link-time symbol - the generated code will instead get the hard-coded address of that processor special function register.

Reply
  • Not only can it be dereferenced. It already is.

    The middle * is for the type cast from integer to pointer.
    The left-most * is the dereference being done.

    So you can use IOPIN0 as if it was a normal 32-bit volatile unsigned integer. You can read from it and you can write to it.

    So the construct is kind of placing a variable at an absolute address, but without involving any link-time symbol - the generated code will instead get the hard-coded address of that processor special function register.

Children