39 lines
776 B
C
39 lines
776 B
C
|
|
#ifndef __CLINT_H__
|
||
|
|
#define __CLINT_H__
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#define CLINT_MTIME_TICK_PERIOD 4 //ns
|
||
|
|
|
||
|
|
|
||
|
|
#define CLINT_BASE (0x2000000)
|
||
|
|
#define CLINT_MTIME_LOW (0xBFF8)
|
||
|
|
#define CLINT_MTIME_HIGH (0xBFFC)
|
||
|
|
#define CLINT_MTIMECMP_LOW (0x4000)
|
||
|
|
#define CLINT_MTIMECMP_HIGH (0x4004)
|
||
|
|
|
||
|
|
|
||
|
|
#ifndef __ASSEMBLER__
|
||
|
|
|
||
|
|
#include "stdint.h"
|
||
|
|
extern volatile const uint32_t * const mtime_high;
|
||
|
|
extern volatile const uint32_t * const mtime_low;
|
||
|
|
extern volatile uint32_t * const mtimecmp_high;
|
||
|
|
extern volatile uint32_t * const mtimecmp_low;
|
||
|
|
|
||
|
|
extern volatile uint32_t mtimer_int_flag;
|
||
|
|
|
||
|
|
uint64_t read_timer(void);
|
||
|
|
void set_mtimecmp(uint64_t value) ;
|
||
|
|
void enable_mtimer_int();
|
||
|
|
void disable_mtimer_int();
|
||
|
|
void set_mtimer(uint32_t delta_t);
|
||
|
|
|
||
|
|
#endif
|
||
|
|
|
||
|
|
|
||
|
|
#endif
|
||
|
|
|
||
|
|
|