Changeset 263 for soft/giet_vm/giet_drivers/mwr_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/mwr_driver.c
r258 r263 12 12 // The (virtual) base address of the associated segment is: 13 13 // 14 // seg_mwr_base + cluster_ id* vseg_cluster_increment14 // seg_mwr_base + cluster_xy * vseg_cluster_increment 15 15 // 16 16 // The seg_mwr_base and vseg_cluster_increment values must be defined … … 22 22 #include <utils.h> 23 23 24 #if !defined( NB_CLUSTERS)25 # error: You must define NB_CLUSTERSin the hard_config.h file24 #if !defined(X_SIZE) 25 # error: You must define X_SIZE in the hard_config.h file 26 26 #endif 27 27 28 #if (NB_CLUSTERS > 256) 29 # error: NB_CLUSTERS cannot be larger than 256! 28 #if !defined(Y_SIZE) 29 # error: You must define X_SIZE in the hard_config.h file 30 #endif 31 32 #if !defined(X_WIDTH) 33 # error: You must define X_WIDTH in the hard_config.h file 34 #endif 35 36 #if !defined(Y_WIDTH) 37 # error: You must define X_WIDTH in the hard_config.h file 30 38 #endif 31 39 32 40 ////////////////////////////////////////////////////////////////////////////////// 33 // _mw mr_hw_init()41 // _mwr_hw_init() 34 42 // This function initializes one MWMR controller channel (i.e. one coprocessor 35 43 // port) in a given cluster. 36 // - cluster_ id: cluster index44 // - cluster_xy : cluster index 37 45 // _ port_id : port index 38 46 // - way : direction (to_coproc/from_coproc) … … 40 48 // TODO : The MWMR controler should be modified to support 40 bits addresses... 41 49 // Introduce a MWMR_CONFIG_PADDR_EXT register in the MWMR coprocessor 42 // To support addresses > 32 bits and remove this limitation...43 50 ////////////////////////////////////////////////////////////////////////////////// 44 51 // Returns 0 if success, returns > 0 if error. 45 52 ////////////////////////////////////////////////////////////////////////////////// 46 unsigned int _mw mr_hw_init( unsigned int cluster_id,47 48 49 53 unsigned int _mwr_hw_init( unsigned int cluster_xy, 54 unsigned int port_id, 55 unsigned int from_coproc, 56 paddr_t channel_pbase ) 50 57 { 51 _puts(" [GIET_ERROR] _mw mr_hw_init() function not implemented yet\n");58 _puts(" [GIET_ERROR] _mwr_hw_init() function not supported yet\n"); 52 59 _exit(); 53 60 54 61 /* 55 62 // parameters checking 56 if (cluster_id >= NB_CLUSTERS) return 1; 63 unsigned int x = cluster_xy >> Y_WIDTH; 64 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 65 if (x >= X_SIZE) return 1; 66 if (y >= Y_SIZE) return 1; 57 67 58 // compute MWMRbase address59 unsigned int* mw mr_address = (unsigned int*) ((unsigned int)&seg_mwmr_base +60 (cluster_ id* (unsigned int)&vseg_cluster_increment));68 // compute base address 69 unsigned int* mwr_address = (unsigned int*) ((unsigned int)&seg_mwr_base + 70 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 61 71 62 72 unsigned int lsb = (unsigned int)channel_pbase; … … 68 78 69 79 // initializes and launches mwmr controler 70 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_FIFO_WAY] = from_coproc;71 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_FIFO_NO] = port_id;72 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_WIDTH] = width;73 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_DEPTH] = depth;74 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_STATUS] = lsb;75 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_DATA] = lsb + 24;76 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_EXT] = msb;77 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_RUNNING] = 1;80 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_FIFO_WAY] = from_coproc; 81 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_FIFO_NO] = port_id; 82 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_WIDTH] = width; 83 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_DEPTH] = depth; 84 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_STATUS] = lsb; 85 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_DATA] = lsb + 24; 86 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_EXT] = msb; 87 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_RUNNING] = 1; 78 88 */ 79 89 return 0;
Note: See TracChangeset
for help on using the changeset viewer.