1 /* 2 * Copyright (c) 2020 BayLibre, SAS 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef MAIN_H 8 #define MAIN_H 9 10 #include <kernel.h> 11 12 #define csr_read(csr) \ 13 ({ \ 14 register unsigned long __v; \ 15 __asm__ volatile ("csrr %0, " #csr \ 16 : "=r" (__v)); \ 17 __v; \ 18 }) 19 20 #endif /* MAIN_H */ 21