]> rtime.felk.cvut.cz Git - arc.git/commitdiff
More updates on OS configuration. Fixes on Scheduletables. Started on kernel testsyst...
authormahi <devnull@localhost>
Sun, 28 Feb 2010 19:46:24 +0000 (20:46 +0100)
committermahi <devnull@localhost>
Sun, 28 Feb 2010 19:46:24 +0000 (20:46 +0100)
23 files changed:
arch/ppc/mpc55xx/kernel/irq.c
examples/simple/config/Os_Cfg.c
examples/simple/config/Os_Cfg.h
examples/tiny/config/Os_Cfg.h
include/os_config_macros.h
makefile
scripts/cc_gcc.mk
scripts/req-os.xlsx
scripts/req-os.xml
scripts/req_extract.r
system/kernel/counter.c
system/kernel/include/internal.h
system/kernel/include/sched_table_i.h
system/kernel/init.c
system/kernel/kernel_offset.c
system/kernel/os_arctest.c
system/kernel/resource.c
system/kernel/sched_table.c
system/kernel/task.c
system/kernel/testsystem/config/Os_Cfg.c
system/kernel/testsystem/config/Os_Cfg.h
system/kernel/testsystem/test_01_task.c
system/kernel/testsystem/test_master.c

index 6495119d811103e5353cf7e84329fd743bc8f49f..002f8d934c7386f4a82f0e644dd5f4b482b353bc 100644 (file)
@@ -359,7 +359,7 @@ void Irq_GenerateSoftInt( IrqType vector ) {
  */
 uint8_t Irq_GetCurrentPriority( Cpu_t cpu) {
 
-       uint8_t prio;
+       uint8_t prio = 0;
 
 #if defined(CFG_MPC5516)
        if( cpu == CPU_Z1 ) {
index 41dfe55c02e70235d5a94158d89ef792721eb39f..c0ae401cfdb2807461792827a06ec9dc5868d0ef 100644 (file)
@@ -30,6 +30,7 @@ OsTickType OsTickFreq = 1000;
 // atleast 1\r
 #define SERVICE_CNT 1\r
 
+
 #if ( OS_SC3 == STD_ON) || (  OS_SC4==STD_ON)\r
 GEN_TRUSTEDFUNCTIONS_LIST\r
 \r
index b03f941d4c34c3dc044cb00f4c0877b2e9f21878..82338687676534c2791c0384aa0f3dcbf81b5f05 100644 (file)
  * -------------------------------- 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
index 5ef9b45e48b1ace23b7f01a1946622e0a24edf71..3f8c93b5abdc3b1d8e6caae61f82345e94992994 100644 (file)
 
 
 
+#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
index b739d8ba9c31bb26bf9fd441df8c186d76228f59..f3f62ead0ac941dbbeabfee6e66f8ba3450c273c 100644 (file)
@@ -435,16 +435,6 @@ struct OsHooks os_conf_global_hooks = { \
 #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
index 389009a10b6c5f1e5b96b31e6c258c822eb55085..1879badd16ace11a9bd3ab2a6090702c8f26ae18 100644 (file)
--- a/makefile
+++ b/makefile
@@ -35,8 +35,10 @@ USE_DBG_PRINTF?=y
 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
index 8483d48cf98c0f81df3e89e99523b5f2f84debf0..c9835a89630b634841d87de67dae6b45726fe186 100644 (file)
@@ -15,20 +15,15 @@ endif
 \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
@@ -39,6 +34,7 @@ cflags-y              += -MMD
 # 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
index 05334fafcbfad1fd111a7e4db0f6e284c7a23e36..9fef113f179057f0c4f8b84e77a29086fe7e69bb 100644 (file)
Binary files a/scripts/req-os.xlsx and b/scripts/req-os.xlsx differ
index 87d65394aea814571e8242d81fe3d8d5ed76a193..6c7da1d61e3d9831ed3bab8cdf845563640afb48 100644 (file)
@@ -38,10 +38,8 @@ system shall disable all interrupts and enter an endless loop.</ns1:Description>
                <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
@@ -361,7 +359,7 @@ be greater than (Offset + OsCounterMinCycle) of the pervious expiry point.</ns1:
 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
@@ -390,7 +388,7 @@ after a synchronization count is provided.</ns1:Description>
 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
@@ -398,7 +396,7 @@ OsScheduleTblExplicitPrecision threshold.</ns1:Description>
 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
@@ -406,7 +404,7 @@ OS shall set the delay to the next expiry point to
 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
@@ -414,14 +412,14 @@ shall set the delay to the next expiry point to Delay-
 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
@@ -435,14 +433,14 @@ state of a schedule table with respect to synchronization.</ns1:Description>
 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
@@ -450,7 +448,7 @@ class is 3 or 4, the Operating System shall call the  ProtectionHook() with the
 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
@@ -1435,7 +1433,7 @@ the previous “next” schedule table and the old “next” schedule table sta
 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 &lt;ScheduleTableID_To&gt; shall come into\r
index aa66b1420e2cad89d79bb675540b24f1a1f1cab9..8f77d4d72a5d52f48ed54e4b47c638158a408c72 100644 (file)
@@ -15,8 +15,8 @@ REBOL [
 ]\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
index ae367a57284a34b50fe5a08858e248bd89a687e0..a27aa3de563795fcb9be44e34eb827b8b6bac450 100644 (file)
@@ -35,7 +35,7 @@ static inline OsSchTblAdjExpPointType *getAdjExpPoint( OsSchTblType *stblPtr ) {
 #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
 
@@ -198,7 +198,7 @@ StatusType GetElapsedCounterValue( CounterType counter_id, TickRefType val, Tick
 {
        StatusType rv = E_OK;\r
        OsCounterType *cPtr;
-       TickType tick;
+       TickType tick = 0;
 
        cPtr = Oil_GetCounter(counter_id);
 
@@ -219,6 +219,9 @@ StatusType GetElapsedCounterValue( CounterType counter_id, TickRefType val, Tick
        /** @req OS382 */
        *elapsed_val = tick - *val;
 
+       /** @req OS460 */
+       *val = tick;
+
        COUNTER_STD_END;
 }\r
 \r
index a5d95867f06cceb654cf2969fdc1d1f3514276c2..2784cf8bd95c3e66b3793bedf4c4afeaf7a7f0da 100644 (file)
@@ -227,7 +227,7 @@ static inline TickType get_os_tick( void ) {
        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
index d125f014e0c94e26cb5904c0691fdf8ce50acddb..4c700b89ddd6a8588b5601cffec5bd749b948960 100644 (file)
@@ -72,10 +72,11 @@ typedef struct OsScheduleTableEventSetting {
 /** @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;
@@ -155,7 +156,7 @@ typedef struct OsSchTbl {
        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
index 106663e1d8745cccfe42da0038351751b81f168b..27571d16d93a2366a208260742867b16dad2fb6e 100644 (file)
@@ -129,7 +129,7 @@ static void os_pcb_rom_copy( OsPcbType *pcb, const OsRomPcbType *r_pcb ) {
 //     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;
@@ -221,7 +221,7 @@ static void os_start( void ) {
                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);
index d308c821dbf357ef103bbab9be6dfd9db7ac0ebe..6c6d7c1ec0949ec594fe058a6aae0cda1d481ed4 100644 (file)
@@ -30,7 +30,7 @@
 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));
index 652ddf6ca85b64b78c5292418c8c96235e8b6cf5..52d59bfe8b3db98ab2a2bf33c23ec2fad56fe1cd 100644 (file)
 \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
@@ -33,6 +32,8 @@ int Os_ArcTest_GetTaskActivationLimit( TaskType task ) {
 \r
 void Os_ArcTest_SetIrqNestLevel( int level ) {\r
 \r
+       os_sys.int_nest_cnt = level;\r
+\r
        return;\r
 }\r
 \r
index 96780e9cc4c338b324d78659553f684956ca3645..4b23f5275e57e35e44f22ffda31def60b8f901db 100644 (file)
@@ -91,7 +91,7 @@ static StatusType GetResource_( OsResourceType * rid ) {
        }
        // 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)))
index fea3665dfd38487e3fd5a8bbbc941cd627ebb5c8..c7304b6feb5f3c97c5c49a87d7f8cd699a9649ab 100644 (file)
@@ -25,6 +25,7 @@
  /** @req OS411 */
  /** @req OS347 */
  /** @req OS358 */
+ /** @req OS428 */
 \r
 /*\r
  * How Autosar sees the scheduletable\r
@@ -130,7 +131,7 @@ static void ScheduleTableConsistenyCheck( OsSchTblType *sTblPtr ) {
 
                /* 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 );
        }
@@ -162,12 +163,11 @@ StatusType StartScheduleTableRel(ScheduleTableType sid, TickType offset) {
        }
 #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
        }
@@ -194,7 +194,8 @@ StatusType StartScheduleTableAbs(ScheduleTableType sid, TickType start ){
        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) ) {
@@ -550,50 +551,13 @@ void Os_SchTblCheck(OsCounterType *c_p) {
        }
 }
 \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
@@ -615,22 +579,31 @@ void Os_SchTblCalcExpire( OsSchTblType *stbl ) {
        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 ) {
@@ -664,7 +637,8 @@ void Os_SchTblCalcExpire( OsSchTblType *stbl ) {
                }
        } 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),
index 09116654bdbb49575066cb2b2e2246f3346c915f..19eda42752a42938329c1fea61badb0d2c4f69d4 100644 (file)
@@ -437,7 +437,6 @@ StatusType GetTaskID( TaskRefType task_id ) {
 }\r
 
 ISRType GetISRID( void ) {
-       OsPcbType *pPtr;
 
        /** @req OS264 */
        if(os_sys.int_nest_cnt == 0 ) {
@@ -447,6 +446,13 @@ ISRType GetISRID( void ) {
        /** @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
@@ -478,17 +484,16 @@ StatusType ActivateTask( TaskType TaskID ) {
        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);
 
@@ -569,10 +574,12 @@ StatusType TerminateTask( void ) {
 \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);
 
@@ -617,10 +624,14 @@ StatusType ChainTask( TaskType TaskId ) {
        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
index a480625401c833867903e49cf95223bff9e05f22..4d9d3d131b8ca9debe868e9327a7e63e8bc3ca0c 100644 (file)
@@ -90,7 +90,7 @@
 
 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
index 293e9345911e93bba8666a00412156cc6f7bbd82..e95b8ab5158ddcf8bf53915dbef7b430016c6b20 100644 (file)
 #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
index 169ad68b1364568fbc35dece05ef33808ad341aa..68b107eae2fd738624cb5ed266219765c07acb38 100644 (file)
@@ -72,7 +72,7 @@ void etask_sup_l_01(void) {
 \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
@@ -83,7 +83,7 @@ void etask_sup_l_01(void) {
                         * 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
@@ -156,7 +156,7 @@ void btask_sup_m_01( void ) {
                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
index 9e8a962e7289d3d2f8943ded064b789f29be7113..247596f02980ddf338a4a1a7648c8a0872edd1ea 100644 (file)
@@ -187,7 +187,7 @@ void ErrorHook( StatusType Error ) {
 //     dbg_printf("## ErrorHook err=%d\n",Error);
        const char *err;
        err = Arc_StatusToString(Error);
-       while(1);
+//     while(1);
 }\r
 \r
 void PreTaskHook( void ) {\r