Changeset 555 for soft


Ignore:
Timestamp:
Apr 13, 2015, 5:21:18 PM (9 years ago)
Author:
alain
Message:

Update coproc application to use the newly defined coprocessor system calls.

Location:
soft/giet_vm/applications
Files:
3 edited

Legend:

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

    r533 r555  
    3131
    3232    # define thread placement
    33     x = 1
    34     y = 1
     33    x = 0
     34    y = 0
    3535    p = 0
    3636
  • soft/giet_vm/applications/coproc/main.c

    r533 r555  
     1///////////////////////////////////////////////////////////////////////////////////////
     2//  file   : main.c  (for coproc application)
     3//  date   : avril 2015
     4//  author : Alain Greiner
     5///////////////////////////////////////////////////////////////////////////////////////
     6//  This file describes the single thread "coproc" application.
     7//  It uses the embedded GCD (Greater Common Divider) coprocessor to make
     8//  the GCD computation between two vectors of 32 bits integers.
     9//  The vectors size is defined by the VECTOR_SIZE parameter.
     10///////////////////////////////////////////////////////////////////////////////////////
     11
     12
    113#include "stdio.h"
    214#include "mapping_info.h"   // for coprocessors types an modes
    315
    4 #define  VECTOR_SIZE  32   
     16#define  VECTOR_SIZE 128   
    517
    6 #define VERBOSE  1
     18#define  DMA_MODE    MODE_DMA_IRQ
     19
     20#define VERBOSE      1
    721
    822// Memory buffers for coprocessor
     
    3246    }
    3347
    34     // request a GCD coprocessor
    3548    unsigned int coproc_info;
    36     unsigned int cluster_xy;
    3749
    38     giet_coproc_alloc( MWR_SUBTYPE_GCD,
    39                        &coproc_info,
    40                        &cluster_xy );
     50    /////////////////////// request a GCD coprocessor
     51    giet_coproc_alloc( MWR_SUBTYPE_GCD, &coproc_info );
    4152
    4253    // check coprocessor ports
     
    4556    unsigned int nb_config      = (coproc_info>>16) & 0xFF;
    4657    unsigned int nb_status      = (coproc_info>>24) & 0xFF;
    47 
    4858    giet_assert( ((nb_to_coproc   == 2) &&
    4959                  (nb_from_coproc == 1) &&
     
    5262                  "wrong GCD coprocessor interface" );
    5363
    54     if ( VERBOSE )
    55     giet_shr_printf("\n*** get GCD coprocessor at cycle %d\n",
    56                     giet_proctime() );
     64if ( VERBOSE )
     65giet_shr_printf("\n*** get GCD coprocessor at cycle %d\n", giet_proctime() );
    5766
    58     // initializes communication channels
    59     giet_coproc_channel_t desc;
     67    //////////////////////// initializes channel for OPA
     68    giet_coproc_channel_t opa_desc;
     69    opa_desc.channel_mode = DMA_MODE;
     70    opa_desc.buffer_size  = VECTOR_SIZE<<2;
     71    opa_desc.buffer_vaddr = (unsigned int)opa;
     72    giet_coproc_channel_init( 0 , &opa_desc );
     73   
     74    //////////////////////// initializes channel for OPB
     75    giet_coproc_channel_t opb_desc;
     76    opb_desc.channel_mode = DMA_MODE;
     77    opb_desc.buffer_size  = VECTOR_SIZE<<2;
     78    opb_desc.buffer_vaddr = (unsigned int)opb;
     79    giet_coproc_channel_init( 1 , &opb_desc );
     80   
     81    //////////////////////// initializes channel for RES
     82    giet_coproc_channel_t res_desc;
     83    res_desc.channel_mode = DMA_MODE;
     84    res_desc.buffer_size  = VECTOR_SIZE<<2;
     85    res_desc.buffer_vaddr = (unsigned int)res;
     86    giet_coproc_channel_init( 2 , &res_desc );
     87   
     88if ( VERBOSE )
     89giet_shr_printf("\n*** channels initialized at cycle %d\n", giet_proctime() );
    6090
    61     desc.channel_mode = MODE_DMA_NO_IRQ;
    62     desc.buffer_size  = VECTOR_SIZE<<2;
    63     desc.buffer_vaddr = (unsigned int)opa;
     91    /////////////////////// starts communication channels
     92    giet_coproc_run( 0 );
    6493
    65     giet_coproc_channel_init( cluster_xy , 0 , &desc );
    66    
    67     desc.channel_mode = MODE_DMA_NO_IRQ;
    68     desc.buffer_size  = VECTOR_SIZE<<2;
    69     desc.buffer_vaddr = (unsigned int)opb;
     94if ( VERBOSE )
     95giet_shr_printf("\n*** start GCD coprocessor at cycle %d\n", giet_proctime() );
    7096
    71     giet_coproc_channel_init( cluster_xy , 1 , &desc );
    72    
    73     desc.channel_mode = MODE_DMA_IRQ;
    74     desc.buffer_size  = VECTOR_SIZE<<2;
    75     desc.buffer_vaddr = (unsigned int)res;
     97    /////////////////////// wait coprocessor completion
     98    if ( DMA_MODE == MODE_DMA_NO_IRQ )
     99    {
     100        giet_coproc_completed( );
     101    }
    76102
    77     giet_coproc_channel_init( cluster_xy , 2 , &desc );
    78    
    79     if ( VERBOSE )
    80     giet_shr_printf("\n*** initialise coomunication channels at cycle %d\n",
    81                     giet_proctime() );
    82 
    83     // starts communication channels
    84     giet_coproc_channel_start( cluster_xy , 0 );
    85     giet_coproc_channel_start( cluster_xy , 1 );
    86     giet_coproc_channel_start( cluster_xy , 2 );
    87 
    88     if ( VERBOSE )
    89     giet_shr_printf("\n*** start communication channels at cycle %d\n",
    90                     giet_proctime() );
    91 
    92     // starts GCD coprocessor
    93     giet_coproc_register_set( cluster_xy , 0 , 1 );
    94 
    95     if ( VERBOSE )
    96     giet_shr_printf("\n*** start GCD coprocessor at cycle %d\n",
    97                     giet_proctime() );
    98 
    99     // wait coprocessor completion
    100     giet_coproc_completed( cluster_xy );
    101 
    102     if ( VERBOSE )
    103     giet_shr_printf("\n*** GCD computation completed at cycle %d\n",
    104                     giet_proctime() );
     103if ( VERBOSE )
     104giet_shr_printf("\n*** GCD computation completed at cycle %d\n", giet_proctime() );
    105105
    106106    // display result
     
    111111    }
    112112
     113    ////////////////////// release GCD coprocessor
     114    giet_coproc_release( 0 );
     115
    113116    giet_exit("completed");
    114117
  • soft/giet_vm/applications/display/main.c

    r544 r555  
    1  ///////////////////////////////////////////////////////////////////////////////
     1///////////////////////////////////////////////////////////////////////////////////////
    22//  file   : main.c  (for display application)
    33//  date   : may 2014
     
    1010
    1111#include <stdio.h>
    12 #include <hard_config.h>
     12#include <hard_config.h>     // To check Frame Buffer size
    1313
    1414#define FILENAME    "misc/images.raw"
Note: See TracChangeset for help on using the changeset viewer.