Blame |
Last modification |
View Log
| RSS feed
#include <kernel/kern.h>
#include <drivers/glib.h>
#include <drivers/keyb.h>
#include <semaphore.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
/*PREY & PREDATOR Dimensions*/
#define RAD 3
#define PREY_RAD 2
/*Graphics dimensions*/
#define BARSIZE 50
#define YMENU 10
#define XMIN 20
#define XMAX 460
#define YMIN 20
#define YMAX 460
#define RATIO 20
/*Grid Mapping*/
int MAPPING = XMIN/RATIO;
int grid[(XMAX-XMIN)/RATIO][(YMAX-YMIN)/RATIO];
/*Tasks number and id */
#define SNAKEGROUP 1
#define INITIAl_TASKS 3
#define MAXTASKS 18
PID pid;
int number_of_tasks =0;
/*For Jet Control*/
#define SNAKE_R "S_Red"
#define SNAKE_B "S_Blue"
#define SNAKE_Y "S_Yell"
#define BAR "BarGraph"
#define PREY "Prey"
const char* NAME[]={SNAKE_R,SNAKE_B,SNAKE_Y,PREY,BAR,NULL};
/* WCET, Periods and Models */
int sam_red_period = 40000; /* task period 40000 */
int sam_red_wcet = 1000; /* task wcet 1000 */
int sam_blue_period = 60000; /* task period 60000 */
int sam_blue_wcet = 1500; /* task wcet 1500 */
int sam_yellow_period = 80000; /* task period 80000 */
int sam_yellow_wcet = 2000; /* task wcet 2000 */
int prey_period = 50000; /* task period 50000 */
int prey_wcet = 1500; /* task wcet 1500 */
int PERIOD_BARGRAPH = 80000; /* task period for bargraph 80000 */
int WCET_BARGRAPH = 2000; /* task wcet for bargraph 2000 */
int PERIOD_JET = 500000; /* task period for bargraph 500000 */
int WCET_JET = 1000; /* task wcet for bargraph 1000 */
/*For grid and graphics semaphore*/
sem_t grx_mutex;
sem_t grid_mutex;
/*Prey decalaration*/
struct Prey
{
int x;
int y;
int isAlive;
};
/*Predator decalaration*/
struct Saamp
{
int x;
int y;
int color;
int number_of_times_killed;
};
struct Saamp saamps[MAXTASKS + 1];
/*For score card*/
int red_killed = 0,blue_killed=0,yellow_killed=0;
/* Useful colours*/
int GREEN1 = 2;
int BLACK1 = 0;
int RED1 = 4;
int BLUE1 = 1;
int LIGHTRED1 = 12;
int YELLOW1 = 14;
int WHITE1 = 15;