Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

/*
 * Project: S.Ha.R.K.
 *
 * Coordinators:
 *   Giorgio Buttazzo    <giorgio@sssup.it>
 *   Paolo Gai           <pj@gandalf.sssup.it>
 *
 * Authors     :
 *   Paolo Gai           <pj@gandalf.sssup.it>
 *   (see the web pages for full authors list)
 *
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
 *
 * http://www.sssup.it
 * http://retis.sssup.it
 * http://shark.sssup.it
 */


/**
 ------------
 CVS :        $Id: demo.h,v 1.1 2003-06-04 09:41:32 giacomo Exp $

 File:        $File$
 Revision:    $Revision: 1.1 $
 Last update: $Date: 2003-06-04 09:41:32 $
 ------------
**/


/*
 * Copyright (C) 2000 Paolo Gai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */



#include <ll/ll.h>
#include <kernel/types.h>
#include <kernel/descr.h>
#include <math.h>
#include <drivers/glib.h>
#include <drivers/keyb.h>

#include <modules/hartport.h>
#include <modules/sem.h>

#define JET_ON
#define BALL_ON

/*
 *
 * WCET, Periods and Models
 *
 */



/* define if you want NRT or SOFT... */
#define TASK_TYPE SOFT
//#define TASK_TYPE NRT

#define WCET_JETCTRL      7500
#define WCET_JETDUMMY      200
#define WCET_JETSLIDE     2100

#define PERIOD_JETCTRL  100000
#define PERIOD_JETDUMMY 100000
#define PERIOD_JETSLIDE 100000


//#define WCET_BALL          100
#define WCET_BALL          500

#define PERIOD_BALL        25000

#define WCET_SCHED         450

#define PERIOD_SCHED      15000

/*
 *
 * Global Stuffs
 *
 */


/* graphic mutex... */
extern mutex_t mutex;

/* sincronizzazione */
//extern sem_t pmutex;
extern mutex_t palmutex;

/* useful colors... */
extern int white;
extern int black;
extern int red;
extern int gray;
extern int green;

void init_jetcontrol();
void init_ball(void);
void scenario_jetcontrol();
void scenario_ball();
char *itoa(int n, char *s);
int myrand(int x);

void initSched(void);
void setPalla (int);
void inizioPartita (void);
void collisioneRilevata(int);
int controlloBuche (float, float, int);
void hardSched (void);
void hardball (void);

/*
 *
 * JETCONTROL stuffs
 *
 */


#define JET_NTASK   15
#define JET_Y_NAME 170

#define DUMMY_PID    1

#define JET_DUMMY_WIDTH    210
#define JET_DUMMY_HEIGHT    80

/* the point (x, y) is the top left corner */
#define JET_DUMMY_X        428
#define JET_DUMMY_Y        65

#define JET_SLIDE_WIDTH     50
#define JET_SLIDE_X        576




/*
 *
 * BALL stuffs
 *
 */


// x and y corners are specified whithout consider a border of 3 pixels
#define BALL_YMAX   390   /* position of the ceil  */
#define BALL_Y      425   /* position of the floor  */
#define BALL_VELY    .1  /* vertical ball velocity */
#define BALL_HEIGHT  5   /* initial height of the ball */
#define BALL_XMIN    65   /* min position X of the ball */
#define BALL_XMAX   255   /* max position X of the ball */
#define BALL_VELX    0.  /* horizontal ball velocity */
#define BALL_VYMIN   11.        /* min ground speed             */
#define BALL_MAX_P   11   /* max number of balls    */

#define BALL_GROUP    2          /* task group of the balls */

#define COLLISION 1
#define NO_COLLISION 0