Subversion Repositories shark

Rev

Rev 1407 | 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
#include "chimera.h"
14
 
1395 giacomo 15
void program_key_end(KEY_EVT* e)
1331 giacomo 16
{
1395 giacomo 17
 
1331 giacomo 18
        int i;
19
        TIME tmp;
20
 
21
        end_send();
22
 
23
        for (i=3; i<MAX_PROC; i++){
24
                if (!jet_getstat(i, NULL, &tmp, NULL, NULL))
25
                        kern_printf("Task Name : %s - Max Time  : %d\n", proc_table[i].name, (int)tmp);
26
        }
1395 giacomo 27
 
1408 giacomo 28
        trace_send();
29
 
1395 giacomo 30
        sys_end();
31
 
1331 giacomo 32
}
33
 
1333 giacomo 34
void action_stand_up(void) {
35
 
1395 giacomo 36
  struct action_event e;
37
  int event;
1339 giacomo 38
 
39
  status.power = 1;
40
 
1395 giacomo 41
  kern_gettime(&(e.time));
42
  ADDUSEC2TIMESPEC(5000000,&(e.time));
1333 giacomo 43
 
1395 giacomo 44
  e.type = EVT_SET_MASK_LEG_ANGLE;
45
  e.mask = 0x3F;
46
  e.ang.a = 0 * 3600;
47
  e.ang.b = 70 * 3600;
48
  e.ang.c = 0;
49
  e.pwm = 7;
1333 giacomo 50
 
1395 giacomo 51
  event = insert_action_event(&(e));
1397 giacomo 52
  cprintf("Event num = %d\n",event);
1339 giacomo 53
 
1395 giacomo 54
  ADDUSEC2TIMESPEC(1000000,&(e.time));
1334 giacomo 55
 
1395 giacomo 56
  e.type = EVT_SET_MASK_LEG_ANGLE;
57
  e.mask = 0x3F;
58
  e.ang.a = 0 * 3600;
59
  e.ang.b = 0 * 3600;
60
  e.ang.c = 0;
61
  e.pwm = 7;
1333 giacomo 62
 
1395 giacomo 63
  event = insert_action_event(&(e));
1397 giacomo 64
  cprintf("Event num = %d\n",event);                          
65
 
1333 giacomo 66
}
67
 
1331 giacomo 68
int main(int argc, char **argv)
69
{
70
        TIME seme;
1395 giacomo 71
        KEY_EVT k;
1331 giacomo 72
 
73
        seme = sys_gettime(NULL);
74
        srand(seme);
75
 
1395 giacomo 76
        k.flag = ALTL_BIT;
77
        k.scan = KEY_C;
78
        k.ascii = 'c';
79
        keyb_hook(k,program_key_end);
1331 giacomo 80
 
1335 giacomo 81
        clear();
82
 
1408 giacomo 83
        trace_init(1000000);
84
 
1331 giacomo 85
        init_send();            /* Comunication */
86
        init_key();             /* Keyboard */
87
 
1396 giacomo 88
        init_action_event(100);
89
 
1390 mauro 90
        action_stand_up();
1333 giacomo 91
 
1331 giacomo 92
        return 0;
1359 giacomo 93
 
1331 giacomo 94
}