Changeset 263 for soft/giet_vm/giet_drivers/icu_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/icu_driver.c
r258 r263 16 16 // The virtual base address of the segment associated to the component is: 17 17 // 18 // seg_icu_base + cluster_ id* vseg_cluster_increment18 // seg_icu_base + cluster_xy * vseg_cluster_increment 19 19 // 20 20 // The seg_icu_base and vseg_cluster_increment values must be defined … … 24 24 #include <giet_config.h> 25 25 #include <icu_driver.h> 26 #include <tty_driver.h> 26 27 #include <utils.h> 27 28 28 #if !defined( NB_CLUSTERS)29 # error: You must define NB_CLUSTERSin the hard_config.h file29 #if !defined(X_SIZE) 30 # error: You must define X_SIZE in the hard_config.h file 30 31 #endif 31 32 32 #if (NB_CLUSTERS > 256) 33 # error: NB_CLUSTERS cannot be larger than 256! 33 #if !defined(Y_SIZE) 34 # error: You must define X_SIZE in the hard_config.h file 35 #endif 36 37 #if !defined(X_WIDTH) 38 # error: You must define X_WIDTH in the hard_config.h file 39 #endif 40 41 #if !defined(Y_WIDTH) 42 # error: You must define X_WIDTH in the hard_config.h file 34 43 #endif 35 44 36 45 #if !defined(NB_PROCS_MAX) 37 46 # error: You must define NB_PROCS_MAX in the hard_config.h file 38 #endif39 40 #if (NB_PROCS_MAX > 8)41 # error: NB_PROCS_MAX cannot be larger than 8!42 47 #endif 43 48 … … 53 58 // Returns 0 if success, > 0 if error. 54 59 //////////////////////////////////////////////////////////////////////////////// 55 unsigned int _icu_set_mask( unsigned int cluster_ id,60 unsigned int _icu_set_mask( unsigned int cluster_xy, 56 61 unsigned int proc_id, 57 62 unsigned int value ) 58 63 { 59 64 // parameters checking 60 if (cluster_id >= NB_CLUSTERS) return 1; 61 if (proc_id >= NB_PROCS_MAX) return 1; 65 unsigned int x = cluster_xy >> Y_WIDTH; 66 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 67 if (x >= X_SIZE) return 1; 68 if (y >= Y_SIZE) return 1; 69 if (proc_id >= NB_PROCS_MAX) return 1; 62 70 63 71 #if USE_XICU 64 _puts("[GIET ERROR] _icu_set_mask should not be used if USE_XICU is set\n");72 _puts("[GIET ERROR] _icu_set_mask() should not be used if USE_XICU is set\n"); 65 73 return 1; 66 74 #else 67 75 unsigned int * icu_address = (unsigned int *) ((unsigned int)&seg_icu_base + 68 (cluster_ id* (unsigned int)&vseg_cluster_increment));76 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 69 77 icu_address[proc_id * ICU_SPAN + ICU_MASK_SET] = value; 70 78 return 0; … … 78 86 // Returns 0 if success, > 0 if error. 79 87 //////////////////////////////////////////////////////////////////////////////// 80 unsigned int _icu_get_index( unsigned int cluster_ id,88 unsigned int _icu_get_index( unsigned int cluster_xy, 81 89 unsigned int proc_id, 82 90 unsigned int * buffer) 83 91 { 84 92 // parameters checking 85 if (cluster_id >= NB_CLUSTERS) return 1; 86 if (proc_id >= NB_PROCS_MAX) return 1; 93 unsigned int x = cluster_xy >> Y_WIDTH; 94 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 95 if (x >= X_SIZE) return 1; 96 if (y >= Y_SIZE) return 1; 97 if (proc_id >= NB_PROCS_MAX) return 1; 87 98 88 99 #if USE_XICU 89 _puts("[GIET ERROR] _icu_get_index should not be used if USE_XICU is set\n");100 _puts("[GIET ERROR] _icu_get_index() should not be used if USE_XICU is set\n"); 90 101 return 1; 91 102 #else 92 103 unsigned int* icu_address = (unsigned int *) ((unsigned int)&seg_icu_base + 93 (cluster_ id* (unsigned int)&vseg_cluster_increment));104 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 94 105 *buffer = icu_address[proc_id * ICU_SPAN + ICU_IT_VECTOR]; 95 106 return 0;
Note: See TracChangeset
for help on using the changeset viewer.