
SCIOPTA - Real-Time Kernel
User’s Manual Manual Version 4.1 10-5
SCIOPTA - Real-Time Kernel
10 Error Handling
10.3.4 Error Hook Example
#include "sconf.h"
#include <sciopta.h>
#include <ossys/errtxt.h>
#if SC_ERR_HOOK == 1
int error_hook(sc_errcode_t err,void *ptr,int user,sc_pcb_t *pcb)
{
kprintf(9,"Error\n %08lx(%s,line %d in %s) %08lx %8lx %08lx %08lx\n",
(int)pcb>1 ? pcb->pid:0,
(int)pcb>1 ? pcb->name:"xx",
(int)pcb>1 ?pcb->cline:0,
(int)pcb>1 ?pcb->cfile:"xx",
pcb,
err,
ptr,
user);
if ( user != 1 &&
((err>>12)&0xfff) <= SC_MAXERR &&
(err>>24) <= SC_MAXFUNC )
{
kprintf(0,"Function: %s\nError: %s\n",
func_txt[err>>24],
err_txt[(err>>12)&0xfff]);
}
return 0;
}
#endif
Kommentare zu diesen Handbüchern