[295] | 1 | #include "stdio.h" |
---|
| 2 | #include "hard_config.h" |
---|
[258] | 3 | |
---|
| 4 | #define NBLOCKS 32 |
---|
| 5 | |
---|
| 6 | unsigned char buf0[128*128] __attribute__((aligned(512))); |
---|
| 7 | unsigned char buf1[128*128] __attribute__((aligned(512))); |
---|
| 8 | |
---|
| 9 | __attribute__((constructor)) void main(void) |
---|
| 10 | { |
---|
[432] | 11 | // get processor identifiers |
---|
| 12 | unsigned int x; |
---|
| 13 | unsigned int y; |
---|
| 14 | unsigned int lpid; |
---|
| 15 | giet_proc_xyp( &x, &y, &lpid ); |
---|
| 16 | |
---|
[295] | 17 | int fd; |
---|
| 18 | unsigned int blocks_to_skip = 0; |
---|
[258] | 19 | |
---|
[295] | 20 | giet_tty_printf( "*** Starting task display on processor[%d,%d,%d] at cycle %d\n\n", |
---|
| 21 | x, y, lpid, giet_proctime() ); |
---|
[258] | 22 | |
---|
| 23 | fd = giet_fat_open( "misc/images.raw", 0 ); |
---|
[297] | 24 | if ( fd < 0 ) giet_exit("echec giet_fat_open for misc/images.raw"); |
---|
[258] | 25 | |
---|
[297] | 26 | giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", |
---|
| 27 | giet_proctime() ); |
---|
| 28 | |
---|
[295] | 29 | giet_fb_cma_init( buf0, buf1, 128*128 ); |
---|
| 30 | |
---|
| 31 | giet_tty_printf("\ngiet_cma_init completed at cycle %d\n", |
---|
[258] | 32 | giet_proctime() ); |
---|
| 33 | |
---|
| 34 | while ( blocks_to_skip < 10 * NBLOCKS ) |
---|
| 35 | { |
---|
[295] | 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", |
---|
[258] | 39 | giet_proctime() ); |
---|
| 40 | |
---|
[295] | 41 | giet_fb_cma_write( 0 ); |
---|
| 42 | |
---|
| 43 | giet_tty_printf("giet_cma_write for buf0 completed at cycle = %d\n", |
---|
[258] | 44 | giet_proctime() ); |
---|
| 45 | |
---|
| 46 | blocks_to_skip = blocks_to_skip + NBLOCKS; |
---|
| 47 | |
---|
[295] | 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", |
---|
[258] | 51 | giet_proctime() ); |
---|
[295] | 52 | |
---|
| 53 | giet_fb_cma_write( 1 ); |
---|
| 54 | |
---|
| 55 | giet_tty_printf("giet_cma_write for buf1 completed at cycle = %d\n", |
---|
[258] | 56 | giet_proctime() ); |
---|
| 57 | |
---|
| 58 | blocks_to_skip = blocks_to_skip + NBLOCKS; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | giet_fb_cma_stop(); |
---|
| 62 | |
---|
[297] | 63 | giet_exit("display completed"); |
---|
[258] | 64 | } |
---|