Changeset 263 for soft/giet_vm/giet_drivers/mmc_driver.c
- Timestamp:
- Dec 19, 2013, 9:36:48 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/mmc_driver.c
r258 r263 21 21 #include <giet_config.h> 22 22 #include <mmc_driver.h> 23 #include <tty_driver.h> 23 24 #include <utils.h> 24 25 25 #if !defined( NB_CLUSTERS)26 # error: You must define NB_CLUSTERSin the hard_config.h file26 #if !defined(X_SIZE) 27 # error: You must define X_SIZE in the hard_config.h file 27 28 #endif 28 29 29 #if (NB_CLUSTERS > 256) 30 # error: NB_CLUSTERS cannot be larger than 256! 30 #if !defined(Y_SIZE) 31 # error: You must define X_SIZE in the hard_config.h file 32 #endif 33 34 #if !defined(X_WIDTH) 35 # error: You must define X_WIDTH in the hard_config.h file 36 #endif 37 38 #if !defined(Y_WIDTH) 39 # error: You must define X_WIDTH in the hard_config.h file 31 40 #endif 32 41 … … 40 49 unsigned int buf_length ) 41 50 { 42 unsigned int cluster_id = (unsigned int)((buf_paddr>>32)/(256/NB_CLUSTERS)); 51 // compute cluster coordinates 52 unsigned int cluster_xy = (unsigned int)(buf_paddr>>(40-X_WIDTH-Y_WIDTH)); 53 unsigned int x = cluster_xy >> Y_WIDTH; 54 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 55 56 // parameters checking 57 if ( (x >= X_SIZE) || (y >= Y_SIZE) ) 58 { 59 _puts("\n[GIET ERROR] in _memc_inval() : illegal cluster index["); 60 _putd( x ); 61 _puts(","); 62 _putd( y ); 63 _puts("]\n"); 64 _puts(" - paddr = "); 65 _putl( buf_paddr ); 66 _puts("\n - cluster_xy = "); 67 _putx( cluster_xy ); 68 _puts("\n"); 69 _exit(); 70 } 43 71 44 72 unsigned int* mmc_address = (unsigned int*)((unsigned int)&seg_mmc_base + 45 (cluster_ id* (unsigned int)&vseg_cluster_increment));73 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 46 74 47 75 // get the hard lock protecting exclusive access to MEMC … … 66 94 unsigned int buf_length ) 67 95 { 68 unsigned int cluster_id = (unsigned int)((buf_paddr>>32)/(256/NB_CLUSTERS)); 96 // compute cluster coordinates 97 unsigned int cluster_xy = (unsigned int)(buf_paddr>>(40-X_WIDTH-Y_WIDTH)); 98 unsigned int x = cluster_xy >> Y_WIDTH; 99 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 100 101 // parameters checking 102 if ( (x >= X_SIZE) || (y >= Y_SIZE) ) 103 { 104 _puts("\n[GIET ERROR] in _memc_sync() : illegal cluster index["); 105 _putd( x ); 106 _puts(","); 107 _putd( y ); 108 _puts("]\n"); 109 _puts(" - paddr = "); 110 _putl( buf_paddr ); 111 _puts("\n - cluster_xy = "); 112 _putx( cluster_xy ); 113 _puts("\n"); 114 _exit(); 115 } 69 116 70 117 unsigned int * mmc_address = (unsigned int *) ((unsigned int)&seg_mmc_base + 71 (cluster_ id* (unsigned int)&vseg_cluster_increment));118 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 72 119 73 120 // get the hard lock protecting exclusive access to MEMC
Note: See TracChangeset
for help on using the changeset viewer.