Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

#ifndef _carfinal_h
#define _carfinal_h
/*-----------------------include files---------------------------*/
#include <ll/ll.h>
#include <kernel/types.h>
#include <kernel/descr.h>
#include <kernel/kern.h>
#include <drivers/glib.h>
#include <drivers/mouse.h>
#include <drivers/keyb.h>
#include <drivers/keycode.h>
#include <semaphore.h>
#include <stdlib.h>
#include <math.h>
#include <modules/hartport.h>
#include <string.h>
#include "myjetctrl.h"
/*-----------------------------------------------------------------------*/

#define YMENU    10             /* menu level*/
#define XMIN     50
#define XMAX     350            //chgd from 400
#define YMIN     100
#define YMAX     450
#define VEL      8  /* constant used for vmax*/
#define ANG      30
#define D        3
#define ESC      27 /* ASCII code of ESCAPE key*/
#define MAX_C    10 /* max number of cars*/

#define CARGROUP 1
#define MINDIST 100 /* Minimum Distance */
#define COLDIST 10 /*distance below which cars collide=max value of velocity*/
/*------------------------------------------------------------------*/

double  tick = 1.0;    /* system tick = 1 ms */
int     car_period = 40000; /* task period*/
int     car_wcet = 1500;   /* task wcet 1000 */
int Px = XMAX - 100;
int Py = YMAX - 100;
PID     pid, rid;
sem_t   mutex;
sem_t sync_m;
PORT px[MAX_C];
PORT py[MAX_C];
int carcount = 0;
int count;
enum mybool{false = 0,true = 1};

/*---------------colors used--------------------*/
int white = rgb16(255,255,255);
int black = rgb16(0,0,0);
int red   = rgb16(255,0,0);
int gray  = rgb16(128,128,128);
int blue = rgb16(0,0,255);
int yellow = rgb16(255,255,0);
int background = rgb16(0,0,0);
/*---------------------------------------------*/

mutex_t display_mutex;
/*----------------function declarations-----------------------------*/
int randomnumber(int, int);
int randomangle();
int hide_car(int x,int y);
int draw_car(int x,int y,int vmax);
int boundary_check(int *x, int *y);
void myhook(KEY_EVT *key1);
void byebye(void *arg);
void mouseHandler(MOUSE_EVT* evt);
int randomnumber(int,int);
int randomangle();

void func_collision(int carid, int x, int y, int *collisioncount,enum mybool *collide,enum mybool *warning, double *alpha);
void byebye(void *arg);
int app_mutex_init(mutex_t *m);

/*----------------------------functiondeclaration ends---------------*/


/*---------------Tasks Dedclaration------------------------*/
TASK  Car(void *arg);
TASK repaint_border(void *arg);
/*-----------------------------------------------------------*/


#endif