source: soft/giet_vm/giet_kernel/ctx_handler.h @ 284

Last change on this file since 284 was 267, checked in by cfuguet, 11 years ago
  • Adding new task context information: THREAD INDEX.

This value can be accessed by USER applications to get the
thread index of the current task. This thread index
corresponds to the index in a vspace.

The value of this index can be forced in the vspace part
of the XML description file using the trdid field in the
task description. When this value is missing, for each
task, a value from 0 to N-1 will be assigned, where N is
the number of task in the vspace.

The user application access this value through the
giet_thread_id() function defined in the stdio library
which uses the SYSCALL_THREAD_ID to access the task
context information.

  • Supporting mono TTY platforms

When the GIET_MONO_TTY constant defined in the giet_config
file, contains a value different than 0, all tasks will
share the TTY[0]. If this is the case, in the stdio
library, the giet_tty_printf() function will take the TTY
hardware lock before writing

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#ifndef _CTX_HANDLER_H
2#define _CTX_HANDLER_H
3
4#include <giet_config.h>
5
6/////////////////////////////////////////////////////////////////////////////////
7//    Definition of the scheduler structure
8/////////////////////////////////////////////////////////////////////////////////
9
10typedef struct static_scheduler_s
11{
12    unsigned int context[15][64];      // at most 15 task contexts
13    unsigned int tasks;                // actual number of tasks
14    unsigned int current;              // current task index
15    unsigned int interrupt_vector[32]; // interrupt vector
16} static_scheduler_t;
17
18
19/////////////////////////////////////////////////////////////////////////////////
20//  "idle" task index definition
21/////////////////////////////////////////////////////////////////////////////////
22
23#define IDLE_TASK_INDEX        14
24
25/////////////////////////////////////////////////////////////////////////////////
26//    Definition of the task context slots indexes
27/////////////////////////////////////////////////////////////////////////////////
28
29#define CTX_SP_ID        29
30#define CTX_RA_ID        31
31
32#define CTX_EPC_ID       32  // Exception Program Counter (CP0)
33#define CTX_CR_ID        33  // Cause Register (CP0)
34#define CTX_SR_ID        34  // Status Register (CP0)
35#define CTX_BVAR_ID      35      // Bad Virtual Address Register (CP0)
36
37#define CTX_PTAB_ID      36  // Page Table Virtual address
38#define CTX_LTID_ID      37  // Local  Task Index (in scheduler)
39#define CTX_VSID_ID      38  // Vspace Index     
40#define CTX_PTPR_ID      39  // Page Table Pointer Register (PADDR>>13)
41
42#define CTX_TTY_ID       40  // global TTY terminal 
43#define CTX_DMA_ID       41  // local DMA channel
44#define CTX_NIC_ID       42  // global NIC channel
45#define CTX_TIM_ID       43  // local TIMER channel
46#define CTX_HBA_ID       44  // global HBA channel
47#define CTX_CMA_ID       45  // global CMA channel
48#define CTX_GTID_ID      46  // Global Task Index
49#define CTX_RUN_ID       47  // Boolean: task runable
50#define CTX_TRDID_ID     48  // Thread Index in vspace
51
52//////////////////////////////////////////////////////////////////////////////////
53//     Prototype of the context switch function
54//////////////////////////////////////////////////////////////////////////////////
55
56extern void _ctx_switch();
57extern void _ctx_eret();
58extern void _idle_task();
59
60extern static_scheduler_t _scheduler[];
61
62#endif
Note: See TracBrowser for help on using the repository browser.