Ignore:
Timestamp:
Apr 4, 2015, 11:34:33 AM (10 years ago)
Author:
alain
Message:

Introducing interactivity in the display application to test
dynamic routing of the TTY_RX interrupt.

File:
1 edited

Legend:

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

    r480 r544  
    1515#define NPIXELS     128
    1616#define NLINES      128
    17 #define NIMAGES     10                   
     17#define NIMAGES     20                 
    1818#define NBLOCKS     (NPIXELS*NLINES/512)   // number of blocks per image
    1919
     20#define INTERACTIVE 1
    2021
    2122unsigned char buf0[NPIXELS*NLINES] __attribute__((aligned(512)));
     
    3536    unsigned int    image = 0;
    3637
     38    char            byte;
     39
    3740    // parameters checking
    3841    if ( (NPIXELS != FBUF_X_SIZE) || (NLINES != FBUF_Y_SIZE) )
     
    4144    }
    4245
    43     giet_shr_printf("\n[DISPLAY] Processor[%d,%d,%d] starts at cycle %d\n",
     46    // get a private TTY
     47    giet_tty_alloc();
     48
     49    giet_tty_printf("\n[DISPLAY] Processor[%d,%d,%d] starts at cycle %d\n",
    4450                    x, y, lpid, giet_proctime() );
    4551
    4652    // open file
    4753    fd = giet_fat_open( FILENAME , 0 );
    48     if ( fd < 0 )
    49     {
    50         giet_exit("echec giet_fat_open for misc/images.raw");
    51     }
    52     else
    53     {
    54         giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] open file %s at cycle %d\n",
     54
     55    giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] open file %s at cycle %d\n",
    5556                    x, y, lpid, FILENAME, giet_proctime() );
    56     }
    5757
    5858    // get a Chained Buffer DMA channel
     
    6262    giet_fbf_cma_start( buf0, buf1, NPIXELS*NLINES );
    6363   
    64     giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] starts CMA at cycle %d\n",
     64    giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] starts CMA at cycle %d\n",
    6565                    x, y, lpid, giet_proctime() );
    6666
    6767    // Main loop (on images)
    68     while ( image < NIMAGES )
     68    while ( 1 )
    6969    {
    7070        // load buf0
    7171        giet_fat_read( fd, buf0, NBLOCKS, image*NBLOCKS );
    7272
    73         giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d to buf0 at cycle %d\n",
     73        giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d at cycle %d\n",
    7474                        x, y, lpid, image, giet_proctime() );
    7575
     
    7777        giet_fbf_cma_display( 0 );
    7878
    79         giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d from buf0 at cycle %d\n",
     79        giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d at cycle %d\n",
    8080                        x, y, lpid, image, giet_proctime() );
    8181
    82         image++;
     82        image = (image + 1) % NIMAGES;
     83
     84        if ( INTERACTIVE ) giet_tty_getc( &byte );
    8385
    8486        // load buf1
    8587        giet_fat_read( fd, buf1, NBLOCKS, image*NBLOCKS );
    8688
    87         giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d to buf1 at cycle %d\n",
     89        giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d at cycle %d\n",
    8890                        x, y, lpid, image, giet_proctime() );
    8991
     
    9193        giet_fbf_cma_display( 1 );
    9294
    93         giet_shr_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d from buf1 at cycle %d\n",
     95        giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d at cycle %d\n",
    9496                        x, y, lpid, image, giet_proctime() );
    9597
    96         image++;
     98        image = (image + 1) % NIMAGES;
     99
     100        if ( INTERACTIVE ) giet_tty_getc( &byte );
    97101    }
    98102
Note: See TracChangeset for help on using the changeset viewer.