/*==================[definiciones de funciones externas]=====================*/ void printError(void) { static uint8_t OSErrorGetServiceIdTxt[][25]={ "Undefined", "ActivateTask", "TerminateTask", "ChainTask", "Schedule", "GetTAskID", "GetTaskState", "DisableAllInterrupts", "EnableAllInterrupts", "SuspendAllInterrupts", "ResumeAllInterrupts", "SuspendOSInterrupts", "ResumeOSInterrupts", "GetResource", "ReleaseResource", "SetEvent", "ClearEvent", "GetEvent", "WaitEvent", "GetAlarmBase", "GetAlarm", "SetRelAlarm", "SetAbsAlarm", "CancelAlarm", "GetACtiveApplicationMode", "StartOS", "ShutdownOS" }; static uint8_t OSErrorGetRetTxt[][13]={ "E_OK", "E_OS_ACCESS", "E_OS_CALLEVEL", "E_OS_ID" "E_OS_LIMIT", "E_OS_NOFUNC", "E_OS_RESOURCE", "E_OS_STATE", "E_OS_VALUE" }; uartWriteString(UART_USB, "\n-----------------------------------\n"); uartWriteString(UART_USB, "Service:\n"); uartWriteByte(UART_USB, ( OSErrorGetServiceId() + 48 ) ); uartWriteString(UART_USB, " = "); uartWriteString(UART_USB, ( OSErrorGetServiceIdTxt[OSErrorGetServiceId()]) ); uartWriteString(UART_USB, " ---> "); uartWriteByte(UART_USB, ( OSErrorGetRet() + 48 ) ); uartWriteString(UART_USB, " = "); uartWriteString(UART_USB, ( OSErrorGetRetTxt[OSErrorGetRet()] ) ); uartWriteString(UART_USB, "\n-----------------------------------\n"); }
/** \brief Error Hook function * * This fucntion is called from the os if an os interface (API) returns an * error. Is for debugging proposes. If called this function triggers a * ShutdownOs which ends in a while(1). * * The values: * OSErrorGetServiceId * OSErrorGetParam1 * OSErrorGetParam2 * OSErrorGetParam3 * OSErrorGetRet * * will provide you the interface, the input parameters and the returned value. * For more details see the OSEK specification: * http://portal.osek-vdx.org/files/pdf/specs/os223.pdf * */ void ErrorHook(void) { ciaaPOSIX_printf("ErrorHook was called\n"); ciaaPOSIX_printf("Service: %d, P1: %d, P2: %d, P3: %d, RET: %d\n", OSErrorGetServiceId(), OSErrorGetParam1(), OSErrorGetParam2(), OSErrorGetParam3(), OSErrorGetRet()); ShutdownOS(0); }