Ignore:
Timestamp:
Dec 19, 2013, 9:36:48 AM (11 years ago)
Author:
alain
Message:

Introducing support for TSAR fixed format cluster index (cluster_xy)
We have now 4 parameters defined in map.xml:

  • X_WIDTH, Y_WIDTH define the fixed format (typically X_WIDTH = 4 / Y_WIDTH = 4)
  • X_SIZE, Y_SIZE define the actual TSAR 2D mesh variable size (from 1 to 16)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/dma_driver.c

    r258 r263  
    1212//
    1313// There is  (NB_CLUSTERS * NB_DMA_CHANNELS) channels, indexed by a global index:
    14 //        dma_id = cluster_id * NB_DMA_CHANNELS + loc_id
     14//        dma_id = cluster_xy * NB_DMA_CHANNELS + loc_id
    1515//
    1616// A DMA channel is a private ressource allocated to a given processor.
     
    2222// The virtual base address of the segment associated to a channel is:
    2323//
    24 //    seg_dma_base + cluster_id * vseg_cluster_increment + DMA_SPAN * channel_id
     24//    seg_dma_base + cluster_xy * vseg_cluster_increment + DMA_SPAN * channel_id
    2525//
    2626////////////////////////////////////////////////////////////////////////////////////
     
    3232#include <vmem.h>
    3333
    34 #if !defined(NB_CLUSTERS)
    35 # error: You must define NB_CLUSTERS in the hard_config.h file
    36 #endif
    37 
    38 #if (NB_CLUSTERS > 256)
    39 # error: NB_CLUSTERS cannot be larger than 256!
    40 #endif
    41 
    42 #if !defined(NB_PROCS_MAX)
    43 # error: You must define NB_PROCS_MAX in the hard_config.h file
    44 #endif
    45 
    46 #if (NB_PROCS_MAX > 8)
    47 # error: NB_PROCS_MAX cannot be larger than 8!
    48 #endif
    49 
    50 #if (NB_DMA_CHANNELS > 8)
    51 # error: NB_DMA_CHANNELS cannot be larger than 8!
     34#if !defined(X_SIZE)
     35# error: You must define X_SIZE in the hard_config.h file
     36#endif
     37
     38#if !defined(Y_SIZE)
     39# error: You must define X_SIZE in the hard_config.h file
     40#endif
     41
     42#if !defined(X_WIDTH)
     43# error: You must define X_WIDTH in the hard_config.h file
     44#endif
     45
     46#if !defined(Y_WIDTH)
     47# error: You must define X_WIDTH in the hard_config.h file
     48#endif
     49
     50#if !defined(NB_DMA_CHANNELS)
     51# error: You must define NB_DMA_CHANNELS in the hard_config.h file
    5252#endif
    5353
     
    6060// Returns 0 if success, returns > 0 if error.
    6161//////////////////////////////////////////////////////////////////////////////////
    62 unsigned int _dma_init( unsigned int cluster_id,
     62unsigned int _dma_init( unsigned int cluster_xy,
    6363                        unsigned int channel_id )
    6464{
    6565#if NB_DMA_CHANNELS > 0
     66
    6667    // parameters checking
    67     if (cluster_id >= NB_CLUSTERS)      return 1;
     68    unsigned int x = cluster_xy >> Y_WIDTH;
     69    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     70    if (x >= X_SIZE)                    return 1;
     71    if (y >= Y_SIZE)                    return 1;
    6872    if (channel_id >= NB_DMA_CHANNELS)  return 1;
    6973
    7074    // compute DMA base address
    7175    unsigned int* dma_address = (unsigned int*) ((unsigned int)&seg_dma_base +
    72                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
     76                                (cluster_xy * (unsigned int)&vseg_cluster_increment));
    7377
    7478    // disable interrupt for selected channel
     
    8488// completion. It actually forces the channel to return in iDLE state.
    8589//////////////////////////////////////////////////////////////////////////////////
    86 unsigned int _dma_reset( unsigned int cluster_id,
     90unsigned int _dma_reset( unsigned int cluster_xy,
    8791                         unsigned int channel_id )
    8892{
    8993#if NB_DMA_CHANNELS > 0
     94
    9095    // parameters checking
    91     if (cluster_id >= NB_CLUSTERS)      return 1;
     96    unsigned int x = cluster_xy >> Y_WIDTH;
     97    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     98    if (x >= X_SIZE)                    return 1;
     99    if (y >= Y_SIZE)                    return 1;
    92100    if (channel_id >= NB_DMA_CHANNELS)  return 1;
    93101
    94102    // compute DMA base address
    95103    unsigned int* dma_address = (unsigned int*) ((unsigned int)&seg_dma_base +
    96                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
     104                                (cluster_xy * (unsigned int)&vseg_cluster_increment));
    97105
    98106    // reset selected channel
     
    107115// This function returns the status of a DMA channel in a given cluster
    108116//////////////////////////////////////////////////////////////////////////////////
    109 unsigned int _dma_get_status( unsigned int cluster_id,
     117unsigned int _dma_get_status( unsigned int cluster_xy,
    110118                              unsigned int channel_id )
    111119{
    112120#if NB_DMA_CHANNELS > 0
     121
    113122    // parameters checking
    114     if (cluster_id >= NB_CLUSTERS)      return 1;
     123    unsigned int x = cluster_xy >> Y_WIDTH;
     124    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     125    if (x >= X_SIZE)                    return 1;
     126    if (y >= Y_SIZE)                    return 1;
    115127    if (channel_id >= NB_DMA_CHANNELS)  return 1;
    116128
    117129    // compute DMA base address
    118130    unsigned int * dma_address = (unsigned int *) ((unsigned int)&seg_dma_base +
    119                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
     131                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
    120132
    121133    // get selected channel status
     
    131143// and sets the transfer size to lauch the transfer.
    132144//////////////////////////////////////////////////////////////////////////////////
    133 unsigned int _dma_start_transfer( unsigned int       cluster_id,
     145unsigned int _dma_start_transfer( unsigned int       cluster_xy,
    134146                                  unsigned int       channel_id,
    135147                                  unsigned long long dst_paddr,   // physical address
     
    138150{
    139151#if NB_DMA_CHANNELS > 0
     152
    140153    // parameters checking
    141     if (cluster_id >= NB_CLUSTERS)      return 1;
     154    unsigned int x = cluster_xy >> Y_WIDTH;
     155    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     156    if (x >= X_SIZE)                    return 1;
     157    if (y >= Y_SIZE)                    return 1;
    142158    if (channel_id >= NB_DMA_CHANNELS)  return 1;
    143159
    144160    // compute DMA base address
    145161    unsigned int * dma_address = (unsigned int *) ((unsigned int)&seg_dma_base +
    146                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
     162                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
    147163
    148164    // selected channel configuration and lauching
     
    179195
    180196    unsigned int procid    = _get_procid();
    181     unsigned int cluster_id = procid/NB_PROCS_MAX;
     197    unsigned int cluster_xy = procid/NB_PROCS_MAX;
    182198    unsigned int channel_id = procid%NB_PROCS_MAX;
    183199
     
    192208_puts("\n - vspace_id  = ");
    193209_putx( vspace_id );
    194 _puts("\n - cluster_id = ");
    195 _putx( cluster_id );
     210_puts("\n - cluster_xy = ");
     211_putx( cluster_xy );
    196212_puts("\n - channel_id = ");
    197213_putx( channel_id );
     
    263279
    264280    // dma channel configuration & lauching
    265     ko = _dma_start_transfer(  cluster_id, channel_id, dst_paddr, src_paddr, size );
     281    ko = _dma_start_transfer(  cluster_xy, channel_id, dst_paddr, src_paddr, size );
    266282    if ( ko )
    267283    {
     
    273289
    274290    // scan dma channel status
    275     unsigned int status = _dma_get_status( cluster_id, channel_id );
     291    unsigned int status = _dma_get_status( cluster_xy, channel_id );
    276292    while( (status != DMA_SUCCESS) &&
    277293           (status != DMA_READ_ERROR) &&
    278294           (status != DMA_WRITE_ERROR) )
    279295    {
    280         status = _dma_get_status( cluster_id, channel_id );
     296        status = _dma_get_status( cluster_xy, channel_id );
    281297
    282298#if GIET_DEBUG_DMA_DRIVER
     
    299315    }
    300316    // reset dma channel
    301     _dma_reset( cluster_id, channel_id );
     317    _dma_reset( cluster_xy, channel_id );
    302318
    303319#if GIET_DEBUG_DMA_DRIVER
Note: See TracChangeset for help on using the changeset viewer.