Ignore:
Timestamp:
Feb 8, 2015, 1:12:23 PM (9 years ago)
Author:
alain
Message:

1) Introduce access functions to MMC intrumentation registers.
2) Use _printf for error or debug messages.

File:
1 edited

Legend:

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

    r481 r496  
    99#include <mmc_driver.h>
    1010#include <tty0.h>
    11 #include <locks.h>
     11#include <kernel_locks.h>
    1212#include <utils.h>
    1313
     
    3737# error: You must define PERI_CLUSTER_INCREMENT in the hard_config.h file
    3838#endif
     39
     40///////////////////////////////////////////////////////////////////////////////
     41// Distributed locks protecting MMC components (one per cluster)
     42///////////////////////////////////////////////////////////////////////////////
     43
     44__attribute__((section(".kdata")))
     45spin_lock_t  _mmc_lock[X_SIZE][Y_SIZE]  __attribute__((aligned(64)));
    3946
    4047///////////////////////////////////////////////////////////////////////////////
     
    8794    if ( (x >= X_SIZE) || (y >= Y_SIZE) )
    8895    {
    89         _puts("\n[GIET ERROR] in _memc_inval() : illegal cluster coordinates\n");
     96        _puts("\n[GIET ERROR] in _mmc_inval() : illegal cluster coordinates\n");
    9097        _exit();
    9198    }
    9299
    93     // get the hard queuing lock protecting exclusive access to MEMC
     100    // get the lock protecting exclusive access to MEMC
    94101    _spin_lock_acquire( &_mmc_lock[x][y] );
    95102
    96103    // write inval arguments
    97     _mmc_set_register( cluster_xy , 0 , MEMC_ADDR_LO   , (unsigned int)buf_paddr );
    98     _mmc_set_register( cluster_xy , 0 , MEMC_ADDR_HI   , (unsigned int)(buf_paddr>>32) );
    99     _mmc_set_register( cluster_xy , 0 , MEMC_BUF_LENGTH, buf_length );
    100     _mmc_set_register( cluster_xy , 0 , MEMC_CMD_TYPE  , MEMC_CMD_INVAL );
     104    _mmc_set_register(cluster_xy, 0, MEMC_ADDR_LO   , (unsigned int)buf_paddr );
     105    _mmc_set_register(cluster_xy, 0, MEMC_ADDR_HI   , (unsigned int)(buf_paddr>>32) );
     106    _mmc_set_register(cluster_xy, 0, MEMC_BUF_LENGTH, buf_length );
     107    _mmc_set_register(cluster_xy, 0, MEMC_CMD_TYPE  , MEMC_CMD_INVAL );
    101108
    102109    // release the lock
     
    116123    if ( (x >= X_SIZE) || (y >= Y_SIZE) )
    117124    {
    118         _puts( "\n[GIET ERROR] in _memc_sync() : illegal cluster coordinates");
     125        _puts( "\n[GIET ERROR] in _mmc_sync() : illegal cluster coordinates");
    119126        _exit();
    120127    }
    121128
    122     // get the hard queuing lock protecting exclusive access to MEMC
     129    // get the lock protecting exclusive access to MEMC
    123130    _spin_lock_acquire( &_mmc_lock[x][y] );
    124131
     
    131138    // release the lock
    132139    _spin_lock_release( &_mmc_lock[x][y] );
     140}
     141
     142/////////////////////////////////////////////
     143unsigned int _mmc_instrument( unsigned int x,
     144                              unsigned int y,
     145                              unsigned int reg )
     146{
     147    // parameters checking
     148    if ( (x >= X_SIZE) || (y >= Y_SIZE) )
     149    {
     150        _puts( "\n[GIET ERROR] in _mmc_instrument() : illegal cluster coordinates");
     151        _exit();
     152    }
     153
     154    unsigned int cluster_xy = (x << Y_WIDTH) + y;
     155    return( _mmc_get_register(cluster_xy , 1 , reg) );
    133156}
    134157
Note: See TracChangeset for help on using the changeset viewer.