Last change
on this file since 179 was
168,
checked in by alain, 12 years ago
|
Introducing application "display" to test the IOC and FBF components.
|
File size:
1.4 KB
|
Line | |
---|
1 | #include <stdio.h> |
---|
2 | |
---|
3 | #define NBLOCS 32 |
---|
4 | #define THRESHOLD 200 |
---|
5 | |
---|
6 | __attribute__((constructor)) void main(void) |
---|
7 | { |
---|
8 | char buf_in[128 * 128]; |
---|
9 | char buf_out[128 * 128]; |
---|
10 | unsigned int x; |
---|
11 | unsigned int i; |
---|
12 | unsigned int base = 0; |
---|
13 | |
---|
14 | while (base < 5 * NBLOCS) |
---|
15 | { |
---|
16 | tty_printf("\n *** image %d *** at date = %d \n", base/NBLOCS, proctime()); |
---|
17 | |
---|
18 | /* Phase 1 : lecture image sur le disque et transfert vers buf_in */ |
---|
19 | x = ioc_read(base, buf_in, NBLOCS); |
---|
20 | if (x) |
---|
21 | { |
---|
22 | tty_printf("echec ioc_read = %d\n", x); |
---|
23 | exit(); |
---|
24 | } |
---|
25 | else |
---|
26 | { |
---|
27 | ioc_completed(); |
---|
28 | tty_printf("ioc_read completed at date = %d \n",proctime()); |
---|
29 | } |
---|
30 | |
---|
31 | /* Phase 2 : transfert de buf_in vers buf_out avec seuillage */ |
---|
32 | for (i = 0; i < 128 * 128; i++) |
---|
33 | { |
---|
34 | if (buf_in[i] > THRESHOLD) |
---|
35 | buf_out[i] = 255; |
---|
36 | else |
---|
37 | buf_out[i] = buf_in[i]; |
---|
38 | } |
---|
39 | tty_printf("image processing completed at date = %d \n",proctime()); |
---|
40 | |
---|
41 | /* Phase 3 : transfert de buf_out vers le frame buffer par dma */ |
---|
42 | x = fb_write(0, buf_out, 128 * 128); |
---|
43 | if (x) |
---|
44 | { |
---|
45 | tty_printf("echec fb_write = %d\n", x); |
---|
46 | exit(); |
---|
47 | } |
---|
48 | else |
---|
49 | { |
---|
50 | fb_completed(); |
---|
51 | tty_printf("transfer completed at date = %d \n",proctime()); |
---|
52 | } |
---|
53 | |
---|
54 | base = base + NBLOCS; |
---|
55 | } |
---|
56 | |
---|
57 | exit(); |
---|
58 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.