Changeset 215 for soft/giet_vm/sys/drivers.c
- Timestamp:
- Sep 17, 2012, 10:47:46 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/drivers.c
r213 r215 17 17 // 18 18 // The following global parameters must be defined in the giet_config.h file: 19 // - CLUSTER_IO_ID20 19 // - CLUSTER_SIZE 21 20 // - NB_CLUSTERS … … 48 47 49 48 #if !defined(NB_CLUSTERS) 50 # error: You must define NB_CLUSTERS in 'giet_config.h'file49 # error: You must define NB_CLUSTERS in the configs file 51 50 #endif 52 51 53 52 #if !defined(NB_PROCS_MAX) 54 # error: You must define NB_PROCS_MAX in 'giet_config.h'file53 # error: You must define NB_PROCS_MAX in the configs file 55 54 #endif 56 55 … … 60 59 61 60 #if !defined(CLUSTER_SIZE) 62 # error: You must define CLUSTER_SIZE in 'giet_config.h'file61 # error: You must define CLUSTER_SIZE in the configs file 63 62 #endif 64 63 65 64 #if !defined(NB_TTYS) 66 # error: You must define NB_TTYS in 'giet_config.h'file65 # error: You must define NB_TTYS in the configs file 67 66 #endif 68 67 … … 84 83 85 84 #if !defined(NB_IOCS) 86 # error: You must define NB_IOCS in 'giet_config.h'file85 # error: You must define NB_IOCS in the configs file 87 86 #endif 88 87 89 88 #if ( NB_IOCS > 1 ) 90 89 # error: NB_IOCS cannot be larger than 1 90 #endif 91 92 #if !defined( USE_XICU ) 93 # error: You must define USE_XICU in the configs file 94 #endif 95 96 #if !defined( IOMMU_ACTIVE ) 97 # error: You must define IOMMU_ACTIVE in the configs file 91 98 #endif 92 99 … … 98 105 ////////////////////////////////////////////////////////////////////////////// 99 106 // The timers can be implemented in a vci_timer component or in a vci_xicu 100 // component (depending on the GIET_USE_XICU parameter).107 // component (depending on the USE_XICU parameter). 101 108 // There is one timer (or xicu) component per cluster. 102 109 // There is two types of timers: … … 132 139 if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1; 133 140 134 #if GIET_USE_XICU141 #if USE_XICU 135 142 unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base + 136 143 (cluster_id * CLUSTER_SIZE) ); … … 160 167 if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1; 161 168 162 #if GIET_USE_XICU169 #if USE_XICU 163 170 unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base + 164 171 (cluster_id * CLUSTER_SIZE) ); … … 189 196 if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1; 190 197 191 #if GIET_USE_XICU198 #if USE_XICU 192 199 unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base + 193 200 (cluster_id * (unsigned)CLUSTER_SIZE) ); … … 260 267 } 261 268 262 unsigned int* tty_address = (unsigned int*)( (char*)&seg_tty_base + 263 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 269 unsigned int* tty_address = (unsigned int*) &seg_tty_base; 264 270 265 271 for (nwritten = 0; nwritten < length; nwritten++) … … 322 328 323 329 // compute terminal base address 324 unsigned int *tty_address = (unsigned int*)( (char*)&seg_tty_base + 325 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 330 unsigned int *tty_address = (unsigned int*) &seg_tty_base; 326 331 327 332 *buffer = (unsigned char)tty_address[tty_id*TTY_SPAN + TTY_READ]; … … 355 360 unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base + 356 361 (cluster_id * (unsigned)CLUSTER_SIZE) ); 357 #if GIET_USE_XICU362 #if USE_XICU 358 363 if ( is_timer ) icu_address[XICU_REG(XICU_MSK_PTI_ENABLE, proc_id)] = value; 359 364 else icu_address[XICU_REG(XICU_MSK_HWI_ENABLE, proc_id)] = value; … … 381 386 unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base + 382 387 (cluster_id * (unsigned)CLUSTER_SIZE) ); 383 #if GIET_USE_XICU388 #if USE_XICU 384 389 unsigned int prio = icu_address[XICU_REG(XICU_PRIO, proc_id)]; 385 390 unsigned int pti_ok = (prio & 0x00000001); … … 420 425 return 1; 421 426 422 unsigned int* gcd_address = (unsigned int*)( (char*)&seg_gcd_base + 423 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 427 unsigned int* gcd_address = (unsigned int*) &seg_gcd_base; 424 428 425 429 gcd_address[register_index] = value; // write word … … 438 442 return 1; 439 443 440 unsigned int* gcd_address = (unsigned int*)( (char*)&seg_gcd_base + 441 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 444 unsigned int* gcd_address = (unsigned int*) &seg_gcd_base; 442 445 443 446 *buffer = gcd_address[register_index]; // read word … … 530 533 if ( (unsigned int)user_vaddr & 0x3 ) return 1; 531 534 532 unsigned int* ioc_address = (unsigned int*)( (char*)&seg_ioc_base + 533 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 535 unsigned int* ioc_address = (unsigned int*) &seg_ioc_base ; 534 536 535 537 unsigned int block_size = ioc_address[BLOCK_DEVICE_BLOCK_SIZE]; … … 561 563 if ( ix2 == 0 ) ppn_first = ppn; 562 564 563 if ( GIET_IOMMU_ACTIVE ) // the user buffer must be remapped in the I/0 space565 if ( IOMMU_ACTIVE ) // the user buffer must be remapped in the I/0 space 564 566 { 565 567 // check buffer length < 2 Mbytes … … 588 590 589 591 // compute buffer base address for IOC depending on IOMMU activation 590 if ( GIET_IOMMU_ACTIVE ) addr = (_ioc_iommu_ix1) << 21 | (user_vaddr & 0xFFF);592 if ( IOMMU_ACTIVE ) addr = (_ioc_iommu_ix1) << 21 | (user_vaddr & 0xFFF); 591 593 else addr = (ppn_first << 12) | (user_vaddr & 0xFFF); 592 594 … … 622 624 623 625 // unmap the buffer from IOMMU page table if IOMMU is activated 624 if ( GIET_IOMMU_ACTIVE ) 625 { 626 unsigned int* iob_address = (unsigned int*)( (char*)&seg_iob_base + 627 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 626 if ( IOMMU_ACTIVE ) 627 { 628 unsigned int* iob_address = (unsigned int*) &seg_iob_base; 628 629 629 630 for ( ix2 = 0 ; ix2 < _ioc_iommu_npages ; ix2++ ) … … 691 692 { 692 693 // get IOC base address 693 unsigned int* ioc_address = (unsigned int*)( (char*)&seg_ioc_base + 694 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 694 unsigned int* ioc_address = (unsigned int*) &seg_ioc_base; 695 695 696 696 *status = ioc_address[BLOCK_DEVICE_STATUS]; // read status & reset IRQ … … 891 891 892 892 // compute frame buffer pbase address 893 unsigned int fb_vaddr = (unsigned int)&seg_fbf_base + 894 (CLUSTER_IO_ID * (unsigned int)CLUSTER_SIZE) + offset; 893 unsigned int fb_vaddr = (unsigned int)&seg_fbf_base + offset; 895 894 896 895 ko = _v2p_translate( (page_table_t*)user_ptab, … … 962 961 if ( ix2 == 0 ) ppn_first = ppn; 963 962 964 if ( GIET_IOMMU_ACTIVE ) // the user buffer must be remapped in the I/0 space963 if ( IOMMU_ACTIVE ) // the user buffer must be remapped in the I/0 space 965 964 { 966 965 // check buffer length < 2 Mbytes … … 1071 1070 1072 1071 // unmap the buffer from IOMMU page table if IOMMU is activated 1073 if ( GIET_IOMMU_ACTIVE ) 1074 { 1075 unsigned int* iob_address = (unsigned int*)( (char*)&seg_iob_base + 1076 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 1072 if ( IOMMU_ACTIVE ) 1073 { 1074 unsigned int* iob_address = (unsigned int*) &seg_iob_base; 1077 1075 1078 1076 unsigned int ix1 = _dma_iommu_ix1 + dma_id;
Note: See TracChangeset
for help on using the changeset viewer.