Subversion Repositories shark

Rev

Rev 1117 | Go to most recent revision | Details | 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
 
21
/* CVS :        $Id: esplo.c,v 1.1 2002-10-01 10:25:00 pj Exp $ */
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
 
47
PID crea_soft_esplo(int index)
48
{
49
  SOFT_TASK_MODEL m;
50
  PID pid;
51
 
52
  soft_task_default_model(m);
53
  soft_task_def_arg(m,(void*)index);
54
  soft_task_def_period(m,ESPLO_PERIOD*5);
55
  soft_task_def_wcet(m,ESPLO_WCET*5);
56
  soft_task_def_met(m,ESPLO_MET*5);
57
 
58
  pid = task_create("esplo", esplo, &m, NULL);
59
  return pid;
60
}
61
 
62
TASK esplo(void *argv)
63
{
64
  int i;
65
  int index;
66
  WORD xx0, yy0, xx1, yy1;
67
 
68
  i=0;
69
  index = (int)argv;
70
  xx0 = aereo_table[index].x - ESPLO_LX/2;
71
  yy0 = aereo_table[index].y - ESPLO_LY/2;
72
  xx1 = xx0   + ESPLO_LX-1;
73
  yy1 = yy0   + ESPLO_LY-1;
74
 
75
  while(1){
76
 
77
  for(i=0;i<5;i++) {
78
       mutex_lock(&grx_mutex);
79
       FAB_image_put_within(image_bca,X0,Y0,xx0,yy0,xx1,yy1);
80
       FAB_image_put_within(image_esplo[i],xx0,yy0,X0,Y0,X1,Y1);
81
       mutex_unlock(&grx_mutex);
82
       task_delay(ESPLO_PERIOD-ESPLO_MET);
83
       }
84
 
85
  mutex_lock(&grx_mutex);
86
  FAB_image_put_within(image_bca,X0,Y0,xx0,yy0,xx1,yy1);
87
  mutex_unlock(&grx_mutex);
88
  return NULL;
89
 
90
  task_endcycle();
91
  }
92
}