1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// example.c
|
4 |
|
|
//
|
5 |
|
|
// Demonstration of the synthetic target framebuffer capabilities
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
// -------------------------------------------
|
10 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
12 |
|
|
//
|
13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
15 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
// for more details.
|
22 |
|
|
//
|
23 |
|
|
// You should have received a copy of the GNU General Public License
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
//==========================================================================
|
40 |
|
|
//###DESCRIPTIONBEGIN####
|
41 |
|
|
//
|
42 |
|
|
// Author(s): bartv
|
43 |
|
|
// Date: 2008-10-06
|
44 |
|
|
//
|
45 |
|
|
//###DESCRIPTIONEND####
|
46 |
|
|
//========================================================================
|
47 |
|
|
|
48 |
|
|
#include <cyg/infra/cyg_type.h>
|
49 |
|
|
#include <cyg/infra/diag.h>
|
50 |
|
|
#include <cyg/hal/hal_arch.h>
|
51 |
|
|
#include <cyg/io/framebuf.h>
|
52 |
|
|
#include <cyg/kernel/kapi.h>
|
53 |
|
|
#include <string.h>
|
54 |
|
|
#include <stdio.h>
|
55 |
|
|
|
56 |
|
|
#define BLACK colours[0x00]
|
57 |
|
|
#define BLUE colours[0x01]
|
58 |
|
|
#define GREEN colours[0x02]
|
59 |
|
|
#define CYAN colours[0x03]
|
60 |
|
|
#define RED colours[0x04]
|
61 |
|
|
#define MAGENTA colours[0x05]
|
62 |
|
|
#define BROWN colours[0x06]
|
63 |
|
|
#define LIGHTGREY colours[0x07]
|
64 |
|
|
#define DARKGREY colours[0x08]
|
65 |
|
|
#define LIGHTBLUE colours[0x09]
|
66 |
|
|
#define LIGHTGREEN colours[0x0A]
|
67 |
|
|
#define LIGHTCYAN colours[0x0B]
|
68 |
|
|
#define LIGHTRED colours[0x0C]
|
69 |
|
|
#define LIGHTMAGENTA colours[0x0D]
|
70 |
|
|
#define YELLOW colours[0x0E]
|
71 |
|
|
#define WHITE colours[0x0F]
|
72 |
|
|
|
73 |
|
|
// ----------------------------------------------------------------------------
|
74 |
|
|
// FB0. 320x240 32bpp true 0888. Just draw a simple image as per the fb.c
|
75 |
|
|
// example and return to main().
|
76 |
|
|
|
77 |
|
|
static void
|
78 |
|
|
fb0_thread(cyg_addrword_t arg)
|
79 |
|
|
{
|
80 |
|
|
#define FRAMEBUF cyg_synth_fb0
|
81 |
|
|
static cyg_ucount32 colours[16];
|
82 |
|
|
cyg_ucount16 block_width;
|
83 |
|
|
int i;
|
84 |
|
|
|
85 |
|
|
for (i = 0; i < 16; i++) {
|
86 |
|
|
colours[i] = cyg_fb_make_colour(&FRAMEBUF,
|
87 |
|
|
cyg_fb_palette_vga[i + i + i], cyg_fb_palette_vga[i + i + i + 1],cyg_fb_palette_vga[i + i + i + 2]);
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
cyg_fb_on(&FRAMEBUF);
|
91 |
|
|
// A white background
|
92 |
|
|
cyg_fb_fill_block(&FRAMEBUF, 0, 0, FRAMEBUF.fb_width, FRAMEBUF.fb_height, WHITE);
|
93 |
|
|
// A black block in the middle, 25 pixels in.
|
94 |
|
|
cyg_fb_fill_block(&FRAMEBUF, 25, 25, FRAMEBUF.fb_width - 50, FRAMEBUF.fb_height - 50, BLACK);
|
95 |
|
|
|
96 |
|
|
// Four diagonal lines in the corners. Red in the top left, blue in the top right,
|
97 |
|
|
// green in the bottom left, and yellow in the bottom right.
|
98 |
|
|
for (i = 0; i < 25; i++) {
|
99 |
|
|
cyg_fb_write_pixel(&FRAMEBUF, i, i, RED);
|
100 |
|
|
cyg_fb_write_pixel(&FRAMEBUF, (FRAMEBUF.fb_width - 1) - i, i, BLUE);
|
101 |
|
|
cyg_fb_write_pixel(&FRAMEBUF, i, (FRAMEBUF.fb_height - 1) - i, GREEN);
|
102 |
|
|
cyg_fb_write_pixel(&FRAMEBUF, (FRAMEBUF.fb_width - 1) - i, (FRAMEBUF.fb_height - 1) - i, YELLOW);
|
103 |
|
|
}
|
104 |
|
|
|
105 |
|
|
// Horizontal and vertical lines. Cyan at the top, magenta on the bottom,
|
106 |
|
|
// brown on the left, lightgrey on the right.
|
107 |
|
|
cyg_fb_write_hline(&FRAMEBUF, 25, 12, FRAMEBUF.fb_width - 50, CYAN);
|
108 |
|
|
cyg_fb_write_hline(&FRAMEBUF, 25, FRAMEBUF.fb_height - 12, FRAMEBUF.fb_width - 50, MAGENTA);
|
109 |
|
|
cyg_fb_write_vline(&FRAMEBUF, 12, 25, FRAMEBUF.fb_height - 50, BROWN);
|
110 |
|
|
cyg_fb_write_vline(&FRAMEBUF, FRAMEBUF.fb_width - 12, 25, FRAMEBUF.fb_height - 50, LIGHTGREY);
|
111 |
|
|
|
112 |
|
|
// And 14 vertical stripes, from blue to yellow, in the centre of the box.
|
113 |
|
|
block_width = (FRAMEBUF.fb_width - 100) / 14;
|
114 |
|
|
for (i = 1; i <= 14; i++) {
|
115 |
|
|
cyg_fb_fill_block(&FRAMEBUF, 50 + ((i - 1) * block_width), 50, block_width, FRAMEBUF.fb_height - 100, colours[i]);
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
cyg_fb_synch(&FRAMEBUF, CYG_FB_UPDATE_NOW);
|
119 |
|
|
#undef FRAMEBUF
|
120 |
|
|
}
|
121 |
|
|
|
122 |
|
|
// ----------------------------------------------------------------------------
|
123 |
|
|
// FB1, 320x240 15bpp, true 555, two pages. Draw a set of horizontal lines
|
124 |
|
|
// in one page, vertical lines in the other, and flip between them at
|
125 |
|
|
// one second intervals.
|
126 |
|
|
|
127 |
|
|
static void
|
128 |
|
|
fb1_thread(cyg_addrword_t arg)
|
129 |
|
|
{
|
130 |
|
|
#define FRAMEBUF cyg_synth_fb1
|
131 |
|
|
static cyg_ucount32 colours[16];
|
132 |
|
|
struct cyg_fb_ioctl_page_flip page_flip;
|
133 |
|
|
size_t len;
|
134 |
|
|
int result;
|
135 |
|
|
int i;
|
136 |
|
|
|
137 |
|
|
cyg_fb_on(&FRAMEBUF);
|
138 |
|
|
for (i = 0; i < 16; i++) {
|
139 |
|
|
colours[i] = cyg_fb_make_colour(&FRAMEBUF,
|
140 |
|
|
cyg_fb_palette_vga[i + i + i], cyg_fb_palette_vga[i + i + i + 1],cyg_fb_palette_vga[i + i + i + 2]);
|
141 |
|
|
}
|
142 |
|
|
|
143 |
|
|
// Draw the horizontal stripes on page 0.
|
144 |
|
|
page_flip.fbpf_visible_page = 0;
|
145 |
|
|
page_flip.fbpf_drawable_page = 1;
|
146 |
|
|
page_flip.fbpf_when = CYG_FB_UPDATE_NOW;
|
147 |
|
|
len = sizeof(page_flip);
|
148 |
|
|
result = cyg_fb_ioctl(&FRAMEBUF, CYG_FB_IOCTL_PAGE_FLIPPING_SET_PAGES, &page_flip, &len);
|
149 |
|
|
if (result != 0) {
|
150 |
|
|
fprintf(stderr, "fb1_thread: initial page flip failed.\n");
|
151 |
|
|
}
|
152 |
|
|
// 16 colours, 240 rows -> 15 rows/colour
|
153 |
|
|
for (i = 0; i < 16; i++) {
|
154 |
|
|
cyg_fb_fill_block(&FRAMEBUF, 0, 15 * i, 320, 15, colours[i]);
|
155 |
|
|
}
|
156 |
|
|
|
157 |
|
|
// Show the horizontal stripes and draw the vertical stripes on page 0.
|
158 |
|
|
page_flip.fbpf_visible_page = 1;
|
159 |
|
|
page_flip.fbpf_drawable_page = 0;
|
160 |
|
|
page_flip.fbpf_when = CYG_FB_UPDATE_NOW;
|
161 |
|
|
len = sizeof(page_flip);
|
162 |
|
|
result = cyg_fb_ioctl(&FRAMEBUF, CYG_FB_IOCTL_PAGE_FLIPPING_SET_PAGES, &page_flip, &len);
|
163 |
|
|
if (result != 0) {
|
164 |
|
|
fprintf(stderr, "fb1_thread: second page flip failed.\n");
|
165 |
|
|
}
|
166 |
|
|
// 16 colours, 320 columns -> 20 columns/colour
|
167 |
|
|
for (i = 0; i < 16; i++) {
|
168 |
|
|
cyg_fb_fill_block(&FRAMEBUF, 20 * i, 0, 20, 240, colours[i]);
|
169 |
|
|
}
|
170 |
|
|
|
171 |
|
|
for ( i = 0; ; i = 1 - i) {
|
172 |
|
|
page_flip.fbpf_visible_page = i;
|
173 |
|
|
page_flip.fbpf_drawable_page = 1 - i;
|
174 |
|
|
page_flip.fbpf_when = CYG_FB_UPDATE_NOW;
|
175 |
|
|
len = sizeof(page_flip);
|
176 |
|
|
result = cyg_fb_ioctl(&FRAMEBUF, CYG_FB_IOCTL_PAGE_FLIPPING_SET_PAGES, &page_flip, &len);
|
177 |
|
|
if (result != 0) {
|
178 |
|
|
fprintf(stderr, "fb1_thread: ongoing page flip failed.\n");
|
179 |
|
|
}
|
180 |
|
|
cyg_thread_delay(100);
|
181 |
|
|
}
|
182 |
|
|
#undef FRAMEBUF
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
// ----------------------------------------------------------------------------
|
186 |
|
|
// FB2, 320x240 15bpp, true 565, with a 160x120 viewport. Draw a simple image
|
187 |
|
|
// as per the fbmacro.c example. Then move around within the viewport in a
|
188 |
|
|
// clockwise direction at 110ms intervals.
|
189 |
|
|
|
190 |
|
|
static void
|
191 |
|
|
fb2_thread(cyg_addrword_t arg)
|
192 |
|
|
{
|
193 |
|
|
#define FRAMEBUF fb2
|
194 |
|
|
#define WIDTH 320
|
195 |
|
|
#define HEIGHT 240
|
196 |
|
|
|
197 |
|
|
static cyg_ucount32 colours[16];
|
198 |
|
|
cyg_ucount16 block_width;
|
199 |
|
|
int i, j;
|
200 |
|
|
int x = 0, y = 0;
|
201 |
|
|
CYG_FB_PIXEL0_VAR(FRAMEBUF);
|
202 |
|
|
CYG_FB_PIXEL1_VAR(FRAMEBUF);
|
203 |
|
|
cyg_fb_ioctl_viewport viewport;
|
204 |
|
|
size_t len;
|
205 |
|
|
|
206 |
|
|
CYG_FB_ON(FRAMEBUF);
|
207 |
|
|
for (i = 0; i < 16; i++) {
|
208 |
|
|
colours[i] = CYG_FB_MAKE_COLOUR(FRAMEBUF,
|
209 |
|
|
cyg_fb_palette_vga[i + i + i], cyg_fb_palette_vga[i + i + i + 1],cyg_fb_palette_vga[i + i + i + 2]);
|
210 |
|
|
}
|
211 |
|
|
// A white background
|
212 |
|
|
CYG_FB_FILL_BLOCK(FRAMEBUF, 0, 0, WIDTH, HEIGHT, WHITE);
|
213 |
|
|
// A black block in the middle, 25 pixels in.
|
214 |
|
|
CYG_FB_FILL_BLOCK(FRAMEBUF, 32, 32, WIDTH - 64, HEIGHT - 64, BLACK);
|
215 |
|
|
|
216 |
|
|
// Four diagonal lines in the corners. Red in the top left, blue in the top right,
|
217 |
|
|
// green in the bottom left, and yellow in the bottom right.
|
218 |
|
|
for (i = 0; i < 32; i++) {
|
219 |
|
|
CYG_FB_WRITE_PIXEL(FRAMEBUF, i, i, RED);
|
220 |
|
|
CYG_FB_WRITE_PIXEL(FRAMEBUF, (WIDTH - 1) - i, i, BLUE);
|
221 |
|
|
CYG_FB_WRITE_PIXEL(FRAMEBUF, i, (HEIGHT - 1) - i, GREEN);
|
222 |
|
|
CYG_FB_WRITE_PIXEL(FRAMEBUF, (WIDTH - 1) - i, (HEIGHT - 1) - i, YELLOW);
|
223 |
|
|
}
|
224 |
|
|
|
225 |
|
|
// Horizontal and vertical lines. Cyan at the top, magenta on the bottom,
|
226 |
|
|
// brown on the left, lightgrey on the right.
|
227 |
|
|
CYG_FB_WRITE_HLINE(FRAMEBUF, 32, 16, WIDTH - 64, CYAN);
|
228 |
|
|
CYG_FB_WRITE_HLINE(FRAMEBUF, 32, HEIGHT - 16, WIDTH - 64, MAGENTA);
|
229 |
|
|
CYG_FB_WRITE_VLINE(FRAMEBUF, 16, 32, HEIGHT - 64, BROWN);
|
230 |
|
|
CYG_FB_WRITE_VLINE(FRAMEBUF, WIDTH - 16, 32, HEIGHT - 64, LIGHTGREY);
|
231 |
|
|
|
232 |
|
|
// Top left, diagonal lines away from 0,0 with increasing spacing horizontally
|
233 |
|
|
for (i = 0; i < 16; i++) {
|
234 |
|
|
CYG_FB_PIXEL0_SET(FRAMEBUF, i + 16, i);
|
235 |
|
|
for (j = 0; j < 16; j++) {
|
236 |
|
|
CYG_FB_PIXEL0_WRITE(FRAMEBUF, colours[i]);
|
237 |
|
|
CYG_FB_PIXEL0_ADDX(FRAMEBUF, j);
|
238 |
|
|
}
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
// Top right, diagonal lines away from the corner, with increasing spacing horizontally
|
242 |
|
|
for (i = 0; i < 16; i++) {
|
243 |
|
|
CYG_FB_PIXEL0_SET(FRAMEBUF, WIDTH - (i + 16), i);
|
244 |
|
|
for (j = 0; j < 16; j++) {
|
245 |
|
|
CYG_FB_PIXEL0_WRITE(FRAMEBUF, colours[i]);
|
246 |
|
|
CYG_FB_PIXEL0_ADDX(FRAMEBUF, -1 * j);
|
247 |
|
|
}
|
248 |
|
|
}
|
249 |
|
|
|
250 |
|
|
// Top left, diagonal lines away from the corner, with increasing spacing vertically
|
251 |
|
|
for (i = 0; i < 16; i++) {
|
252 |
|
|
CYG_FB_PIXEL0_SET(FRAMEBUF, i, i + 16);
|
253 |
|
|
for (j = 0; j < 16; j++) {
|
254 |
|
|
CYG_FB_PIXEL0_WRITE(FRAMEBUF, colours[i]);
|
255 |
|
|
CYG_FB_PIXEL0_ADDY(FRAMEBUF, j);
|
256 |
|
|
}
|
257 |
|
|
}
|
258 |
|
|
// Bottom left, diagonal lines away from the corner, with increasing spacing vertically
|
259 |
|
|
for (i = 0; i < 16; i++) {
|
260 |
|
|
CYG_FB_PIXEL0_SET(FRAMEBUF, i, HEIGHT - (i + 16));
|
261 |
|
|
for (j = 0; j < 16; j++) {
|
262 |
|
|
CYG_FB_PIXEL0_WRITE(FRAMEBUF, colours[i]);
|
263 |
|
|
CYG_FB_PIXEL0_ADDY(FRAMEBUF, -1 * j);
|
264 |
|
|
}
|
265 |
|
|
}
|
266 |
|
|
|
267 |
|
|
// Thin vertical bars in the top-middle of the screen, between the hline and the box.
|
268 |
|
|
// Starting in the center and moving out with increasing spacing.
|
269 |
|
|
for (j = 0; j < 8; j++) {
|
270 |
|
|
CYG_FB_PIXEL0_SET(FRAMEBUF, (WIDTH / 2) - 2, 20 + j);
|
271 |
|
|
CYG_FB_PIXEL0_GET(FRAMEBUF, x, y);
|
272 |
|
|
CYG_FB_PIXEL1_SET(FRAMEBUF, x + 3, y);
|
273 |
|
|
for (i = 0; i < 16; i++) {
|
274 |
|
|
CYG_FB_PIXEL0_ADDX(FRAMEBUF, -1 * i);
|
275 |
|
|
CYG_FB_PIXEL1_ADDX(FRAMEBUF, i);
|
276 |
|
|
CYG_FB_PIXEL0_WRITE(FRAMEBUF, colours[i]);
|
277 |
|
|
CYG_FB_PIXEL1_WRITE(FRAMEBUF, colours[i]);
|
278 |
|
|
}
|
279 |
|
|
}
|
280 |
|
|
|
281 |
|
|
block_width = (WIDTH - 100) / 14;
|
282 |
|
|
for (i = 1; i <= 14; i++) {
|
283 |
|
|
CYG_FB_FILL_BLOCK(FRAMEBUF, 50 + ((i - 1) * block_width), 50, block_width, HEIGHT - 100, colours[i]);
|
284 |
|
|
}
|
285 |
|
|
|
286 |
|
|
|
287 |
|
|
for ( ; ; ) {
|
288 |
|
|
for (x = 0; x <= 160; x += 5) {
|
289 |
|
|
viewport.fbvp_x = x;
|
290 |
|
|
viewport.fbvp_y = 0;
|
291 |
|
|
viewport.fbvp_when = CYG_FB_UPDATE_NOW;
|
292 |
|
|
len = sizeof(viewport);
|
293 |
|
|
CYG_FB_IOCTL(FRAMEBUF, CYG_FB_IOCTL_VIEWPORT_SET_POSITION, &viewport, &len);
|
294 |
|
|
cyg_thread_delay(11);
|
295 |
|
|
}
|
296 |
|
|
for (y = 0; y < 120; y += 5) {
|
297 |
|
|
viewport.fbvp_x = 160;
|
298 |
|
|
viewport.fbvp_y = y;
|
299 |
|
|
viewport.fbvp_when = CYG_FB_UPDATE_NOW;
|
300 |
|
|
len = sizeof(viewport);
|
301 |
|
|
CYG_FB_IOCTL(FRAMEBUF, CYG_FB_IOCTL_VIEWPORT_SET_POSITION, &viewport, &len);
|
302 |
|
|
cyg_thread_delay(11);
|
303 |
|
|
}
|
304 |
|
|
for (x = 160; x >= 0; x -= 5) {
|
305 |
|
|
viewport.fbvp_x = x;
|
306 |
|
|
viewport.fbvp_y = 120;
|
307 |
|
|
viewport.fbvp_when = CYG_FB_UPDATE_NOW;
|
308 |
|
|
len = sizeof(viewport);
|
309 |
|
|
CYG_FB_IOCTL(FRAMEBUF, CYG_FB_IOCTL_VIEWPORT_SET_POSITION, &viewport, &len);
|
310 |
|
|
cyg_thread_delay(11);
|
311 |
|
|
}
|
312 |
|
|
for (y = 120; y >= 0; y -= 5) {
|
313 |
|
|
viewport.fbvp_x = 0;
|
314 |
|
|
viewport.fbvp_y = y;
|
315 |
|
|
viewport.fbvp_when = CYG_FB_UPDATE_NOW;
|
316 |
|
|
len = sizeof(viewport);
|
317 |
|
|
CYG_FB_IOCTL(FRAMEBUF, CYG_FB_IOCTL_VIEWPORT_SET_POSITION, &viewport, &len);
|
318 |
|
|
cyg_thread_delay(11);
|
319 |
|
|
}
|
320 |
|
|
}
|
321 |
|
|
#undef FRAMEBUF
|
322 |
|
|
#undef WIDTH
|
323 |
|
|
#undef HEIGHT
|
324 |
|
|
}
|
325 |
|
|
|
326 |
|
|
// ----------------------------------------------------------------------------
|
327 |
|
|
// FB3, 320x240 8bpp, paletted 888. Draw a series of vertical stripes, 5 pixels
|
328 |
|
|
// wide, and rotate through the palette at 210ms intervals.
|
329 |
|
|
|
330 |
|
|
static void
|
331 |
|
|
fb3_thread(cyg_addrword_t arg)
|
332 |
|
|
{
|
333 |
|
|
#define FRAMEBUF fb3
|
334 |
|
|
static cyg_uint8 palette[(128 +16) * 3];
|
335 |
|
|
int i;
|
336 |
|
|
|
337 |
|
|
CYG_FB_ON(FRAMEBUF);
|
338 |
|
|
|
339 |
|
|
// Read in the first 128 palette entries, and copy the first 16
|
340 |
|
|
// entries to give a wrap-around. After 128 the palette gets less
|
341 |
|
|
// interesting.
|
342 |
|
|
CYG_FB_READ_PALETTE(FRAMEBUF, 0, 128, palette);
|
343 |
|
|
memcpy(&(palette[128 * 3]), palette, 16 * 3);
|
344 |
|
|
|
345 |
|
|
for (i = 0; i < 32; i++) {
|
346 |
|
|
CYG_FB_FILL_BLOCK(FRAMEBUF, 10 * i, 0, 10, 240, i);
|
347 |
|
|
}
|
348 |
|
|
|
349 |
|
|
for ( i = 0; ; i = (i + 1) % 128 ) {
|
350 |
|
|
cyg_thread_delay(21);
|
351 |
|
|
CYG_FB_WRITE_PALETTE(FRAMEBUF, 0, 64, &(palette[i * 3]), CYG_FB_UPDATE_NOW);
|
352 |
|
|
}
|
353 |
|
|
#undef FRAMEBUF
|
354 |
|
|
}
|
355 |
|
|
|
356 |
|
|
// ----------------------------------------------------------------------------
|
357 |
|
|
// main(). Start up separate threads for FB1 and FB2, run the FB0 code since
|
358 |
|
|
// it just does some drawing and finishes, then run the FB3 code.
|
359 |
|
|
static cyg_thread fb1_thread_data;
|
360 |
|
|
static cyg_handle_t fb1_thread_handle;
|
361 |
|
|
static unsigned char fb1_thread_stack[CYGNUM_HAL_STACK_SIZE_TYPICAL];
|
362 |
|
|
static cyg_thread fb2_thread_data;
|
363 |
|
|
static cyg_handle_t fb2_thread_handle;
|
364 |
|
|
static unsigned char fb2_thread_stack[CYGNUM_HAL_STACK_SIZE_TYPICAL];
|
365 |
|
|
|
366 |
|
|
int
|
367 |
|
|
main(int argc, char** argv)
|
368 |
|
|
{
|
369 |
|
|
cyg_thread_create(10, &fb1_thread, 0, "fb1", fb1_thread_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL, &fb1_thread_handle, &fb1_thread_data);
|
370 |
|
|
cyg_thread_create(10, &fb2_thread, 0, "fb2", fb2_thread_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL, &fb2_thread_handle, &fb2_thread_data);
|
371 |
|
|
cyg_thread_resume(fb1_thread_handle);
|
372 |
|
|
cyg_thread_resume(fb2_thread_handle);
|
373 |
|
|
fb0_thread(0);
|
374 |
|
|
fb3_thread(0);
|
375 |
|
|
return 0;
|
376 |
|
|
}
|
377 |
|
|
|