| [158] | 1 | #ifndef _CTX_HANDLER_H | 
|---|
|  | 2 | #define _CTX_HANDLER_H | 
|---|
|  | 3 |  | 
|---|
|  | 4 | #include <giet_config.h> | 
|---|
|  | 5 |  | 
|---|
|  | 6 | ///////////////////////////////////////////////////////////////////////////////// | 
|---|
| [232] | 7 | //    Definition of the scheduler structure | 
|---|
| [158] | 8 | ///////////////////////////////////////////////////////////////////////////////// | 
|---|
|  | 9 |  | 
|---|
| [232] | 10 | typedef struct static_scheduler_s { | 
|---|
|  | 11 | unsigned int context[15][64];      // at most 15 task contexts | 
|---|
|  | 12 | unsigned int tasks;                // actual number of tasks | 
|---|
|  | 13 | unsigned int current;              // current task index | 
|---|
|  | 14 | unsigned int interrupt_vector[32]; // interrupt vector | 
|---|
| [158] | 15 | } static_scheduler_t; | 
|---|
|  | 16 |  | 
|---|
| [199] | 17 |  | 
|---|
| [167] | 18 | ///////////////////////////////////////////////////////////////////////////////// | 
|---|
| [199] | 19 | //  "idle" task index definition | 
|---|
|  | 20 | ///////////////////////////////////////////////////////////////////////////////// | 
|---|
|  | 21 |  | 
|---|
| [232] | 22 | #define IDLE_TASK_INDEX        14 | 
|---|
| [199] | 23 |  | 
|---|
|  | 24 | ///////////////////////////////////////////////////////////////////////////////// | 
|---|
| [232] | 25 | //    Definition of the task context slots indexes | 
|---|
| [167] | 26 | ///////////////////////////////////////////////////////////////////////////////// | 
|---|
|  | 27 |  | 
|---|
| [232] | 28 | #define CTX_SP_ID        29 | 
|---|
|  | 29 | #define CTX_RA_ID        31 | 
|---|
| [167] | 30 |  | 
|---|
| [232] | 31 | #define CTX_EPC_ID       32 | 
|---|
|  | 32 | #define CTX_CR_ID        33 | 
|---|
|  | 33 | #define CTX_SR_ID        34 | 
|---|
|  | 34 | #define CTX_BVAR_ID      35 | 
|---|
| [167] | 35 |  | 
|---|
| [232] | 36 | #define CTX_PTPR_ID      39 | 
|---|
| [199] | 37 |  | 
|---|
| [232] | 38 | #define CTX_TTY_ID       40  // Integer : global TTY terminal index | 
|---|
|  | 39 | #define CTX_DMA_ID       41  // Integer : global DMA channel index | 
|---|
|  | 40 | #define CTX_NIC_ID       42  // Integer : global NIC channel index | 
|---|
|  | 41 | #define CTX_TIMER_ID     43  // Integer : user level timer index / UNUSED | 
|---|
|  | 42 | #define CTX_PTAB_ID      44  // Pointer : page table virtual base adress | 
|---|
|  | 43 | #define CTX_LTID_ID      45  // Integer : local task index (in scheduler) / UNUSED | 
|---|
|  | 44 | #define CTX_VSID_ID      46  // Integer : vspace index | 
|---|
|  | 45 | #define CTX_RUN_ID       47  // Boolean : task runable | 
|---|
|  | 46 | #define CTX_GTID_ID      48  // Integer : Global task id | 
|---|
| [167] | 47 |  | 
|---|
| [158] | 48 | ////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [232] | 49 | //     Prototype of the context switch function | 
|---|
| [158] | 50 | ////////////////////////////////////////////////////////////////////////////////// | 
|---|
|  | 51 |  | 
|---|
|  | 52 | extern void _ctx_switch(); | 
|---|
| [199] | 53 | extern void _ctx_eret(); | 
|---|
|  | 54 | extern void _ctx_idle(); | 
|---|
| [158] | 55 |  | 
|---|
|  | 56 | extern static_scheduler_t _scheduler[]; | 
|---|
|  | 57 |  | 
|---|
|  | 58 | #endif | 
|---|