litedram: Update to new LiteX/LiteDRAM version
[microwatt.git] / litedram / gen-src / sdram_init / include / system.h
1 #ifndef __SYSTEM_H
2 #define __SYSTEM_H
3
4 #include "microwatt_soc.h"
5 #include "io.h"
6
7 #define CSR_ACCESSORS_DEFINED
8 #define CSR_BASE DRAM_CTRL_BASE
9 #define CONFIG_CPU_NOP "nop"
10
11 extern void flush_cpu_dcache(void);
12 extern void flush_cpu_icache(void);
13 static inline void flush_l2_cache(void) { }
14
15 /* Fake timer stuff. LiteX should abstract this */
16 static inline void timer0_en_write(int e) { }
17 static inline void timer0_reload_write(int r) { }
18 static inline void timer0_load_write(int l) { }
19 static inline void timer0_update_value_write(int v) { }
20 static inline uint64_t timer0_value_read(void)
21 {
22 uint64_t val;
23
24 __asm__ volatile ("mfdec %0" : "=r" (val));
25 return val;
26 }
27
28 static inline void csr_write_simple(unsigned long v, unsigned long a)
29 {
30 return writel(v, a);
31 }
32
33 static inline unsigned long csr_read_simple(unsigned long a)
34 {
35 return readl(a);
36 }
37
38 #endif /* __SYSTEM_H */
39