2015-04-04 22:08:32 +08:00
|
|
|
#include "exceptions.h"
|
2015-04-05 22:04:50 +08:00
|
|
|
#include "mailbox.h"
|
|
|
|
#include "messages.h"
|
2015-04-04 22:08:32 +08:00
|
|
|
#include "rtio.h"
|
|
|
|
#include "dds.h"
|
|
|
|
|
2015-04-03 17:44:56 +08:00
|
|
|
void exception_handler(unsigned long vect, unsigned long *sp);
|
|
|
|
void exception_handler(unsigned long vect, unsigned long *sp)
|
|
|
|
{
|
2015-04-05 22:04:50 +08:00
|
|
|
struct msg_exception msg;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
msg.type = MESSAGE_TYPE_EXCEPTION;
|
|
|
|
msg.eid = EID_INTERNAL_ERROR;
|
|
|
|
for(i=0;i<3;i++)
|
|
|
|
msg.eparams[i] = 0;
|
|
|
|
mailbox_send_and_wait(&msg);
|
|
|
|
while(1);
|
2015-04-03 17:44:56 +08:00
|
|
|
}
|
|
|
|
|
2015-04-04 22:08:32 +08:00
|
|
|
typedef void (*kernel_function)(void);
|
2015-04-03 17:44:56 +08:00
|
|
|
|
|
|
|
int main(void);
|
|
|
|
int main(void)
|
|
|
|
{
|
2015-04-04 22:08:32 +08:00
|
|
|
kernel_function k;
|
|
|
|
void *jb;
|
|
|
|
|
|
|
|
jb = exception_push();
|
2015-04-05 22:04:50 +08:00
|
|
|
if(exception_setjmp(jb)) {
|
|
|
|
struct msg_exception msg;
|
|
|
|
|
|
|
|
msg.type = MESSAGE_TYPE_EXCEPTION;
|
|
|
|
msg.eid = exception_getid(msg.eparams);
|
|
|
|
mailbox_send_and_wait(&msg);
|
|
|
|
} else {
|
|
|
|
struct msg_finished msg;
|
|
|
|
|
|
|
|
k = mailbox_receive();
|
|
|
|
if(!k)
|
|
|
|
exception_raise(EID_INTERNAL_ERROR);
|
2015-04-04 22:08:32 +08:00
|
|
|
dds_init();
|
|
|
|
rtio_init();
|
|
|
|
k();
|
|
|
|
exception_pop(1);
|
2015-04-05 22:04:50 +08:00
|
|
|
|
|
|
|
msg.type = MESSAGE_TYPE_FINISHED;
|
|
|
|
mailbox_send_and_wait(&msg);
|
2015-04-04 22:08:32 +08:00
|
|
|
}
|
|
|
|
while(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
int comm_rpc(int rpc_num, ...);
|
|
|
|
int comm_rpc(int rpc_num, ...)
|
|
|
|
{
|
|
|
|
/* TODO */
|
2015-04-03 17:44:56 +08:00
|
|
|
return 0;
|
|
|
|
}
|