Subversion Repositories shark

Rev

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

Rev Author Line No. Line
1090 pj 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
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   (see the web pages for full authors list)
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
1469 giacomo 21
/* CVS :        $Id: esplo.c,v 1.5 2004-05-26 09:25:06 giacomo Exp $ */
1090 pj 22
 
23
/*
24
 * Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.it>
25
 *
26
 * This program is free software; you can redistribute it and/or modify
27
 * it under the terms of the GNU General Public License as published by
28
 * the Free Software Foundation; either version 2 of the License, or
29
 * (at your option) any later version.
30
 *
31
 * This program is distributed in the hope that it will be useful,
32
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34
 * GNU General Public License for more details.
35
 *
36
 * You should have received a copy of the GNU General Public License
37
 * along with this program; if not, write to the Free Software
38
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
39
 *
40
 */
41
 
42
//************************
43
//* file:        esplo.c *
44
//* included by: bca.c   *
45
//************************
46
 
1123 pj 47
#include <time.h>
48
 
1090 pj 49
PID crea_soft_esplo(int index)
50
{
51
  SOFT_TASK_MODEL m;
52
  PID pid;
53
 
54
  soft_task_default_model(m);
55
  soft_task_def_arg(m,(void*)index);
1468 giacomo 56
  soft_task_def_period(m,ESPLO_PERIOD*2);
1469 giacomo 57
  soft_task_def_wcet(m,ESPLO_WCET*10);
58
  soft_task_def_met(m,ESPLO_MET*10);
1090 pj 59
 
60
  pid = task_create("esplo", esplo, &m, NULL);
61
  return pid;
62
}
63
 
64
TASK esplo(void *argv)
65
{
66
  int i;
67
  int index;
68
  WORD xx0, yy0, xx1, yy1;
1117 pj 69
  struct timespec delay;
1090 pj 70
 
1117 pj 71
 
1468 giacomo 72
  delay.tv_sec = 0;
73
  delay.tv_nsec = 20000000;
1090 pj 74
  i=0;
75
  index = (int)argv;
76
  xx0 = aereo_table[index].x - ESPLO_LX/2;
77
  yy0 = aereo_table[index].y - ESPLO_LY/2;
78
  xx1 = xx0   + ESPLO_LX-1;
79
  yy1 = yy0   + ESPLO_LY-1;
80
 
81
  for(i=0;i<5;i++) {
1468 giacomo 82
     mutex_lock(&grx_mutex);
83
     FAB_image_put_within(image_esplo[i],xx0,yy0,X0,Y0,X1,Y1);
84
     mutex_unlock(&grx_mutex);
85
     task_endcycle();
86
  }
1090 pj 87
 
88
  mutex_lock(&grx_mutex);
89
  FAB_image_put_within(image_bca,X0,Y0,xx0,yy0,xx1,yy1);
90
  mutex_unlock(&grx_mutex);
91
 
1468 giacomo 92
  return 0;
93
 
1090 pj 94
}