Changeset 263 for soft/giet_vm/giet_drivers
- Timestamp:
- Dec 19, 2013, 9:36:48 AM (11 years ago)
- Location:
- soft/giet_vm/giet_drivers
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/dma_driver.c
r258 r263 12 12 // 13 13 // There is (NB_CLUSTERS * NB_DMA_CHANNELS) channels, indexed by a global index: 14 // dma_id = cluster_ id* NB_DMA_CHANNELS + loc_id14 // dma_id = cluster_xy * NB_DMA_CHANNELS + loc_id 15 15 // 16 16 // A DMA channel is a private ressource allocated to a given processor. … … 22 22 // The virtual base address of the segment associated to a channel is: 23 23 // 24 // seg_dma_base + cluster_ id* vseg_cluster_increment + DMA_SPAN * channel_id24 // seg_dma_base + cluster_xy * vseg_cluster_increment + DMA_SPAN * channel_id 25 25 // 26 26 //////////////////////////////////////////////////////////////////////////////////// … … 32 32 #include <vmem.h> 33 33 34 #if !defined( NB_CLUSTERS)35 # error: You must define NB_CLUSTERSin the hard_config.h file36 #endif 37 38 #if (NB_CLUSTERS > 256)39 # error: NB_CLUSTERS cannot be larger than 256!40 #endif 41 42 #if !defined( NB_PROCS_MAX)43 # error: You must define NB_PROCS_MAXin the hard_config.h file44 #endif 45 46 #if (NB_PROCS_MAX > 8)47 # error: NB_PROCS_MAX cannot be larger than 8!48 #endif 49 50 #if (NB_DMA_CHANNELS > 8)51 # error: NB_DMA_CHANNELS cannot be larger than 8!34 #if !defined(X_SIZE) 35 # error: You must define X_SIZE in the hard_config.h file 36 #endif 37 38 #if !defined(Y_SIZE) 39 # error: You must define X_SIZE in the hard_config.h file 40 #endif 41 42 #if !defined(X_WIDTH) 43 # error: You must define X_WIDTH in the hard_config.h file 44 #endif 45 46 #if !defined(Y_WIDTH) 47 # error: You must define X_WIDTH in the hard_config.h file 48 #endif 49 50 #if !defined(NB_DMA_CHANNELS) 51 # error: You must define NB_DMA_CHANNELS in the hard_config.h file 52 52 #endif 53 53 … … 60 60 // Returns 0 if success, returns > 0 if error. 61 61 ////////////////////////////////////////////////////////////////////////////////// 62 unsigned int _dma_init( unsigned int cluster_ id,62 unsigned int _dma_init( unsigned int cluster_xy, 63 63 unsigned int channel_id ) 64 64 { 65 65 #if NB_DMA_CHANNELS > 0 66 66 67 // parameters checking 67 if (cluster_id >= NB_CLUSTERS) return 1; 68 unsigned int x = cluster_xy >> Y_WIDTH; 69 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 70 if (x >= X_SIZE) return 1; 71 if (y >= Y_SIZE) return 1; 68 72 if (channel_id >= NB_DMA_CHANNELS) return 1; 69 73 70 74 // compute DMA base address 71 75 unsigned int* dma_address = (unsigned int*) ((unsigned int)&seg_dma_base + 72 (cluster_ id* (unsigned int)&vseg_cluster_increment));76 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 73 77 74 78 // disable interrupt for selected channel … … 84 88 // completion. It actually forces the channel to return in iDLE state. 85 89 ////////////////////////////////////////////////////////////////////////////////// 86 unsigned int _dma_reset( unsigned int cluster_ id,90 unsigned int _dma_reset( unsigned int cluster_xy, 87 91 unsigned int channel_id ) 88 92 { 89 93 #if NB_DMA_CHANNELS > 0 94 90 95 // parameters checking 91 if (cluster_id >= NB_CLUSTERS) return 1; 96 unsigned int x = cluster_xy >> Y_WIDTH; 97 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 98 if (x >= X_SIZE) return 1; 99 if (y >= Y_SIZE) return 1; 92 100 if (channel_id >= NB_DMA_CHANNELS) return 1; 93 101 94 102 // compute DMA base address 95 103 unsigned int* dma_address = (unsigned int*) ((unsigned int)&seg_dma_base + 96 (cluster_ id* (unsigned int)&vseg_cluster_increment));104 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 97 105 98 106 // reset selected channel … … 107 115 // This function returns the status of a DMA channel in a given cluster 108 116 ////////////////////////////////////////////////////////////////////////////////// 109 unsigned int _dma_get_status( unsigned int cluster_ id,117 unsigned int _dma_get_status( unsigned int cluster_xy, 110 118 unsigned int channel_id ) 111 119 { 112 120 #if NB_DMA_CHANNELS > 0 121 113 122 // parameters checking 114 if (cluster_id >= NB_CLUSTERS) return 1; 123 unsigned int x = cluster_xy >> Y_WIDTH; 124 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 125 if (x >= X_SIZE) return 1; 126 if (y >= Y_SIZE) return 1; 115 127 if (channel_id >= NB_DMA_CHANNELS) return 1; 116 128 117 129 // compute DMA base address 118 130 unsigned int * dma_address = (unsigned int *) ((unsigned int)&seg_dma_base + 119 (cluster_ id* (unsigned int)&vseg_cluster_increment));131 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 120 132 121 133 // get selected channel status … … 131 143 // and sets the transfer size to lauch the transfer. 132 144 ////////////////////////////////////////////////////////////////////////////////// 133 unsigned int _dma_start_transfer( unsigned int cluster_ id,145 unsigned int _dma_start_transfer( unsigned int cluster_xy, 134 146 unsigned int channel_id, 135 147 unsigned long long dst_paddr, // physical address … … 138 150 { 139 151 #if NB_DMA_CHANNELS > 0 152 140 153 // parameters checking 141 if (cluster_id >= NB_CLUSTERS) return 1; 154 unsigned int x = cluster_xy >> Y_WIDTH; 155 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 156 if (x >= X_SIZE) return 1; 157 if (y >= Y_SIZE) return 1; 142 158 if (channel_id >= NB_DMA_CHANNELS) return 1; 143 159 144 160 // compute DMA base address 145 161 unsigned int * dma_address = (unsigned int *) ((unsigned int)&seg_dma_base + 146 (cluster_ id* (unsigned int)&vseg_cluster_increment));162 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 147 163 148 164 // selected channel configuration and lauching … … 179 195 180 196 unsigned int procid = _get_procid(); 181 unsigned int cluster_ id= procid/NB_PROCS_MAX;197 unsigned int cluster_xy = procid/NB_PROCS_MAX; 182 198 unsigned int channel_id = procid%NB_PROCS_MAX; 183 199 … … 192 208 _puts("\n - vspace_id = "); 193 209 _putx( vspace_id ); 194 _puts("\n - cluster_ id= ");195 _putx( cluster_ id);210 _puts("\n - cluster_xy = "); 211 _putx( cluster_xy ); 196 212 _puts("\n - channel_id = "); 197 213 _putx( channel_id ); … … 263 279 264 280 // dma channel configuration & lauching 265 ko = _dma_start_transfer( cluster_ id, channel_id, dst_paddr, src_paddr, size );281 ko = _dma_start_transfer( cluster_xy, channel_id, dst_paddr, src_paddr, size ); 266 282 if ( ko ) 267 283 { … … 273 289 274 290 // scan dma channel status 275 unsigned int status = _dma_get_status( cluster_ id, channel_id );291 unsigned int status = _dma_get_status( cluster_xy, channel_id ); 276 292 while( (status != DMA_SUCCESS) && 277 293 (status != DMA_READ_ERROR) && 278 294 (status != DMA_WRITE_ERROR) ) 279 295 { 280 status = _dma_get_status( cluster_ id, channel_id );296 status = _dma_get_status( cluster_xy, channel_id ); 281 297 282 298 #if GIET_DEBUG_DMA_DRIVER … … 299 315 } 300 316 // reset dma channel 301 _dma_reset( cluster_ id, channel_id );317 _dma_reset( cluster_xy, channel_id ); 302 318 303 319 #if GIET_DEBUG_DMA_DRIVER -
soft/giet_vm/giet_drivers/dma_driver.h
r258 r263 42 42 43 43 // low level access functions 44 extern unsigned int _dma_init( unsigned int cluster_ id,44 extern unsigned int _dma_init( unsigned int cluster_xy, 45 45 unsigned int channel_id ); 46 46 47 extern unsigned int _dma_reset( unsigned int cluster_ id,47 extern unsigned int _dma_reset( unsigned int cluster_xy, 48 48 unsigned int channel_id ); 49 49 50 extern unsigned int _dma_get_status( unsigned int cluster_ id,50 extern unsigned int _dma_get_status( unsigned int cluster_xy, 51 51 unsigned int channel_id ); 52 52 53 extern unsigned int _dma_start_transfer( unsigned int cluster_ id,53 extern unsigned int _dma_start_transfer( unsigned int cluster_xy, 54 54 unsigned int channel_id, 55 55 unsigned long long dst_paddr, -
soft/giet_vm/giet_drivers/fbf_driver.c
r258 r263 96 96 } fb_cma_channel_t; 97 97 98 // array of FB_CMA channels descriptors (32 bytes per entry) 99 // each entry contains one SRC and one DST chbuf descriptors. 98 100 in_unckdata volatile fb_cma_channel_t 99 101 _fb_cma_channel[NB_CMA_CHANNELS] __attribute__((aligned(64))); 100 102 103 // array of physical addresses for the FB_CMA channels descriptors 101 104 in_unckdata volatile paddr_t 102 105 _fb_cma_desc_paddr[NB_CMA_CHANNELS]; … … 105 108 // _fb_cma_init() 106 109 // This function uses the _fb_cma_channel[] and _fb_cma_desc_paddr[] arrays, 107 // that are both indexed by the channel index. 108 // where each entry contains one fb_cma_channel structure (defining two 109 // SRC and DST chbuf descriptors), and does four things: 110 // (that are both indexed by the channel index), and does four things: 110 111 // 111 112 // 1) computes the physical addresses for the two source user buffers, for 112 113 // the destination frame buffer. It initialises the channel descriptor 113 114 // _fb_cma_channel[i], containing the SRC chbuf descriptor (two buffers), 114 // the DST chbuf descriptor (one single framebuffer), and the buffer length.115 // the DST chbuf descriptor (one single buffer), and the buffer length. 115 116 // 116 117 // 2) computes the physical address for the channel descriptor and register it … … 138 139 unsigned int flags; // protection flags 139 140 unsigned int ppn; // physical page number 140 paddr_t channel_pbase;// physical address of channel descriptor141 paddr_t desc_paddr; // physical address of channel descriptor 141 142 142 143 // get CMA channel index … … 255 256 return 1; 256 257 } 257 channel_pbase = (((paddr_t)ppn) << 12) | (vaddr & 0x00000FFF); 258 _fb_cma_desc_paddr[channel_id] = channel_pbase; 259 260 #if GIET_DEBUG_CMA_DRIVER 258 _fb_cma_desc_paddr[channel_id] = (((paddr_t)ppn) << 12) | (vaddr & 0x00000FFF); 259 260 desc_paddr = (((paddr_t)ppn) << 12) | (vaddr & 0x00000FFF); 261 262 263 #if GIET_DEBUG_FBF_DRIVER 264 _tty_get_lock( 0 ); 265 _puts("\n[CMA DEBUG] fb_cma_init()"); 266 _puts("\n - fbf pbase = "); 267 _putl( _fb_cma_channel[channel_id].fbf ); 268 _puts("\n - buf0 pbase = "); 269 _putl( _fb_cma_channel[channel_id].buf0 ); 270 _puts("\n - buf1 pbase = "); 271 _putl( _fb_cma_channel[channel_id].buf1 ); 272 _puts("\n - channel pbase = "); 273 _putl( _fb_cma_desc_paddr[channel_id] ); 261 274 _puts("\n"); 262 _puts("- fbf pbase = "); 263 _putl( _fb_cma_channel[channel_id].fbf ); 264 _puts("\n"); 265 _puts("- buf0 pbase = "); 266 _putl( _fb_cma_channel[channel_id].buf0 ); 267 _puts("\n"); 268 _puts("- buf1 pbase = "); 269 _putl( _fb_cma_channel[channel_id].buf1 ); 270 _puts("\n"); 271 _puts("- channel pbase = "); 272 _putl( channel_pbase ); 273 _puts("\n"); 275 _tty_release_lock( 0 ); 274 276 #endif 275 277 276 278 // SYNC request for channel descriptor 277 _memc_sync( channel_pbase, 32 );279 _memc_sync( desc_paddr, 32 ); 278 280 279 281 // CMA channel activation 280 282 unsigned int* cma_vbase = (unsigned int *)&seg_cma_base; 281 unsigned int offset 282 283 cma_vbase[offset + CHBUF_SRC_DESC] = (unsigned int)( channel_pbase& 0xFFFFFFFF);284 cma_vbase[offset + CHBUF_SRC_EXT] = (unsigned int)( channel_pbase>> 32);283 unsigned int offset = channel_id * CHBUF_CHANNEL_SPAN; 284 285 cma_vbase[offset + CHBUF_SRC_DESC] = (unsigned int)(desc_paddr & 0xFFFFFFFF); 286 cma_vbase[offset + CHBUF_SRC_EXT] = (unsigned int)(desc_paddr >> 32); 285 287 cma_vbase[offset + CHBUF_SRC_NBUFS] = 2; 286 cma_vbase[offset + CHBUF_DST_DESC] = (unsigned int)( channel_pbase& 0xFFFFFFFF) + 16;287 cma_vbase[offset + CHBUF_DST_EXT] = (unsigned int)( channel_pbase>> 32);288 cma_vbase[offset + CHBUF_DST_DESC] = (unsigned int)(desc_paddr & 0xFFFFFFFF) + 16; 289 cma_vbase[offset + CHBUF_DST_EXT] = (unsigned int)(desc_paddr >> 32); 288 290 cma_vbase[offset + CHBUF_DST_NBUFS] = 1; 289 291 cma_vbase[offset + CHBUF_BUF_SIZE] = length; … … 302 304 #endif 303 305 } 304 ////////////////////////////////////////////////////////////////////////////////// 306 //////////////////////////////////////////////////////////////////////////////////// 305 307 // _fb_cma_write() 306 // This function makes a SYNC request for the source user buffer. 307 // Then it updates the status of the SRC and DST chbuf descriptors, to allow 308 // the CMA component to transfer the source user buffer buffer to the destination 309 // frame buffer, and makes a SYNC request for the channel descriptor. 310 // 311 // - buffer_id : user buffer index (0 => buf0 / not 0 => buf1) 308 // 309 // It updates the status of the SRC and DST chbuf descriptors, to allow the CMA 310 // component to transfer the source user buffer to the frame buffer. 311 // 312 // If the IO Bridge component is used: 313 // 1) it makes an INVAL request for the channel descriptor, before testing the 314 // source buffer status, because it is modified in XRAM by the CMA component. 315 // 2) it makes a SYNC request for the source user buffer before activating the CMA 316 // transfer, because the data will be read from XRAM by the CMA component. 317 // 3) it makes a SYNC request for the channel descriptor after modification 318 // of the SRC and DST status, because these descriptors will be read from XRAM 319 // by the CMA component. 320 // 321 // The buffer_id argument is the user buffer index (0 => buf0 / not 0 => buf1) 312 322 // Returns 0 if success, > 0 if error 313 ////////////////////////////////////////////////////////////////////////////////// 323 //////////////////////////////////////////////////////////////////////////////////// 314 324 unsigned int _fb_cma_write( unsigned int buffer_id ) 315 325 { 316 326 #if NB_CMA_CHANNELS > 0 317 327 318 paddr_t buf_paddr; 319 unsigned int buf_length; 328 volatile paddr_t buf_paddr; 329 unsigned int buf_length; 330 unsigned int full = 1; 331 332 unsigned int count = 0; 320 333 321 334 // get CMA channel index 322 335 unsigned int channel_id = _get_context_slot(CTX_CMA_ID); 323 336 324 // SYNC request for the source user buffer 325 if ( buffer_id == 0 ) buf_paddr = _fb_cma_channel[channel_id].buf0; 326 else buf_paddr = _fb_cma_channel[channel_id].buf1; 327 buf_length = _fb_cma_channel[channel_id].length; 328 _memc_sync( buf_paddr, buf_length ); 337 #if GIET_DEBUG_FBF_DRIVER 338 _tty_get_lock( 0 ); 339 _puts("\n[CMA DEBUG] fb_cma_write() for CMA channel "); 340 _putd( channel_id ); 341 _puts(" / buf_id = "); 342 _putd( buffer_id ); 343 _puts("\n"); 344 _tty_release_lock( 0 ); 345 #endif 346 347 // waiting buffer empty 348 while ( full ) 349 { 350 if ( USE_IOB ) 351 { 352 // INVAL L2 cache for the channel descriptor, 353 _memc_inval( _fb_cma_desc_paddr[channel_id], 32 ); 354 355 // INVAL L1 cache for the channel descriptor, 356 _dcache_buf_invalidate( &_fb_cma_channel[channel_id], 32 ); 357 } 358 359 // read SRC buffer descriptor 360 if ( buffer_id == 0 ) buf_paddr = _fb_cma_channel[channel_id].buf0; 361 else buf_paddr = _fb_cma_channel[channel_id].buf1; 362 full = ( (unsigned int)(buf_paddr>>63) ); 363 364 count++; 365 if ( count == 10 ) _exit(); 366 367 #if GIET_DEBUG_FBF_DRIVER 368 _tty_get_lock( 0 ); 369 _puts(" - buffer descriptor = "); 370 _putl( buf_paddr ); 371 _puts(" at cycle "); 372 _putd( _get_proctime() ); 373 _puts("\n"); 374 _tty_release_lock( 0 ); 375 #endif 376 377 } 378 379 if ( USE_IOB ) 380 { 381 // SYNC request for the user buffer because 382 // this buffer will be read from XRAM by the CMA component 383 _memc_sync( buf_paddr, _fb_cma_channel[channel_id].length ); 384 } 329 385 330 386 // set SRC full … … 338 394 & 0x7FFFFFFFFFFFFFFFULL; 339 395 340 // SYNC request for the channel descriptor 341 buf_paddr = _fb_cma_desc_paddr[channel_id]; 342 buf_length = 32; 343 _memc_sync( buf_paddr, buf_length ); 396 if ( USE_IOB ) 397 { 398 // SYNC request for the channel descriptor, because 399 // it will be read in XRAM by the CMA component 400 _memc_sync( _fb_cma_desc_paddr[channel_id], 32 ); 401 } 344 402 345 403 return 0; -
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; -
soft/giet_vm/giet_drivers/icu_driver.h
r258 r263 29 29 /////////////////////////////////////////////////////////////////////////////////// 30 30 31 extern unsigned int _icu_get_index( unsigned int cluster_ id,31 extern unsigned int _icu_get_index( unsigned int cluster_xy, 32 32 unsigned int proc_id, 33 33 unsigned int * buffer ); 34 34 35 extern unsigned int _icu_set_mask( unsigned int cluster_ id,35 extern unsigned int _icu_set_mask( unsigned int cluster_xy, 36 36 unsigned int proc_id, 37 37 unsigned int value ); -
soft/giet_vm/giet_drivers/ioc_driver.c
r258 r263 285 285 _puts("\n"); 286 286 _puts(" - lba = "); 287 _put d( lba );287 _putx( lba ); 288 288 _puts("\n"); 289 289 _tty_release_lock( 0 ); … … 379 379 _puts(" for processor "); 380 380 _putd( _get_procid() ); 381 _puts(" : error = "); 382 _putd( (unsigned int)error ); 381 383 _puts("\n"); 382 384 _tty_release_lock( 0 ); -
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 -
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; -
soft/giet_vm/giet_drivers/mwr_driver.h
r258 r263 19 19 MWMR_CONFIG_FIFO_WAY, 20 20 MWMR_CONFIG_FIFO_NO, 21 MWMR_CONFIG_STATUS _ADDR,21 MWMR_CONFIG_STATUS, 22 22 MWMR_CONFIG_DEPTH, 23 23 MWMR_CONFIG_BUFFER_ADDR, 24 24 MWMR_CONFIG_RUNNING, 25 25 MWMR_CONFIG_WIDTH, 26 MWMR_FIFO_FILL_STATUS, 26 MWMR_CONFIG_DATA, 27 MWMR_CONFIG_EXT, 28 /***/ 29 MWMR_SPAN, 27 30 }; 28 31 … … 37 40 /////////////////////////////////////////////////////////////////////////////////// 38 41 39 extern unsigned int _mw mr_hw_init( unsigned int cluster_id,40 41 42 42 extern unsigned int _mwr_hw_init( unsigned int cluster_xy, 43 unsigned int port_id, 44 unsigned int from_coproc, 45 unsigned long long channel_pbase); 43 46 44 47 /////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_drivers/tim_driver.c
r258 r263 16 16 // - "user" timers : requested by the task in the mapping_info data structure. 17 17 // For each user timer, the timer_id is stored in the context of the task. 18 // The global index is cluster_ id* (NB_PROCS_MAX + NB_TIM_CHANNELS) + local_id18 // The global index is cluster_xy * (NB_PROCS_MAX + NB_TIM_CHANNELS) + local_id 19 19 // 20 20 // The NB_PROCS_MAX and NB_TIM_CHANNELS values must be defined in the … … 25 25 // The virtual base address of the segment associated to a channel is: 26 26 // 27 // seg_tim_base + cluster_ id* vseg_cluster_increment + TIMER_SPAN * timer_id27 // seg_tim_base + cluster_xy * vseg_cluster_increment + TIMER_SPAN * timer_id 28 28 // 29 29 // The seg_tim_base and vseg_cluster_increment values must be defined … … 35 35 #include <utils.h> 36 36 37 #if !defined( NB_CLUSTERS)38 # error: You must define NB_CLUSTERSin the hard_config.h file37 #if !defined(X_SIZE) 38 # error: You must define X_SIZE in the hard_config.h file 39 39 #endif 40 40 41 #if (NB_CLUSTERS > 256) 42 # error: NB_CLUSTERS cannot be larger than 256! 41 #if !defined(Y_SIZE) 42 # error: You must define X_SIZE in the hard_config.h file 43 #endif 44 45 #if !defined(X_WIDTH) 46 # error: You must define X_WIDTH in the hard_config.h file 47 #endif 48 49 #if !defined(Y_WIDTH) 50 # error: You must define X_WIDTH in the hard_config.h file 43 51 #endif 44 52 45 53 #if !defined(NB_PROCS_MAX) 46 54 # error: You must define NB_PROCS_MAX in the hard_config.h file 47 #endif48 49 #if (NB_PROCS_MAX > 8)50 # error: NB_PROCS_MAX cannot be larger than 8!51 55 #endif 52 56 … … 59 63 #endif 60 64 61 #if !defined( USE_XICU )62 # error: You must define USE_XICU in the hard_config.h file63 #endif64 65 65 /////////////////// Timer global variables //////////////////////////////////////// 66 66 … … 68 68 69 69 #if (NB_TIM_CHANNELS > 0) 70 in_unckdata volatile unsigned char _user_timer_event[ NB_CLUSTERS *NB_TIM_CHANNELS]71 = { [0 ... (( NB_CLUSTERS *NB_TIM_CHANNELS) - 1)] = 0 };70 in_unckdata volatile unsigned char _user_timer_event[X_SIZE*Y_SIZE*NB_TIM_CHANNELS] 71 = { [0 ... ((X_SIZE*Y_SIZE*NB_TIM_CHANNELS) - 1)] = 0 }; 72 72 #endif 73 73 … … 80 80 // Returns 0 if success, > 0 if error. 81 81 ////////////////////////////////////////////////////////////////////////////// 82 unsigned int _timer_start( unsigned int cluster_ id,82 unsigned int _timer_start( unsigned int cluster_xy, 83 83 unsigned int local_id, 84 84 unsigned int period) 85 85 { 86 86 // parameters checking 87 if (cluster_id >= NB_CLUSTERS) return 1; 87 unsigned int x = cluster_xy >> Y_WIDTH; 88 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 89 if (x >= X_SIZE) return 1; 90 if (y >= Y_SIZE) return 1; 88 91 if (local_id >= NB_TIM_CHANNELS) return 1; 89 92 90 93 unsigned int* timer_address = (unsigned int *) ((unsigned int)&seg_tim_base + 91 (cluster_ id* (unsigned int)&vseg_cluster_increment));94 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 92 95 93 96 timer_address[local_id * TIMER_SPAN + TIMER_PERIOD] = period; … … 102 105 // Returns 0 if success, > 0 if error. 103 106 ////////////////////////////////////////////////////////////////////////////// 104 unsigned int _timer_stop( unsigned int cluster_ id,107 unsigned int _timer_stop( unsigned int cluster_xy, 105 108 unsigned int local_id) 106 109 { 107 110 // parameters checking 108 if (cluster_id >= NB_CLUSTERS) return 1; 111 unsigned int x = cluster_xy >> Y_WIDTH; 112 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 113 if (x >= X_SIZE) return 1; 114 if (y >= Y_SIZE) return 1; 109 115 if (local_id >= NB_TIM_CHANNELS) return 1; 110 116 111 117 unsigned int* timer_address = (unsigned int *) ((unsigned int)&seg_tim_base + 112 (cluster_ id* (unsigned int)&vseg_cluster_increment));118 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 113 119 114 120 timer_address[local_id * TIMER_SPAN + TIMER_MODE] = 0; … … 124 130 // Returns 0 if success, > 0 if error. 125 131 ////////////////////////////////////////////////////////////////////////////// 126 unsigned int _timer_reset_irq( unsigned int cluster_ id,132 unsigned int _timer_reset_irq( unsigned int cluster_xy, 127 133 unsigned int local_id ) 128 134 { 129 135 // parameters checking 130 if (cluster_id >= NB_CLUSTERS) return 1; 136 unsigned int x = cluster_xy >> Y_WIDTH; 137 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 138 if (x >= X_SIZE) return 1; 139 if (y >= Y_SIZE) return 1; 131 140 if (local_id >= NB_TIM_CHANNELS) return 1; 132 141 133 142 unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_tim_base + 134 (cluster_ id* (unsigned int)&vseg_cluster_increment));143 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 135 144 136 145 timer_address[local_id * TIMER_SPAN + TIMER_RESETIRQ] = 0; … … 147 156 // This function is called during a context switch (user or preemptive) 148 157 //////////////////////////////////////////////////////////////////////i////// 149 unsigned int _timer_reset_cpt( unsigned int cluster_ id,158 unsigned int _timer_reset_cpt( unsigned int cluster_xy, 150 159 unsigned int local_id) 151 160 { 152 161 // parameters checking 153 if (cluster_id >= NB_CLUSTERS) return 1; 162 unsigned int x = cluster_xy >> Y_WIDTH; 163 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 164 if (x >= X_SIZE) return 1; 165 if (y >= Y_SIZE) return 1; 154 166 if (local_id >= NB_TIM_CHANNELS) return 1; 155 167 156 168 // We suppose that the TIMER_MODE register value is 0x3 157 169 unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_tim_base + 158 (cluster_ id* (unsigned int)&vseg_cluster_increment));170 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 159 171 160 172 unsigned int period = timer_address[local_id * TIMER_SPAN + TIMER_PERIOD]; -
soft/giet_vm/giet_drivers/tim_driver.h
r258 r263 29 29 extern volatile unsigned char _timer_event[]; 30 30 31 extern unsigned int _timer_start( unsigned int cluster_ id,31 extern unsigned int _timer_start( unsigned int cluster_xy, 32 32 unsigned int local_id, 33 33 unsigned int period ); 34 34 35 extern unsigned int _timer_stop( unsigned int cluster_ id,35 extern unsigned int _timer_stop( unsigned int cluster_xy, 36 36 unsigned int local_id ); 37 37 38 extern unsigned int _timer_reset_irq( unsigned int cluster_ id,38 extern unsigned int _timer_reset_irq( unsigned int cluster_xy, 39 39 unsigned int local_id ); 40 40 41 extern unsigned int _timer_reset_cpt( unsigned int cluster_ id,41 extern unsigned int _timer_reset_cpt( unsigned int cluster_xy, 42 42 unsigned int local_id); 43 43 -
soft/giet_vm/giet_drivers/xcu_driver.c
r258 r263 16 16 // The virtual base address of the segment associated to the component is: 17 17 // 18 // seg_xcu_base + cluster_ id* vseg_cluster_increment18 // seg_xcu_base + cluster_xy * vseg_cluster_increment 19 19 // 20 20 // The seg_xcu_base and vseg_cluster_increment values must be defined … … 24 24 #include <giet_config.h> 25 25 #include <xcu_driver.h> 26 #include <tty_driver.h> 27 #include <mapping_info.h> 26 28 #include <utils.h> 27 29 28 #if !defined(NB_CLUSTERS) 29 # error: You must define NB_CLUSTERS in the hard_config.h file 30 #endif 31 32 #if (NB_CLUSTERS > 256) 33 # error: NB_CLUSTERS cannot be larger than 256! 30 #if !defined(X_SIZE) 31 # error: You must define X_SIZE in the hard_config.h file 32 #endif 33 34 #if !defined(Y_SIZE) 35 # error: You must define X_SIZE in the hard_config.h file 36 #endif 37 38 #if !defined(X_WIDTH) 39 # error: You must define X_WIDTH in the hard_config.h file 40 #endif 41 42 #if !defined(Y_WIDTH) 43 # error: You must define X_WIDTH in the hard_config.h file 34 44 #endif 35 45 36 46 #if !defined(NB_PROCS_MAX) 37 47 # 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 48 #endif 43 49 … … 53 59 // Returns 0 if success, > 0 if error. 54 60 //////////////////////////////////////////////////////////////////////////////// 55 unsigned int _xcu_set_mask( unsigned int cluster_id, unsigned int proc_id, 61 unsigned int _xcu_set_mask( unsigned int cluster_xy, 62 unsigned int proc_id, 56 63 unsigned int value, 57 unsigned int is_PTI) 58 { 59 // parameters checking 60 if (cluster_id >= NB_CLUSTERS) return 1; 61 if (proc_id >= NB_PROCS_MAX) return 1; 64 unsigned int irq_type ) 65 { 66 // parameters checking 67 unsigned int x = cluster_xy >> Y_WIDTH; 68 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 69 if (x >= X_SIZE) return 1; 70 if (y >= Y_SIZE) return 1; 71 if (proc_id >= NB_PROCS_MAX) return 1; 62 72 63 73 #if USE_XICU 64 74 unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 65 (cluster_id * (unsigned int)&vseg_cluster_increment)); 66 if (is_PTI) 67 xcu_address[XICU_REG(XICU_MSK_PTI_ENABLE, proc_id)] = value; 68 else 69 xcu_address[XICU_REG(XICU_MSK_HWI_ENABLE, proc_id)] = value; 75 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 76 unsigned int func; 77 if (irq_type == IRQ_TYPE_PTI) func = XICU_MSK_PTI_ENABLE; 78 else if (irq_type == IRQ_TYPE_SWI) func = XICU_MSK_WTI_ENABLE; 79 else func = XICU_MSK_HWI_ENABLE; 80 xcu_address[XICU_REG(func,proc_id)] = value; 70 81 return 0; 71 82 #else … … 86 97 // Returns 0 if success, > 0 if error. 87 98 //////////////////////////////////////////////////////////////////////////////// 88 unsigned int _xcu_get_index( unsigned int cluster_ id,99 unsigned int _xcu_get_index( unsigned int cluster_xy, 89 100 unsigned int proc_id, 90 101 unsigned int * buffer) 91 102 { 92 103 // parameters checking 93 if (cluster_id >= NB_CLUSTERS) return 1; 94 if (proc_id >= NB_PROCS_MAX) return 1; 104 unsigned int x = cluster_xy >> Y_WIDTH; 105 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 106 if (x >= X_SIZE) return 1; 107 if (y >= Y_SIZE) return 1; 108 if (proc_id >= NB_PROCS_MAX) return 1; 95 109 96 110 #if USE_XICU 97 111 unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 98 (cluster_ id* (unsigned int)&vseg_cluster_increment));112 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 99 113 100 114 unsigned int prio = xcu_address[XICU_REG(XICU_PRIO, proc_id)]; … … 125 139 // Returns 0 if success, > 0 if error. 126 140 //////////////////////////////////////////////////////////////////////////////// 127 unsigned int _xcu_send_ipi( unsigned int cluster_ id,141 unsigned int _xcu_send_ipi( unsigned int cluster_xy, 128 142 unsigned int proc_id, 129 143 unsigned int wdata ) 130 144 { 131 145 // parameters checking 132 if (cluster_id >= NB_CLUSTERS) return 1; 133 if (proc_id >= NB_PROCS_MAX) return 1; 146 unsigned int x = cluster_xy >> Y_WIDTH; 147 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 148 if (x >= X_SIZE) return 1; 149 if (y >= Y_SIZE) return 1; 150 if (proc_id >= NB_PROCS_MAX) return 1; 134 151 135 152 #if USE_XICU 136 153 unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 137 (cluster_ id* (unsigned int)&vseg_cluster_increment));154 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 138 155 xcu_address[XICU_REG(XICU_WTI_REG, proc_id)] = wdata; 139 156 return 0; … … 152 169 // Returns 0 if success, > 0 if error. 153 170 //////////////////////////////////////////////////////////////////////////////// 154 unsigned int _xcu_timer_start( unsigned int cluster_ id,155 unsigned int local_id,171 unsigned int _xcu_timer_start( unsigned int cluster_xy, 172 unsigned int proc_id, 156 173 unsigned int period ) 157 174 { 158 175 // parameters checking 159 if (cluster_id >= NB_CLUSTERS) return 1; 160 if (local_id >= NB_TIM_CHANNELS) return 1; 176 unsigned int x = cluster_xy >> Y_WIDTH; 177 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 178 if (x >= X_SIZE) return 1; 179 if (y >= Y_SIZE) return 1; 180 if (proc_id >= NB_PROCS_MAX) return 1; 161 181 162 182 #if USE_XICU 163 183 unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 164 (cluster_ id* (unsigned int)&vseg_cluster_increment));165 xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = period;184 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 185 xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = period; 166 186 return 0; 167 187 #else … … 179 199 // Returns 0 if success, > 0 if error. 180 200 ////////////////////////////////////////////////////////////////////////////// 181 unsigned int _xcu_timer_stop( unsigned int cluster_id, 182 unsigned int local_id) 183 { 184 // parameters checking 185 if (cluster_id >= NB_CLUSTERS) return 1; 186 if (local_id >= NB_TIM_CHANNELS) return 1; 201 unsigned int _xcu_timer_stop( unsigned int cluster_xy, 202 unsigned int proc_id) 203 { 204 // parameters checking 205 unsigned int x = cluster_xy >> Y_WIDTH; 206 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 207 if (x >= X_SIZE) return 1; 208 if (y >= Y_SIZE) return 1; 209 if (proc_id >= NB_PROCS_MAX) return 1; 187 210 188 211 #if USE_XICU 189 212 unsigned int * xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 190 (cluster_ id* (unsigned int)&vseg_cluster_increment));191 xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = 0;213 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 214 xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = 0; 192 215 return 0; 193 216 #else … … 207 230 // Returns 0 if success, > 0 if error. 208 231 ////////////////////////////////////////////////////////////////////////////// 209 unsigned int _xcu_timer_reset_irq( unsigned int cluster_id, 210 unsigned int local_id ) 211 { 212 // parameters checking 213 if (cluster_id >= NB_CLUSTERS) return 1; 214 if (local_id >= NB_TIM_CHANNELS) return 1; 232 unsigned int _xcu_timer_reset_irq( unsigned int cluster_xy, 233 unsigned int proc_id ) 234 { 235 // parameters checking 236 unsigned int x = cluster_xy >> Y_WIDTH; 237 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 238 if (x >= X_SIZE) return 1; 239 if (y >= Y_SIZE) return 1; 240 if (proc_id >= NB_PROCS_MAX) return 1; 215 241 216 242 #if USE_XICU 217 243 unsigned int * xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 218 (cluster_ id* (unsigned int)&vseg_cluster_increment));219 220 unsigned int bloup = xcu_address[XICU_REG(XICU_PTI_ACK, local_id)];244 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 245 246 unsigned int bloup = xcu_address[XICU_REG(XICU_PTI_ACK, proc_id)]; 221 247 bloup++; // to avoid a warning 222 248 return 0; … … 238 264 // This function is called during a context switch (user or preemptive) 239 265 ///////////////////////////////////////////////////////////////////////////// 240 unsigned int _xcu_timer_reset_cpt( unsigned int cluster_id, 241 unsigned int local_id ) 242 { 243 // parameters checking 244 if (cluster_id >= NB_CLUSTERS) return 1; 245 if (local_id >= NB_TIM_CHANNELS) return 1; 266 unsigned int _xcu_timer_reset_cpt( unsigned int cluster_xy, 267 unsigned int proc_id ) 268 { 269 // parameters checking 270 unsigned int x = cluster_xy >> Y_WIDTH; 271 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 272 if (x >= X_SIZE) return 1; 273 if (y >= Y_SIZE) return 1; 274 if (proc_id >= NB_PROCS_MAX) return 1; 246 275 247 276 #if USE_XICU 248 277 unsigned int * xcu_address = (unsigned int *) ((unsigned int) &seg_xcu_base + 249 (cluster_ id* (unsigned int)&vseg_cluster_increment));250 251 unsigned int period = xcu_address[XICU_REG(XICU_PTI_PER, local_id)];278 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 279 280 unsigned int period = xcu_address[XICU_REG(XICU_PTI_PER, proc_id)]; 252 281 253 282 // we write 0 first because if the timer is currently running, 254 283 // the corresponding timer counter is not reset 255 xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = 0;256 xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = period;284 xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = 0; 285 xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = period; 257 286 return 0; 258 287 #else -
soft/giet_vm/giet_drivers/xcu_driver.h
r258 r263 39 39 40 40 #define XICU_REG(func, index) (((func)<<5)|(index)) 41 41 42 42 /////////////////////////////////////////////////////////////////////////////////// 43 43 // XICU access functions 44 44 /////////////////////////////////////////////////////////////////////////////////// 45 45 46 extern unsigned int _xcu_get_index( unsigned int cluster_ id,46 extern unsigned int _xcu_get_index( unsigned int cluster_xy, 47 47 unsigned int proc_id, 48 48 unsigned int * buffer ); 49 49 50 extern unsigned int _xcu_set_mask( unsigned int cluster_ id,50 extern unsigned int _xcu_set_mask( unsigned int cluster_xy, 51 51 unsigned int proc_id, 52 52 unsigned int mask, 53 53 unsigned int is_timer ); 54 54 55 extern unsigned int _xcu_send_ipi( unsigned int cluster_ id,55 extern unsigned int _xcu_send_ipi( unsigned int cluster_xy, 56 56 unsigned int proc_id, 57 57 unsigned int wdata ); 58 58 59 extern unsigned int _xcu_timer_start( unsigned int cluster_ id,60 unsigned int local_id,59 extern unsigned int _xcu_timer_start( unsigned int cluster_xy, 60 unsigned int proc_id, 61 61 unsigned int period ); 62 62 63 extern unsigned int _xcu_timer_stop( unsigned int cluster_ id,64 unsigned int local_id );63 extern unsigned int _xcu_timer_stop( unsigned int cluster_xy, 64 unsigned int proc_id ); 65 65 66 extern unsigned int _xcu_timer_reset_irq( unsigned int cluster_ id,67 unsigned int local_id );66 extern unsigned int _xcu_timer_reset_irq( unsigned int cluster_xy, 67 unsigned int proc_id ); 68 68 69 extern unsigned int _xcu_timer_reset_cpt( unsigned int cluster_ id,70 unsigned int local_id );69 extern unsigned int _xcu_timer_reset_cpt( unsigned int cluster_xy, 70 unsigned int proc_id ); 71 71 72 72 ///////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.