[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 | { |
---|
[295] | 11 | int fd; |
---|
| 12 | unsigned int blocks_to_skip = 0; |
---|
| 13 | unsigned int procid = giet_procid(); |
---|
| 14 | unsigned int cluster_xy = procid/NB_PROCS_MAX; |
---|
| 15 | unsigned int lpid = procid%NB_PROCS_MAX; |
---|
| 16 | unsigned int x = cluster_xy >> Y_WIDTH; |
---|
| 17 | unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); |
---|
[258] | 18 | |
---|
[295] | 19 | giet_tty_printf( "*** Starting task display on processor[%d,%d,%d] at cycle %d\n\n", |
---|
| 20 | x, y, lpid, giet_proctime() ); |
---|
[258] | 21 | |
---|
| 22 | fd = giet_fat_open( "misc/images.raw", 0 ); |
---|
[297] | 23 | if ( fd < 0 ) giet_exit("echec giet_fat_open for misc/images.raw"); |
---|
[258] | 24 | |
---|
[297] | 25 | giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", |
---|
| 26 | giet_proctime() ); |
---|
| 27 | |
---|
[295] | 28 | giet_fb_cma_init( buf0, buf1, 128*128 ); |
---|
| 29 | |
---|
| 30 | giet_tty_printf("\ngiet_cma_init completed at cycle %d\n", |
---|
[258] | 31 | giet_proctime() ); |
---|
| 32 | |
---|
| 33 | while ( blocks_to_skip < 10 * NBLOCKS ) |
---|
| 34 | { |
---|
[295] | 35 | giet_fat_read( fd, buf0, NBLOCKS, blocks_to_skip ); |
---|
| 36 | |
---|
| 37 | giet_tty_printf("\ngiet_fat_read to buf0 completed at cycle = %d\n", |
---|
[258] | 38 | giet_proctime() ); |
---|
| 39 | |
---|
[295] | 40 | giet_fb_cma_write( 0 ); |
---|
| 41 | |
---|
| 42 | giet_tty_printf("giet_cma_write for buf0 completed at cycle = %d\n", |
---|
[258] | 43 | giet_proctime() ); |
---|
| 44 | |
---|
| 45 | blocks_to_skip = blocks_to_skip + NBLOCKS; |
---|
| 46 | |
---|
[295] | 47 | giet_fat_read( fd, buf1, NBLOCKS, blocks_to_skip ); |
---|
| 48 | |
---|
| 49 | giet_tty_printf("giet_fat_read to buf1 completed at cycle = %d\n", |
---|
[258] | 50 | giet_proctime() ); |
---|
[295] | 51 | |
---|
| 52 | giet_fb_cma_write( 1 ); |
---|
| 53 | |
---|
| 54 | giet_tty_printf("giet_cma_write for buf1 completed at cycle = %d\n", |
---|
[258] | 55 | giet_proctime() ); |
---|
| 56 | |
---|
| 57 | blocks_to_skip = blocks_to_skip + NBLOCKS; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | giet_fb_cma_stop(); |
---|
| 61 | |
---|
[297] | 62 | giet_exit("display completed"); |
---|
[258] | 63 | } |
---|