*/
uint8_t Irq_GetCurrentPriority( Cpu_t cpu) {
- uint8_t prio;
+ uint8_t prio = 0;
#if defined(CFG_MPC5516)
if( cpu == CPU_Z1 ) {
// atleast 1\r
#define SERVICE_CNT 1\r
+
#if ( OS_SC3 == STD_ON) || ( OS_SC4==STD_ON)\r
GEN_TRUSTEDFUNCTIONS_LIST\r
\r
* -------------------------------- Arctic Core ------------------------------*/
-
-
-
-
-
-
-/*\r
- * Os_Cfg.h\r
- *\r
- * Created on: 2008-dec-22\r
- * Author: mahi\r
- */\r
\r
#ifndef OS_CFG_H_\r
#define OS_CFG_H_\r
+
+
+/*
+ * OsOs container
+ */
+#define OS_SC1 STD_ON /* | OS_SC2 | OS_SC3 | OS_SC4 */
+#define OS_STACK_MONITORING STD_ON
+#define OS_STATUS_EXTENDED STD_ON /* OS_STATUS_STANDARD */
+#define OS_USE_GET_SERVICE_ID STD_ON
+#define OS_USE_PARAMETER_ACCESS STD_ON
+#define OS_RES_SCHEDULER STD_ON
+
\r
#define COUNTER_ID_OsTick 0
\r
+#ifndef OS_CFG_H_
+#define OS_CFG_H_
+/*
+ * OsOs container
+ */
+#define OS_SC1 STD_ON /* | OS_SC2 | OS_SC3 | OS_SC4 */
+#define OS_STACK_MONITORING STD_ON
+#define OS_STATUS_EXTENDED STD_ON /* OS_STATUS_STANDARD */
+#define OS_USE_GET_SERVICE_ID STD_ON
+#define OS_USE_PARAMETER_ACCESS STD_ON
+#define OS_RES_SCHEDULER STD_ON
-
-
-
-/*\r
- * Os_Cfg.h\r
- *\r
- * Created on: 2008-dec-22\r
- * Author: mahi\r
- */\r
-\r
-#ifndef OS_CFG_H_\r
-#define OS_CFG_H_\r
\r
/* os_config.h */\r
\r
#undef MESSAGE_CNT\r
#undef EVENT_CNT\r
#undef SERVICE_CNT\r
-
-/*
- * OsOs container
- */
-#define OS_SC1 STD_ON /* | OS_SC2 | OS_SC3 | OS_SC4 */
-#define OS_STACK_MONITORING STD_ON
-#define OS_STATUS_EXTENDED STD_ON /* OS_STATUS_STANDARD */
-#define OS_USE_GET_SERVICE_ID STD_ON
-#define OS_USE_PARAMETER_ACCESS STD_ON
-#define OS_RES_SCHEDULER STD_ON
\r
#endif\r
\r
Q?=@\r
export Q\r
export TOPDIR = $(CURDIR)\r
+export CFG_DEBUG ?= n\r
+ifeq ($(CFG_DEBUG),n)\r
export CFG_RELEASE = y\r
-export CFG_DEBUG = n\r
+endif\r
export PATH\r
\r
ifneq ($(filter clean_all,$(MAKECMDGOALS)),clean_all)\r
\r
CC = $(CROSS_COMPILE)gcc\r
cflags-$(CFG_RELEASE) += -O3\r
-cflags-$(CFG_DEBUG) += -O0\r
-#cflags-y += -O0\r
-#cflags-y += -O3\r
+cflags-$(CFG_DEBUG) += -g -O0\r
\r
+# Remove sections if needed.. may be problems with other compilers here.\r
#cflags-y += -ffunction-sections\r
\r
ifneq ($(filter -O2 -O3 -O1,$(cflags-y)),) \r
cflags-y += -fno-schedule-insns -fno-schedule-insns2\r
endif\r
\r
-# Remove sections if needed.. may be problems with other compilers here.\r
-#cflags-$(CFG_MPC55XX) += -ffunction-sections\r
-\r
-\r
#cflags-y += -c \r
#cflags-y += -fno-common\r
cflags-y += -std=gnu99\r
# Warnings\r
cflags-y += -Wall\r
cflags-y += -Winline # warn if inline failed\r
+#cflags-y += -pedantic\r
\r
# Conformance\r
cflags-y += -fno-strict-aliasing\r
<ns1:Class>1,2,3,4</ns1:Class>\r
<ns1:Component>code</ns1:Component>\r
<ns1:Verification>code</ns1:Verification>\r
- <ns1:Description>The Operating System shall provide the services DisableAllInterrupts(),\r
-EnableAllInterrupts(), SuspendAllInterrupts(), ResumeAllInterrupts()\r
-prior to calling StartOS() and after calling ShutdownOS(). (It is assumed that the\r
-static variables of these functions are initialized).</ns1:Description>\r
+ <ns1:Description>The Operating System shall provide the services DisableAllInterrupts(), EnableAllInterrupts(), SuspendAllInterrupts(), ResumeAllInterrupts()\r
+prior to calling StartOS() and after calling ShutdownOS(). (It is assumed that the static variables of these functions are initialized).</ns1:Description>\r
</ns1:Req>\r
<ns1:Req id="OS301">\r
<ns1:Class>1,2,3,4</ns1:Class>\r
be less than the duration of the schedule table.</ns1:Description>\r
</ns1:Req>\r
<ns1:Req id="OS438">\r
- <ns1:Class>1,2,3,4</ns1:Class>\r
+ <ns1:Class>2,4</ns1:Class>\r
<ns1:Component>code</ns1:Component>\r
<ns1:Verification>code</ns1:Verification>\r
<ns1:Description>A schedule table shall define a precision bound with a value in the range 0\r
OsScheduleTblExplicitPrecision threshold.</ns1:Description>\r
</ns1:Req>\r
<ns1:Req id="OS419">\r
- <ns1:Class>1,2,3,4</ns1:Class>\r
+ <ns1:Class>2,4</ns1:Class>\r
<ns1:Component>code</ns1:Component>\r
<ns1:Verification>code</ns1:Verification>\r
<ns1:Description>The OS shall set the state of an explicitly synchronized schedule table to\r
OsScheduleTblExplicitPrecision threshold.</ns1:Description>\r
</ns1:Req>\r
<ns1:Req id="OS420">\r
- <ns1:Class>1,2,3,4</ns1:Class>\r
+ <ns1:Class>2,4</ns1:Class>\r
<ns1:Component>code</ns1:Component>\r
<ns1:Verification>code</ns1:Verification>\r
<ns1:Description>If the deviation is negative and the next expiry point is adjustable then the\r
Delay+min(OsScheduleTableMaxAdvance,Deviation)</ns1:Description>\r
</ns1:Req>\r
<ns1:Req id="OS421">\r
- <ns1:Class>1,2,3,4</ns1:Class>\r
+ <ns1:Class>2,4</ns1:Class>\r
<ns1:Component>code</ns1:Component>\r
<ns1:Verification>code</ns1:Verification>\r
<ns1:Description>If the deviation is positive and the next expiry point is adjustable then the OS\r
min(OsScheduleTableMaxRetard, Deviation)</ns1:Description>\r
</ns1:Req>\r
<ns1:Req id="OS422">\r
- <ns1:Class>1,2,3,4</ns1:Class>\r
+ <ns1:Class>2,4</ns1:Class>\r
<ns1:Component>code</ns1:Component>\r
<ns1:Verification>code</ns1:Verification>\r
<ns1:Description>The OS shall provide a service to cancel synchronization being performed at\r
adjustable expiry points on a schedule table.</ns1:Description>\r
</ns1:Req>\r
<ns1:Req id="OS227">\r
- <ns1:Class>1,2,3,4</ns1:Class>\r
+ <ns1:Class>2,4</ns1:Class>\r
<ns1:Component>code</ns1:Component>\r
<ns1:Verification>code</ns1:Verification>\r
<ns1:Description>The Operating System shall extend the service from OS359 to query the\r
stack faults of Task(s)/Category 2 OsIsr(s).</ns1:Description>\r
</ns1:Req>\r
<ns1:Req id="OS068">\r
- <ns1:Class>1,2,3,4</ns1:Class>\r
+ <ns1:Class>1,2</ns1:Class>\r
<ns1:Component>code</ns1:Component>\r
<ns1:Verification>code</ns1:Verification>\r
<ns1:Description>If a stack fault is detected by stack monitoring AND the configured scalability\r
class is 1 or 2, the Operating System shall call the ShutdownOS() service with the status E_OS_STACKFAULT.</ns1:Description>\r
</ns1:Req>\r
<ns1:Req id="OS396">\r
- <ns1:Class>1,2,3,4</ns1:Class>\r
+ <ns1:Class>3,4</ns1:Class>\r
<ns1:Component>code</ns1:Component>\r
<ns1:Verification>code</ns1:Verification>\r
<ns1:Description>If a stack fault is detected by stack monitoring AND the configured scalability\r
status E_OS_STACKFAULT.</ns1:Description>\r
</ns1:Req>\r
<ns1:Req id="OS445">\r
- <ns1:Class>1,2,3,4</ns1:Class>\r
+ <ns1:Class>3,4</ns1:Class>\r
<ns1:Component>code</ns1:Component>\r
<ns1:Verification>code</ns1:Verification>\r
<ns1:Description>The Operating System shall support OS-Applications which are a\r
SCHEDULETABLE_STOPPED.</ns1:Description>\r
</ns1:Req>\r
<ns1:Req id="OS363">\r
- <ns1:Class>1,2,3,4</ns1:Class>\r
+ <ns1:Class>2,4</ns1:Class>\r
<ns1:Component>code</ns1:Component>\r
<ns1:Verification>code</ns1:Verification>\r
<ns1:Description>The synchronization strategy of the <ScheduleTableID_To> shall come into\r
]\r
\r
usage: does [\r
-; do/args %scripts/req_extract.r ["diff" "OS" "req" "Class=1"]\r
- print "Usage: do/args %extract_req [ ^"<cmd>^" ^"[....]^" ]"\r
+; do/args %req_extract.r ["diff" "OS" "req" "Class=1,Component=Code"]\r
+ print "Usage: do/args %req_extract.r [ ^"<cmd>^" ^"[....]^" ]"\r
print " req.sh diff OS req ^"Class=1^""\r
print " <cmd> = (diff|ls) "\r
print " diff <module> (code|test) <filter>"\r
#endif
\r
\r
-static inline struct OsSchTblAutostart *getAutoStart( OsSchTblType *stblPtr ) {\r
+static inline const struct OsSchTblAutostart *getAutoStart( OsSchTblType *stblPtr ) {\r
return stblPtr->autostartPtr;\r
}\r
{
StatusType rv = E_OK;\r
OsCounterType *cPtr;
- TickType tick;
+ TickType tick = 0;
cPtr = Oil_GetCounter(counter_id);
/** @req OS382 */
*elapsed_val = tick - *val;
+ /** @req OS460 */
+ *val = tick;
+
COUNTER_STD_END;
}\r
\r
return os_sys.tick;\r
}\r
-#if ( OS_SC1 == STD_ON ) || ( OS_SC4 == STD_ON )\r
+#if ( OS_SC3 == STD_ON ) || ( OS_SC4 == STD_ON )\r
static inline OsApplicationType *get_curr_application( void ) {\r
return get_curr_pcb()->application;\r
}\r
/** @req OS403 */
typedef struct OsScheduleTableExpiryPoint {
/* The expiry point offset, OsScheduleTblExpPointOffset */
+ /** @req OS404 */
uint64 offset;
// delta to next action
- /** @req OS404 */
- uint64 delta;
+
+ //uint64 delta;
/* List of events to activate */
const TaskType *taskList;
struct OsCounter *counter;\r
/* OsScheduleTableAutostart[C] */\r
- struct OsSchTblAutostart *autostartPtr;\r
+ const struct OsSchTblAutostart *autostartPtr;\r
/* NULL if NONE, and non-NULL if EXPLICIT and IMPLICIT */\r
struct OsScheduleTableSync *sync;\r
// memset(pcb,sizeof(OsPcbType),0);
pcb->pid = r_pcb->pid;
pcb->prio = r_pcb->prio;
-#if ( OS_SC1 == STD_ON ) || ( OS_SC4 == STD_ON )
+#if ( OS_SC3 == STD_ON ) || ( OS_SC4 == STD_ON )
pcb->application = Oil_GetApplObj(r_pcb->application_id);
#endif
pcb->entry = r_pcb->entry;
OsAlarmType *alarmPtr;
alarmPtr = Oil_GetAlarmObj(j);
if(alarmPtr->autostartPtr != NULL ) {
- OsAlarmAutostartType *autoPtr = alarmPtr->autostartPtr;
+ const OsAlarmAutostartType *autoPtr = alarmPtr->autostartPtr;
if( autoPtr->autostartType == ALARM_AUTOSTART_ABSOLUTE ) {
SetAbsAlarm(j,autoPtr->alarmTime, autoPtr->cycleTime);
void oil_foo(void) {\r
\r
DECLARE(PCB_T_SIZE, sizeof(OsPcbType));
-#if ( OS_SC1 == STD_ON ) || ( OS_SC4 == STD_ON )\r
+#if ( OS_SC3 == STD_ON ) || ( OS_SC4 == STD_ON )\r
DECLARE(APP_T_SIZE, sizeof(OsApplicationType));
#endif\r
DECLARE(PCB_STACK_CURR_P, offsetof(OsPcbType, stack));
\r
#include "internal.h"\r
\r
+int Os_ArcTest_GetTaskActivationLimit( TaskType TaskId ) {\r
\r
-int Os_ArcTest_GetTaskActivationLimit( TaskType task ) {\r
-\r
- return 0;\r
+ return os_get_pcb(TaskId)->activationLimit;\r
}\r
\r
/**\r
\r
void Os_ArcTest_SetIrqNestLevel( int level ) {\r
\r
+ os_sys.int_nest_cnt = level;\r
+\r
return;\r
}\r
\r
}
// Check that the resource does not belong to another application or task
if( ( (os_task_nr_to_mask(get_curr_pid()) & rid->task_mask ) == 0 )
-#if ( OS_SC1 == STD_ON ) || ( OS_SC4 == STD_ON )
+#if ( OS_SC3 == STD_ON ) || ( OS_SC4 == STD_ON )
|| ( get_curr_application_id() != rid->application_owner_id)
#endif
|| ( rid->owner != (TaskType)(-1)))
/** @req OS411 */
/** @req OS347 */
/** @req OS358 */
+ /** @req OS428 */
\r
/*\r
* How Autosar sees the scheduletable\r
/* Final */
/** @req OS444 */
- delta = sTblPtr->duration - SA_LIST_GET(&sTblPtr->expirePointList,iter)->offset;
+ delta = sTblPtr->duration - SA_LIST_GET(&sTblPtr->expirePointList,iter-1)->offset;
assert( delta >= minCycle );
assert( delta <= maxValue );
}
}
#endif
-#if (OS_STATUS_EXTENDED == STD_ON )\r
-\r
max_offset = Os_CounterGetMaxValue(s_tbl->counter);
+#if (OS_STATUS_EXTENDED == STD_ON )
/** @req OS276 */
/** @req OS332 */
- if( (offset == 0) || ((offset + Os_SchTblGetInitialOffset()) > max_offset ) ) {\r
+ if( (offset == 0) || ((offset + Os_SchTblGetInitialOffset(s_tbl)) > max_offset ) ) {\r
rv = E_OS_VALUE;\r
goto err;\r
}
OsSchTblType *sTblPtr;\r
/** @req OS348 */\r
- SCHED_CHECK_ID(sid);\r
+ SCHED_CHECK_ID(sid);
+ sTblPtr = Oil_GetSched(sid);\r
/** @req OS349 */
if( start > Os_CounterGetMaxValue(sTblPtr->counter) ) {
}
}
\r
-/*\r
- *start e e e delta stop\r
- * |----|---|-------|---------|\r
- *\r
- *\r
- * | s e e cm e\r
- * |---|---|----|---|----|----------|\r
- * 1 2 3 4 5\r
- * e-expiry point\r
- * cm-counter max( restart from 0)\r
- * s-call to StartScheduleTableRel()\r
- */\r
-\r
-\r
-/* TODO: Remove when we have a stable generator. The reason for this\r
- * funcion is that I'm afraid of if I change the maxallowedvalue for the\r
- * counter I will miss to update the delta values\r
- */\r
-static void os_stbl_action_calc_delta( OsSchTblType *stbl ) {\r
- OsScheduleTableExpiryPointType * first;\r
- OsScheduleTableExpiryPointType * second;\r
-// ALIST_DECL_ITER(iter);\r
- int iter;\r
-\r
- // calculate the delta to next action\r
-\r
- for(iter=1; iter < SA_LIST_CNT(&stbl->expirePointList) ;iter++) {\r
- first = SA_LIST_GET(&stbl->expirePointList,iter-1);\r
- second = SA_LIST_GET(&stbl->expirePointList,iter);\r
- first->delta = second->offset - first->offset;\r
- }\r
- // calculate the last delta( to countes max value )\r
- first = SA_LIST_GET(&stbl->expirePointList, SA_LIST_CNT(&stbl->expirePointList)-1);\r
- first->delta = stbl->counter->alarm_base.maxallowedvalue - first->offset;\r
-}\r
-\r
/**\r
*
*/\r
void Os_SchTblInit( void ) {\r
OsSchTblType *s_p;\r
for( int i=0; i < Oil_GetSchedCnt();i++ ) {\r
- s_p = Oil_GetSched(i);\r
- os_stbl_action_calc_delta(s_p);\r
+ s_p = Oil_GetSched(i);
\r
ScheduleTableConsistenyCheck(s_p);\r
}\r
TickType initalOffset;
TickType finalOffset;
OsSchTblType *nextStblPtr;
+ _Bool handleLast = 0;
if( (stbl->expire_curr_index) == SA_LIST_CNT(&stbl->expirePointList) ) {
/* We are at the last expiry point */
finalOffset = Os_SchTblGetFinalOffset(stbl);
- stbl->expire_val = Os_CounterCalcModulo(
- Os_CounterGetValue(stbl->counter),
- Os_CounterGetMaxValue(stbl->counter),
- finalOffset );
+ if (finalOffset != 0) {
+ stbl->expire_val = Os_CounterCalcModulo(
+ Os_CounterGetValue(stbl->counter),
+ Os_CounterGetMaxValue(stbl->counter),
+ finalOffset );
- stbl->expire_curr_index++;
+ stbl->expire_curr_index++;
+ } else {
+ /* Only single shot may have an offset of 0 */
+ assert(stbl->repeating == SINGLE_SHOT);
+ handleLast = 1;
+ }
+ }
- } else if( (stbl->expire_curr_index) > SA_LIST_CNT(&stbl->expirePointList) ) {
+ if( handleLast ||
+ ( (stbl->expire_curr_index) > SA_LIST_CNT(&stbl->expirePointList) ) )
+ {
/* At final offset */
-
/** @req OS194 */
if( (stbl->repeating == REPEATING) || (stbl->next != NULL) ) {
if( stbl->next != NULL ) {
}
} else {
- delta = SA_LIST_GET(&stbl->expirePointList,stbl->expire_curr_index)->delta;
+ delta = SA_LIST_GET(&stbl->expirePointList,stbl->expire_curr_index+1) -
+ SA_LIST_GET(&stbl->expirePointList,stbl->expire_curr_index) ;
stbl->expire_val = Os_CounterCalcModulo(
Os_CounterGetValue(stbl->counter),
}\r
ISRType GetISRID( void ) {
- OsPcbType *pPtr;
/** @req OS264 */
if(os_sys.int_nest_cnt == 0 ) {
/** @req OS263 */
return (ISRType)Os_TaskGetCurrent()->pid;
}
+
+#define TASK_CHECK_ID(x) \
+ if( (x) > Oil_GetTaskCnt()) { \
+ rv = E_OS_ID; \
+ goto err; \
+ }
+
\r
/**\r
* The task <TaskID> is transferred from the suspended state into\r
StatusType rv = E_OK;\r
\r
os_isr_printf(D_TASK,"ActivateTask %s\n",pcb->name);\r
-\r
- if( !os_pcb_pid_valid(pcb) ) {\r
- rv = E_OS_ID;\r
- goto err;\r
- }\r
+
+#if (OS_STATUS_EXTENDED == STD_ON )
+ TASK_CHECK_ID(TaskID);
/* @req OS093 ActivateTask */
if( Os_IrqAnyDisabled() ) {
rv = E_OS_DISABLEDINT;
goto err;
}
+#endif
Irq_Save(msr);
\r
os_std_printf(D_TASK,"TerminateTask %s\n",curr_pcb->name);\r
+#if (OS_STATUS_EXTENDED == STD_ON )
if( os_sys.int_nest_cnt != 0 ) {
rv = E_OS_CALLEVEL;
goto err;
}
+#endif
\r
Irq_Save(flags);
StatusType rv;
uint32_t flags;
+#if (OS_STATUS_EXTENDED == STD_ON )
+ TASK_CHECK_ID(TaskId);
+
if( os_sys.int_nest_cnt != 0 ) {
rv = E_OS_CALLEVEL;
goto err;
}
+#endif
\r
Irq_Save(flags);\r
rv = ActivateTask(TaskId);\r
OsTickType OsTickFreq = 1000;\r
\r
-extern void dec_exception( void );\r
+extern void dec_exception( void );
#if ( OS_SC1 == STD_ON ) || ( OS_SC4 == STD_ON )
// atleast 1
#define OS_CFG_H_\r
\r
-/* os_config.h */\r
+/* os_config.h */
+
+/*
+ * OsOs container
+ */
+#define OS_SC1 STD_ON /* | OS_SC2 | OS_SC3 | OS_SC4 */
+#define OS_STACK_MONITORING STD_ON
+#define OS_STATUS_EXTENDED STD_ON /* OS_STATUS_STANDARD */
+#define OS_USE_GET_SERVICE_ID STD_ON
+#define OS_USE_PARAMETER_ACCESS STD_ON
+#define OS_RES_SCHEDULER STD_ON
+\r
\r
#define APPLICATION_ID_application_1 0\r
#define APPLICATION_CNT 1\r
\r
/* Activate higher prio task to do the test */\r
rv = ActivateTask(TASK_ID_btask_sup_h);\r
- TEST_ASSERT(rv=E_OK);\r
+ TEST_ASSERT(rv == E_OK);\r
\r
/* Was it run activation times? */\r
TEST_ASSERT(btaskRunCnt == Os_ArcTest_GetTaskActivationLimit(TASK_ID_btask_sup_m));\r
* Terminate a task that still holds resources\r
* */\r
rv = ActivateTask(TASK_ID_btask_sup_h);\r
- TEST_ASSERT(rv=E_OK);\r
+ TEST_ASSERT(rv == E_OK);\r
break;\r
case 11:\r
/*@req E_OS_CALLEVEL TerminateTask */\r
break;\r
case 10:\r
rv = GetResource(RES_ID_ext_prio_3);\r
- TEST_ASSERT(rv=E_OK);\r
+ TEST_ASSERT(rv == E_OK);\r
\r
rv = TerminateTask();\r
TEST_ASSERT(rv==E_OS_RESOURCE);\r
// dbg_printf("## ErrorHook err=%d\n",Error);
const char *err;
err = Arc_StatusToString(Error);
- while(1);
+// while(1);
}\r
\r
void PreTaskHook( void ) {\r