Changeset 496 for soft/giet_vm/giet_drivers/mmc_driver.c
- Timestamp:
- Feb 8, 2015, 1:12:23 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/mmc_driver.c
r481 r496 9 9 #include <mmc_driver.h> 10 10 #include <tty0.h> 11 #include < locks.h>11 #include <kernel_locks.h> 12 12 #include <utils.h> 13 13 … … 37 37 # error: You must define PERI_CLUSTER_INCREMENT in the hard_config.h file 38 38 #endif 39 40 /////////////////////////////////////////////////////////////////////////////// 41 // Distributed locks protecting MMC components (one per cluster) 42 /////////////////////////////////////////////////////////////////////////////// 43 44 __attribute__((section(".kdata"))) 45 spin_lock_t _mmc_lock[X_SIZE][Y_SIZE] __attribute__((aligned(64))); 39 46 40 47 /////////////////////////////////////////////////////////////////////////////// … … 87 94 if ( (x >= X_SIZE) || (y >= Y_SIZE) ) 88 95 { 89 _puts("\n[GIET ERROR] in _m emc_inval() : illegal cluster coordinates\n");96 _puts("\n[GIET ERROR] in _mmc_inval() : illegal cluster coordinates\n"); 90 97 _exit(); 91 98 } 92 99 93 // get the hard queuinglock protecting exclusive access to MEMC100 // get the lock protecting exclusive access to MEMC 94 101 _spin_lock_acquire( &_mmc_lock[x][y] ); 95 102 96 103 // 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 ); 101 108 102 109 // release the lock … … 116 123 if ( (x >= X_SIZE) || (y >= Y_SIZE) ) 117 124 { 118 _puts( "\n[GIET ERROR] in _m emc_sync() : illegal cluster coordinates");125 _puts( "\n[GIET ERROR] in _mmc_sync() : illegal cluster coordinates"); 119 126 _exit(); 120 127 } 121 128 122 // get the hard queuinglock protecting exclusive access to MEMC129 // get the lock protecting exclusive access to MEMC 123 130 _spin_lock_acquire( &_mmc_lock[x][y] ); 124 131 … … 131 138 // release the lock 132 139 _spin_lock_release( &_mmc_lock[x][y] ); 140 } 141 142 ///////////////////////////////////////////// 143 unsigned 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) ); 133 156 } 134 157
Note: See TracChangeset
for help on using the changeset viewer.