Rev 1627 | Rev 1629 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1627 | giacomo | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Giacomo Guidi <giacomo@gandalf.sssup.ti> |
||
10 | * |
||
11 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
12 | * |
||
13 | * http://www.sssup.it |
||
14 | * http://retis.sssup.it |
||
15 | * http://shark.sssup.it |
||
16 | */ |
||
17 | |||
18 | /* |
||
19 | * This program is free software; you can redistribute it and/or modify |
||
20 | * it under the terms of the GNU General Public License as published by |
||
21 | * the Free Software Foundation; either version 2 of the License, or |
||
22 | * (at your option) any later version. |
||
23 | * |
||
24 | * This program is distributed in the hope that it will be useful, |
||
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
27 | * GNU General Public License for more details. |
||
28 | * |
||
29 | * You should have received a copy of the GNU General Public License |
||
30 | * along with this program; if not, write to the Free Software |
||
31 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
32 | */ |
||
33 | |||
34 | #include "kernel/kern.h" |
||
35 | |||
36 | TASK elastic_test(void *arg) { |
||
37 | |||
38 | while(1) { |
||
39 | |||
40 | cprintf("X."); |
||
41 | |||
42 | task_endcycle(); |
||
43 | |||
44 | } |
||
45 | |||
46 | } |
||
47 | |||
48 | int main(int argc, char **argv) |
||
49 | { |
||
50 | |||
51 | ELASTIC_TASK_MODEL e; |
||
52 | PID el_pid; |
||
53 | |||
1628 | giacomo | 54 | cprintf("Elastic Task Demo\n"); |
55 | |||
1627 | giacomo | 56 | elastic_task_default_model(e); |
57 | elastic_task_def_period(e, 10000, 100000); |
||
58 | elastic_task_def_wcet(e, 4000); |
||
59 | elastic_task_def_param(e, 0, 0); |
||
60 | elastic_task_def_ctrl_jet(e); |
||
61 | elastic_task_def_usemath(e); |
||
62 | |||
63 | el_pid = task_create("Elastic Test",elastic_test,&e,NULL); |
||
64 | if (el_pid == NIL) { |
||
65 | cprintf("ERROR: Cannot create elastic task\n"); |
||
66 | sys_end(); |
||
67 | } |
||
68 | |||
69 | task_activate(el_pid); |
||
70 | |||
1628 | giacomo | 71 | while(sys_gettime(NULL) < 10000000); |
72 | |||
73 | sys_end(); |
||
74 | |||
1627 | giacomo | 75 | return 0; |
76 | |||
77 | } |