Search code examples
carmraspberry-piinline-assemblygpio

Working with GPIO on bcm2836


I am writing a GPIO-driver for my RPI2 OS. And I was surfing really long time about it, but I found only linux data. How should I do such functions as

void gpio_set(int pin);
void gpio_clr(int pin);

in C for the driver. Or, maybe it can be done due inline assembly?


Solution

  • As explained here

    The underlying architecture in BCM2836 is identical to BCM2835. The only significant difference is the removal of the ARM1176JZF-S processor and replacement with a quad-core Cortex-A7 cluster.

    The available documentation for the BCM2836 does not detail the peripheral hardare, only the A7. Instead you need the documentation for the BCM2835. The peripheral specification section 6 deals with the GPIO. The registers are memory mapped so you can write directly to them in C.