1 | #include <stdio.h> |
---|
2 | |
---|
3 | #define NBLOCS 32 |
---|
4 | #define THRESHOLD 200 |
---|
5 | |
---|
6 | __attribute__((constructor)) int main(void) |
---|
7 | { |
---|
8 | unsigned char buf_in[128*128]; |
---|
9 | unsigned char buf_out[128*128]; |
---|
10 | unsigned int i; |
---|
11 | unsigned int x; |
---|
12 | unsigned int base = 0; |
---|
13 | |
---|
14 | while (base < 5 * NBLOCS) |
---|
15 | { |
---|
16 | |
---|
17 | giet_tty_printf("\n *** image %d *** at date = %d \n", |
---|
18 | base / NBLOCS, giet_proctime()); |
---|
19 | |
---|
20 | /* Phase 1 : lecture image sur le disque et transfert vers buf_in */ |
---|
21 | x = giet_ioc_read(base, buf_in, NBLOCS); |
---|
22 | if ( x ) |
---|
23 | { |
---|
24 | giet_tty_printf("echec giet_ioc_read %d at date : %d\n", x , giet_proctime() ); |
---|
25 | giet_exit(); |
---|
26 | } |
---|
27 | x = giet_ioc_completed(); |
---|
28 | if ( x ) |
---|
29 | { |
---|
30 | giet_tty_printf("echec giet_ioc_completed %d at date : %d\n", x, giet_proctime() ); |
---|
31 | giet_exit(); |
---|
32 | } |
---|
33 | giet_tty_printf("io_read completed at date = %d \n", giet_proctime()); |
---|
34 | |
---|
35 | /* Phase 2 : transfert de buf_in vers buf_out avec seuillage */ |
---|
36 | for (i = 0; i < 128 * 128; i++) |
---|
37 | { |
---|
38 | if (buf_in[i] > THRESHOLD) |
---|
39 | buf_out[i] = 255; |
---|
40 | else |
---|
41 | buf_out[i] = buf_in[i]; |
---|
42 | } |
---|
43 | giet_tty_printf("image processing completed at date = %d \n", giet_proctime()); |
---|
44 | |
---|
45 | /* Phase 3 : transfert de buf_out vers le frame buffer par dma */ |
---|
46 | x = giet_fb_write(0, buf_out, 128 * 128); |
---|
47 | if ( x ) |
---|
48 | { |
---|
49 | giet_tty_printf("echec giet_fb_write %d at date : %d\n", x, giet_proctime() ); |
---|
50 | giet_exit(); |
---|
51 | } |
---|
52 | x = giet_fb_completed(); |
---|
53 | if ( x ) |
---|
54 | { |
---|
55 | giet_tty_printf("echec giet_fb_completed %d at date : %d\n", x, giet_proctime() ); |
---|
56 | giet_exit(); |
---|
57 | } |
---|
58 | giet_tty_printf("transfer completed at date = %d \n", giet_proctime()); |
---|
59 | |
---|
60 | base = base + NBLOCS; |
---|
61 | } |
---|
62 | |
---|
63 | giet_exit(); |
---|
64 | |
---|
65 | return 0; |
---|
66 | } |
---|