source: soft/giet_vm/applications/display/main.c @ 432

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

Bug fix in both _tty_rx_isr() and _bdv_isr():
The ISR must do nothing it the status indicates that
there is no pending ISR.

File size: 1.7 KB
Line 
1#include "stdio.h"
2#include "hard_config.h"
3
4#define NBLOCKS 32   // (128 * 128) / 512
5
6unsigned char buf[128*128] __attribute__((aligned(512)));
7
8__attribute__((constructor)) void main()
9{ 
10    int             fd;
11    int             blocks;
12    unsigned int    ko;
13    unsigned int    blocks_to_skip = 8*NBLOCKS;
14
15    unsigned int    procid     = giet_procid();
16    unsigned int    cluster_xy = procid/NB_PROCS_MAX;
17    unsigned int    lpid       = procid%NB_PROCS_MAX;
18    unsigned int    x          = cluster_xy >> Y_WIDTH;
19    unsigned int    y          = cluster_xy & ((1<<Y_WIDTH)-1);
20
21    giet_tty_printf( "*** Starting task display on processor[%d,%d,%d] at cycle %d\n\n", 
22                      x, y, lpid, giet_proctime() );
23
24    ///////////////////////////////////////////
25    fd = giet_fat_open( "misc/images.raw", 0 );
26    if ( fd < 0 ) giet_exit("echec giet_fat_open for misc/images.raw");
27
28    giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", 
29                    giet_proctime() );
30
31    /////////////////////////////////////////
32    while ( blocks_to_skip < (10 * NBLOCKS) )
33    {
34        // lecture image sur le disque
35        giet_fat_read( fd, buf, NBLOCKS, blocks_to_skip );
36       
37        giet_tty_printf("\ngiet_fat_read for image %d completed at cycle %d \n", 
38                        (blocks_to_skip>>5), giet_proctime());
39
40        // transfert vers le frame buffer 
41        giet_fb_sync_write( 0, buf, 128 * 128 );
42
43        giet_tty_printf("\ndisplay completed for image %d at cycle %d \n", 
44                        (blocks_to_skip>>5), giet_proctime());
45
46        blocks_to_skip = blocks_to_skip + NBLOCKS;
47    }
48
49    giet_exit("completed");
50}
Note: See TracBrowser for help on using the repository browser.