# HG changeset patch # User asl # Date 1180989682 0 # Node ID 354b32473c3e7435a23005801b4cad44bea41730 # Parent b8111f0a6f98781b041158987cbd775e143bc964 * src/hal_diag.c (cyg_hal_plf_serial_isr): Fixed issue with UART ISR handling. Old handler doesn't read the UxIIR register in order to clear the interrupt flag. The resulted in endless interrupts and the DSR never got to run. diff --git a/packages/hal/arm/lpc2xxx/var/current/ChangeLog b/packages/hal/arm/lpc2xxx/var/current/ChangeLog --- a/packages/hal/arm/lpc2xxx/var/current/ChangeLog +++ b/packages/hal/arm/lpc2xxx/var/current/ChangeLog @@ -1,3 +1,10 @@ +2007-06-04 Alexey Shusharin + + * src/hal_diag.c (cyg_hal_plf_serial_isr): Fixed issue with UART + ISR handling. Old handler doesn't read the UxIIR register in order + to clear the interrupt flag. The resulted in endless interrupts + and the DSR never got to run. + 2006-02-03 Sergei Gavrikov * cdl/hal_arm_lpc2xxx.cdl: Added CYGNUM_HAL_ARM_VECTOR_0x14. That diff --git a/packages/hal/arm/lpc2xxx/var/current/src/hal_diag.c b/packages/hal/arm/lpc2xxx/var/current/src/hal_diag.c --- a/packages/hal/arm/lpc2xxx/var/current/src/hal_diag.c +++ b/packages/hal/arm/lpc2xxx/var/current/src/hal_diag.c @@ -242,16 +242,21 @@ cyg_hal_plf_serial_isr(void *__ch_data, int res = 0; channel_data_t* chan = (channel_data_t*)__ch_data; cyg_uint8 c; - cyg_uint8 stat; + cyg_uint8 iir; + CYGARC_HAL_SAVE_GP(); *__ctrlc = 0; - HAL_READ_UINT32(chan->base+CYGARC_HAL_LPC2XXX_REG_UxLSR, stat); - if ( (stat & CYGARC_HAL_LPC2XXX_REG_UxLSR_RDR) != 0 ) { + HAL_READ_UINT32(chan->base + CYGARC_HAL_LPC2XXX_REG_UxIIR, iir); + + if((iir & (CYGARC_HAL_LPC2XXX_REG_UxIIR_IIR0 | CYGARC_HAL_LPC2XXX_REG_UxIIR_IIR1 | + CYGARC_HAL_LPC2XXX_REG_UxIIR_IIR2)) == CYGARC_HAL_LPC2XXX_REG_UxIIR_IIR2) + { + // Rx data available or character timeout + // Read data in order to clear interrupt HAL_READ_UINT32(chan->base+CYGARC_HAL_LPC2XXX_REG_UxRBR, c); - if( cyg_hal_is_break( &c , 1 ) ) - *__ctrlc = 1; + if( cyg_hal_is_break( &c , 1 ) ) *__ctrlc = 1; res = CYG_ISR_HANDLED; }