2018-02-18 02:50:39 +00:00
|
|
|
#ifndef EXOSPHERE_TIMERS_H
|
|
|
|
#define EXOSPHERE_TIMERS_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2018-02-24 16:13:42 +00:00
|
|
|
#include "memory_map.h"
|
2018-02-18 02:50:39 +00:00
|
|
|
|
|
|
|
/* Exosphere driver for the Tegra X1 Timers. */
|
|
|
|
|
2018-02-26 21:09:35 +00:00
|
|
|
static inline uintptr_t get_timers_base(void) {
|
|
|
|
return MMIO_GET_DEVICE_ADDRESS(MMIO_DEVID_TMRs_WDTs);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define TIMERS_BASE (get_timers_base())
|
2018-02-18 02:50:39 +00:00
|
|
|
|
2018-02-23 01:50:19 +00:00
|
|
|
#define TIMERUS_CNTR_1US_0 (*((volatile uint32_t *)(TIMERS_BASE + 0x10)))
|
2018-02-18 02:50:39 +00:00
|
|
|
|
|
|
|
void wait(uint32_t microseconds);
|
|
|
|
|
2018-02-26 10:00:02 +00:00
|
|
|
static inline uint32_t get_time(void) {
|
|
|
|
return TIMERUS_CNTR_1US_0;
|
|
|
|
}
|
|
|
|
|
2018-02-24 16:13:42 +00:00
|
|
|
#endif
|