diff --git a/soc/runtime/exceptions.c b/soc/runtime/exceptions.c index 34e0affde..d6c2e9d10 100644 --- a/soc/runtime/exceptions.c +++ b/soc/runtime/exceptions.c @@ -14,7 +14,7 @@ static int stored_id; void *exception_push(void) { if(ec_top >= MAX_EXCEPTION_CONTEXTS) - exception_raise(EID_NOMEM); + exception_raise(EID_OUT_OF_MEMORY); return exception_contexts[ec_top++].jb; } diff --git a/soc/runtime/exceptions.h b/soc/runtime/exceptions.h index f5b9782ac..d701153b0 100644 --- a/soc/runtime/exceptions.h +++ b/soc/runtime/exceptions.h @@ -2,7 +2,8 @@ #define __EXCEPTIONS_H enum { - EID_NOMEM = 0 + EID_OUT_OF_MEMORY = 0, + EID_RTIO_UNDERFLOW = 1 }; int exception_setjmp(void *jb) __attribute__((returns_twice)); diff --git a/soc/runtime/rtio.c b/soc/runtime/rtio.c index 8ee74dafc..6f38b9419 100644 --- a/soc/runtime/rtio.c +++ b/soc/runtime/rtio.c @@ -1,5 +1,6 @@ #include +#include "exceptions.h" #include "rtio.h" void rtio_init(void) @@ -21,6 +22,8 @@ void rtio_set(long long int timestamp, int channel, int value) rtio_o_value_write(value); while(!rtio_o_writable_read()); rtio_o_we_write(1); + if(rtio_o_error_read()) + exception_raise(EID_RTIO_UNDERFLOW); } void rtio_replace(long long int timestamp, int channel, int value)