[258] | 1 | #include <stdio.h> |
---|
| 2 | |
---|
| 3 | #define NBLOCKS 32 |
---|
| 4 | |
---|
| 5 | unsigned char buf0[128*128] __attribute__((aligned(512))); |
---|
| 6 | unsigned char buf1[128*128] __attribute__((aligned(512))); |
---|
| 7 | |
---|
| 8 | __attribute__((constructor)) void main(void) |
---|
| 9 | { |
---|
| 10 | unsigned int ko; |
---|
| 11 | int blocks; |
---|
| 12 | int fd; |
---|
| 13 | unsigned int blocks_to_skip = 0; |
---|
| 14 | |
---|
| 15 | giet_tty_printf("\nStarting task DISPLAY on processor %d at cycle %d\n", |
---|
| 16 | giet_procid(), giet_proctime() ); |
---|
| 17 | |
---|
| 18 | ////////////////////////////////////////// |
---|
| 19 | fd = giet_fat_open( "misc/images.raw", 0 ); |
---|
| 20 | if ( fd < 0 ) |
---|
| 21 | { |
---|
| 22 | giet_tty_printf("\n*** echec giet_fat_open for misc/images.raw at cycle %d\n", |
---|
| 23 | giet_proctime() ); |
---|
| 24 | giet_exit(); |
---|
| 25 | } |
---|
| 26 | else |
---|
| 27 | { |
---|
| 28 | giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", |
---|
| 29 | giet_proctime() ); |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | //////////////////////////////////////////// |
---|
| 33 | ko = giet_fb_cma_init( buf0, buf1, 128*128 ); |
---|
| 34 | if ( ko ) |
---|
| 35 | { |
---|
| 36 | giet_tty_printf("\n*** echec giet_cma_init at cycle %d\n", |
---|
| 37 | giet_proctime() ); |
---|
| 38 | giet_exit(); |
---|
| 39 | } |
---|
| 40 | else |
---|
| 41 | { |
---|
| 42 | giet_tty_printf("\ngiet_cma_init completed at cycle %d\n", |
---|
| 43 | giet_proctime() ); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | while ( blocks_to_skip < 10 * NBLOCKS ) |
---|
| 48 | { |
---|
| 49 | //////////////////////////////////////////////////////////// |
---|
| 50 | blocks = giet_fat_read( fd, buf0, NBLOCKS, blocks_to_skip ); |
---|
| 51 | if ( blocks != NBLOCKS ) |
---|
| 52 | { |
---|
| 53 | giet_tty_printf("\nechec giet_fat_read to buf0 at cycle %d\n", |
---|
| 54 | giet_proctime() ); |
---|
| 55 | giet_exit(); |
---|
| 56 | } |
---|
| 57 | else |
---|
| 58 | { |
---|
| 59 | giet_tty_printf("\ngiet_fat_read to buf0 completed at cycle = %d\n", |
---|
| 60 | giet_proctime() ); |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | /////////////////////////// |
---|
| 64 | ko = giet_fb_cma_write( 0 ); |
---|
| 65 | if ( ko ) |
---|
| 66 | { |
---|
| 67 | giet_tty_printf("echec giet_cma_write for buf0 at cycle %d\n", |
---|
| 68 | giet_proctime() ); |
---|
| 69 | giet_exit(); |
---|
| 70 | } |
---|
| 71 | else |
---|
| 72 | { |
---|
| 73 | giet_tty_printf("giet_cma_write for buf0 completed at cycle = %d\n", |
---|
| 74 | giet_proctime() ); |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | blocks_to_skip = blocks_to_skip + NBLOCKS; |
---|
| 78 | |
---|
| 79 | /////////////////////////////////////////////////////// |
---|
| 80 | blocks = giet_fat_read( fd, buf1, NBLOCKS, blocks_to_skip ); |
---|
| 81 | if ( blocks != NBLOCKS ) |
---|
| 82 | { |
---|
| 83 | giet_tty_printf("echec giet_fat_read to buf1 at cycle %d\n", |
---|
| 84 | giet_proctime() ); |
---|
| 85 | giet_exit(); |
---|
| 86 | } |
---|
| 87 | else |
---|
| 88 | { |
---|
| 89 | giet_tty_printf("giet_fat_read to buf1 completed at cycle = %d\n", |
---|
| 90 | giet_proctime() ); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | //////////////////////////// |
---|
| 94 | ko = giet_fb_cma_write( 1 ); |
---|
| 95 | if ( ko ) |
---|
| 96 | { |
---|
| 97 | giet_tty_printf("echec giet_cma_write for buf1 at cycle %d\n", |
---|
| 98 | giet_proctime() ); |
---|
| 99 | giet_exit(); |
---|
| 100 | } |
---|
| 101 | else |
---|
| 102 | { |
---|
| 103 | giet_tty_printf("giet_cma_write for buf1 completed at cycle = %d\n", |
---|
| 104 | giet_proctime() ); |
---|
| 105 | } |
---|
| 106 | blocks_to_skip = blocks_to_skip + NBLOCKS; |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | /////////////////// |
---|
| 110 | giet_fb_cma_stop(); |
---|
| 111 | |
---|
| 112 | giet_tty_printf("\n*** Task display exit at cycle %d ***\n", giet_proctime()); |
---|
| 113 | |
---|
| 114 | giet_exit(); |
---|
| 115 | } |
---|