You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

16 lines
347 B

#include "delay.h"
#include "mmio.h"
#define STC_LOW (*(volatile unsigned *)(IO_BASE + 0x3004))
#define STC_HIGH (*(volatile unsigned *)(IO_BASE + 0x3008))
uint64_t micros() {
uint32_t high, low;
high = STC_HIGH;
low = STC_LOW;
if (high != STC_HIGH) {
high = STC_HIGH;
low = STC_LOW;
}
return ((uint64_t)high) << 32 | low;
}