10 __attribute__((unused
)) static void flush_cpu_icache(void)
22 __attribute__((unused
)) static void flush_cpu_dcache(void)
24 asm volatile(".word(0x500F)\n");
27 void flush_l2_cache(void);
29 void busy_wait(unsigned int ms
);
33 #define csrr(reg) ({ unsigned long __tmp; \
34 asm volatile ("csrr %0, " #reg : "=r"(__tmp)); \
37 #define csrw(reg, val) ({ \
38 if (__builtin_constant_p(val) && (unsigned long)(val) < 32) \
39 asm volatile ("csrw " #reg ", %0" :: "i"(val)); \
41 asm volatile ("csrw " #reg ", %0" :: "r"(val)); })
43 #define csrs(reg, bit) ({ \
44 if (__builtin_constant_p(bit) && (unsigned long)(bit) < 32) \
45 asm volatile ("csrrs x0, " #reg ", %0" :: "i"(bit)); \
47 asm volatile ("csrrs x0, " #reg ", %0" :: "r"(bit)); })
49 #define csrc(reg, bit) ({ \
50 if (__builtin_constant_p(bit) && (unsigned long)(bit) < 32) \
51 asm volatile ("csrrc x0, " #reg ", %0" :: "i"(bit)); \
53 asm volatile ("csrrc x0, " #reg ", %0" :: "r"(bit)); })
59 #endif /* __SYSTEM_H */