Changeset 728 for soft/giet_vm/giet_drivers
- Timestamp:
- Nov 21, 2015, 2:53:00 PM (9 years ago)
- Location:
- soft/giet_vm/giet_drivers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/bdv_driver.c
r715 r728 97 97 unsigned int status; 98 98 99 // get the BDV lock and register it in task context100 static_scheduler_t* psched = _get_sched();101 unsigned int ltid = _get_thread_ltid();102 _spin_lock_acquire( &_bdv_lock );103 _atomic_or( &psched->context[ltid].slot[CTX_LOCKS_ID] , LOCKS_MASK_BDV );104 105 // set device registers106 _bdv_set_register( BLOCK_DEVICE_BUFFER , (unsigned int)buf_paddr );107 _bdv_set_register( BLOCK_DEVICE_BUFFER_EXT, (unsigned int)(buf_paddr>>32) );108 _bdv_set_register( BLOCK_DEVICE_COUNT , count );109 _bdv_set_register( BLOCK_DEVICE_LBA , lba );110 111 99 #if USE_IOB // software L2/L3 cache coherence 112 100 if ( to_mem ) _mmc_inval( buf_paddr, count<<9 ); … … 120 108 if ( use_irq == 0 ) 121 109 { 110 // set device registers 111 _bdv_set_register( BLOCK_DEVICE_BUFFER , (unsigned int)buf_paddr ); 112 _bdv_set_register( BLOCK_DEVICE_BUFFER_EXT, (unsigned int)(buf_paddr>>32) ); 113 _bdv_set_register( BLOCK_DEVICE_COUNT , count ); 114 _bdv_set_register( BLOCK_DEVICE_LBA , lba ); 115 122 116 // Launch transfert 123 117 if (to_mem == 0) _bdv_set_register( BLOCK_DEVICE_OP, BLOCK_DEVICE_WRITE ); … … 162 156 unsigned int save_sr; 163 157 164 // activates BDV interrupt 158 // get the BDV lock and register it in calling task context 159 static_scheduler_t* psched = _get_sched(); 160 unsigned int ltid = psched->current; 161 _spin_lock_acquire( &_bdv_lock ); 162 _atomic_or( &psched->context[ltid].slot[CTX_LOCKS_ID] , LOCKS_MASK_BDV ); 163 164 // set device registers 165 _bdv_set_register( BLOCK_DEVICE_BUFFER , (unsigned int)buf_paddr ); 166 _bdv_set_register( BLOCK_DEVICE_BUFFER_EXT, (unsigned int)(buf_paddr>>32) ); 167 _bdv_set_register( BLOCK_DEVICE_COUNT , count ); 168 _bdv_set_register( BLOCK_DEVICE_LBA , lba ); 165 169 _bdv_set_register( BLOCK_DEVICE_IRQ_ENABLE, 1 ); 166 170 … … 172 176 173 177 // Set NORUN_MASK_IOC bit 174 static_scheduler_t* psched = (static_scheduler_t*)_get_sched();175 unsigned int ltid = psched->current;176 178 _atomic_or( &psched->context[ltid].slot[CTX_NORUN_ID] , NORUN_MASK_IOC ); 177 179 … … 202 204 error = ( (_bdv_status == BLOCK_DEVICE_READ_ERROR) || 203 205 (_bdv_status == BLOCK_DEVICE_WRITE_ERROR) ); 204 } 205 206 // release BDV lock and clear task context207 _spin_lock_release( &_bdv_lock );208 _atomic_and( &psched->context[ltid].slot[CTX_LOCKS_ID] , ~LOCKS_MASK_BDV );206 207 // release BDV lock and clear task context 208 _spin_lock_release( &_bdv_lock ); 209 _atomic_and( &psched->context[ltid].slot[CTX_LOCKS_ID] , ~LOCKS_MASK_BDV ); 210 } 209 211 210 212 #if GIET_DEBUG_IOC -
soft/giet_vm/giet_drivers/bdv_driver.h
r709 r728 15 15 // - in "synchronous" mode, it uses a polling policy on the BDV STATUS 16 16 // register to detect transfer completion, as interrupts are not activated. 17 // This mode isused by the boot code to load the map.bin file into memory17 // This mode must be used by the boot code to load the map.bin file into memory 18 18 // (before MMU activation), or to load the .elf files (after MMU activation). 19 // As only one processor acces the block device, it doesn't take the _bdv_lock. 20 // 19 21 // - In "descheduling" mode, ir uses a descheduling + IRQ policy. 22 // This mode mus be used by the kernel code tho handle system calls. 20 23 // The ISR executed when transfer completes should restart the calling task, 21 24 // as the calling task global index has been saved in the _bdv_gtid variable. 22 // 23 // As the BDV component can be used by several programs running in parallel, 24 // the _bdv_lock variable guaranties exclusive access to the device. 25 // As the BDV component can be used by several programs running in parallel, 26 // it takes the _bdv_lock and registers it in the calling task context. 25 27 // 26 28 // The SEG_IOC_BASE address must be defined in the hard_config.h file. -
soft/giet_vm/giet_drivers/cma_driver.h
r704 r728 49 49 50 50 /////////////////////////////////////////////////////////////////////////////////// 51 // CMA channel running modes 52 /////////////////////////////////////////////////////////////////////////////////// 53 54 enum CMA_modes_e 55 { 56 MODE_IDLE = 0, 57 MODE_NORMAL = 1, 58 MODE_NO_DST_SYNC = 2, 59 MODE_NO_SRC_SYNC = 4, 60 }; 61 62 /////////////////////////////////////////////////////////////////////////////////// 51 63 // CMA channel status values 52 64 /////////////////////////////////////////////////////////////////////////////////// … … 89 101 }; 90 102 103 91 104 /////////////////////////////////////////////////////////////////////////////////// 92 105 // access functions
Note: See TracChangeset
for help on using the changeset viewer.