* for more details.
* -------------------------------- Arctic Core ------------------------------*/
-
-
-
-
-
-
-
#ifndef SCHED_TABLE_I_H_\r
#define SCHED_TABLE_I_H_\r
\r
#include "alist_i.h"\r
#include "counter_i.h"\r
\r
-struct counter_obj_s;\r
-\r
+struct OsCounter;\r
+
+#define SINGLE_SHOT 0
+#define REPEATING 1
+
+#if ( OS_SC2 == STD_ON ) || ( OS_SC4 == STD_ON )\r
enum OsScheduleTableSyncStrategy {\r
- /* Support for sync */\r
+ /* Support for sync, this is same as no OS */\r
NONE,\r
/* synchronize with "external" counter */\r
EXPLICIT,\r
/* sync internal */\r
IMPLICIT,\r
};\r
+#endif
\r
enum OsScheduleTableAutostartType {\r
// Start with StartScheduleTableAbs()\r
SYNCHRONE,\r
};\r
\r
-\r
-typedef struct sched_table_sync_s {\r
+
+typedef struct OsScheduleTableAction {
+ // 0 - activate task, 1 - event
+ /** @req OS402 */
+ /** @req OS403 */
+ int type;
+ // for debug only???
+ uint64 offset;
+ // delta to next action
+ /** @req OS404 */
+ uint64 delta;
+ TaskType task_id;
+ // used only if event..
+ EventMaskType event_id;
+} OsScheduleTableActionType;
+
+#if ( OS_SC2 == STD_ON ) || ( OS_SC4 == STD_ON )\r
+typedef struct OsScheduleTableSync {\r
\r
/* SPEC */\r
enum OsScheduleTableSyncStrategy syncStrategy;\r
// Calculated as 'driver count' - 'global time count from SyncScheduleTable()'\r
int deviation;\r
\r
-} sched_table_sync_t;\r
+} OsScheduleTableSyncType;\r
+
\r
/* SPEC */\r
-typedef struct Stbl_AdjustableExpPoint {\r
+typedef struct OsSchTblAdjExpPoint {\r
uint8_t maxAdvance;\r
uint8_t maxRetard;\r
-} Stbl_AdjustableExpPointType;\r
-\r
-struct sched_table_autostart_s {\r
+} OsSchTblAdjExpPointType;
+#endif
+
+/* STD container: OsScheduleTableAutostart
+ * OsScheduleTableAbsValue 1 Int
+ * OsScheduleTableAutostartType 1 Enum
+ * OsScheduleTableRelOffset 1 Int
+ * 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
};\r
-\r
-typedef struct sched_table_s {\r
+
+
+/* STD container: OsScheduleTable
+ * OsScheduleTableDuration: 1 Int
+ * OsScheduleTableRepeating: 1 Bool
+ * OsSchTblAccessingApplication 0..* Ref
+ * OsScheduleTableCounterRef: 1 Ref
+ * OsScheduleTableAutostart[C] 0..1
+ * OsScheduleTableExpiryPoint[C] 1..*
+ * OsScheduleTableSync 0..1
+ */
+\r
+typedef struct OsSchTbl {\r
\r
// Configuration\r
\r
int duration;\r
\r
// If true, the schedule is periodic, OS009\r
- // OsScheduleTableRepeating\r
+ // OsScheduleTableRepeating , 0 - SINGLE_SHOT\r
_Bool repeating;\r
\r
// Application mask\r
uint32 app_mask;\r
\r
// pointer to this tables counter\r
- // OsScheduleTableCounterRef\r
- struct counter_obj_s *counter;\r
+ // OsScheduleTableCounterRef
+ /** @req OS409 */\r
+ struct OsCounter *counter;\r
\r
- struct sched_table_autostart_s autostart;\r
-\r
- struct sched_table_sync_s sync;\r
-\r
- struct Stbl_AdjustableExpPoint adjExpPoint;\r
+ struct OsSchTblAutostart autostart;\r
+
+ /* NULL if NONE, and non-NULL if EXPLICIT and IMPLICIT */\r
+ struct OsScheduleTableSync *sync;\r
+
+#if ( OS_SC2 == STD_ON ) || ( OS_SC4 == STD_ON )\r
+ struct OsSchTblAdjExpPoint adjExpPoint;\r
+#endif
\r
// Private stuff\r
\r
- uint32_t final_offset; // used?\r
- uint32_t init_offset; // used?\r
+ uint32_t finalOffset;
+\r
+ uint32_t initialOffset;\r
// Name...\r
char *name;\r
\r
uint64 length;\r
\r
uint32 id;\r
+
+ /* The current index into the expire list
+ * 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
+ TickType expire_val;
\r
- int expire_curr_index;\r
- // When this table expires the next time\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
- struct sched_table_s *next;\r
+ struct OsSchTbl *next;\r
\r
/* Head of static action list */\r
- SA_LIST_HEAD(alist,sched_action_s) action_list;\r
+ SA_LIST_HEAD(alist,OsScheduleTableAction) action_list;\r
\r
/* Entry in the list of schedule tables connected to a specfic\r
* counter */\r
- SLIST_ENTRY(sched_table_s) sched_list;\r
+ SLIST_ENTRY(OsSchTbl) sched_list;\r
\r
// TableDuration\r
//\r
\r
-} sched_table_t;\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_event(x) os_stbl_get_action(x)->event\r
*/\r
\r
-void os_stbl_init( void );\r
-void os_stbl_calc_expire( sched_table_t *stbl);\r
+void Os_SchTblInit( void );\r
+void Os_SchTblCalcExpire( OsSchTblType *stbl );
+
+static inline TickType Os_SchTblGetInitialOffset( OsSchTblType *sPtr ) {
+ return SA_LIST_GET(&sPtr->action_list,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);
+}
+
+\r
\r
#endif /*SCHED_TABLE_I_H_*/\r