Subversion Repositories shark

Rev

Rev 1117 | 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
 
1123 pj 21
/* CVS :        $Id: esplo.c,v 1.3 2003-01-07 17:10:16 pj 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);
56
  soft_task_def_period(m,ESPLO_PERIOD*5);
57
  soft_task_def_wcet(m,ESPLO_WCET*5);
58
  soft_task_def_met(m,ESPLO_MET*5);
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
 
72
  delay.tv_sec = (ESPLO_PERIOD-ESPLO_MET)/1000000;
73
  delay.tv_nsec = ((ESPLO_PERIOD-ESPLO_MET)%1000000)*1000;
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
  while(1){
82
 
83
  for(i=0;i<5;i++) {
84
       mutex_lock(&grx_mutex);
85
       FAB_image_put_within(image_bca,X0,Y0,xx0,yy0,xx1,yy1);
86
       FAB_image_put_within(image_esplo[i],xx0,yy0,X0,Y0,X1,Y1);
87
       mutex_unlock(&grx_mutex);
1117 pj 88
       nanosleep(&delay, NULL);
1090 pj 89
       }
90
 
91
  mutex_lock(&grx_mutex);
92
  FAB_image_put_within(image_bca,X0,Y0,xx0,yy0,xx1,yy1);
93
  mutex_unlock(&grx_mutex);
94
  return NULL;
95
 
96
  task_endcycle();
97
  }
98
}