source: soft/giet_vm/display/main.c @ 217

Last change on this file since 217 was 207, checked in by alain, 12 years ago

Several bugs have been fixed to support TSAR multi-cluster architecture
such as the "tsarv4-generic_mmu" platform.

File size: 1.9 KB
Line 
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
11    unsigned int i;
12    unsigned int x;
13    unsigned int base = 0;
14
15    while (base < 5 * NBLOCS)
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
53        x = giet_fb_completed();
54        if ( x )
55        {
56            giet_tty_printf("echec giet_fb_completed %d at date : %d\n", x, giet_proctime() );
57            giet_exit();
58        }
59        giet_tty_printf("transfer completed at date = %d \n", giet_proctime());
60
61        base = base + NBLOCS;
62    }
63
64    giet_exit();
65
66    return 0;
67}
Note: See TracBrowser for help on using the repository browser.