Bare metal clock and timers tutorial for banana pi


Im trying to learn as hobby how to make baremetal programing on banana pi.

To begin I take this tutorial and made it in banana pi

Then I add the getc and made an echo shell (just show what you type in serial port); After that i blink a led using a loop delay function;

Then i try to blink the led with interrups. I got stuck here. Im not smart enought to figure if for my self. There is no simple information or simple code sample about clok control and timers on banana pi, and allwinner A20. Then i try to see if i cant get the code from else here. U-boot code was my first try. But it is not simple enough get how to do it.

So… i need some help to get this done. Any one knows where to get a simple code sample or tutorial about clock control, timers and interrupts on banana pi / A20


At github there is a small sample with only a few files.

I cant find anything simple like this to bananapi. So I try to find the memory addresses on bananapi, but certanly i need to get smart because i didn’t find any.

So I kindly ask if any one knows the banana pi addresses to match these ones.

#define ARM_TIMER_LOD 0x2000B400
#define ARM_TIMER_VAL 0x2000B404
#define ARM_TIMER_CTL 0x2000B408
#define ARM_TIMER_CLI 0x2000B40C
#define ARM_TIMER_RIS 0x2000B410
#define ARM_TIMER_MIS 0x2000B414
#define ARM_TIMER_RLD 0x2000B418
#define ARM_TIMER_DIV 0x2000B41C
#define ARM_TIMER_CNT 0x2000B420

#define SYSTIMERCLO 0x20003004
#define GPFSEL1 0x20200004
#define GPSET0  0x2020001C
#define GPCLR0  0x20200028

#define IRQ_BASIC 0x2000B200
#define IRQ_PEND1 0x2000B204
#define IRQ_PEND2 0x2000B208
#define IRQ_FIQ_CONTROL 0x2000B210
#define IRQ_ENABLE_BASIC 0x2000B218
#define IRQ_DISABLE_BASIC 0x2000B224