Subversion Repositories shark

Rev

Rev 1336 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1331 giacomo 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
5
 *
6
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
7
 *
8
 * http://www.sssup.it
9
 * http://retis.sssup.it
10
 * http://shark.sssup.it
11
 */
12
 
13
/*
14
 * Copyright (C) 2000 Paolo Gai
15
 *
16
 * This program is free software; you can redistribute it and/or modify
17
 * it under the terms of the GNU General Public License as published by
18
 * the Free Software Foundation; either version 2 of the License, or
19
 * (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU General Public License
27
 * along with this program; if not, write to the Free Software
28
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29
 *
30
 */
31
 
32
#include "chimera.h"
33
 
34
void my_close(void *arg)
35
{
36
        int i;
37
        TIME tmp;
38
 
39
        end_send();
40
 
41
        for (i=3; i<MAX_PROC; i++){
42
                if (!jet_getstat(i, NULL, &tmp, NULL, NULL))
43
                        kern_printf("Task Name : %s - Max Time  : %d\n", proc_table[i].name, (int)tmp);
44
        }
45
}
46
 
1333 giacomo 47
void action_stand_up(void) {
48
 
1334 giacomo 49
  static struct action_event e[20];
1333 giacomo 50
  int i,temp;
51
 
1334 giacomo 52
  for (i=0;i<3;i++) {
1333 giacomo 53
 
1334 giacomo 54
    kern_gettime(&(e[i].time));
55
    ADDUSEC2TIMESPEC(10000000,&(e[i].time));
56
    temp = i*1000000;
57
    ADDUSEC2TIMESPEC(temp,&(e[i].time));
1333 giacomo 58
 
1334 giacomo 59
    e[i].type = EVT_SET_MASK_LEG_ANGLE;
60
    e[i].mask = 1 << i;
1336 giacomo 61
    e[i].ang.a = 45 * 3600;
62
    e[i].ang.b = 0;
63
    e[i].ang.c = 0;
64
    e[i].pwm = 7;
1333 giacomo 65
 
1334 giacomo 66
    insert_action_event(&(e[i]));
1333 giacomo 67
 
68
  }
1334 giacomo 69
 
70
  for (i=0;i<3;i++) {
1333 giacomo 71
 
1334 giacomo 72
    kern_gettime(&(e[6+i].time));
73
    ADDUSEC2TIMESPEC(20000000,&(e[6+i].time));
74
    temp = i*1000000;
75
    ADDUSEC2TIMESPEC(temp,&(e[6+i].time));
76
 
77
    e[6+i].type = EVT_SET_MASK_LEG_ANGLE;
78
    e[6+i].mask = 1 << i;
1336 giacomo 79
    e[6+i].ang.a = 135 * 3600;
80
    e[6+i].ang.b = 0;
81
    e[6+i].ang.c = 0;
82
    e[6+i].pwm = 7;    
83
 
84
 
1334 giacomo 85
    insert_action_event(&(e[6+i]));
86
 
87
  }
1335 giacomo 88
 
1333 giacomo 89
}
90
 
1331 giacomo 91
int main(int argc, char **argv)
92
{
93
        TIME seme;
94
 
95
        seme = sys_gettime(NULL);
96
        srand(seme);
97
 
98
        sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT);
99
 
1335 giacomo 100
        clear();
101
 
1331 giacomo 102
        init_send();            /* Comunication */
103
        init_key();             /* Keyboard */
104
 
1333 giacomo 105
        action_stand_up();
106
 
1331 giacomo 107
        return 0;
108
}