Changeset 697 for soft/giet_vm


Ignore:
Timestamp:
Aug 7, 2015, 5:42:06 PM (9 years ago)
Author:
guerin
Message:

kernel: release WTI mailbox associated with TTY

We don't block on giet_tty_alloc() anymore when launching the same app
again and again.

Location:
soft/giet_vm/giet_kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/ctx_handler.c

    r696 r697  
    3030    static_scheduler_t* psched = (static_scheduler_t*)_get_sched();
    3131
     32    // pretend the task to kill is scheduled (required for sys_handler calls)
     33    unsigned int cur_task = psched->current;
     34    psched->current = ltid;
     35
    3236    // release private TTY terminal if required
    3337    if ( psched->context[ltid][CTX_TTY_ID] < NB_TTY_CHANNELS )
    3438    {
    35         psched->context[ltid][CTX_TTY_ID] = 0xFFFFFFFF;
    3639        _sys_tty_release();
     40        psched->context[ltid][CTX_TTY_ID] = -1;
    3741    }
    3842
     
    4044    if ( psched->context[ltid][CTX_TIM_ID] < NB_TIM_CHANNELS )
    4145    {
    42         psched->context[ltid][CTX_TIM_ID] = 0xFFFFFFFF;
    4346        _sys_tim_release();
     47        psched->context[ltid][CTX_TIM_ID] = -1;
    4448    }
    4549
     
    4751    if ( psched->context[ltid][CTX_NIC_RX_ID] < NB_NIC_CHANNELS )
    4852    {
    49         psched->context[ltid][CTX_NIC_RX_ID] = 0xFFFFFFFF;
    5053        _sys_nic_release( 1 );
     54        psched->context[ltid][CTX_NIC_RX_ID] = -1;
    5155    }
    5256
     
    5458    if ( psched->context[ltid][CTX_NIC_TX_ID] < NB_NIC_CHANNELS )
    5559    {
    56         psched->context[ltid][CTX_NIC_TX_ID] = 0xFFFFFFFF;
    5760        _sys_nic_release( 0 );
    58     }
     61        psched->context[ltid][CTX_NIC_TX_ID] = -1;
     62    }
     63
     64    // restore scheduled task
     65    psched->current = cur_task;
    5966
    6067    // set NORUN_MASK_TASK bit
  • soft/giet_vm/giet_kernel/irq_handler.c

    r648 r697  
    206206////////////////////////////////////////////
    207207void _ext_irq_release( unsigned int isr_type,
    208                        unsigned int isr_channel,
    209                        unsigned int wti_index )
    210 {
     208                       unsigned int isr_channel )
     209{
     210    unsigned int wti_id;        // allocated WTI mailbox index in XCU
    211211    unsigned int irq_id;        // external IRQ index in PIC (input)
    212212
     
    230230    }
    231231
     232    // find WTI index
     233    static_scheduler_t*  psched = (static_scheduler_t*)_get_sched();
     234    for ( wti_id = 0 ; wti_id < 32 ; wti_id++ )
     235    {
     236        if ( psched->wti_vector[wti_id] == (isr_channel<<16 | isr_type) )
     237            break;
     238    }
     239    if ( wti_id == 32 )
     240    {
     241        _printf("\n[GIET ERROR] in _ext_irq_release() : isr not found\n");
     242        return;
     243    }
     244
    232245    // desactivates dynamically allocated PIC entry
    233246    irq_id = _ext_irq_index[isr_type][isr_channel];
     
    235248
    236249    // releases dynamically allocated WTI mailbox
    237     if      ( wti_index == p +   NB_PROCS_MAX ) _wti_alloc_one[x][y][p] = 0;
    238     else if ( wti_index == p + 2*NB_PROCS_MAX ) _wti_alloc_two[x][y][p] = 0;
    239     else if ( wti_index == p + 3*NB_PROCS_MAX ) _wti_alloc_ter[x][y][p] = 0;
     250    if      ( wti_id == p +   NB_PROCS_MAX ) _wti_alloc_one[x][y][p] = 0;
     251    else if ( wti_id == p + 2*NB_PROCS_MAX ) _wti_alloc_two[x][y][p] = 0;
     252    else if ( wti_id == p + 3*NB_PROCS_MAX ) _wti_alloc_ter[x][y][p] = 0;
    240253    else
    241254    {
  • soft/giet_vm/giet_kernel/irq_handler.h

    r629 r697  
    9696
    9797extern void _ext_irq_release( unsigned int isr_type,
    98                               unsigned int isr_channel,
    99                               unsigned int wti_index );
     98                              unsigned int isr_channel );
    10099
    101100///////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/giet_kernel/sys_handler.c

    r696 r697  
    797797int _sys_tty_release()
    798798{
     799    // release WTI mailbox
     800    if ( USE_PIC ) _ext_irq_release( ISR_TTY_RX , _get_context_slot( CTX_TTY_ID ) );
     801
    799802    // release one TTY terminal
    800803    _atomic_increment( &_tty_channel_allocator , 0xFFFFFFFF );
Note: See TracChangeset for help on using the changeset viewer.