SYSCTL->RCGCGPIO |= 0x00000008 ; How does this work ???

I'm working through an I2C tutorial and one of the first lines of code are SYSCTL->RCGCGPIO  |= 0x00000008 ;  I know this enables the clock for Port D. I do not understand how it works. I see SYSCTL in the included uC header but as part of a bigger macro. I believe the arrow operator is some sort of pointer to a struct or union, but I don't know where it is or how it works. Here's the tutorial.

https://microcontrollerslab.com/i2c-communication-tm4c123g-tiva-c-launchpad/?unapproved=389239&moderation-hash=7f34516551695754103292e7933b582b#comment-389239

Thanks in advance.

Charlie

  • It is simply a dereferenced pointer. In the device header you find:

    #define SYSCTL                          ((SYSCTL_Type             *) SYSCTL_BASE)
    

    where the SYSCTL_BASE is the value for the address to the peripheral that is type-cast to a pointer to a struct defining the register layout.

    It is done like that, as for the SRFs, no memory should be allocated.