Changeset 258 for soft/giet_vm/display
- Timestamp:
- Dec 4, 2013, 7:48:04 PM (11 years ago)
- Location:
- soft/giet_vm/display
- Files:
-
- 1 added
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/display/display.ld
r191 r258 3 3 *****************************************************************************/ 4 4 5 seg_data_base = 0x00800000;6 5 seg_code_base = 0x00400000; 6 seg_data_base = 0x00500000; 7 7 8 8 /*************************************************************************** -
soft/giet_vm/display/main.c
r254 r258 1 1 #include <stdio.h> 2 2 3 #define NBLOCKS 32 // number of blocks per image(128 * 128) / 5123 #define NBLOCKS 32 // (128 * 128) / 512 4 4 5 unsigned char buf0[128*128] __attribute__((aligned(64))); 6 unsigned char buf1[128*128] __attribute__((aligned(64))); 5 unsigned char buf[128*128] __attribute__((aligned(512))); 7 6 8 __attribute__((constructor)) int main(void) 9 { 10 unsigned int x; 11 unsigned int base = 0; 7 __attribute__((constructor)) void main() 8 { 9 int fd; 10 int blocks; 11 unsigned int ko; 12 unsigned int blocks_to_skip = 8*NBLOCKS; 12 13 13 /* initialise CDMA transfert (double buffer) */ 14 giet_tty_printf("\nStarting task DISPLAY on processor %d at cycle %d\n", 15 giet_procid(), giet_proctime() ); 14 16 15 giet_tty_printf( "*** Starting task DISPLAY_CMA on processor %d at cycle %d\n", 16 giet_procid(), giet_proctime() ); 17 giet_tty_printf( " - buf0 address (LSB) = %x\n", (unsigned int)buf0 ); 18 giet_tty_printf( " - buf1 address (LSB) = %x\n", (unsigned int)buf1 ); 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 } 19 30 20 x = giet_fb_cma_init( buf0, // buf0 base address 21 buf1, // buf1 base address 22 128*128 ); // buffer size (bytes) 23 giet_assert( (x==0), "echec giet_fb_cdma_init" ); 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 } 24 47 25 while (base < 10 * NBLOCKS) 26 { 27 /* Phase 1 : transfer one image from disk to buf0 and display */ 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 } 28 61 29 giet_tty_printf( "\n *** image %d *** at date = %d \n",30 (base/NBLOCKS), giet_proctime() );62 blocks_to_skip = blocks_to_skip + NBLOCKS; 63 } 31 64 32 x = giet_ioc_read( base, // lba on disk 33 buf0, // user buffer address 34 NBLOCKS ); // number of blocks 35 giet_assert( (x==0) , "echec giet_ioc_read for buf0" ); 36 37 x = giet_ioc_completed(); 38 giet_assert( (x==0) , "echec giet_ioc_completed for buf0" ); 39 40 giet_tty_printf( "ioc_read buf0 completed at date = %d \n", giet_proctime() ); 41 42 x = giet_fb_cma_write( 0 ); // buf0 43 giet_assert( (x==0) , "echec giet_fb_cma_write for buf0" ); 44 45 base = base + NBLOCKS; 46 47 /* Phase 2 : transfer one image from disk to buf1 and display */ 48 49 giet_tty_printf( "\n *** image %d *** at date = %d \n", 50 (base/NBLOCKS), giet_proctime() ); 51 52 x = giet_ioc_read( base, // lba on disk 53 buf1, // user buffer address 54 NBLOCKS ); // number of locks 55 giet_assert( (x==0) , "echec giet_ioc_read for buf1"); 56 57 x = giet_ioc_completed(); 58 giet_assert( (x==0) , "echec giet_ioc_completed for buf1"); 59 60 giet_tty_printf( "ioc_read buf1 completed at date = %d \n", giet_proctime() ); 61 62 x = giet_fb_cma_write( 1 ); // buf1 63 giet_assert( (x==0) , "echec giet_fb_cma_write for buf1" ); 64 65 base = base + NBLOCKS; 66 } // end while 67 68 giet_fb_cma_stop(); 65 giet_tty_printf("\n*** Tak display exit at cycle %d ***\n", giet_proctime()); 69 66 giet_exit(); 70 return 0;71 67 }
Note: See TracChangeset
for help on using the changeset viewer.