Ignore:
Timestamp:
Jul 22, 2015, 1:00:45 PM (9 years ago)
Author:
alain
Message:

Introduce support for the "active" field in display.py

Location:
soft/giet_vm/applications/display
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/display/display.py

    r610 r644  
    3333
    3434    # create vspace
    35     vspace = mapping.addVspace( name = 'display', startname = 'disp_data' )
     35    vspace = mapping.addVspace( name = 'display', startname = 'disp_data', active = False )
    3636   
    3737    # data vseg
     
    5858
    5959    # task
    60     mapping.addTask( vspace, 'disp', 0, 0, 0, 0, 'disp_stack', 'disp_heap', 0 )
     60    mapping.addTask( vspace, 'disp', 0, 0, 0, 1, 'disp_stack', 'disp_heap', 0 )
    6161
    6262    # extend mapping name
  • soft/giet_vm/applications/display/main.c

    r589 r644  
    11///////////////////////////////////////////////////////////////////////////////////////
    2 //  file   : main.c  (for display application)
     2//  file   : main.c     (display application)
    33//  date   : may 2014
    44//  author : Alain Greiner
     
    1212#include <hard_config.h>     // To check Frame Buffer size
    1313
    14 #define FILENAME    "misc/lena.raw"
    15 #define NPIXELS     256
    16 #define NLINES      256
    17 #define NIMAGES     1                 
     14#define FILENAME    "misc/images_128.raw"
     15#define NPIXELS     128
     16#define NLINES      128
     17#define NIMAGES     10                 
    1818
    1919#define INTERACTIVE 1
    2020
    21 unsigned char buf0[NPIXELS*NLINES] __attribute__((aligned(512)));
    22 unsigned char buf1[NPIXELS*NLINES] __attribute__((aligned(512)));
     21unsigned char buf0[NPIXELS*NLINES] __attribute__((aligned(64)));
     22unsigned char buf1[NPIXELS*NLINES] __attribute__((aligned(64)));
     23
     24unsigned int  sts0[16]  __attribute__((aligned(64)));
     25unsigned int  sts1[16]  __attribute__((aligned(64)));
    2326
    2427////////////////////////////////////////////
     
    2932    unsigned int    x;
    3033    unsigned int    y;
    31     unsigned int    lpid;
    32     giet_proc_xyp( &x, &y, &lpid );
     34    unsigned int    p;
     35    giet_proc_xyp( &x, &y, &p );
    3336
    3437    int             fd;
     
    4649    giet_tty_alloc();
    4750
    48     giet_tty_printf("\n[DISPLAY] Processor[%d,%d,%d] starts at cycle %d\n",
    49                     x, y, lpid, giet_proctime() );
     51    giet_tty_printf("\n[DISPLAY] P[%d,%d,%d] starts at cycle %d\n"
     52                    "  - buf0_vaddr = %x\n"
     53                    "  - buf1_vaddr = %x\n"
     54                    "  - sts0_vaddr = %x\n"
     55                    "  - sts1_vaddr = %x\n",
     56                    x, y, p, giet_proctime(),
     57                    buf0, buf1, sts0, sts1 );
    5058
    5159    // open file
    5260    fd = giet_fat_open( FILENAME , 0 );
    5361
    54     giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] open file %s at cycle %d\n",
    55                     x, y, lpid, FILENAME, giet_proctime() );
     62    giet_tty_printf("\n[DISPLAY] P[%d,%d,%d] open file %s at cycle %d\n",
     63                    x, y, p, FILENAME, giet_proctime() );
    5664
    5765    // get a Chained Buffer DMA channel
    5866    giet_fbf_cma_alloc();
    5967
     68    // initialize the source and destination chbufs
     69    giet_fbf_cma_init_buf( buf0 , buf1 , sts0 , sts1 );
     70
    6071    // start Chained Buffer DMA channel
    61     giet_fbf_cma_start( buf0, buf1, NPIXELS*NLINES );
     72    giet_fbf_cma_start( NPIXELS*NLINES );
    6273   
    6374    giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] starts CMA at cycle %d\n",
    64                     x, y, lpid, giet_proctime() );
     75                    x, y, p, giet_proctime() );
    6576
    66     // Main loop (on images)
     77    // Main loop on images
    6778    while ( 1 )
    6879    {
     
    7182
    7283        giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d at cycle %d\n",
    73                         x, y, lpid, image, giet_proctime() );
     84                        x, y, p, image, giet_proctime() );
    7485
    7586        // display buf0
     
    7788
    7889        giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d at cycle %d\n",
    79                         x, y, lpid, image, giet_proctime() );
     90                        x, y, p, image, giet_proctime() );
    8091
    81         image = (image + 1) % NIMAGES;
     92        image++;
     93
     94        if ( image == NIMAGES )
     95        {
     96            image = 0;
     97            giet_fat_lseek( fd , 0 , 0 );
     98        }
    8299
    83100        if ( INTERACTIVE ) giet_tty_getc( &byte );
     
    87104
    88105        giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] load image %d at cycle %d\n",
    89                         x, y, lpid, image, giet_proctime() );
     106                        x, y, p, image, giet_proctime() );
    90107
    91108        // display buf1
     
    93110
    94111        giet_tty_printf("\n[DISPLAY] Proc[%d,%d,%d] display image %d at cycle %d\n",
    95                         x, y, lpid, image, giet_proctime() );
     112                        x, y, p, image, giet_proctime() );
    96113
    97         image = (image + 1) % NIMAGES;
     114        image++;
     115
     116        if ( image == NIMAGES )
     117        {
     118            image = 0;
     119            giet_fat_lseek( fd , 0 , 0 );
     120        }
    98121
    99122        if ( INTERACTIVE ) giet_tty_getc( &byte );
Note: See TracChangeset for help on using the changeset viewer.