28 lines
534 B
C
28 lines
534 B
C
#include <stdint.h>
|
|
|
|
#define GPIO_BASE 0x40000000u
|
|
#define VOUT_BASE 0x40000004u
|
|
|
|
static volatile uint32_t * const gpio = (volatile uint32_t *)GPIO_BASE;
|
|
static volatile uint32_t * const vout = (volatile uint32_t *)VOUT_BASE;
|
|
|
|
static void delay(volatile uint32_t ticks){
|
|
while (ticks--) {
|
|
__asm__ volatile ("nop");
|
|
}
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
uint32_t v = 0;
|
|
|
|
for (;;) {
|
|
for(int i=0; i<1000; i++){
|
|
*vout = v;
|
|
v++;
|
|
delay(5u);
|
|
}
|
|
*gpio ^= 0xffffffff;
|
|
}
|
|
}
|