Ignore:
Timestamp:
Mar 28, 2014, 10:48:51 AM (10 years ago)
Author:
alain
Message:

Bug fix in both _tty_rx_isr() and _bdv_isr():
The ISR must do nothing it the status indicates that
there is no pending ISR.

File:
1 edited

Legend:

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

    r295 r297  
    170170
    171171///////////////////////////////////////////////////////////////////////////////////
    172 // This ISR handles the IRQ signaling that the RX buffer is full.
     172// This ISR handles the IRQ signaling that the RX buffer is not empty.
    173173// IT can be an HWI or an SWI.
    174 // There is one single multi_tty component controling all channels.
    175174// There is one communication buffer _tty_rx_buf[i] and one synchronisation
    176175// variable _tty_rx_full[i] per channel.
    177 // A character is lost if the buffer is full when the ISR is executed.
     176// Does nothing if the TTY_RX buffer is empty, or if the kernel buffer is full
     177// when the ISR is called.
    178178///////////////////////////////////////////////////////////////////////////////////
    179179void _tty_rx_isr( unsigned int irq_type,   // HWI / WTI
     
    183183    unsigned int cluster_xy = _get_procid() / NB_PROCS_MAX;
    184184
    185     if ( irq_type == IRQ_TYPE_WTI )   // reset SWI in XCU if required
     185    // get TTY status
     186    unsigned int status = _tty_get_register( channel, TTY_STATUS );
     187
     188    // check both TTY status and kernel buffer status:
     189    // does nothing if kernel buffer full or tty_buffer empty
     190    if ( ((status & 0x1) == 0) ||
     191         (_tty_rx_full[channel] != 0) )  return;
     192 
     193    // reset WTI in XCU if WTI type
     194    if ( irq_type == IRQ_TYPE_WTI )
    186195    {
    187196        unsigned int value;
    188197        _xcu_get_wti_value( cluster_xy, irq_id, &value );
    189198    }
    190      
    191     // get character and reset TTY IRQ
    192     _tty_rx_buf[channel] = _tty_get_register( channel, TTY_READ );
     199
     200    // transfer character to kernel buffer and acknowledge TTY IRQ
     201    _tty_rx_buf[channel]  = _tty_get_register( channel, TTY_READ );
     202
     203    // set kernel buffer status
     204    asm volatile( "sync" );
     205    _tty_rx_full[channel] = 1;
    193206
    194207#if GIET_DEBUG_IRQS  // we don't take the TTY lock to avoid deadlock
     
    209222#endif
    210223
    211     // signals character available
    212     _tty_rx_full[channel] = 1;
    213224}
    214225
Note: See TracChangeset for help on using the changeset viewer.