source: soft/giet_vm/applications/display/main_cma.c @ 438

Last change on this file since 438 was 432, checked in by alain, 10 years ago

1) Introduce the "applications" directory.
2) Introduce the fixed format (X_WIDTH / Y_WIDTH / P_WIDTH) for processor index in all applications.

File size: 1.9 KB
Line 
1#include "stdio.h"
2#include "hard_config.h"
3
4#define NBLOCKS 32
5
6unsigned char buf0[128*128] __attribute__((aligned(512)));
7unsigned char buf1[128*128] __attribute__((aligned(512)));
8
9__attribute__((constructor)) void main(void)
10{
11    // get processor identifiers
12    unsigned int    x;
13    unsigned int    y; 
14    unsigned int    lpid;
15    giet_proc_xyp( &x, &y, &lpid );
16
17    int             fd;
18    unsigned int    blocks_to_skip = 0;
19
20    giet_tty_printf( "*** Starting task display on processor[%d,%d,%d] at cycle %d\n\n", 
21                      x, y, lpid, giet_proctime() );
22
23    fd = giet_fat_open( "misc/images.raw", 0 );
24    if ( fd < 0 ) giet_exit("echec giet_fat_open for misc/images.raw");
25
26    giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", 
27                    giet_proctime() );
28
29    giet_fb_cma_init( buf0, buf1, 128*128 );
30
31    giet_tty_printf("\ngiet_cma_init completed at cycle %d\n", 
32                        giet_proctime() );
33 
34    while ( blocks_to_skip < 10 * NBLOCKS )
35    {
36        giet_fat_read( fd, buf0, NBLOCKS, blocks_to_skip );
37
38        giet_tty_printf("\ngiet_fat_read to buf0 completed at cycle = %d\n",
39                            giet_proctime() );
40
41        giet_fb_cma_write( 0 );
42
43        giet_tty_printf("giet_cma_write for buf0 completed at cycle = %d\n",
44                            giet_proctime() );
45
46        blocks_to_skip = blocks_to_skip + NBLOCKS;
47
48        giet_fat_read( fd, buf1, NBLOCKS, blocks_to_skip );
49
50        giet_tty_printf("giet_fat_read to buf1 completed at cycle = %d\n",
51                            giet_proctime() );
52
53        giet_fb_cma_write( 1 );
54       
55        giet_tty_printf("giet_cma_write for buf1 completed at cycle = %d\n",
56                            giet_proctime() );
57
58        blocks_to_skip = blocks_to_skip + NBLOCKS;
59    }
60
61    giet_fb_cma_stop();
62
63    giet_exit("display completed");
64}
Note: See TracBrowser for help on using the repository browser.