applied uncrustify to csr source

master
Anton Lydike 3 years ago
parent c5afa93bb3
commit 5128b0376f

@ -6,10 +6,12 @@
#error "You set TIMECMP_IN_MEMORY but did not provide a memory addres in TIMECMP_MEM_ADDR!"
#endif
void write_mtimecmp(unsigned long long int mtimecmp) {
void write_mtimecmp(unsigned long long int mtimecmp)
{
unsigned int lo = mtimecmp;
unsigned int hi = mtimecmp >> 32;
__asm__(
__asm__ (
"li t0, %0\n"
"sw %1, 0(t0)\n"
"sw %2, 4(t0)" ::
@ -19,10 +21,12 @@ void write_mtimecmp(unsigned long long int mtimecmp) {
#else
void write_mtimecmp(unsigned long long int mtimecmp) {
void write_mtimecmp(unsigned long long int mtimecmp)
{
unsigned int lower = mtimecmp;
unsigned int higher = mtimecmp >> 32;
__asm__(
__asm__ (
"csrw %0, %2\n"
"csrw %1, %3" ::
"I"(CSR_MTIMECMP),"I"(CSR_MTIMECMPH),

@ -23,23 +23,25 @@
// do not define C macros and other C stuff when this is included inside assembly
#ifndef __assembly
#define CSR_READ(csr_id, result) {\
#define CSR_READ(csr_id, result) { \
__asm__ ("csrr %0, %1" : "=r"((result)) : "I"((csr_id))); \
}
#define CSR_WRITE(csr_id, val) {\
#define CSR_WRITE(csr_id, val) { \
__asm__ ("csrw %0, %1" :: "I"((csr_id)), "r"((val))); \
}
#define HALT(code) {\
__asm__("csrw %0, %1" :: "I"(CSR_HALT), "I"(code)); \
#define HALT(code) { \
__asm__ ("csrw %0, %1" :: "I"(CSR_HALT), "I"(code)); \
}
void write_mtimecmp(unsigned long long int mtimecmp);
inline __attribute__((always_inline)) unsigned long long int read_time() {
inline __attribute__((always_inline)) unsigned long long int read_time()
{
unsigned int lower, higher;
__asm__(
__asm__ (
"csrr %0, %2\n"
"csrr %1, %3\n"
: "=r"(lower), "=r"(higher)

Loading…
Cancel
Save