Changeset 630 for soft/giet_vm/giet_drivers/mmc_driver.c
- Timestamp:
- Jul 18, 2015, 3:04:15 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/mmc_driver.c
r615 r630 39 39 40 40 /////////////////////////////////////////////////////////////////////////////// 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. 46 50 // The global variable mmc_boot_mode define the type of lock which is used, 47 51 // 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"))) 55 unsigned int _mmc_boot_mode; 53 56 54 57 __attribute__((section(".kdata"))) … … 64 67 void _mmc_init_locks() 65 68 { 66 unsigned int cx; // cluster X coordinate67 unsigned int cy; // cluster Y coordinate69 unsigned int x; // cluster X coordinate 70 unsigned int y; // cluster Y coordinate 68 71 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++ ) 72 75 { 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 } 75 85 } 76 86 }
Note: See TracChangeset
for help on using the changeset viewer.