Exemplo n.º 1
0
/*==================[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");
}
Exemplo n.º 2
0
void
ErrorHook(StatusType Error)
{
	TaskType	tskid;
	StatusType	ercd;

#ifdef IOC_E_NO_DATA
	/* IOC_E_NO_DATAはエラーではない */
	if (Error == IOC_E_NO_DATA) {
		return;
	}
#endif /* IOC_E_NO_DATA */

	syslog(LOG_NOTICE, "## ErrorHook is called !! (%d)", Error);

	ercd = GetTaskID(&tskid);
	if (ercd == E_OK) {
		syslog(LOG_NOTICE, "GetTaskID: %d", (sintptr) tskid);
	}
	else {
		syslog(LOG_NOTICE, "GetTaskID is unavailable.");
	}
	syslog(LOG_NOTICE, "GetISRID: %d", (sintptr) GetISRID());
	syslog(LOG_NOTICE, "OSErrorGetServiceId(): %d", OSErrorGetServiceId());

	return;
}
Exemplo n.º 3
0
/** \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);
}
Exemplo n.º 4
0
/**
 *
 * @param error
 */
void ErrorHook( StatusType error ) {

	TaskType task;
	static struct LogBad LogBad[ERROR_LOG_SIZE];
	static uint8_t ErrorCount = 0;
	printf("ErrorHook: %d\r\n", error);
	GetTaskID(&task);


	OsServiceIdType service = OSErrorGetServiceId();

	/* Grab the arguments to the functions
	 * This is the standard way, see 11.2 in OSEK spec
	 */
	switch(service) {
	case OSServiceId_SetRelAlarm:
	{
		// Read the arguments to the faulty functions...
		AlarmType alarm_id = OSError_SetRelAlarm_AlarmId;
		TickType increment = OSError_SetRelAlarm_Increment;
		TickType cycle = OSError_SetRelAlarm_Cycle;
		(void)alarm_id;
		(void)increment;
		(void)cycle;

		// ... Handle this some way.
		break;
	}
	/*
	 * The same pattern as above applies for all other OS functions.
	 * See Os.h for names and definitions.
	 */

	default:
		break;
	}

	LDEBUG_PRINTF("## ErrorHook err=%u\n",Error);

	/* Log the errors in a buffer for later review */
	LogBad[ErrorCount].param1 = os_error.param1;
	LogBad[ErrorCount].param2 = os_error.param2;
	LogBad[ErrorCount].param3 = os_error.param3;
	LogBad[ErrorCount].serviceId = service;
	LogBad[ErrorCount].taskId = task;
	LogBad[ErrorCount].error = error;

	ErrorCount++;

	/* Keep compiler silent */
	(void)LogBad[ErrorCount].param1;

	// Stall if buffer is full.
	while(ErrorCount >= ERROR_LOG_SIZE)
	{

	};
}
Exemplo n.º 5
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance9(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(19);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT(19,OSServiceId_StartScheduleTableSynchron, result_inst_1);
		
}
Exemplo n.º 6
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance2(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(9);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT(9,OSServiceId_SetEvent , result_inst_1);
		
}
Exemplo n.º 7
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance7(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(16);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT(16,OSServiceId_GetResource, result_inst_1);
		
}
Exemplo n.º 8
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance1(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(4);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT(4,OSServiceId_ActivateTask, result_inst_1);
		
}
Exemplo n.º 9
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance6(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(14);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT(14,OSServiceId_GetTaskState, result_inst_1);
		
}
Exemplo n.º 10
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance15(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(32);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT(32,OSServiceId_SetRelAlarm, result_inst_1);
		
}
Exemplo n.º 11
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance3(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(8);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT(8,OSServiceId_ChainTask, result_inst_1);
		
}
Exemplo n.º 12
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance8(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(17);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT(17,OSServiceId_NextScheduleTable, result_inst_1);
		
}
Exemplo n.º 13
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance16(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(33);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT(33,OSServiceId_TerminateApplication, result_inst_1);
		
}
Exemplo n.º 14
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance10(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(37);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(37, OSServiceId_GetScheduleTableStatus , result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(37, INVALID_SCHEDULETABLE , OSError_GetScheduleTableStatus_ScheduleTableID());	
}
Exemplo n.º 15
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance2(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(6);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT(6,OSServiceId_TerminateTask, result_inst_1);
		
}
Exemplo n.º 16
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance1(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(8);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(8, INVALID_RESTART , OSError_TerminateApplication_opt());
	SCHEDULING_CHECK_AND_EQUAL_INT(8,OSServiceId_TerminateApplication , result_inst_1);
	
}
Exemplo n.º 17
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance6(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(12);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(12,OSServiceId_GetElapsedCounterValue , result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(12, INVALID_COUNTER , OSError_GetElapsedCounterValue_CounterID());
	
}
Exemplo n.º 18
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance6(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(18);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(18,OSServiceId_StartScheduleTableSynchron, result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(18,sched_explicit, OSError_StartScheduleTableSynchron_ScheduleTableID());
		
}
Exemplo n.º 19
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance2(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(4);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(4,OSServiceId_IncrementCounter , result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(4, INVALID_COUNTER , OSError_IncrementCounter_CounterID());
	
}
Exemplo n.º 20
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance6(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(17);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(17,OSServiceId_StopScheduleTable , result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(17, sched1 , OSError_StopScheduleTable_ScheduleTableID());
	
}
Exemplo n.º 21
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance12(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(26);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(26,sched_nosync, OSError_SetScheduleTableAsync_ScheduleTableID());
	SCHEDULING_CHECK_AND_EQUAL_INT(26,OSServiceId_SetScheduleTableAsync, result_inst_1);
		
}
Exemplo n.º 22
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance5(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(13);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(13,OSServiceId_StopScheduleTable , result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT(13, INVALID_SCHEDULETABLE , OSError_StopScheduleTable_ScheduleTableID());
	
}
Exemplo n.º 23
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance4(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(9);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(9, OBJECT_TASK, OSError_CheckObjectOwnership_ObjectType());
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(9, t1, OSError_CheckObjectOwnership_ObjectID());
	SCHEDULING_CHECK_AND_EQUAL_INT(9,OSServiceId_CheckObjectOwnership, result_inst_1);
		
}
Exemplo n.º 24
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance4(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(10);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(10,OSServiceId_NextScheduleTable , result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(10, sched2 , OSError_NextScheduleTable_ScheduleTableID());
	SCHEDULING_CHECK_AND_EQUAL_INT(10, sched2, OSError_NextScheduleTable_ScheduleTableID2());
	
}
Exemplo n.º 25
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance2(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(8);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(8,OSServiceId_StartScheduleTableRel, result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(8,sched_explicit, OSError_StartScheduleTableRel_ScheduleTableID());
	SCHEDULING_CHECK_AND_EQUAL_INT(8,1 , OSError_StartScheduleTableRel_offset());
		
}
Exemplo n.º 26
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance3(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(10);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(10,OSServiceId_StartScheduleTableAbs, result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(10,sched_explicit, OSError_StartScheduleTableAbs_ScheduleTableID());
	SCHEDULING_CHECK_AND_EQUAL_INT(10,1 , OSError_StartScheduleTableAbs_value());
		
}
Exemplo n.º 27
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance7(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(14);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(14,sched_explicit, OSError_SyncScheduleTable_ScheduleTableID());
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(14,1 , OSError_SyncScheduleTable_value());
	SCHEDULING_CHECK_AND_EQUAL_INT(14,OSServiceId_SyncScheduleTable, result_inst_1);
		
}
Exemplo n.º 28
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance1(void)
{
	extern StatusType error_status;
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(4);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(4, E_OS_RESOURCE , error_status);
	SCHEDULING_CHECK_AND_EQUAL_INT(4, OSServiceId_TerminateTask , result_inst_1);
		
}
Exemplo n.º 29
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance4(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(8);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(8,OSServiceId_GetElapsedCounterValue , result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(8, Software_Counter , OSError_GetElapsedCounterValue_CounterID());
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(8, (OSMAXALLOWEDVALUE_Software_Counter + 1) , (StatusType)(*OSError_GetElapsedCounterValue_value()));
	SCHEDULING_CHECK_AND_EQUAL_INT(8, (OSMAXALLOWEDVALUE_Software_Counter + 1) , (StatusType)(*OSError_GetElapsedCounterValue_previous_value()));
	
}
Exemplo n.º 30
0
/*test case:test the reaction of the system called with 
 an activation of a task*/
static void test_error_instance3(void)
{
	StatusType result_inst_1;
	
	SCHEDULING_CHECK_INIT(16);
	result_inst_1 = OSErrorGetServiceId();
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(16,OSServiceId_SetRelAlarm , result_inst_1);
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(16, 0 , OSError_SetRelAlarm_increment());
	SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(16, 0 , OSError_SetRelAlarm_cycle());
	SCHEDULING_CHECK_AND_EQUAL_INT(16, Alarm_ActivateTask , OSError_SetRelAlarm_AlarmID());
		
}