soc/runtime: raise exception on RTIO underflow

This commit is contained in:
Sebastien Bourdeauducq 2014-09-25 12:55:50 +08:00
parent 378ca64193
commit f4d6bfc094
3 changed files with 6 additions and 2 deletions

View File

@ -14,7 +14,7 @@ static int stored_id;
void *exception_push(void) void *exception_push(void)
{ {
if(ec_top >= MAX_EXCEPTION_CONTEXTS) if(ec_top >= MAX_EXCEPTION_CONTEXTS)
exception_raise(EID_NOMEM); exception_raise(EID_OUT_OF_MEMORY);
return exception_contexts[ec_top++].jb; return exception_contexts[ec_top++].jb;
} }

View File

@ -2,7 +2,8 @@
#define __EXCEPTIONS_H #define __EXCEPTIONS_H
enum { enum {
EID_NOMEM = 0 EID_OUT_OF_MEMORY = 0,
EID_RTIO_UNDERFLOW = 1
}; };
int exception_setjmp(void *jb) __attribute__((returns_twice)); int exception_setjmp(void *jb) __attribute__((returns_twice));

View File

@ -1,5 +1,6 @@
#include <generated/csr.h> #include <generated/csr.h>
#include "exceptions.h"
#include "rtio.h" #include "rtio.h"
void rtio_init(void) void rtio_init(void)
@ -21,6 +22,8 @@ void rtio_set(long long int timestamp, int channel, int value)
rtio_o_value_write(value); rtio_o_value_write(value);
while(!rtio_o_writable_read()); while(!rtio_o_writable_read());
rtio_o_we_write(1); 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) void rtio_replace(long long int timestamp, int channel, int value)