Rev 1624 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1624 | giacomo | 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 | * (see the web pages for full authors list) |
||
11 | * |
||
12 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
13 | * |
||
14 | * http://www.sssup.it |
||
15 | * http://retis.sssup.it |
||
16 | * http://shark.sssup.it |
||
17 | */ |
||
18 | |||
19 | /* |
||
20 | * Copyright (C) 1999 Luca Abeni and Massimiliano Giorgi |
||
21 | * |
||
22 | * This program is free software; you can redistribute it and/or modify |
||
23 | * it under the terms of the GNU General Public License as published by |
||
24 | * the Free Software Foundation; either version 2 of the License, or |
||
25 | * (at your option) any later version. |
||
26 | * |
||
27 | * This program is distributed in the hope that it will be useful, |
||
28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
30 | * GNU General Public License for more details. |
||
31 | * |
||
32 | * You should have received a copy of the GNU General Public License |
||
33 | * along with this program; if not, write to the Free Software |
||
34 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
35 | * |
||
36 | */ |
||
37 | |||
38 | /* |
||
39 | * CVS : $Id: gvideo.c,v 1.1.1.1 2004-05-24 17:54:50 giacomo Exp $ |
||
40 | * |
||
41 | * File: $File$ |
||
42 | * Revision: $Revision: 1.1.1.1 $ |
||
43 | * Last update: $Date: 2004-05-24 17:54:50 $ |
||
44 | */ |
||
45 | |||
46 | //#include "config.h" |
||
47 | |||
48 | #include <kernel/func.h> |
||
49 | #include <kernel/model.h> |
||
50 | #include <kernel/const.h> |
||
51 | |||
52 | #include <drivers/glib.h> |
||
53 | |||
54 | #include <stdlib.h> |
||
55 | |||
56 | #include <stdio.h> |
||
57 | #include <stdlib.h> |
||
58 | #include <fcntl.h> |
||
59 | |||
60 | #include "config.h" |
||
61 | #include "global.h" |
||
62 | |||
63 | #define COLORFG rgb16(255,255,255) |
||
64 | #define COLORBG rgb16(0,0,0) |
||
65 | |||
66 | #define SP rgb16(0,128,0) |
||
67 | #define FG rgb16(255,255,255) |
||
68 | #define BG rgb16(0,0,0) |
||
69 | |||
70 | /* border size (pixels) */ |
||
71 | #define BO 4 |
||
72 | |||
73 | |||
74 | //#define NOGRX |
||
75 | |||
76 | /* |
||
77 | * |
||
78 | */ |
||
79 | |||
80 | |||
81 | void draw_frame(int x, int y, int dx, int dy) |
||
82 | { |
||
83 | #ifndef NOGRX |
||
84 | grx_box(x-1-BO,y-1-BO,x+dx+BO,y+dy+BO,SP); |
||
85 | grx_rect(x-1-BO,y-1-BO,x+dx+BO,y+dy+BO,FG); |
||
86 | grx_box(x,y,x+dx-1,y+dy-1,BG); |
||
87 | grx_rect(x-1,y-1,x+dx,y+dy,FG); |
||
88 | #endif |
||
89 | } |
||
90 | |||
91 | static TASK play(void *arg) |
||
92 | { |
||
93 | int x1,y1,x2,y2; |
||
94 | int moreframes; |
||
95 | struct framebuf_struct *fbuf; |
||
96 | |||
97 | x1=1; |
||
98 | y1=1; |
||
99 | x2=x1+Coded_Picture_Width-1; |
||
100 | y2=y1+Coded_Picture_Height-1; |
||
101 | |||
102 | moreframes=1; |
||
103 | task_nopreempt(); |
||
104 | |||
105 | while (moreframes) { |
||
106 | fbuf = remove_frame(); |
||
107 | #ifndef NOGRX |
||
108 | // grxlock(); |
||
109 | // grx_rect(10,10,10+5*fbuf->n,10+5*fbuf->n,FG); |
||
110 | grx_putimage(x1, y1, x2, y2, fbuf->f); |
||
111 | // grxunlock(); |
||
112 | #else |
||
113 | cprintf("(%d %d)\n",fbuf->n, fbuf->f); |
||
114 | #endif |
||
115 | give_back_framebuf(fbuf); |
||
116 | task_endcycle(); |
||
117 | } |
||
118 | |||
119 | return NULL; |
||
120 | } |
||
121 | |||
122 | void gvideo_init(void) |
||
123 | { |
||
124 | SOFT_TASK_MODEL model; |
||
125 | PID pid; |
||
126 | int period,wcet; |
||
127 | |||
128 | #ifndef NOGRX |
||
129 | grx_init(); |
||
130 | grx_setmode(grx_getmode(800, 600, 16)); |
||
131 | #endif |
||
132 | |||
133 | // draw_frame(0, 0, CodedImageWidth,CodedImageHeight); |
||
134 | |||
135 | srand(7); |
||
136 | |||
137 | period=1000000/20; |
||
138 | wcet=20000; |
||
139 | |||
140 | soft_task_default_model(model); |
||
141 | soft_task_def_met(model,wcet); |
||
142 | soft_task_def_wcet(model,wcet); |
||
143 | soft_task_def_period(model,period); |
||
144 | soft_task_def_periodic(model); |
||
145 | soft_task_def_ctrl_jet(model); |
||
146 | |||
147 | pid=task_create("Video",play,&model,NULL); |
||
148 | if (pid!=-1) task_activate(pid); |
||
149 | } |
||
150 | |||
151 | |||
152 | |||
153 | |||
154 | |||
155 | |||
156 | |||
157 |