Subversion Repositories shark

Rev

Rev 1334 | Rev 1336 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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