Changeset 728


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

bloup

Location:
soft/giet_vm/giet_drivers
Files:
3 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
  • soft/giet_vm/giet_drivers/bdv_driver.h

    r709 r728  
    1515// - in "synchronous" mode, it uses a polling policy on the BDV STATUS
    1616//   register to detect transfer completion, as interrupts are not activated.
    17 //   This mode is used by the boot code to load the map.bin file into memory
     17//   This mode must be used by the boot code to load the map.bin file into memory
    1818//   (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//
    1921// - In "descheduling" mode, ir uses a descheduling + IRQ policy.
     22//   This mode mus be used by the kernel code tho handle system calls.
    2023//   The ISR executed when transfer completes should restart the calling task,
    2124//   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.
    2527//
    2628// The SEG_IOC_BASE address must be defined in the hard_config.h file.
  • soft/giet_vm/giet_drivers/cma_driver.h

    r704 r728  
    4949
    5050///////////////////////////////////////////////////////////////////////////////////
     51//  CMA channel running modes
     52///////////////////////////////////////////////////////////////////////////////////
     53
     54enum 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///////////////////////////////////////////////////////////////////////////////////
    5163//  CMA channel status values
    5264///////////////////////////////////////////////////////////////////////////////////
     
    89101};
    90102
     103
    91104///////////////////////////////////////////////////////////////////////////////////
    92105//    access functions
Note: See TracChangeset for help on using the changeset viewer.