| 1 | #include <stdio.h> |
|---|
| 2 | |
|---|
| 3 | #define NBLOCKS 32 // (128 * 128) / 512 |
|---|
| 4 | |
|---|
| 5 | unsigned char buf[128*128] __attribute__((aligned(512))); |
|---|
| 6 | |
|---|
| 7 | __attribute__((constructor)) void main() |
|---|
| 8 | { |
|---|
| 9 | int fd; |
|---|
| 10 | int blocks; |
|---|
| 11 | unsigned int ko; |
|---|
| 12 | unsigned int blocks_to_skip = 8*NBLOCKS; |
|---|
| 13 | |
|---|
| 14 | giet_tty_printf("\nStarting task DISPLAY on processor %d at cycle %d\n", |
|---|
| 15 | giet_procid(), giet_proctime() ); |
|---|
| 16 | |
|---|
| 17 | /////////////////////////////////////////// |
|---|
| 18 | fd = giet_fat_open( "misc/images.raw", 0 ); |
|---|
| 19 | if ( fd < 0 ) |
|---|
| 20 | { |
|---|
| 21 | giet_tty_printf("\n*** echec giet_fat_open for misc/images.raw at cycle %d\n", |
|---|
| 22 | giet_proctime() ); |
|---|
| 23 | giet_exit(); |
|---|
| 24 | } |
|---|
| 25 | else |
|---|
| 26 | { |
|---|
| 27 | giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", |
|---|
| 28 | giet_proctime() ); |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | ///////////////////////////////////////// |
|---|
| 32 | while ( blocks_to_skip < (10 * NBLOCKS) ) |
|---|
| 33 | { |
|---|
| 34 | // lecture image sur le disque |
|---|
| 35 | blocks = giet_fat_read( fd, buf, NBLOCKS, blocks_to_skip ); |
|---|
| 36 | if ( blocks != NBLOCKS ) |
|---|
| 37 | { |
|---|
| 38 | giet_tty_printf("\n*** echec giet_fat_read at cycle %d\n", |
|---|
| 39 | giet_proctime() ); |
|---|
| 40 | giet_exit(); |
|---|
| 41 | } |
|---|
| 42 | else |
|---|
| 43 | { |
|---|
| 44 | giet_tty_printf("\ngiet_fat_read for image %d completed at cycle %d \n", |
|---|
| 45 | (blocks_to_skip>>5), giet_proctime()); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | // transfert vers le frame buffer |
|---|
| 49 | ko = giet_fb_sync_write( 0, buf, 128 * 128 ); |
|---|
| 50 | if ( ko ) |
|---|
| 51 | { |
|---|
| 52 | giet_tty_printf("\n*** echec giet_fb_sync_write at cycle %d\n", |
|---|
| 53 | giet_proctime() ); |
|---|
| 54 | giet_exit(); |
|---|
| 55 | } |
|---|
| 56 | else |
|---|
| 57 | { |
|---|
| 58 | giet_tty_printf("\ndisplay completed for image %d at cycle %d \n", |
|---|
| 59 | (blocks_to_skip>>5), giet_proctime()); |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | blocks_to_skip = blocks_to_skip + NBLOCKS; |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | giet_tty_printf("\n*** Tak display exit at cycle %d ***\n", giet_proctime()); |
|---|
| 66 | giet_exit(); |
|---|
| 67 | } |
|---|