1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include <stdint.h> #include <stdbool.h> #include "rvcontroller-ecalls.h" volatile char thischar; volatile uint32_t nonblocking_read() { volatile uint32_t ret; asm( "li a7,132 \n\ ecall \n\ mv %0,a0 \n" : "=r" (ret) : : "a0" ); return ret; } void main() { while (true) { thischar = nonblocking_read(); //printint(thischar); } }