Ignore:
Timestamp:
Jul 18, 2015, 3:04:15 PM (9 years ago)
Author:
alain
Message:

Update the peripheral drivers using descheduling,
to comply with the modified NORUN bit-vector in task context.

File:
1 edited

Legend:

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

    r615 r630  
    3939
    4040///////////////////////////////////////////////////////////////////////////////
    41 // Locks protecting MMC components (one per cluster)
    42 // There are two kinds of lock: the _mmc_lock table contains all the locks and
    43 // and is stored in the kernel data segment, whereas the _mmc_distributed_lock
    44 // contains the addresses of locks which are distributed in every cluster (each
    45 // cluster contains the lock which protects its own mmc_component).
     41//     Global variables
     42///////////////////////////////////////////////////////////////////////////////
     43// Two kinds of locks protecting the MMC components (one per cluster):
     44// - the _mmc_lock array contains spin_locks allocated in cluster[0,0].
     45//   They must be used by the boot code because the kernel heap is not set.
     46// - the _mmc_distributed_locks array contains pointers on distributed
     47//   spin_loks allocated in the distributed heap in each cluster.
     48//   Each cluster contains the lock protecting its own mmc_component.
     49//   They can be used by the kernel code.
    4650// The global variable mmc_boot_mode define the type of lock which is used,
    4751// and must be defined in both kernel_init.c and boot.c files.
    48 // - the boot code must use a spin_lock because the kernel heap is not set.
    49 // - the kernel code can use a sqt_lock when the kernel heap is set.
    50 ///////////////////////////////////////////////////////////////////////////////
    51 
    52 extern unsigned int  _mmc_boot_mode;
     52///////////////////////////////////////////////////////////////////////////////
     53
     54__attribute__((section(".kdata")))
     55unsigned int  _mmc_boot_mode;
    5356
    5457__attribute__((section(".kdata")))
     
    6467void _mmc_init_locks()
    6568{
    66     unsigned int cx;    // cluster X coordinate
    67     unsigned int cy;    // cluster Y coordinate
     69    unsigned int x;    // cluster X coordinate
     70    unsigned int y;    // cluster Y coordinate
    6871   
    69     for ( cx = 0 ; cx < X_SIZE ; cx++ )
    70     {
    71         for ( cy = 0 ; cy < Y_SIZE ; cy++ )
     72    for ( x = 0 ; x < X_SIZE ; x++ )
     73    {
     74        for ( y = 0 ; y < Y_SIZE ; y++ )
    7275        {
    73             _mmc_distributed_lock[cx][cy] = _remote_malloc( sizeof(spin_lock_t), cx, cy );
    74             _spin_lock_init( _mmc_distributed_lock[cx][cy] );
     76            if ( _mmc_boot_mode )
     77            {
     78                _spin_lock_init( &_mmc_lock[x][y] );
     79            }
     80            else
     81            {
     82                _mmc_distributed_lock[x][y] = _remote_malloc( sizeof(spin_lock_t), x, y );
     83                _spin_lock_init( _mmc_distributed_lock[x][y] );
     84            }
    7585        }
    7686    }
Note: See TracChangeset for help on using the changeset viewer.