Ignore:
Timestamp:
Nov 21, 2015, 2:53:00 PM (9 years ago)
Author:
alain
Message:

bloup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/bdv_driver.c

    r715 r728  
    9797    unsigned int status;
    9898
    99     // get the BDV lock and register it in task context
    100     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 registers
    106     _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 
    11199#if USE_IOB    // software L2/L3 cache coherence
    112100    if ( to_mem )  _mmc_inval( buf_paddr, count<<9 );
     
    120108    if ( use_irq == 0 )
    121109    {
     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
    122116        // Launch transfert
    123117        if (to_mem == 0) _bdv_set_register( BLOCK_DEVICE_OP, BLOCK_DEVICE_WRITE );
     
    162156        unsigned int save_sr;
    163157
    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 );
    165169        _bdv_set_register( BLOCK_DEVICE_IRQ_ENABLE, 1 );
    166170
     
    172176
    173177        // Set NORUN_MASK_IOC bit
    174         static_scheduler_t* psched  = (static_scheduler_t*)_get_sched();
    175         unsigned int ltid = psched->current;
    176178        _atomic_or( &psched->context[ltid].slot[CTX_NORUN_ID] , NORUN_MASK_IOC );
    177179       
     
    202204        error = ( (_bdv_status == BLOCK_DEVICE_READ_ERROR) ||
    203205                  (_bdv_status == BLOCK_DEVICE_WRITE_ERROR) );
    204     }
    205 
    206     // release BDV lock and clear task context
    207     _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    }
    209211
    210212#if GIET_DEBUG_IOC
Note: See TracChangeset for help on using the changeset viewer.