Skip to content

Commit f391dd9

Browse files
committed
GTL added
1 parent a47a083 commit f391dd9

File tree

7 files changed

+949
-409
lines changed

7 files changed

+949
-409
lines changed

examples/osek.leos

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
os Trampoline {
2+
cpu processor with extended_task [
3+
BUSY: task in RUNNING,
4+
IDLE: empty
5+
]
6+
(
7+
BUSY -> IDLE, IDLE -> BUSY
8+
)
9+
10+
task basic_task [ SUSPENDED, READY, RUNNING ] {
11+
int base_priority (r);
12+
int max_activation_count (r);
13+
int priority (rw);
14+
int activation (rw);
15+
bool new (rw);
16+
}
17+
(
18+
SUSPENDED -> READY, READY -> RUNNING, RUNNING -> SUSPENDED
19+
)
20+
21+
task extended_task [ WAITING ] extends basic_task {
22+
unsigned events_wait (rw);
23+
unsigned events_set (rw);
24+
}
25+
(
26+
SUSPENDED -> READY,
27+
RUNNING -> WAITING,
28+
WAITING -> READY
29+
)
30+
31+
// extern function init_context(extended_task t);
32+
33+
container processor idle_processor [ IDLE ];
34+
container processor busy_processor [ BUSY ];
35+
container extended_task queue ready [ READY ] sorted by priority: > ;
36+
37+
scheduler fixed_priority with extended_task on processor {
38+
init {}
39+
method schedule {
40+
if (ready.first.priority > busy_processor.running.priority) {
41+
move busy_processor.running to ready;
42+
move ready.first to idle_processor.running;
43+
}
44+
}
45+
}
46+
47+
transitions context_init (basic_task t) {
48+
SUSPENDED -> READY {
49+
t.new = YES;
50+
}
51+
READY -> RUNNING {
52+
if (t.new) {
53+
t.new = NO;
54+
/* init_context(t); */
55+
}
56+
}
57+
}
58+
59+
transitions reset_event_masks (extended_task t) {
60+
SUSPENDED -> READY {
61+
t.events_wait = 0;
62+
t.events_set = 0;
63+
}
64+
}
65+
66+
backend storm (basic_task t) {
67+
activate { move t to ready; }
68+
unblock { move t to ready; }
69+
block { move t to []; }
70+
terminate { move t to [SUSPENDED]; }
71+
sched { call fixed_priority.schedule; }
72+
priority for t.priority
73+
}
74+
/*
75+
api osek {
76+
ActivateTask(basic_task t)
77+
runtime error (t.activation < t.max_activation)
78+
{
79+
ready_list <- t
80+
81+
}
82+
}
83+
*/
84+
85+
}

src/all_leos.galgasProject

+23-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,32 @@ project (0:0:1) -> "leos"
2424
"galgas-sources/expression_semantics.galgas"
2525
"galgas-sources/leos_types.galgas"
2626
"galgas-sources/utilities.galgas"
27-
# "galgas-sources/config_generation.galgas"
27+
"galgas-sources/config_generation.galgas"
2828
"galgas-sources/leos_grammar.galgas"
2929

3030
"galgas-sources/leos_cocoa.galgas"
3131
"galgas-sources/leos_program.galgas"
3232

33-
#--- Extern source file (relative path from 'hand_coded_sources' directory)
34-
# extern "leos_computations.cpp";
33+
#--- GTL
34+
"GTL/galgas-sources/gtl_interface.galgas"
35+
"GTL/galgas-sources/gtl_types.galgas"
36+
"GTL/galgas-sources/gtl_expressions.galgas"
37+
"GTL/galgas-sources/gtl_data_types.galgas"
38+
"GTL/galgas-sources/gtl_scanner.galgas"
39+
"GTL/galgas-sources/gtl_parser.galgas"
40+
"GTL/galgas-sources/gtl_instruction_parser.galgas"
41+
"GTL/galgas-sources/gtl_module.galgas"
42+
"GTL/galgas-sources/gtl_module_parser.galgas"
43+
"GTL/galgas-sources/gtl_module_grammar.galgas"
44+
"GTL/galgas-sources/gtl_expression_parser.galgas"
45+
"GTL/galgas-sources/gtl_instructions.galgas"
46+
"GTL/galgas-sources/gtl_grammar.galgas"
47+
"GTL/galgas-sources/gtl_functions.galgas"
48+
"GTL/galgas-sources/gtl_options.galgas"
49+
"GTL/galgas-sources/gtl_debugger.galgas"
50+
"GTL/galgas-sources/gtl_debugger_input.galgas"
51+
"GTL/galgas-sources/gtl_debugger_scanner.galgas"
52+
"GTL/galgas-sources/gtl_debugger_grammar.galgas"
53+
"GTL/galgas-sources/gtl_debugger_parser.galgas"
54+
"GTL/galgas-sources/gtl_debugger_expression_parser.galgas"
3555
}

0 commit comments

Comments
 (0)