* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
* -------------------------------- Arctic Core ------------------------------*/
-
-
-
-
-
-
-
-
#ifndef PCB_H\r
#define PCB_H\r
+
+struct OsApplication;
+struct OsRomPcb;
\r
-#include "types.h"\r
-#include "sys/queue.h"\r
-#include "Os.h"\r
-#include "kernel.h"\r
-#include "counter_i.h"\r
-#include <stdio.h>\r
-//#include "app_i.h"\r
-\r
-#define PID_IDLE 0\r
-#define PRIO_IDLE 0\r
+#define PID_IDLE 0\r
+#define PRIO_IDLE 0\r
\r
-#define ST_READY 1\r
-#define ST_WAITING (1<<1)\r
-#define ST_SUSPENDED (1<<2)\r
-#define ST_RUNNING (1<<3)\r
-#define ST_NOT_STARTED (1<<4)\r
+#define ST_READY 1\r
+#define ST_WAITING (1<<1)\r
+#define ST_SUSPENDED (1<<2)\r
+#define ST_RUNNING (1<<3)\r
+#define ST_NOT_STARTED (1<<4)\r
\r
typedef uint16_t state_t;\r
\r
/* from Os.h types */\r
-typedef TaskType procid_t;\r
-typedef EventMaskType event_t;\r
+typedef TaskType OsTaskidType;\r
+typedef EventMaskType OsEventType;\r
/* Lets have 32 priority levels\r
* 0 - Highest prio\r
* 31- Lowest
*/\r
-typedef sint8 prio_t;\r
+typedef sint8 OsPriorityType;\r
\r
#define TASK_NAME_SIZE 16\r
+
+
+/* STD container : OsIsr
+ * Class: ALL
+ *
+ * OsIsrCategory: 1 CATEGORY_1 or CATEGORY_2
+ * OsIsrResourceRef: 0..1 Reference to OsResource
+ * OsIsrTimingProtection[C] 0..1
+ * */
+
+/* STD container : OsIsrResourceLock
+ * Class: 2 and 4
+ *
+ * OsIsrResourceLockBudget 1 Float in seconds (MAXRESOURCELOCKINGTIME)
+ * OsIsrResourceLockResourceRef 1 Ref to OsResource
+ * */
+
+/* STD container : OsIsrTimingProtection
+ * Class: 2 and 4
+ *
+ * OsIsrAllInterruptLockBudget 0..1 float
+ * OsIsrExecutionBudget 0..1 float
+ * OsIsrOsInterruptLockBudget 0..1 float
+ * OsIsrTimeFrame 0..1 float
+ * OsIsrResourceLock[C] 0..1
+ * */
+
+
+
+/* STD container : OsHooks
+ * OsErrorHooks: 1
+ * OsPostTaskHook: 1
+ * OsPreTaskHook: 1
+ * OsProtectionHook: 0..1 Class 2,3,4 it's 1 instance
+ * OsShutdownHook: 1
+ * OsStartupkHook: 1
+ * */
+
+typedef struct OsHooks {
+#if ( OS_SC2 == STD_ON ) || ( OS_SC1 == STD_ON ) || ( OS_SC4 == STD_ON )
+ ProtectionHookType ProtectionHook;
+#endif
+ StartupHookType StartupHook;
+ ShutdownHookType ShutdownHook;
+ ErrorHookType ErrorHook;
+ PreTaskHookType PreTaskHook;
+ PostTaskHookType PostTaskHook;
+} OsHooksType;
+
+/* OsTask/OsTaskSchedule */
+enum OsTaskSchedule {
+ FULL,
+ NON
+};
+
+/*-----------------------------------------------------------------*/
+
+typedef uint8_t proc_type_t;
+
+#define PROC_PRIO 0x1
+#define PROC_BASIC 0x1
+#define PROC_EXTENDED 0x3
+
+#define PROC_ISR 0x4
+#define PROC_ISR1 0x4
+#define PROC_ISR2 0xc
+
+
+typedef struct {
+ void *curr; // Current stack ptr( at swap time )
+ void *top; // Top of the stack( low address )
+ uint32 size; // The size of the stack
+} OsStackType;
+
+
\r
-#if 0\r
-/* Application */\r
-typedef struct {\r
- /* Application id */\r
- uint32_t application_id;\r
- /* Name of the application */\r
- char name[16];\r
- /* We let the application have a pool */\r
- void *pool;\r
- /* if this application is trusted or not */\r
- uint8 trusted:1;\r
- /* Attached counters */\r
- counter_obj_t *counter;\r
-} app_t;\r
-#endif\r
-typedef rom_app_t app_t;\r
-\r
-\r
-struct rom_pcb_s;\r
\r
/* We do ISR and TASK the same struct for now */\r
-typedef struct pcb_s {\r
- procid_t pid; // TASK\r
- prio_t prio;\r
- ApplicationType application_id;\r
- uint32 app_mask;\r
- void (*entry)();\r
- proc_type_t proc_type;\r
- uint8 autostart:1; // TASK\r
- stack_t stack; // TASK\r
- /* belongs to this application */\r
- app_t *application;\r
-\r
- int vector; // ISR\r
- char name[TASK_NAME_SIZE];\r
-\r
- timing_protection_t *timing_protection;\r
-\r
- state_t state; // TASK\r
- event_t ev_wait; // TASK\r
- event_t ev_set; // TASK\r
-\r
- enum OsTaskSchedule scheduling; // TASK
-
- // OsTaskActivation
- // The limit from OsTaskActivation
+typedef struct OsPcb {\r
+ OsTaskidType pid; // TASK\r
+ OsPriorityType prio;
+#if ( OS_SC1 == STD_ON ) || ( OS_SC4 == STD_ON )\r
+ ApplicationType application_id;
+ uint32 app_mask;\r
+#endif
+ void (*entry)();\r
+ proc_type_t proc_type;\r
+ uint8 autostart:1; // TASK\r
+ OsStackType stack; // TASK\r
+\r
+ int vector; // ISR\r
+ char name[TASK_NAME_SIZE];\r
+#if ( OS_SC2 == STD_ON ) || ( OS_SC4 == STD_ON )\r
+ OsTimingProtectionType *timing_protection;\r
+#endif
+\r
+ state_t state; // TASK\r
+ OsEventType ev_wait; // TASK\r
+ OsEventType ev_set; // TASK\r
+\r
+ enum OsTaskSchedule scheduling; // TASK
+ /* belongs to this application */
+ struct OsApplication *application;
+
+ /* OsTaskActivation
+ * The limit from OsTaskActivation. This is 1 for extended tasks */
uint8_t activationLimit;
// The number of queued activation of a task\r
- uint8_t activations;
+ int8_t activations;
\r
// A task can hold only one internal resource and only i f
// OsTaskSchedule == FULL\r
- resource_obj_t *resource_int_p; // TASK
+ OsResourceType *resource_int_p; // TASK
+ // OsTaskResourceRef
// What resources this task have access to
// Typically (1<<RES_xxx) | (1<<RES_yyy)
uint32_t resourceAccess;
+
// What resource that are currently held by this task
// Typically (1<<RES_xxx) | (1<<RES_yyy)
- uint32_t resourceHolds;
+// uint32_t resourceHolds;
\r
- TAILQ_HEAD(,resource_obj_s) resource_head; // TASK
+ TAILQ_HEAD(,OsResource) resource_head; // TASK
\r
- struct rom_pcb_s *pcb_rom_p;\r
+ const struct OsRomPcb *pcb_rom_p;\r
\r
/* TODO: Arch specific regs .. make space for them later...*/\r
uint32_t regs[16]; // TASK\r
/* List of PCB's */\r
- TAILQ_ENTRY(pcb_s) pcb_list; // TASK\r
+ TAILQ_ENTRY(OsPcb) pcb_list; // TASK\r
/* ready list */\r
- TAILQ_ENTRY(pcb_s) ready_list; // TASK\r
-} pcb_t;\r
-\r
-extern pcb_t pcb_list[];\r
-extern rom_pcb_t rom_pcb_list[];\r
-\r
-static inline pcb_t * os_get_pcb( procid_t pid ) {\r
- return &pcb_list[pid];\r
-}\r
-\r
-static inline rom_pcb_t * os_get_rom_pcb( procid_t pid ) {\r
- return &rom_pcb_list[pid];\r
-}\r
-\r
-static inline prio_t os_pcb_set_prio( pcb_t *pcb, prio_t new_prio ) {\r
- prio_t old_prio;\r
- old_prio = pcb->prio;\r
- pcb->prio = new_prio;\r
- //simple_printf("set_prio of %s to %d from %d\n",pcb->name,new_prio,pcb->prio);\r
- return old_prio;\r
-}\r
-\r
-#define os_pcb_get_state(pcb) ((pcb)->state)\r
+ TAILQ_ENTRY(OsPcb) ready_list; // TASK\r
+} OsPcbType;\r
+
+/*-----------------------------------------------------------------*/
+
+typedef struct OsRomPcb {
+ TaskType pid;
+ uint8 prio;
+ uint32 app_mask;
+ void (*entry)();
+ proc_type_t proc_type;
+ uint8 autostart;
+ OsStackType stack;
+ int vector; // ISR
+ ApplicationType application_id;
+ char name[16];
+ enum OsTaskSchedule scheduling;
+ uint32_t resourceAccess;
+ // pointer to internal resource
+ // NULL if none
+ OsResourceType *resource_int_p;
+ OsTimingProtectionType *timing_protection;
+ uint8_t activationLimit;
+// lockingtime_obj_t
+} OsRomPcbType;
\r
#endif\r
\r