]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Renamed USE_DEBUG to USE_DEBUG_PRINT, for now. Updates to kernel testsystem and kernel.
authormahi <devnull@localhost>
Tue, 9 Mar 2010 21:06:57 +0000 (22:06 +0100)
committermahi <devnull@localhost>
Tue, 9 Mar 2010 21:06:57 +0000 (22:06 +0100)
25 files changed:
arch/arm/arm_cm3/drivers/Mcu.c
arch/hc1x/hcs12d/drivers/Mcu.c
arch/ppc/mpc55xx/drivers/Eep.c
arch/ppc/mpc55xx/drivers/Mcu.c
arch/ppc/mpc55xx/drivers/Spi.c
arch/ppc/mpc55xx/kernel/arch.c
boards/mpc5516it/config/Eep_Lcfg.c
boards/mpc5516it/config/Eeprom_Lcfg.c
boards/mpc5567qrtech/config/Eep_Lcfg.c
boards/mpc5567qrtech/config/Eeprom_Lcfg.c
examples/pwm_node/Hooks.c
examples/simple/simple_main.c
examples/tiny/tiny.c
include/Trace.h
makefile
peripherals/Fls_SST25xx.c
system/kernel/include/internal.h
system/kernel/init.c
system/kernel/task.c
system/kernel/testsystem/config/Os_Cfg.c
system/kernel/testsystem/os_test.h
system/kernel/testsystem/test_01_task.c
system/kernel/testsystem/test_02_resource.c
system/kernel/testsystem/test_framework.c
system/kernel/testsystem/test_master.c

index 8ef789763434af4e1cb0c4546a2567c5859eae56..7d75bbe37bd3166603e588f38be51fd353b66af6 100644 (file)
@@ -33,7 +33,7 @@
 #include "system_stm32f10x.h"
 \r
 //#define USE_TRACE 1\r
-//#define USE_DEBUG 1\r
+//#define USE_DEBUG_PRINT 1\r
 #include "Trace.h"\r
 \r
 typedef struct {\r
@@ -273,7 +273,7 @@ Std_ReturnType Mcu_InitClock(const Mcu_ClockType ClockSetting)
 \r
 \r
 \r
-#if defined(USE_DEBUG)\r
+#if defined(USE_DEBUG_PRINT)\r
   {\r
     uint32    extal = Mcu_Global.config->McuClockSettingConfig[Mcu_Global.clockSetting].McuClockReferencePointFrequency;\r
     uint32    f_sys;\r
index 29f04c8bd875b17620cce91e613312ba4b31568e..55c6d8cb82dfa642b7369bfd18dbe892960fa263 100644 (file)
@@ -24,7 +24,7 @@
 #include "Ramlog.h"\r
 \r
 #define USE_TRACE 1\r
-#define USE_DEBUG 1\r
+#define USE_DEBUG_PRINT 1\r
 #include "Trace.h"
 
 
index db1f2ad62f860adcaf17c95a0aec91a07080cc1d..2dca98e8cf13a6a98bfd3070ada20ef7333abfa5 100644 (file)
@@ -56,7 +56,7 @@
 #include <assert.h>
 #include <string.h>
 
-//#define USE_DEBUG    1
+//#define USE_DEBUG_PRINT      1
 #include "Trace.h"
 #define MODULE_NAME    "/driver/Eep"
 
index fefb85cc6040e90a6e78d4ca6b692cc6ae28a68e..af1f83a26c1bb203b54b70ea66fa991f6d43ce1d 100644 (file)
@@ -35,7 +35,7 @@
 #include "irq.h"\r
 \r
 //#define USE_TRACE 1\r
-//#define USE_DEBUG 1\r
+//#define USE_DEBUG_PRINT 1\r
 #include "Trace.h"\r
 \r
 #define SYSCLOCK_SELECT_PLL    0x2\r
@@ -345,7 +345,7 @@ Std_ReturnType Mcu_InitClock(const Mcu_ClockType ClockSetting)
 #endif\r
 \r
 \r
-#if defined(USE_DEBUG)\r
+#if defined(USE_DEBUG_PRINT)\r
   {\r
     uint32    extal = Mcu_Global.config->McuClockSettingConfig[Mcu_Global.clockSetting].McuClockReferencePointFrequency;\r
     uint32    f_sys;\r
index 2745a64cd88fbd9348ca34be648602fe1b73858a..96f412ec989adc1b60975466dca47a53031d32f8 100644 (file)
 #include <stdlib.h>
 
 //#define USE_TRACE 1
-//#define USE_DEBUG    1
+//#define USE_DEBUG_PRINT      1
 #undef DEBUG_LVL
 #define DEBUG_LVL DEBUG_HIGH
 #include "Trace.h"
@@ -1373,7 +1373,7 @@ static void Spi_SeqWrite( Spi_SequenceType seqIndex, Spi_CallTypeType sync ) {
          DEBUG(DEBUG_MEDIUM,"%s: sync/polled mode\n",MODULE_NAME);
        }
 
-#if defined(USE_DEBUG) && ( DEBUG_LVL <= DEBUG_HIGH )
+#if defined(USE_DEBUG_PRINT) && ( DEBUG_LVL <= DEBUG_HIGH )
        Spi_PrintSeqInfo( seqConfig );
 #endif
 
index 528128ad6ae35724900c33d7d989a056a7e95899..6db25bbb4a2bb56e4125c7ad420a6a6fa77dfd31 100644 (file)
@@ -17,7 +17,7 @@
 #include "mpc55xx.h"\r
 #include "asm_book_e.h"
 \r
-#define USE_DEBUG\r
+#define USE_DEBUG_PRINT\r
 #include "Trace.h"\r
 \r
 /**\r
index 3139421cb1c8764692de386397e6b688518eb8fd..95d28a27209c955ba35233c518885bedeccb4ef9 100644 (file)
@@ -26,7 +26,7 @@
 #include "Spi_Cfg.h"
 
 //#define USE_TRACE 1
-//#define USE_DEBUG    1
+//#define USE_DEBUG_PRINT      1
 #undef DEBUG_LVL
 #define DEBUG_LVL DEBUG_LOW
 #include "Trace.h"
index 21873eed2d45888f112acffdaecbb0e221d67863..39e48e9a307817662dcf22981e4ce1dc3054b333 100644 (file)
@@ -26,7 +26,7 @@
 #include "Spi_Cfg.h"
 
 //#define USE_TRACE 1
-//#define USE_DEBUG    1
+//#define USE_DEBUG_PRINT      1
 #undef DEBUG_LVL
 #define DEBUG_LVL DEBUG_LOW
 #include "Trace.h"
index 3139421cb1c8764692de386397e6b688518eb8fd..95d28a27209c955ba35233c518885bedeccb4ef9 100644 (file)
@@ -26,7 +26,7 @@
 #include "Spi_Cfg.h"
 
 //#define USE_TRACE 1
-//#define USE_DEBUG    1
+//#define USE_DEBUG_PRINT      1
 #undef DEBUG_LVL
 #define DEBUG_LVL DEBUG_LOW
 #include "Trace.h"
index 21873eed2d45888f112acffdaecbb0e221d67863..39e48e9a307817662dcf22981e4ce1dc3054b333 100644 (file)
@@ -26,7 +26,7 @@
 #include "Spi_Cfg.h"
 
 //#define USE_TRACE 1
-//#define USE_DEBUG    1
+//#define USE_DEBUG_PRINT      1
 #undef DEBUG_LVL
 #define DEBUG_LVL DEBUG_LOW
 #include "Trace.h"
index e3d43cbc895d18cc884c6c5f77f1eb9f06f4ab10..eea4fb45b41014a6111247f534ba822e0a06cf3e 100644 (file)
@@ -25,7 +25,7 @@
 #include <stdio.h>
 #include <assert.h>
 #define USE_TRACE      1
-#define USE_DEBUG 1
+#define USE_DEBUG_PRINT 1
 #include "Trace.h"
 
 /* Notification callback from channel 0 */
index 13ebccdb835662143cf2debbd46a2e52e2d929ec..e464727bea044fa2002dc77295b990c5ead219eb 100644 (file)
@@ -18,7 +18,7 @@
 #include "Mcu.h"\r
 #include "arc.h"
 \r
-#define USE_DEBUG\r
+#define USE_DEBUG_PRINT\r
 #include "Trace.h"\r
 \r
 // How many errors to keep in error log.\r
index 9944804b9ca0626743f425ce64c6bbbea23b2cf7..5f0162f44abe43cdca7b20e89d634405a6c63447 100644 (file)
@@ -18,7 +18,7 @@
 #include "Mcu.h"\r
 #include "arc.h"
 \r
-#define USE_DEBUG\r
+#define USE_DEBUG_PRINT\r
 #include "Trace.h"\r
 \r
 // How many errors to keep in error log.\r
index 61186402233be16ca982b6c6a0b96ec276f5b1f4..e04c656d013dddcfa90019809889e3e6a4a5ee26 100644 (file)
@@ -29,7 +29,7 @@
  *\r
  * Macro's for debugging and tracing\r
  *\r
- * Define USE_DEBUG and DBG_LEVEL either globally( e.g. a makefile )\r
+ * Define USE_DEBUG_PRINT and DBG_LEVEL either globally( e.g. a makefile )\r
  * or in a specific file.  The DBG_LEVEL macro controls the amount\r
  * of detail you want in the debug printout.\r
  * There are 3 levels:\r
@@ -57,7 +57,7 @@
 #define CH_ISR         0\r
 #define CH_PROC                1\r
 \r
-#if defined(USE_DEBUG)\r
+#if defined(USE_DEBUG_PRINT)\r
 #define DEBUG(_level,...) \\r
        do { \\r
                if(_level>=DEBUG_LVL) { \\r
@@ -69,7 +69,7 @@
 #define DEBUG(_level,...)\r
 #endif\r
 \r
-#if defined(USE_DEBUG)\r
+#if defined(USE_DEBUG_PRINT)\r
 #define dbg_printf(format,...) simple_printf(format,## __VA_ARGS__ )\r
 #else\r
 #define dbg_printf(format,...)\r
index 1879badd16ace11a9bd3ab2a6090702c8f26ae18..45703192a396a2aee4392e9935b90bda7273604c 100644 (file)
--- a/makefile
+++ b/makefile
@@ -36,6 +36,7 @@ Q?=@
 export Q\r
 export TOPDIR = $(CURDIR)\r
 export CFG_DEBUG ?= n\r
+export CFG_USE_DEBUG_PRINT\r
 ifeq ($(CFG_DEBUG),n)\r
 export CFG_RELEASE = y\r
 endif\r
@@ -81,6 +82,7 @@ help:
        @echo ""\r
        \r
 def-$(USE_DBG_PRINTF) += USE_DBG_PRINTF\r
+def-$(USE_DEBUG_PRINT) += USE_DEBUG_PRINT\r
 \r
 \r
 export CFG_MCU \r
index e1eec7e1c744cac8ccb2b2d43a0f645163934a84..4ecc7b59c3907f20c26d0d8395e901f10eb5c7ef 100644 (file)
@@ -62,7 +62,7 @@
 //#include <stdio.h>\r
 #include <string.h>\r
 \r
-//#define USE_DEBUG\r
+//#define USE_DEBUG_PRINT\r
 #include "Trace.h"\r
 #define MODULE_NAME    "/driver/Fls_25"\r
 \r
index 2784cf8bd95c3e66b3793bedf4c4afeaf7a7f0da..3257ad75c96ba37e74781b8b3db1daf48f16c9c1 100644 (file)
@@ -258,7 +258,12 @@ void Os_ResourceGetInternal(void );
 void Os_ResourceReleaseInternal( void );
 
 
-static inline void Os_ResourceCheckAndRelease( OsPcbType *pcb )  {
+/**
+ *
+ * @return 1 - if any resources were found.
+ */
+static inline _Bool Os_ResourceCheckAndRelease( OsPcbType *pcb )  {
+       _Bool rv = 0;
        if( !TAILQ_EMPTY(&pcb->resource_head) ) {
                OsResourceType *rPtr;
 
@@ -266,10 +271,14 @@ static inline void Os_ResourceCheckAndRelease( OsPcbType *pcb )  {
                        ReleaseResource(rPtr->nr);
                        /* Requirements are a little fuzzy here, no explicit
                         * requirement for this.
+                        *
+                        * For OSEK this is a req.
                         */
                        ERRORHOOK(E_OS_RESOURCE);
+                       rv = 1;
                }
        }
+       return rv;
 }
 
 \r
index 7bf7fc46d39aa9cd4f55cad21e9ca86caf2b2958..9a3ed0a240b50719d6ada0bb38319e5e23041cff 100644 (file)
@@ -83,7 +83,7 @@ static void os_resource_init( void ) {
                rsrc_p = Oil_GetResource(i);
                topPrio = 0;
 
-               for( int pi; pi < Oil_GetTaskCnt(); pi++) {
+               for( int pi = 0; pi < Oil_GetTaskCnt(); pi++) {
 
                        pcb_p = os_get_pcb(pi);
                        if(pcb_p->resourceAccess & (1<<i) ) {
@@ -189,7 +189,6 @@ void InitOS( void ) {
        // Init counter.. with alarms and schedule tables
        os_counter_init();
        Os_SchTblInit();
-       os_resource_init();
 
        // Put all tasks in the pcb list
        // Put the one that belong in the ready queue there
@@ -205,11 +204,15 @@ void InitOS( void ) {
                        Os_ContextInit(tmp_pcb);
                }
 
+               TAILQ_INIT(&tmp_pcb->resource_head);
+
                Os_AddTask(tmp_pcb);
 
                DEBUG(DEBUG_LOW,"pid:%d name:%s prio:%d\n",tmp_pcb->pid,tmp_pcb->name,tmp_pcb->prio);
        }
 
+       os_resource_init();
+
        // Now all tasks should be created.
 }
 
index 8ec8f822612a00f91e17075a110aa24372af4d6e..996c64b94b6ab7cdeb211652250ca363f39e2e8c 100644 (file)
@@ -43,9 +43,6 @@ void Os_TaskStartExtended( void ) {
 
        Os_ArchFirstCall();
 
-       /** @req OS070 */
-       Os_ResourceCheckAndRelease(pcb);
-
        /** @req OS239 */
        Irq_Disable();
        if( Os_IrqAnyDisabled() ) {
@@ -76,8 +73,6 @@ void Os_TaskStartBasic( void ) {
        Os_TaskMakeRunning(pcb);
        Os_ArchFirstCall();
 
-       /** @req OS070 */
-       Os_ResourceCheckAndRelease(pcb);
 
        /** @req OS239 */
        Irq_Disable();
@@ -250,7 +245,7 @@ OsPcbType *Os_TaskGetTop( void ){
 }
 
 
-#define USE_DEBUG
+#define USE_DEBUG_PRINT
 #include "Trace.h"
 
 // we come here from
@@ -514,11 +509,10 @@ StatusType ActivateTask( TaskType TaskID ) {
                         * state into ready state all its events are cleared.*/
                        pcb->ev_set = 0;
                        pcb->ev_wait = 0;
-               } else {
-                       Os_StackSetup(pcb);
-                       OsArch_SetTaskEntry(pcb);
-                       Os_ArchSetupContext(pcb);
                }
+               Os_StackSetup(pcb);
+               OsArch_SetTaskEntry(pcb);
+               Os_ArchSetupContext(pcb);
                Os_TaskMakeReady(pcb);
        } else {
 
@@ -588,15 +582,29 @@ StatusType TerminateTask( void ) {
        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;
        }
+
+       /** @req OS070 */
+       if( Os_ResourceCheckAndRelease(curr_pcb) == 1 ) {
+               rv =  E_OS_RESOURCE;
+               goto err;
+
+       }
+
+
 #endif
-\r
+
+
        Irq_Save(flags);
 
        --curr_pcb->activations;
+
+
 //     assert(curr_pcb->activations>=0);
 
        /*@req OSEK TerminateTask
@@ -604,7 +612,8 @@ StatusType TerminateTask( void ) {
         * terminating the current instance of the task automatically puts the next
         * instance of the same task into the ready state
         */
-       if( curr_pcb->activations == 0 ) {
+       if( curr_pcb->activations <= 0 ) {
+               curr_pcb->activations = 0;
                Os_TaskMakeSuspended(curr_pcb);
        } else {
                /* We need to add ourselves to the ready list again,
index bd47de9cc24e1ea3b5ddbae99dbe57f2dfa7b348..62e4aca29c7418ddd507a0f36cc28c863bd3b68f 100644 (file)
@@ -150,14 +150,14 @@ GEN_TASK_HEAD {
 /* extended */\r
        GEN_ETASK(etask_master,1,FULL,true/*auto*/, NULL/*rsrc*/, 0 ),\r
 \r
-       GEN_ETASK(etask_sup_l,2,FULL,false/*auto*/, NULL/*rsrc*/, 0 ),\r
-       GEN_ETASK(etask_sup_m,3,FULL,false/*auto*/, NULL/*rsrc*/, 0 ),\r
-       GEN_ETASK(etask_sup_h,4,FULL,false/*auto*/, NULL/*rsrc*/, 0 ),\r
+       GEN_ETASK(etask_sup_l,2,FULL,false/*auto*/, NULL/*rsrc*/, (1<<2)|(1<<3)|(1<<4) ),\r
+       GEN_ETASK(etask_sup_m,4,FULL,false/*auto*/, NULL/*rsrc*/, (1<<2)|(1<<3)|(1<<4) ),\r
+       GEN_ETASK(etask_sup_h,6,FULL,false/*auto*/, NULL/*rsrc*/, (1<<2)|(1<<3)|(1<<4) ),\r
 \r
 /* basic */\r
-       GEN_BTASK(btask_sup_l,2,FULL,false/*auto*/, NULL/*rsrc*/, 0, 1 ),\r
-       GEN_BTASK(btask_sup_m,3,FULL,false/*auto*/, NULL/*rsrc*/, 0, 1 ),\r
-       GEN_BTASK(btask_sup_h,4,FULL,false/*auto*/, NULL/*rsrc*/, 0, 1 ),\r
+       GEN_BTASK(btask_sup_l,2,FULL,false/*auto*/, NULL/*rsrc*/, (1<<2)|(1<<3)|(1<<4), 1 ),\r
+       GEN_BTASK(btask_sup_m,4,FULL,false/*auto*/, NULL/*rsrc*/, (1<<2)|(1<<3)|(1<<4), 1 ),\r
+       GEN_BTASK(btask_sup_h,6,FULL,false/*auto*/, NULL/*rsrc*/, (1<<2)|(1<<3)|(1<<4), 1 ),\r
 \r
        GEN_ISR_2(  TASK_ID_os_tick, "dec", OsTick, /*prio*/ 11,  INTC_VECTOR_EXCEPTION_DEC ),\r
 #if 0\r
index 302e7d5af8651e5a971e50f5d346febc8ded4599..2db8e751428a9c29c3ec4148e878c7de28fadc69 100644 (file)
 #ifndef OS_TEST_H_\r
 #define OS_TEST_H_\r
 \r
-#include "test_framework.h"\r
+#include "test_framework.h"
+#include "Trace.h"\r
 \r
 typedef void (*test_func_t)( void );\r
 \r
 #define TEST_FAIL(_text)               test_fail((_text),  __FILE__,  __LINE__, __FUNCTION__ )\r
 #define TEST_OK()                              test_ok();\r
-#define TEST_ASSERT(_cond)                     if(!(_cond)) { TEST_FAIL(#_cond); }\r
+#define TEST_ASSERT(_cond)                     if(!(_cond)) { TEST_FAIL(#_cond); }
+#define TEST_RUN()                             dbg_printf("Running test %d\n",test_nr);
+\r
 \r
 extern int test_suite;\r
 extern int test_nr;
@@ -41,6 +44,15 @@ extern int test_nr;
 \r
 #define SECTION_BSS_SUPER      __attribute__ ((aligned (16),section(".bss")))\r
 #define SECTION_BSS_USER       __attribute__ ((aligned (16),section(".bss")))\r
+
+#define OS_STR__(x)            #x
+#define OS_STRSTR__(x)         OS_STR__(x)
+
+#define DECLARE_TEST_BTASK(_nr, _task1, _task2, _task3 ) \
+               __attribute__ ((section (".test_btask"))) const test_func_t btask_sup_matrix_ ## _nr[3] = { _task1, _task2, _task3 }
+
+#define DECLARE_TEST_ETASK(_nr, _task1, _task2, _task3 ) \
+               __attribute__ ((section (".test_etask"))) const test_func_t etask_sup_matrix_ ## _nr[3]  = { _task1, _task2, _task3 }
 \r
 #define DECLARE_TASKS(_nr) \\r
        void etask_sup_l_##_nr( void ); \\r
index 6875335b528229ebf5f57466d067fbd1ea31702b..bd6ffc03e7bcdd167534f3f94d102f51fb5e3584 100644 (file)
@@ -37,6 +37,8 @@
 \r
 int btaskRunCnt = 0;\r
 \r
+static int status_100 = 0;\r
+\r
 void isr_l(void ) {\r
        StatusType rv;\r
        switch(test_nr) {\r
@@ -58,6 +60,8 @@ void etask_sup_l_01(void) {
        StatusType rv;\r
 \r
        while (!done) {\r
+               TEST_RUN();\r
+\r
                switch (test_nr) {\r
                case 1:\r
                        /*@req E_OS_ID ActivateTask */\r
@@ -81,9 +85,11 @@ void etask_sup_l_01(void) {
                case 10:\r
                        /*@req E_OS_RESOURCE TerminateTask\r
                         * Terminate a task that still holds resources\r
-                        * */\r
-                       rv = ActivateTask(TASK_ID_btask_sup_h);\r
+                        * This is done in the TASK_ID_btask_sup_m task..\r
+                        */\r
+                       rv = ActivateTask(TASK_ID_btask_sup_m);\r
                        TEST_ASSERT(rv == E_OK);\r
+                       test_nr++;\r
                        break;\r
                case 11:\r
                        /*@req E_OS_CALLEVEL TerminateTask */\r
@@ -97,7 +103,7 @@ void etask_sup_l_01(void) {
                        /*@req E_OS_ID ChainTask */\r
                        rv = ChainTask(TASK_ID_ILL);\r
                        TEST_ASSERT(rv == E_OS_ID);\r
-                       test_nr++;\r
+                       test_nr = 100;\r
                case 21:\r
                        /*@req E_OS_LIMIT ChainTask */\r
                case 22:\r
@@ -113,20 +119,35 @@ void etask_sup_l_01(void) {
                        break;\r
 \r
                case 100:\r
-                       /*@req Scheduler test\r
-                        * The first task(oldest) task of the same priority should be scheduled first\r
-                        * E.g. From M task do ActivateTask()\r
-                        */\r
-                       /* Change to higher prio */\r
+                       /* Check that tasks as run in priority order and that the oldest task\r
+                        * of the same priority should be scheduled first.\r
+                        * 1. esup_l: Activate(sup_m)\r
+                        * 2. bsup_m: Activate(sup_l)  (should not be taken)\r
+                        * 3. bsup_m: Activate(sup_h)  (taken)\r
+                        * 4. bsup_h: Terminate()\r
+                        *   (We should now have bsup_m, esup_l, bsup_l )\r
+                        * 5. bsup_m: Terminate()\r
+                        * 6. esup_l : Terminate()\r
+                        * 7. bsup_l : Activate(esup_l)  (found by dispatcher)\r
+                        * 8. esup_l:  Back again!!!!\r
+                        *\r
+                        * */\r
+                       if(status_100==6) {\r
+                               test_nr=101;\r
+                               break;\r
+                       }\r
                        btaskRunCnt = 0;\r
                        rv = ActivateTask(TASK_ID_btask_sup_m);\r
-                       /* We got back from M, btask_l is now ready in queue */\r
-                       TEST_ASSERT(btaskRunCnt==0);\r
-                       /* Terminate ourselves, to be activated later */\r
-                       TerminateTask();\r
+                       TEST_ASSERT(status_100=3);\r
+                       status_100=4;\r
+                       TerminateTask();  // Step 6.\r
+\r
+                       // Should never get here since we have restarded ourselves.\r
+                       assert(0);\r
                        break;\r
                case 101:\r
-                       TEST_ASSERT(btaskRunCnt==1);\r
+                       /* End Testing of this module */\r
+                       TerminateTask();\r
                        break;\r
                default:\r
                        while(1);\r
@@ -139,8 +160,11 @@ void btask_sup_l_01( void ) {
        case 100:\r
                btaskRunCnt++;\r
                /* Make it go up again */\r
-               test_nr = 101;\r
-               ActivateTask(TASK_ID_etask_sup_l);\r
+               TEST_ASSERT(status_100=4);\r
+               status_100=5;\r
+               ActivateTask(TASK_ID_etask_sup_l);  // Step 7.\r
+               TEST_ASSERT(status_100=5);\r
+               status_100=6;\r
                break;\r
        default:\r
                break;\r
@@ -153,6 +177,7 @@ void btask_sup_m_01( void ) {
        switch(test_nr){\r
        case 2:\r
                btaskRunCnt++;\r
+               TerminateTask();\r
                break;\r
        case 10:\r
                rv = GetResource(RES_ID_ext_prio_3);\r
@@ -162,11 +187,19 @@ void btask_sup_m_01( void ) {
                TEST_ASSERT(rv==E_OS_RESOURCE);\r
 \r
                rv = ReleaseResource(RES_ID_ext_prio_3);\r
+               TEST_ASSERT(rv==E_OK);\r
                TerminateTask();\r
                break;\r
        case 100:\r
                /* We got here from etask_l, so it should be oldest */\r
                rv = ActivateTask(TASK_ID_btask_sup_l);\r
+               TEST_ASSERT(rv==E_OK);\r
+               TEST_ASSERT(status_100==0);\r
+               status_100=1;\r
+               rv = ActivateTask(TASK_ID_btask_sup_h);\r
+               TEST_ASSERT(rv==E_OK);\r
+               TEST_ASSERT(status_100==2);\r
+               status_100=3;\r
                break;\r
        default:\r
                while(1);\r
@@ -195,12 +228,16 @@ void btask_sup_h_01(void) {
                 *           Oldest is scheduled first..\r
                 * */\r
                break;\r
+       case 100:\r
+               TEST_ASSERT(status_100==1);\r
+               status_100=2;\r
+               break;\r
        default:\r
                while(1);\r
 \r
        }\r
 }\r
 \r
-__attribute__ ((section (".test_btask"))) const test_func_t btask_sup_matrix_01[3] = { btask_sup_l_01, btask_sup_m_01, btask_sup_h_01 };\r
-__attribute__ ((section (".test_etask"))) const test_func_t etask_sup_matrix_01[3] = { etask_sup_l_01, NULL, NULL };\r
+DECLARE_TEST_ETASK(01, etask_sup_l_01, NULL, NULL );\r
+DECLARE_TEST_BTASK(01, btask_sup_l_01, btask_sup_m_01, btask_sup_h_01);\r
 \r
index 51566029ee46d9c4d46a07f33bded5a51675b94f..9dd784891a0612b70fdbd7c0896c4dad23c0acc0 100644 (file)
  * Limitations:\r
  * - Internal resources.\r
  */\r
+\r
+#include "Os.h"\r
+#include "os_test.h"\r
+#include "arc.h"\r
+\r
+\r
+void etask_sup_l_02(void) {\r
+       _Bool done = 0;\r
+       StatusType rv;\r
+\r
+       while (!done) {\r
+               TEST_RUN();\r
+               switch (test_nr) {\r
+               case 1:\r
+                       rv = GetResource(RES_ID_ext_prio_3);\r
+                       TEST_ASSERT(rv == E_OK);\r
+                       rv = ReleaseResource(RES_ID_ext_prio_3);\r
+                       TEST_ASSERT(rv == E_OK);\r
+                       test_nr++;\r
+                       break;\r
+               case 2:\r
+                       /* Get the same resource twice */\r
+                       rv = GetResource(RES_ID_ext_prio_3);\r
+                       TEST_ASSERT(rv == E_OK);\r
+                       rv = GetResource(RES_ID_ext_prio_3);\r
+                       TEST_ASSERT(rv == E_OK);\r
+                       break;\r
+\r
+               }\r
+       }\r
+}\r
+\r
+void btask_sup_l_02(void) {\r
+}\r
+\r
+\r
+DECLARE_TEST_ETASK(02, etask_sup_l_02, NULL, NULL );\r
+DECLARE_TEST_BTASK(02, btask_sup_l_02, NULL, NULL );\r
index eb249592116aa95214b3176033adb78dc3bbf019..5d7a06ed403ea6e2c7db4de98cffcd7f705797f9 100644 (file)
@@ -17,7 +17,7 @@
 #include "Platform_Types.h"
 #include "simple_printf.h"
 \r
-#define USE_DEBUG\r
+#define USE_DEBUG_PRINT\r
 #include "Trace.h"\r
 \r
 int test_suite = 1;\r
index 780f6542d89d1c5db4b91c48bd50b9dd6724be7c..29c385fb660d914471469dd8abe628a9414b3eae 100644 (file)
@@ -22,7 +22,7 @@
 #endif\r
 #include "simple_printf.h"
 \r
-#define USE_DEBUG\r
+#define USE_DEBUG_PRINT\r
 #include "Trace.h"
 #include "arc.h"\r
 \r