changeset 2396:354b32473c3e

* 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.
author asl
date Mon, 04 Jun 2007 20:41:22 +0000
parents b8111f0a6f98
children 64c9e46ea486
files packages/hal/arm/lpc2xxx/var/current/ChangeLog packages/hal/arm/lpc2xxx/var/current/src/hal_diag.c
diffstat 2 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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 <mrfinch@mail.ru>
+
+	* 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 <sg@sgs.gomel.by>
 
 	* cdl/hal_arm_lpc2xxx.cdl: Added CYGNUM_HAL_ARM_VECTOR_0x14. That
--- 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;
     }