Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1664 | pj | 1 | #ifndef _carfinal_h |
2 | #define _carfinal_h |
||
3 | /*-----------------------include files---------------------------*/ |
||
4 | #include <ll/ll.h> |
||
5 | #include <kernel/types.h> |
||
6 | #include <kernel/descr.h> |
||
7 | #include <kernel/kern.h> |
||
8 | #include <drivers/glib.h> |
||
9 | #include <drivers/mouse.h> |
||
10 | #include <drivers/keyb.h> |
||
11 | #include <drivers/keycode.h> |
||
12 | #include <semaphore.h> |
||
13 | #include <stdlib.h> |
||
14 | #include <math.h> |
||
15 | #include <modules/hartport.h> |
||
16 | #include <string.h> |
||
17 | #include "myjetctrl.h" |
||
18 | /*-----------------------------------------------------------------------*/ |
||
19 | |||
20 | #define YMENU 10 /* menu level*/ |
||
21 | #define XMIN 50 |
||
22 | #define XMAX 350 //chgd from 400 |
||
23 | #define YMIN 100 |
||
24 | #define YMAX 450 |
||
25 | #define VEL 8 /* constant used for vmax*/ |
||
26 | #define ANG 30 |
||
27 | #define D 3 |
||
28 | #define ESC 27 /* ASCII code of ESCAPE key*/ |
||
29 | #define MAX_C 10 /* max number of cars*/ |
||
30 | |||
31 | #define CARGROUP 1 |
||
32 | #define MINDIST 100 /* Minimum Distance */ |
||
33 | #define COLDIST 10 /*distance below which cars collide=max value of velocity*/ |
||
34 | /*------------------------------------------------------------------*/ |
||
35 | |||
36 | double tick = 1.0; /* system tick = 1 ms */ |
||
37 | int car_period = 40000; /* task period*/ |
||
38 | int car_wcet = 1500; /* task wcet 1000 */ |
||
39 | int Px = XMAX - 100; |
||
40 | int Py = YMAX - 100; |
||
41 | PID pid, rid; |
||
42 | sem_t mutex; |
||
43 | sem_t sync_m; |
||
44 | PORT px[MAX_C]; |
||
45 | PORT py[MAX_C]; |
||
46 | int carcount = 0; |
||
47 | int count; |
||
48 | enum mybool{false = 0,true = 1}; |
||
49 | |||
50 | /*---------------colors used--------------------*/ |
||
51 | int white = rgb16(255,255,255); |
||
52 | int black = rgb16(0,0,0); |
||
53 | int red = rgb16(255,0,0); |
||
54 | int gray = rgb16(128,128,128); |
||
55 | int blue = rgb16(0,0,255); |
||
56 | int yellow = rgb16(255,255,0); |
||
57 | int background = rgb16(0,0,0); |
||
58 | /*---------------------------------------------*/ |
||
59 | |||
60 | mutex_t display_mutex; |
||
61 | /*----------------function declarations-----------------------------*/ |
||
62 | int randomnumber(int, int); |
||
63 | int randomangle(); |
||
64 | int hide_car(int x,int y); |
||
65 | int draw_car(int x,int y,int vmax); |
||
66 | int boundary_check(int *x, int *y); |
||
67 | void myhook(KEY_EVT *key1); |
||
68 | void byebye(void *arg); |
||
69 | void mouseHandler(MOUSE_EVT* evt); |
||
70 | int randomnumber(int,int); |
||
71 | int randomangle(); |
||
72 | |||
73 | void func_collision(int carid, int x, int y, int *collisioncount,enum mybool *collide,enum mybool *warning, double *alpha); |
||
74 | void byebye(void *arg); |
||
75 | int app_mutex_init(mutex_t *m); |
||
76 | |||
77 | /*----------------------------functiondeclaration ends---------------*/ |
||
78 | |||
79 | |||
80 | /*---------------Tasks Dedclaration------------------------*/ |
||
81 | TASK Car(void *arg); |
||
82 | TASK repaint_border(void *arg); |
||
83 | /*-----------------------------------------------------------*/ |
||
84 | |||
85 | |||
86 | #endif |