Ignore:
Timestamp:
Aug 27, 2013, 5:41:51 PM (11 years ago)
Author:
alain
Message:

Improving support for Chained Buffer DMA in drivers.c file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/display/main.c

    r249 r254  
    11#include <stdio.h>
    22
    3 #define NBLOCS 32   // (128 * 128) / 512
     3#define NBLOCKS 32   // number of blocks per image (128 * 128) / 512
    44
    5 unsigned char buf[128*128] __attribute__((aligned(64)));
     5unsigned char buf0[128*128] __attribute__((aligned(64)));
     6unsigned char buf1[128*128] __attribute__((aligned(64)));
    67
    78__attribute__((constructor)) int main(void)
     
    1011    unsigned int  base = 0;
    1112
    12     while (base < 10 * NBLOCS)
     13    /* initialise CDMA transfert (double buffer) */
     14
     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 );
     19
     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" );
     24
     25    while (base < 10 * NBLOCKS)
    1326    {
    14         giet_tty_printf("\n *** image %d *** at date = %d \n",
    15                 base / NBLOCS, giet_proctime());
     27        /* Phase 1 : transfer one image from disk to buf0 and display  */
    1628
    17         /* Phase 1 : lecture image sur le disque et transfert vers buf */
    18         x = giet_ioc_read(base, buf, NBLOCS);
    19         if ( x )
    20         {
    21             giet_tty_printf("echec giet_ioc_read = %d at date : %d\n", x , giet_proctime() );
    22             giet_exit();
    23         }
     29        giet_tty_printf( "\n *** image %d *** at date = %d \n",
     30                         (base/NBLOCKS), giet_proctime() );
     31
     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
    2437        x = giet_ioc_completed();
    25         if ( x )
    26         {
    27             giet_tty_printf("echec giet_ioc_completed = %d at date : %d\n", x, giet_proctime() );
    28             giet_exit();
    29         }
    30         giet_tty_printf("ioc_read  completed at date = %d \n", giet_proctime());
     38        giet_assert( (x==0) , "echec giet_ioc_completed for buf0" );
    3139
    32         // Phase 2 : transfert de buf vers le frame buffer par dma
    33         x = giet_fb_sync_write(0, buf, 128 * 128);
    34         if ( x )
    35         {
    36             giet_tty_printf("echec giet_fb_write = %d at date : %d\n", x, giet_proctime() );
    37             giet_exit();
    38         }
     40        giet_tty_printf( "ioc_read buf0 completed at date = %d \n", giet_proctime() );
    3941
    40 /*
    41         giet_tty_printf("fb_write ok at date : %d\n", giet_proctime() );
     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;
    4246
    43         x = giet_fb_completed();
    44         if ( x )
    45         {
    46             giet_tty_printf("echec giet_fb_completed = %d at date : %d\n", x, giet_proctime() );
    47             giet_exit();
    48         }
    49 */
    50         giet_tty_printf("display completed at date = %d \n", giet_proctime());
     47        /* Phase 2 : transfer one image from disk to buf1 and display  */
    5148
    52         base = base + NBLOCS;
    53     }
     49        giet_tty_printf( "\n *** image %d *** at date = %d \n",
     50                         (base/NBLOCKS), giet_proctime() );
    5451
     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();
    5569    giet_exit();
    56 
    5770    return 0;
    5871}
Note: See TracChangeset for help on using the changeset viewer.