]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Merge with krn-v2
authormahi <>
Tue, 23 Feb 2010 10:02:18 +0000 (10:02 +0000)
committermahi <>
Tue, 23 Feb 2010 10:02:18 +0000 (10:02 +0000)
20 files changed:
common/newlib_port.c
common/ramlog.c
common/strace.c
common/xtoa.c
examples/simple/config/Os_Cfg.c
examples/tiny/config/Os_Cfg.c
include/Os.h
include/os_config_macros.h
makefile
scripts/cc_gcc.mk
system/kernel/counter.c
system/kernel/include/alarm_i.h
system/kernel/include/counter_i.h
system/kernel/include/sched_table_i.h
system/kernel/init.c
system/kernel/os_arctest.c
system/kernel/sched_table.c
system/kernel/testsystem/config/Os_Cfg.c
system/kernel/testsystem/config/Os_Cfg.h
system/kernel/testsystem/os_test.h

index 1952c2ec323c976bcb30847a77eebf317e884304..1c8fb5e38eb6ae8260fc5e6941f09f50877412e0 100644 (file)
@@ -158,9 +158,11 @@ int open(const char *name, int flags, int mode){
        (void)flags;
        (void)mode;
 
+#if defined(USE_RAMLOG)
        if( strcmp(name,"ramlog") == 0 ) {
                return FILE_RAMLOG;
        }
+#endif
 
     return -1;
 }
index daa3d9faa26d882ed1cd9d5fc4edf8f3c04a52dc..2409df3a7c5fc124f1e371624b2a6b305c14e4f6 100644 (file)
  * for more details.
  * -------------------------------- Arctic Core ------------------------------*/
 
+/**
+ * A very simple ramlog.
+ *
+ * Features:
+ * - Prints to a ram space in section ".ramlog"
+ * - The size is configurable using CFG_RAMLOG_SIZE (default is 1000)
+ * - The ramlog section should not be cleared by the linkfile if one wants
+ *   to have a ramlog that survives reset.
+ *
+ * Assumes some c-lib support:
+ * - The clib support should be able to open a file called "ramlog".
+ * - Printing to that file will print to the ramlog.
+ *
+ */
+
 #include <stdio.h>
 #include <stdarg.h>
 #include "simple_printf.h"
@@ -29,6 +44,10 @@ static unsigned ramlog_session __attribute__ ((section (".ramlog")));
 static FILE *ramlogFile = 0;
 
 
+/**
+ * Print a char to the ramlog
+ * @param c
+ */
 void ramlog_chr( char c ) {
   ramlog[ramlog_curr++] = c;
   if( ramlog_curr >= CFG_RAMLOG_SIZE ) {
@@ -36,6 +55,10 @@ void ramlog_chr( char c ) {
   }
 }
 
+/**
+ * Print a string to the ramlog
+ * @param str
+ */
 void ramlog_puts( char *str ) {
 
   while(*str!=0) {
@@ -44,6 +67,11 @@ void ramlog_puts( char *str ) {
   ramlog_chr('\n');
 }
 
+/**
+ * Formatted print for the ramlog.
+ *
+ * @param format The format string.
+ */
 void ramlog_printf( const char *format, ... ) {
 
        // Fast and ugly ramlog support.
@@ -55,6 +83,10 @@ void ramlog_printf( const char *format, ... ) {
        va_end(args);
 }
 
+
+/**
+ * Initialize the ramlog. Must be called before any other ramlog functions.
+ */
 void ramlog_init()
 {
        char buf[32];
index a9ceaf55a125f1a78de0e44de5c65bf6e802b50f..b3d59dcd6fb5f72dbecce4739bb8667183e5ed97 100644 (file)
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * for more details.
  * -------------------------------- Arctic Core ------------------------------*/
-
-
-
-
-
-
-
-
 /*\r
  * strace.c\r
  *\r
@@ -29,7 +21,6 @@
  * System trace...\r
  * Idea to trace\r
  *\r
- *\r
  * Inspiration:\r
  *   http://ltt.polymtl.ca/tracingwiki/index.php/TracingBook\r
  *   http://developer.apple.com/tools/performance/optimizingwithsystemtrace.html\r
index 132319c638373957728617b0d7c5eede5c17acd6..1634baaeae357751a8c2230fdd86defed1edd239 100644 (file)
  * for more details.
  * -------------------------------- Arctic Core ------------------------------*/
 
+#include <stdlib.h>
+/**
+ * K & R itoa
+ */
 
+void strreverse(char* begin, char* end) {
 
+       char c;
 
+       while (end > begin) {
+               c = *end;
+               *end-- = *begin;
+               *begin++ = c;
+       }
+}
 
+/**
+ * Convert a number to a string
+ *
+ * @param val          The value to convert
+ * @param str          Pointer to a space where to put the string
+ * @param base         The base
+ * @param negative     If negative or not.
+ */
+void xtoa( unsigned long val, char* str, int base, int negative) {
+       static char num[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+       char* wstr = str;
+       int value = (int) val;
+
+       div_t res;
+
+       // Validate base
+       if (base < 2 || base > 35) {
+               *wstr = '\0';
+               return;
+       }
+
+       // Check sign
+       if (negative) {
+               value = -value;
+       }
+
+       do {
+               res = div(value, base);
+               *wstr++ = num[res.rem];
+       } while ((value = res.quot));
 
+       if (negative)
+               *wstr++ = '-';
 
+       *wstr = '\0';
+
+       // Reverse string
+       strreverse(str, wstr - 1);
+}
+
+/**
+ * Converts an unsigned long to a string
+ *
+ * @param value  The value to convert
+ * @param str    Pointer to the string
+ * @param base   The base
+ */
+void ultoa(unsigned long value, char* str, int base) {
+       xtoa(value, str, base, 0);
+}
+
+/**
+ * Converts an integer to a string
+ *
+ * @param value The value to convert
+ * @param str   Pointer to the string to write to
+ * @param base  The base
+ */
+void itoa(int value, char* str, int base) {
+       xtoa(value, str, base, (value < 0));
+}
 
-\r
-#include <stdlib.h>\r
-/**\r
- * Ansi C "itoa" based on Kernighan & Ritchie's "Ansi C"\r
- * with slight modification to optimize for specific architecture:\r
- */\r
-\r
-void strreverse(char* begin, char* end) {\r
-\r
-  char aux;\r
-\r
-  while (end > begin) {\r
-    aux = *end, *end-- = *begin, *begin++ = aux;\r
-  }\r
-}\r
-\r
-\r
-// int to string\r
-void xtoa(unsigned long val, char* str, int base,int negative) {\r
-  static char num[] = "0123456789abcdefghijklmnopqrstuvwxyz";\r
-  char* wstr = str;\r
-  int value = (int)val;\r
-\r
-  div_t res;\r
-\r
-  // Validate base\r
-  if (base < 2 || base > 35) {\r
-    *wstr = '\0';\r
-    return;\r
-  }\r
-\r
-  // Check sign\r
-  if ( negative ) {\r
-    value = -value;\r
-  }\r
-\r
-  do {\r
-    res = div(value, base);\r
-    *wstr++ = num[res.rem];\r
-  } while ((value = res.quot));\r
-\r
-  if (negative)\r
-    *wstr++ = '-';\r
-\r
-  *wstr = '\0';\r
-\r
-  // Reverse string\r
-  strreverse(str, wstr - 1);\r
-}\r
-\r
-\r
-// unsigned long to string\r
-void ultoa(unsigned long value, char* str, int base) {\r
-  xtoa(value,str,base,0);\r
-}\r
-\r
-// int to string\r
-void itoa(int value, char* str, int base) {\r
-  xtoa(value,str,base,(value<0));\r
-}\r
-\r
index 04ed730a688b123b33dca7d157873857a6034c37..41dfe55c02e70235d5a94158d89ef792721eb39f 100644 (file)
@@ -113,10 +113,12 @@ CounterType Os_Arc_OsTickCounter = COUNTER_ID_OsTick;
 \r
 // --- ALARMS ---\r
 #define ALARM_USE\r
+
+GEN_ALARM_AUTOSTART( 0, ALARM_AUTOSTART_ABSOLUTE, 100, 10, OSDEFAULTAPPMODE );
 \r
 GEN_ALARM_HEAD {\r
        GEN_ALARM(      0,"Alarm1",COUNTER_ID_OsTick,
-                               1,100,10,0,             /*active,start,cycle,app_mask */\r
+                               GEN_ALARM_AUTOSTART_NAME(0),\r
                                ALARM_ACTION_SETEVENT, TASK_ID_etask_1, 2, 0 ),\r
 };\r
 \r
index 984b8cd484562ff4f00b4aa560cd8713ec41900f..dfce64b502bc030ab842d28a4a467647a9e7f259 100644 (file)
@@ -15,9 +15,9 @@
 
 #include <stdlib.h>
 #include <stdint.h>
-#include "os_config_macros.h"
 #include "Platform_Types.h"
 #include "Os.h"                                // includes Os_Cfg.h
+#include "os_config_macros.h"
 #include "kernel.h"
 #include "kernel_offset.h"
 #include "alist_i.h"
@@ -104,11 +104,13 @@ CounterType Os_Arc_OsTickCounter = COUNTER_ID_OsTick;
 // --- ALARMS ---\r
 #define ALARM_USE\r
 \r
-GEN_ALARM_HEAD {\r
-       GEN_ALARM(      0,"Alarm_4ms",COUNTER_ID_OsTick,\r
-                               1,100,2,0,              /*active,start,cycle,app_mask */\r
-                               ALARM_ACTION_SETEVENT, TASK_ID_etask_1, 2, 0 ),\r
-};\r
+GEN_ALARM_AUTOSTART( 0, ALARM_AUTOSTART_ABSOLUTE, 100, 2 , OSDEFAULTAPPMODE );
+
+GEN_ALARM_HEAD {
+       GEN_ALARM(      0,"Alarm_4ms",COUNTER_ID_OsTick,
+                               GEN_ALARM_AUTOSTART_NAME(0),
+                               ALARM_ACTION_SETEVENT, TASK_ID_etask_1, 2, 0 ),
+};
 \r
 // --- SCHEDULETABLES ---\r
 \r
index 38e511ea8b74daf5066c24ee885ea42d42fbf2c3..4bcadec63d3727df742eae52ab25afe70098ae9f 100644 (file)
@@ -44,7 +44,8 @@ typedef enum {
 typedef TaskStateType *TaskStateRefType;\r
 \r
 /* FIXME: OSMEMORY_IS__ , see 8.2*/\r
-\r
+
+#define OSDEFAULTAPPMODE  1\r
 \r
 #define INVALID_OSAPPLICATION (-1)\r
 \r
index a821232fc38ab1a99286e4ecd6eebc2cae1a0cef..b739d8ba9c31bb26bf9fd441df8c186d76228f59 100644 (file)
  * for more details.
  * -------------------------------- Arctic Core ------------------------------*/
 
+/* Configure "rules"
+ * - Don't pollute the namespace with the generator tools. The tools should
+ *   ONLY know the GEN_xxx macros.
+ * - If something is a container with multiplicity 1 and above, make it a pointer.
+ * - ...
+ */
+
 #ifndef _OS_CONFIG_MACROS_H\r
 #define _OS_CONFIG_MACROS_H\r
 \r
        // For now...
        .driver.OsGptChannelRef = _gpt_ch
 #endif
+
+
+#define        GEN_ALARM_AUTOSTART_NAME(_id)    &(Os_AlarmAutoStart_ ## _id)
+
+/**
+ * _id
+ * _type
+ * _alarms_time
+ * _cycle_time
+ * _app_mode
+ */
+#define GEN_ALARM_AUTOSTART(_id, _type, _alarm_time, _cycle_time, _app_mode ) \
+               const OsAlarmAutostartType Os_AlarmAutoStart_ ## _id = \
+               { \
+                       .autostartType = _type, \
+                       .alarmTime = _alarm_time, \
+                       .cycleTime = _cycle_time, \
+                       .appModeRef = _app_mode \
+               }
 \r
 #define GEN_ALARM_HEAD OsAlarmType alarm_list[] =\r
 
  * _counter_id
  *    The id of the counter to drive the alarm
  *
- * _autostart_active
- *     If the alarm should be auto-started.
- *
- * _autostart_alarmtime
- *     Only used if active = 1
- *
- * _autostart_cycletime
- *     Only used if active = 1
- *
- * _autostart_application_mode_mask
- *     Set to 0 for now
+ * _autostart_ref
  *
  * _X_type       - Any of:
  *                                     ALARM_ACTION_ACTIVATETASK
  * _X_counter_id - The counter ID if type is ALARM_ACTION_INCREMENTCOUNTER
  *
  */
-#define GEN_ALARM( _id, _name, _counter_id,    \\r
-                       _autostart_active,                              \\r
-                       _autostart_alarmtime,                   \\r
-                       _autostart_cycletime,                   \\r
-                       _autostart_application_mode_mask,\\r
+#define GEN_ALARM( _id, _name, _counter_id,    \
+                   _autostart_ref,                 \\r
                        _action_type,                                   \\r
                        _action_task_id,                                \\r
                        _action_event_id,                               \\r
        .name = _name,                                                  \\r
        .counter = &counter_list[_counter_id],  \\r
        .counter_id = _counter_id,                              \\r
-       .autostart = {                                                  \\r
-               .active = _autostart_active,            \\r
-               .alarmtime = _autostart_alarmtime,      \\r
-               .cycletime = _autostart_cycletime,      \\r
-               .appmode_mask = _autostart_application_mode_mask,       \\r
-       },                                                                              \\r
+       .autostartPtr = _autostart_ref,            \\r
        .action = {                                                             \\r
                .type = _action_type,                           \\r
                .task_id = _action_task_id,                     \\r
                .event_id = _action_event_id,           \\r
                .counter_id = _action_counter_id        \\r
        },                                                                              \\r
-}\r
+}
+
+/*\r
+ *---------------------- SCHEDULE TABLES -----------------------------------
+ */
+
+#define GEN_SCHTBL_EXPIRY_POINT_HEAD(_id ) \
+               OsScheduleTableExpiryPointType Os_SchTblExpPointList_##_id[] =
+
+#define GEN_SCHTBL_EXPIRY_POINT_W_TASK_EVENT(_id, _offset )                                                                            \
+       {                                                                                                                                                       \
+               .offset      = _offset,                                                                                                 \
+               .taskList    = Os_SchTblTaskList_ ## _id ## _ ## _offset,                               \
+               .taskListCnt = ARRAY_SIZE(Os_SchTblTaskList_ ## _id ## _ ## _offset),   \
+               .eventList   = Os_SchTblEventList_ ## _id ## _ ## _offset,                              \
+               .eventListCnt    = ARRAY_SIZE(Os_SchTblEventList_ ## _id ## _ ## _offset)       \
+       }
+
+#define GEN_SCHTBL_EXPIRY_POINT_W_TASK(_id, _offset )                                                  \
+       {                                                                                                                                                       \
+               .offset      = _offset,                                                                                                 \
+               .taskList    = Os_SchTblTaskList_ ## _id ## _ ## _offset,                               \
+               .taskListCnt = ARRAY_SIZE(Os_SchTblTaskList_ ## _id ## _ ## _offset),   \
+       }
+
+#define GEN_SCHTBL_EXPIRY_POINT_W_EVENT(_id, _offset )                                                         \
+       {                                                                                                                                                       \
+               .offset      = _offset,                                                                                                 \
+               .eventList   = Os_SchTblEventList_ ## _id ## _ ## _offset,                              \
+               .eventListCnt    = ARRAY_SIZE(Os_SchTblEventList_ ## _id ## _ ## _offset)       \
+       }
+
+#define        GEN_SCHTBL_TASK_LIST_HEAD( _id, _offset ) \
+               const TaskType Os_SchTblTaskList_ ## _id ## _ ## _offset[] =
+
+#define        GEN_SCHTBL_EVENT_LIST_HEAD( _id, _offset ) \
+               const OsScheduleTableEventSettingType Os_SchTblEventList_ ## _id ## _ ## _offset[] =
+
+#define GEN_SCHTBL_AUTOSTART(_id, _type, _offset, _app_mode ) \
+               const struct OsSchTblAutostart Os_SchTblAutoStart_ ## _id = \
+               { \
+                       .type = _type, \
+                       .offset = _offset, \
+                       .appMode = _app_mode, \
+               }
+
+#define GEN_SCHTBL_AUTOSTART_NAME(_id) &(Os_SchTblAutoStart_ ## _id)
 \r
-#define GEN_SCHEDULETABLE_HEAD OsSchTblType sched_list[] =\r
-#define GEN_SCHEDULETABLE(  _id, _name, _counter, _repeating, _length, _application_mask, \\r
-                                                       _action_cnt, _action_expire_ref, \\r
-                                                       _autostart_active, _autostart_type, _autostart_rel_offset, _autostart_appmode, \\r
-                                                       _sync_strategy, _sync_explicit_precision , \\r
-                                                       _adj_max_advance,_adj_max_retard  ) \\r
-{                                                                                              \\r
-       .name = _name,                                          \\r
-       .counter = &counter_list[_counter],     \\r
-       .repeating = _repeating,                        \\r
-       .length = _length,                                      \\r
-       .app_mask = _application_mask,          \\r
-       .action_list = SA_LIST_HEAD_INITIALIZER(_action_cnt,_action_expire_ref), \\r
-       .autostart = { \\r
-               .active = _autostart_active,            \\r
-               .type = _autostart_type,        \\r
-               .relOffset = _autostart_rel_offset,     \\r
-               .appModeRef = _autostart_appmode,       \\r
-       }, \\r
-       .sync = { \\r
-               .syncStrategy = _sync_strategy,         \\r
-               .explicitPrecision = _sync_explicit_precision,  \\r
-       }, \\r
-       .adjExpPoint = { \\r
-               .maxAdvance = _adj_max_advance,         \\r
-               .maxRetard = _adj_max_retard,   \\r
-       } \\r
-}\r
+#define GEN_SCHTBL_HEAD OsSchTblType sched_list[] =
+
+/**
+ * _id
+ *    NOT USED
+ *
+ * _name
+ *    Name of the alarm, string
+ *
+ * _counter_ref
+ *    Pointer to the counter that drives the table
+ *
+ * _repeating
+ *   SINGLE_SHOT or REPEATING
+ *
+ * _duration
+ *   The duration of the schedule table
+ *
+ * _autostart_ref
+ *   Pointer to autostart configuration.
+ *   If autostart is desired set name to GEN_SCHTBL_AUTOSTART_NAME(<id>). It also
+ *   requires that GEN_SCHTBL_AUTOSTART(...) is set.
+ *   Set to NULL if not autostart configuration is desired.
+ *
+ * The usage of the macro requires that GEN_SCHTBL_EXPIRY_POINT_HEAD(<id>) is also
+ * set.
+ */
+
+#define GEN_SCHEDULETABLE(  _id, _name, _counter_id, _repeating, \
+                                                       _duration,       \
+                                                       _autostart_ref ) \
+{                                                                                       \
+       .name = _name,                                               \
+       .counter = &counter_list[_counter_id],       \
+       .repeating = _repeating,                             \
+       .duration = _duration,                                   \
+       .expirePointList = {                     \
+         .data = (void *)( Os_SchTblExpPointList_ ## _id ), \
+         .cnt = ARRAY_SIZE(Os_SchTblExpPointList_ ## _id), \
+        }, \
+       .autostartPtr = _autostart_ref,                          \
+}
+
 
 #if (  OS_SC3 == STD_ON) || (  OS_SC4 == STD_ON)
-#error BEPA
+#error OLD or NOT implemented
 #define GEN_HOOKS( _startup, _protection, _shutdown, _error, _pretask, _posttask ) \\r
 struct OsHooks os_conf_global_hooks = { \\r
                .StartupHook = _startup,                \
index 250946191401cb9a6afe0700008b71f527405445..389009a10b6c5f1e5b96b31e6c258c822eb55085 100644 (file)
--- a/makefile
+++ b/makefile
@@ -35,8 +35,8 @@ USE_DBG_PRINTF?=y
 Q?=@\r
 export Q\r
 export TOPDIR = $(CURDIR)\r
-export CFG_RELEASE = n\r
-export CFG_DEBUG = y\r
+export CFG_RELEASE = y\r
+export CFG_DEBUG = n\r
 export PATH\r
 \r
 ifneq ($(filter clean_all,$(MAKECMDGOALS)),clean_all)\r
index d9039a8c3b3d2ce7a5aec9d246e834f40e36e4e5..8483d48cf98c0f81df3e89e99523b5f2f84debf0 100644 (file)
@@ -19,6 +19,8 @@ cflags-$(CFG_DEBUG) += -O0
 #cflags-y += -O0\r
 #cflags-y += -O3\r
 \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
@@ -89,6 +91,7 @@ TE = elf
 LDMAPFILE = -M > $(subst .$(TE),.map, $@)\r
 \r
 libitem-y += $(libitem-yy)\r
+#LDFLAGS += --gc-section\r
 \r
 # ---------------------------------------------------------------------------\r
 # Assembler\r
index 150f6a7b4be18f6abe60448132865062ccada6e5..ae367a57284a34b50fe5a08858e248bd89a687e0 100644 (file)
@@ -36,7 +36,7 @@ static inline OsSchTblAdjExpPointType *getAdjExpPoint( OsSchTblType *stblPtr ) {
 \r
 \r
 static inline struct OsSchTblAutostart *getAutoStart( OsSchTblType *stblPtr ) {\r
-       return &stblPtr->autostart;\r
+       return stblPtr->autostartPtr;\r
 }\r
 
 #if ( OS_SC2 == STD_ON ) || ( OS_SC4 == STD_ON )\r
@@ -102,79 +102,6 @@ static void check_alarms( OsCounterType *c_p ) {
        }\r
 }\r
 \r
-/**\r
- * Go through the schedule tables connected to this counter\r
- *
- * @param c_p Pointer to counter object
- */\r
-
-/** @req OS002 */
-/** @req OS007 */
-static void check_stbl(OsCounterType *c_p) {
-       OsSchTblType *sched_obj;\r
-\r
-       /* Iterate through the schedule tables */\r
-       SLIST_FOREACH(sched_obj,&c_p->sched_head,sched_list) {\r
-\r
-               if( sched_obj->state == SCHEDULETABLE_STOPPED ) {\r
-                       continue;\r
-               }\r
-
-#if ( OS_SC2 == STD_ON ) || ( OS_SC4 == STD_ON )\r
-               if( sched_obj->sync.syncStrategy == IMPLICIT ) {\r
-                       // ....\r
-\r
-               } else {\r
-                       int adj;\r
-                       // Handle EXPLICIT\r
-                       if( sched_obj->sync.deviation > 0 ) {\r
-                               // The sync counter was set back ==\r
-                               // we have more time to complete the table\r
-                               adj = MIN(sched_obj->sync.deviation, getAdjExpPoint(sched_obj)->maxAdvance );\r
-                               sched_obj->sync.deviation -= adj;\r
-\r
-                       } else if( sched_obj->sync.deviation < 0 ) {\r
-                               // The sync counter was set forward ==\r
-                               // we have less time to complete the table\r
-                               adj = MIN((-sched_obj->sync.deviation), getAdjExpPoint(sched_obj)->maxRetard);\r
-                               sched_obj->sync.deviation -= adj;\r
-\r
-                       } else {\r
-                               // all is well\r
-                               sched_obj->state = SCHEDULETABLE_RUNNING_AND_SYNCHRONOUS;\r
-                       }\r
-               }\r
-#endif
-\r
-               /* Check if the expire point have been hit */\r
-               if( (sched_obj->state == SCHEDULETABLE_RUNNING ||\r
-                               SCHEDULETABLE_RUNNING_AND_SYNCHRONOUS ) &&\r
-                               (c_p->val >= sched_obj->expire_val) )
-               {\r
-                       OsScheduleTableActionType * action;\r
-\r
-                       action = SA_LIST_GET(&sched_obj->action_list,sched_obj->expire_curr_index);\r
-\r
-                       switch( action->type ) {
-                       case SCHEDULE_ACTION_ACTIVATETASK:
-                               ActivateTask(action->task_id);
-                               break;
-
-                       case SCHEDULE_ACTION_SETEVENT:
-                               SetEvent( action->task_id, action->event_id);
-                               break;
-
-                       default:
-                               /** @req OS407 */
-                               assert(0);
-               }\r
-                       // Calc new expire val\r
-                       Os_SchTblCalcExpire(sched_obj);\r
-               }\r
-\r
-       }\r
-}\r
-\r
 \r
 /**\r
  * Increment a counter. Checks for wraps.\r
@@ -227,13 +154,14 @@ StatusType IncrementCounter( CounterType counter_id ) {
        IncCounter(counter);\r
 \r
        check_alarms(counter);\r
-       check_stbl(counter);\r
+       Os_SchTblCheck(counter);\r
 
        /** @req OS321 */\r
        COUNTER_STD_END;\r
 }\r
 \r
-\r
+
+/** @req OS383 */\r
 StatusType GetCounterValue( CounterType counter_id , TickRefType tick_ref)\r
 {
        StatusType rv = E_OK;\r
@@ -264,7 +192,8 @@ StatusType GetCounterValue( CounterType counter_id , TickRefType tick_ref)
 \r
        COUNTER_STD_END;
 }\r
-\r
+
+/** @req OS392 */\r
 StatusType GetElapsedCounterValue( CounterType counter_id, TickRefType val, TickRefType elapsed_val)\r
 {
        StatusType rv = E_OK;\r
@@ -287,7 +216,8 @@ StatusType GetElapsedCounterValue( CounterType counter_id, TickRefType val, Tick
 
        GetCounterValue(counter_id,&tick);
 
-#warning missing....OS382
+       /** @req OS382 */
+       *elapsed_val = tick - *val;
 
        COUNTER_STD_END;
 }\r
@@ -321,7 +251,7 @@ void OsTick( void ) {
        //      os_sys.tick = c_p->val;
 
                check_alarms(c_p);
-               check_stbl(c_p);
+               Os_SchTblCheck(c_p);
        }
 }\r
 \r
index 198752bc3f161fb1a4e49ffd449bfae822c87266..19045ee53fe6dc65c8398a5762f68042f4b5e10b 100644 (file)
@@ -59,17 +59,26 @@ typedef struct OsAlarmAction {
        CounterType             counter_id;\r
 } OsAlarmActionType;\r
 
+
+enum OsAlarmAutostartTypeType {
+       // Start with SetAbsAlarm()
+       ALARM_AUTOSTART_ABSOLUTE,
+       // Start with SetRelAlarm()
+       ALARM_AUTOSTART_RELATIVE,
+};
+
+
 /* STD container : OsAlarmAutostart
  * OsAlarmAlarmTime:                   1    Int
  * OsAlarmAutoStartType:               1    Int, ABSOLUTE, RELATIVE
  * OsAlarmCycleTime:                   1    Int
  * OsAlarmAppModeRef:                  1..*
  */\r
-typedef struct OsAlarmAutostart {\r
-       _Bool  active;\r
-       uint32 alarmtime;\r
-       uint32 cycletime;\r
-       uint32 appmode_mask;\r
+typedef struct OsAlarmAutostart {
+       uint32 alarmTime;
+       enum OsAlarmAutostartTypeType autostartType;\r
+       uint32 cycleTime;\r
+       uint32 appModeRef;\r
 } OsAlarmAutostartType;\r
 
 /* STD container : OsAlarm
@@ -87,7 +96,7 @@ typedef struct OsAlarm {
        /* cycle, 0 = no cycle */\r
        uint32 alarmtime;\r
        uint32 cycletime;\r
-       uint32 appmode_mask;\r
+//     uint32 appmode_mask;\r
 \r
        uint32 app_mask;\r
 \r
@@ -99,7 +108,7 @@ typedef struct OsAlarm {
        OsAlarmActionType action;\r
 
        /* Autostart */
-       OsAlarmAutostartType autostart;
+       const struct OsAlarmAutostart *autostartPtr;
 
        /* List of alarms connected to the same counter */\r
        SLIST_ENTRY(OsAlarm) alarm_list;\r
index cc210d7a2a763117f0b9c7f2574de1a3c6dcf103..04985e3af0fd385606c0d0be4f68a7f56638ae9b 100644 (file)
@@ -62,6 +62,10 @@ typedef struct OsCounter {
 static inline TickType Os_CounterGetMaxValue(OsCounterType *cPtr ) {
        return cPtr->alarm_base.maxallowedvalue;
 }
+
+static inline TickType Os_CounterGetMinCycle(OsCounterType *cPtr ) {
+       return cPtr->alarm_base.mincycle;
+}
 \r
 static inline TickType Os_CounterGetValue( OsCounterType *cPtr ) {
        return cPtr->val;
index 5445ad69976f2c0b204f1d0cea169126bbd081f9..d125f014e0c94e26cb5904c0691fdf8ce50acddb 100644 (file)
@@ -42,28 +42,50 @@ enum OsScheduleTableSyncStrategy {
 \r
 enum OsScheduleTableAutostartType {\r
        // Start with StartScheduleTableAbs()\r
-       ABSOLUTE,\r
+       SCHTBL_AUTOSTART_ABSOLUTE,\r
        // Start with StartScheduleTableRel()\r
-       RELATIVE,\r
+       SCHTBL_AUTOSTART_RELATIVE,\r
        // Start with StartScheduleTableSyncon()\r
-       SYNCHRONE,\r
+       SCHTBL_AUTOSTART_SYNCHRONE,\r
 };\r
-\r
 
-typedef struct OsScheduleTableAction {
-       // 0 - activate task, 1 - event
-       /** @req OS402 */
-       /** @req OS403 */
-       int                     type;
-       // for debug only???
+
+/* STD container: OsScheduleTableEventSetting
+ * OsScheduleTableSetEventRef:                 1
+ * OsScheduleTableSetEventTaskRef:     1
+*/
+typedef struct OsScheduleTableEventSetting {
+       EventMaskType   event;
+       TaskType     task;
+} OsScheduleTableEventSettingType;
+
+/* OsScheduleTableTaskActivation */
+\r
+/* STD container: OsScheduleTableExpiryPoint
+ * OsScheduleTblExpPointOffset:        1    Int
+ * OsScheduleTableEventSetting:                0..*
+ * OsScheduleTableTaskActivation:      0..*
+ * OsScheduleTblAdjustableExpPoint:    0..1
+ * */
+
+/** @req OS402 */
+/** @req OS403 */
+typedef struct OsScheduleTableExpiryPoint {
+       /* The expiry point offset, OsScheduleTblExpPointOffset */
        uint64                  offset;
        // delta to next action
        /** @req OS404 */
        uint64                  delta;
-       TaskType                task_id;
-       // used only if event..
-       EventMaskType event_id;
-} OsScheduleTableActionType;
+
+       /* List of events to activate */
+       const TaskType          *taskList;
+       uint8_t                 taskListCnt;
+
+       /* List of events to activate */
+       const OsScheduleTableEventSettingType *eventList;
+       uint8_t                 eventListCnt;
+} OsScheduleTableExpiryPointType;
+
 
 #if ( OS_SC2 == STD_ON ) || ( OS_SC4 == STD_ON )\r
 typedef struct OsScheduleTableSync {\r
@@ -100,10 +122,10 @@ typedef struct OsSchTblAdjExpPoint {
  * OsScheduleTableAppModeRef           1..* Ref to OsAppMode
  */\r
 struct OsSchTblAutostart {\r
-       _Bool active;\r
        enum OsScheduleTableAutostartType type;\r
-       uint32_t relOffset;\r
-       uint32_t appModeRef;    // TODO\r
+       /* offset applies to both rel and abs */
+       TickType offset;\r
+       uint32_t appMode;       // TODO\r
 };\r
 
 
@@ -118,81 +140,65 @@ struct OsSchTblAutostart {
  */
 \r
 typedef struct OsSchTbl {\r
-\r
-// Configuration\r
-\r
-       // OsScheduleTableDuration\r
-       int duration;\r
-\r
-       // If true, the schedule is periodic, OS009\r
-       // OsScheduleTableRepeating , 0 - SINGLE_SHOT\r
+       /* OsScheduleTableDuration */\r
+       TickType duration;\r
+
+       char *name;
+       /* If true, the schedule is periodic, OS009\r
+        * OsScheduleTableRepeating , 0 - SINGLE_SHOT */
+       /** @req OS413 */\r
        _Bool repeating;\r
 \r
-       // Application mask\r
-       uint32 app_mask;\r
-\r
        // pointer to this tables counter\r
        // OsScheduleTableCounterRef
        /** @req OS409 */\r
        struct OsCounter *counter;\r
-\r
-       struct OsSchTblAutostart autostart;\r
+
+       /* OsScheduleTableAutostart[C] */\r
+       struct OsSchTblAutostart *autostartPtr;\r
 
        /* NULL if NONE, and non-NULL if EXPLICIT and IMPLICIT */\r
        struct OsScheduleTableSync *sync;\r
 
+#if (OS_SC3 == STD_ON ) || (OS_SC4 == STD_ON )
+       uint32 app_mask;
+#endif
+
 #if ( OS_SC2 == STD_ON ) || ( OS_SC4 == STD_ON )\r
        struct OsSchTblAdjExpPoint adjExpPoint;\r
 #endif
-\r
-// Private stuff\r
-\r
-       uint32_t finalOffset;
-\r
-       uint32_t initialOffset;\r
-       // Name...\r
-       char *name;\r
-\r
-       // ??\r
 // RAM\r
-       uint64 length;\r
-\r
+
        uint32 id;\r
 
        /* The current index into the expire list
-        * The value is updated at each expire point.
-        * */\r
+        * The value is updated at each expire point. */\r
        int expire_curr_index;
 \r
        /* When this table expires the next time
         * This value should be compared to the counter that drives
         * the counter to check if it has expired.
-        * The value is updated at each expire point.
-        */\r
+        * The value is updated at each expire point. */\r
        TickType expire_val;
 \r
-       // if true, the table is active\r
-       //_Bool active;\r
        ScheduleTableStatusType state;\r
 \r
-       // Pointer to next schedule table, if any\r
-       // (don't use normal lists here since we have no list head)\r
+       /* Pointer to next schedule table, if any\r
+        * (don't use normal lists here since we have no list head) */\r
        struct OsSchTbl *next;\r
 \r
-       /* Head of static action list */\r
-       SA_LIST_HEAD(alist,OsScheduleTableAction) action_list;\r
+       /* Head of static expire point list
+        * OsScheduleTableExpiryPoint[C] */\r
+       SA_LIST_HEAD(alist,OsScheduleTableExpiryPoint) expirePointList;\r
 \r
-       /* Entry in the list of schedule tables connected to a specfic\r
+       /* Entry in the list of schedule tables connected to a specific\r
         * counter  */\r
        SLIST_ENTRY(OsSchTbl) sched_list;\r
 \r
-       // TableDuration\r
-       //\r
-\r
 } OsSchTblType;\r
 \r
 /*\r
-#define os_stbl_get_action(x)          SA_LIST_GET(&(x)->action_list,(x)->expire_curr_index)\r
+#define os_stbl_get_action(x)          SA_LIST_GET(&(x)->expirePointList,(x)->expire_curr_index)\r
 #define os_stbl_get_action_type(x) os_stbl_get_action(x)->type\r
 #define os_stbl_get_action_offset(x) os_stbl_get_action(x)->offset\r
 #define os_stbl_get_action_pid(x) os_stbl_get_action(x)->pid\r
@@ -201,14 +207,15 @@ typedef struct OsSchTbl {
 \r
 void Os_SchTblInit( void );\r
 void Os_SchTblCalcExpire( OsSchTblType *stbl );
+void Os_SchTblCheck(OsCounterType *c_p);
 
 static inline TickType Os_SchTblGetInitialOffset( OsSchTblType *sPtr ) {
-       return SA_LIST_GET(&sPtr->action_list,0)->offset;
+       return SA_LIST_GET(&sPtr->expirePointList,0)->offset;
 }
 
 static inline TickType Os_SchTblGetFinalOffset( OsSchTblType *sPtr ) {
        return (sPtr->duration -
-                       SA_LIST_GET(&sPtr->action_list, SA_LIST_CNT(&sPtr->action_list))->offset);
+                       SA_LIST_GET(&sPtr->expirePointList, SA_LIST_CNT(&sPtr->expirePointList)-1)->offset);
 }
 
 \r
index 8b38546f049b18a5aac83c4171a9e89f7a1d0641..106663e1d8745cccfe42da0038351751b81f168b 100644 (file)
@@ -220,10 +220,14 @@ static void os_start( void ) {
        for(int j=0; j < Oil_GetAlarmCnt(); j++ ) {
                OsAlarmType *alarmPtr;
                alarmPtr = Oil_GetAlarmObj(j);
-               if(alarmPtr->autostart.active) {
-                       OsAlarmAutostartType *autoPtr = &alarmPtr->autostart;
+               if(alarmPtr->autostartPtr != NULL ) {
+                       OsAlarmAutostartType *autoPtr = alarmPtr->autostartPtr;
 
-                       SetAbsAlarm(j,autoPtr->alarmtime, autoPtr->cycletime);
+                       if( autoPtr->autostartType == ALARM_AUTOSTART_ABSOLUTE ) {
+                               SetAbsAlarm(j,autoPtr->alarmTime, autoPtr->cycleTime);
+                       } else {
+                               SetRelAlarm(j,autoPtr->alarmTime, autoPtr->cycleTime);
+                       }
                }
        }
 
index cd4b24b0ee814e142cb2c1d9fc3a38d4e7a8f8b9..652ddf6ca85b64b78c5292418c8c96235e8b6cf5 100644 (file)
@@ -1,8 +1,20 @@
-/*\r
- * os_arctest.c\r
+/* -------------------------------- Arctic Core ------------------------------\r
+ * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
  *\r
- *  Created on: 19 jan 2010\r
- *      Author: mahi\r
+ * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
+ *\r
+ * This source code is free software; you can redistribute it and/or modify it\r
+ * under the terms of the GNU General Public License version 2 as published by the\r
+ * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
+ *\r
+ * This program is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
+ * for more details.\r
+ * -------------------------------- Arctic Core ------------------------------*/\r
+/**\r
+ * Holds an API for manipulation of internal OS structures.\r
+ * To be used by the test-system.
  */\r
 \r
 #include "internal.h"\r
@@ -13,6 +25,12 @@ int Os_ArcTest_GetTaskActivationLimit( TaskType task ) {
        return 0;\r
 }\r
 \r
+/**\r
+ * Set number of simultaneous interrupts.\r
+ * Used to the test for E_OS_CALLLEVEL.
+ * @param level
+ */\r
+\r
 void Os_ArcTest_SetIrqNestLevel( int level ) {\r
 \r
        return;\r
index d145cd7d3452b9fc8ca441fadbcd2593f3dfbbc0..fea3665dfd38487e3fd5a8bbbc941cd627ebb5c8 100644 (file)
@@ -91,22 +91,49 @@ enum OsScheduleTableSyncStrategy getSyncStrategy( OsSchTblType *stblPtr ) {
  *
  * @return
  */\r
-static void ScheduleTableConsistenyCheck( OsSchTblType *s_p ) {\r
+static void ScheduleTableConsistenyCheck( OsSchTblType *sTblPtr ) {\r
 
 #if ( OS_SC2 == STD_ON ) || ( OS_SC4 == STD_ON )\r
        /** @req OS440 */\r
-       if( s_p->sync.syncStrategy == IMPLICIT ) {\r
-               assert( s_p->duration == (s_p->counter->alarm_base.maxallowedvalue +1) );\r
+       if( sTblPtr->sync.syncStrategy == IMPLICIT ) {\r
+               assert( sTblPtr->duration == (sTblPtr->counter->alarm_base.maxallowedvalue +1) );\r
        }\r
 \r
        /** @req OS431 */\r
-       if( s_p->sync.syncStrategy == EXPLICIT ) {\r
-               assert( s_p->duration <= (s_p->counter->alarm_base.maxallowedvalue +1) );\r
+       if( sTblPtr->sync.syncStrategy == EXPLICIT ) {\r
+               assert( sTblPtr->duration <= (sTblPtr->counter->alarm_base.maxallowedvalue +1) );\r
        }
 #endif
 
        /** @req OS401 */
-       assert(SA_LIST_CNT(&s_p->action_list)>=1);
+       assert(SA_LIST_CNT(&sTblPtr->expirePointList)>=1);
+
+
+
+       {
+               int iter;
+               TickType delta = 0;
+               TickType minCycle = Os_CounterGetMinCycle(sTblPtr->counter);
+               TickType maxValue =  Os_CounterGetMaxValue(sTblPtr->counter);
+
+               /* - start at offset=0
+                * - X expiry points = SA_LIST_CNT
+                * - Final offset.
+                */
+               /** @req OS443 */
+               /** @req OS408 */
+               for(iter=0; iter  <  SA_LIST_CNT(&sTblPtr->expirePointList) ; iter++) {
+                       delta = SA_LIST_GET(&sTblPtr->expirePointList,iter)->offset - delta;
+                       assert( delta >=  minCycle );
+                       assert( delta <=  maxValue );
+               }
+
+               /* Final */
+               /** @req OS444 */
+               delta = sTblPtr->duration - SA_LIST_GET(&sTblPtr->expirePointList,iter)->offset;
+               assert( delta >=  minCycle );
+               assert( delta <=  maxValue );
+       }
 
 }\r
 \r
@@ -448,6 +475,80 @@ StatusType SetScheduleTableAsync( ScheduleTableType sid ) {
        SCHED_STD_END;\r
 }\r
 #endif
+
+
+
+/**
+ * Go through the schedule tables connected to this counter
+ *
+ * @param c_p Pointer to counter object
+ */
+void Os_SchTblCheck(OsCounterType *c_p) {
+       /** @req OS002 */
+       /** @req OS007 */
+
+       OsSchTblType *sched_obj;
+
+       /* Iterate through the schedule tables */
+       SLIST_FOREACH(sched_obj,&c_p->sched_head,sched_list) {
+
+               if( sched_obj->state == SCHEDULETABLE_STOPPED ) {
+                       continue;
+               }
+
+#if ( OS_SC2 == STD_ON ) || ( OS_SC4 == STD_ON )
+               if( sched_obj->sync.syncStrategy == IMPLICIT ) {
+                       // ....
+
+               } else {
+                       int adj;
+                       // Handle EXPLICIT
+                       if( sched_obj->sync.deviation > 0 ) {
+                               // The sync counter was set back ==
+                               // we have more time to complete the table
+                               adj = MIN(sched_obj->sync.deviation, getAdjExpPoint(sched_obj)->maxAdvance );
+                               sched_obj->sync.deviation -= adj;
+
+                       } else if( sched_obj->sync.deviation < 0 ) {
+                               // The sync counter was set forward ==
+                               // we have less time to complete the table
+                               adj = MIN((-sched_obj->sync.deviation), getAdjExpPoint(sched_obj)->maxRetard);
+                               sched_obj->sync.deviation -= adj;
+
+                       } else {
+                               // all is well
+                               sched_obj->state = SCHEDULETABLE_RUNNING_AND_SYNCHRONOUS;
+                       }
+               }
+#endif
+
+               /* Check if the expire point have been hit */
+               if( (sched_obj->state == SCHEDULETABLE_RUNNING ||
+                               SCHEDULETABLE_RUNNING_AND_SYNCHRONOUS ) &&
+                               (c_p->val >= sched_obj->expire_val) )
+               {
+                       OsScheduleTableExpiryPointType * action;
+                       int i;
+
+                       action = SA_LIST_GET(&sched_obj->expirePointList,sched_obj->expire_curr_index);
+
+                       /** @req OS407 */
+                       /** @req OS412 */
+
+                       /* According to OS412 activate tasks before events */
+                       for(i=0; i< action->taskListCnt;i++ ) {
+                               ActivateTask(action->taskList[i]);
+                       }
+
+                       for(i=0; i< action->eventListCnt;i++ ) {
+                               SetEvent( action->eventList[i].task, action->eventList[i].event);
+                       }
+                       // Calc new expire val
+                       Os_SchTblCalcExpire(sched_obj);
+               }
+
+       }
+}
 \r
 /*\r
  *start e   e       e  delta stop\r
@@ -468,20 +569,20 @@ StatusType SetScheduleTableAsync( ScheduleTableType sid ) {
  * counter I will miss to update the delta values\r
  */\r
 static void os_stbl_action_calc_delta( OsSchTblType *stbl ) {\r
-       OsScheduleTableActionType * first;\r
-       OsScheduleTableActionType * second;\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->action_list) ;iter++) {\r
-               first = SA_LIST_GET(&stbl->action_list,iter-1);\r
-               second = SA_LIST_GET(&stbl->action_list,iter);\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->action_list, SA_LIST_CNT(&stbl->action_list)-1);\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
@@ -516,7 +617,7 @@ void Os_SchTblCalcExpire( OsSchTblType *stbl ) {
        OsSchTblType *nextStblPtr;
 
 
-       if( (stbl->expire_curr_index) == SA_LIST_CNT(&stbl->action_list) ) {
+       if( (stbl->expire_curr_index) == SA_LIST_CNT(&stbl->expirePointList) ) {
                /* We are at the last expiry point */
                finalOffset = Os_SchTblGetFinalOffset(stbl);
 
@@ -527,7 +628,8 @@ void Os_SchTblCalcExpire( OsSchTblType *stbl ) {
 
                stbl->expire_curr_index++;
 
-       } else if( (stbl->expire_curr_index) > SA_LIST_CNT(&stbl->action_list) ) {
+       } else if( (stbl->expire_curr_index) > SA_LIST_CNT(&stbl->expirePointList) ) {
+               /* At final offset */
 
                /** @req OS194 */
                if( (stbl->repeating == REPEATING) || (stbl->next != NULL) ) {
@@ -542,6 +644,8 @@ void Os_SchTblCalcExpire( OsSchTblType *stbl ) {
                                stbl->state = SCHEDULETABLE_STOPPED;
                                nextStblPtr->state = SCHEDULETABLE_RUNNING;
                        } else {
+                               /** @req OS414 */
+
                                /* REPEATING */
                                assert( stbl->repeating == REPEATING );
                                initalOffset = Os_SchTblGetInitialOffset(stbl);
@@ -560,7 +664,7 @@ void Os_SchTblCalcExpire( OsSchTblType *stbl ) {
                }
        } else {
 
-               delta = SA_LIST_GET(&stbl->action_list,stbl->expire_curr_index)->delta;
+               delta = SA_LIST_GET(&stbl->expirePointList,stbl->expire_curr_index)->delta;
 
                stbl->expire_val =      Os_CounterCalcModulo(
                                                Os_CounterGetValue(stbl->counter),
index 67fb297ad198494c2c426c935b2c1e0fcc93ca40..a480625401c833867903e49cf95223bff9e05f22 100644 (file)
  */\r
 #define OS_CFG_API_VERSION 2
 \r
-#include <stdlib.h>\r
-#include <stdint.h>\r
-#include "os_config_macros.h"\r
-#include "Platform_Types.h"\r
-#include "Os.h"                                // includes Os_Cfg.h\r
-#include "os_test.h"\r
-#include "kernel.h"\r
-#include "kernel_offset.h"\r
+#include <stdlib.h>
+#include <stdint.h>
+#include "Platform_Types.h"
+#include "Os.h"                                // includes Os_Cfg.h
+#include "os_config_macros.h"
+#include "kernel.h"
+#include "kernel_offset.h"
 #include "alist_i.h"
 #include "Mcu.h"
+#include "os_test.h"
 
 OsTickType OsTickFreq = 1000;\r
 \r
@@ -102,7 +102,7 @@ GEN_TRUSTEDFUNCTIONS_LIST
 \r
 //-------------------------------------------------------------------\r
 
-#if ( OS_SC1 == STD_ON ) || ( OS_SC4 == STD_ON )\r
+#if ( OS_SC3 == STD_ON ) || ( OS_SC4 == STD_ON )\r
 GEN_APPLICATION_HEAD {\r
        GEN_APPLICATON(0,"application_1",true,NULL,NULL,NULL , 0,0,0,0,0,0 )\r
 };
@@ -321,58 +321,50 @@ GEN_ALARM_HEAD {
 \r
 \r
 #if defined(SCHEDULETABLE_USE)\r
+
+// ---- Table 0 -----
+GEN_SCHTBL_TASK_LIST_HEAD( 0, 5 ) {
+       TASK_ID_etask_sup_m
+};
+
+GEN_SCHTBL_EVENT_LIST_HEAD( 0, 7 ) {
+       { EVENT_2, TASK_ID_etask_sup_m },
+};
+
+GEN_SCHTBL_EXPIRY_POINT_HEAD( 0 ) {
+       GEN_SCHTBL_EXPIRY_POINT_W_TASK(  0, 5 ),
+       GEN_SCHTBL_EXPIRY_POINT_W_EVENT( 0, 7 )
+};
+
+// ---- Table 1 -----
+GEN_SCHTBL_TASK_LIST_HEAD(1,2) {
+       TASK_ID_etask_sup_m ,
+};
+
+GEN_SCHTBL_EXPIRY_POINT_HEAD( 1 ) {
+       GEN_SCHTBL_EXPIRY_POINT_W_TASK( 1, 2 )
+};
 \r
+GEN_SCHTBL_AUTOSTART(0,SCHTBL_AUTOSTART_ABSOLUTE, 100, OSDEFAULTAPPMODE );
 \r
-OsScheduleTableActionType sched_expire_list_0[] = {\r
-       {\r
-               .type = SCHEDULE_ACTION_ACTIVATETASK,\r
-               .offset = 5,\r
-               .task_id = TASK_ID_etask_sup_m,\r
-       },{\r
-               .type = SCHEDULE_ACTION_SETEVENT,\r
-               .offset = 7,\r
-               .task_id = TASK_ID_etask_sup_m,\r
-               .event_id = EVENT_2,\r
-       }\r
-};\r
-\r
-\r
-OsScheduleTableActionType sched_expire_list_1[] = {\r
-       {\r
-               .type = SCHEDULE_ACTION_ACTIVATETASK,\r
-               .offset = 2,\r
-               .task_id = TASK_ID_etask_sup_m,\r
-       }\r
-};\r
-\r
-\r
-GEN_SCHEDULETABLE_HEAD {\r
+GEN_SCHTBL_HEAD {
        GEN_SCHEDULETABLE(\r
-                       0,                                              // id\r
-                       "stable0",                              // name\r
-                   COUNTER_ID_soft_2,          // counter\r
-                   REPEATING,                          // periodic
-                       SCHEDULETABLE_DURATION_1,       // duration\r
-                       0,                                              // app_mask\r
-                       ARRAY_SIZE(sched_expire_list_0),                                // action count\r
-                       sched_expire_list_0,    // expire ref\r
-                       0,0,0,0,                                // autostart\r
-                       NONE,0,                                 // sync\r
-                       0,0                                     // adjExpPoint\r
+                       0,                                                    // id\r
+                       "stable0",                                    // name\r
+                   COUNTER_ID_soft_2,                // counter\r
+                   REPEATING,                                // periodic
+                       SCHEDULETABLE_DURATION_1,         // duration
+                       GEN_SCHTBL_AUTOSTART_NAME(0)\r
                        ),\r
-\r
+
+
        GEN_SCHEDULETABLE(\r
                        1,                                              // id\r
                        "stable1",                              // name\r
                        COUNTER_ID_soft_2,              // counter\r
                        REPEATING,                              // periodic\r
-                       SCHEDULETABLE_DURATION_2,       // duration\r
-                       0,                                              // app_mask\r
-                       ARRAY_SIZE(sched_expire_list_1),                                // action count\r
-                       sched_expire_list_1,    // expire ref\r
-                       0,0,0,0,                                // autostart\r
-                       NONE,0,                                 // sync\r
-                       0,0                                     // adjExpPoint\r
+                       SCHEDULETABLE_DURATION_2,       // duration
+                       NULL\r
                        ),\r
 };\r
 \r
index 7a3852a3f0e227dc0c98d230da9b19c9d3e72f0a..293e9345911e93bba8666a00412156cc6f7bbd82 100644 (file)
 #define EVENT_1        (1<<1)\r
 #define EVENT_2 (1<<2)\r
 \r
-\r
-\r
 #endif /* OS_CFG_H_ */\r
index 41b58d1d9fcae890f985526b20ae3a32418f30c9..302e7d5af8651e5a971e50f5d346febc8ded4599 100644 (file)
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * for more details.
  * -------------------------------- Arctic Core ------------------------------*/
-
-
-
-
-
-
-
-
-/*\r
- * os_test.h\r
- *\r
- *  Created on: 2009-jan-08\r
- *      Author: mahi\r
- */\r
 \r
 #ifndef OS_TEST_H_\r
 #define OS_TEST_H_\r