Subversion Repositories shark

Rev

Rev 1590 | 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
 
1590 tullio 21
/* CVS :        $Id: esplo.c,v 1.6 2006-07-03 15:10:15 tullio 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
 
1123 pj 42
#include <time.h>
1590 tullio 43
#include "bca.h"
1123 pj 44
 
1090 pj 45
PID crea_soft_esplo(int index)
46
{
47
  SOFT_TASK_MODEL m;
48
  PID pid;
49
 
50
  soft_task_default_model(m);
51
  soft_task_def_arg(m,(void*)index);
1468 giacomo 52
  soft_task_def_period(m,ESPLO_PERIOD*2);
1469 giacomo 53
  soft_task_def_wcet(m,ESPLO_WCET*10);
54
  soft_task_def_met(m,ESPLO_MET*10);
1090 pj 55
 
56
  pid = task_create("esplo", esplo, &m, NULL);
57
  return pid;
58
}
59
 
60
TASK esplo(void *argv)
61
{
62
  int i;
63
  int index;
64
  WORD xx0, yy0, xx1, yy1;
1117 pj 65
  struct timespec delay;
1090 pj 66
 
1117 pj 67
 
1468 giacomo 68
  delay.tv_sec = 0;
69
  delay.tv_nsec = 20000000;
1090 pj 70
  i=0;
71
  index = (int)argv;
72
  xx0 = aereo_table[index].x - ESPLO_LX/2;
73
  yy0 = aereo_table[index].y - ESPLO_LY/2;
74
  xx1 = xx0   + ESPLO_LX-1;
75
  yy1 = yy0   + ESPLO_LY-1;
76
 
77
  for(i=0;i<5;i++) {
1468 giacomo 78
     mutex_lock(&grx_mutex);
79
     FAB_image_put_within(image_esplo[i],xx0,yy0,X0,Y0,X1,Y1);
80
     mutex_unlock(&grx_mutex);
81
     task_endcycle();
82
  }
1090 pj 83
 
84
  mutex_lock(&grx_mutex);
85
  FAB_image_put_within(image_bca,X0,Y0,xx0,yy0,xx1,yy1);
86
  mutex_unlock(&grx_mutex);
87
 
1468 giacomo 88
  return 0;
89
 
1090 pj 90
}