This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I need the UART driver example of RTX for LPC2366!!!

I download the uart example form NXP.com
I port it to RTX for keil,base on RTX_Traffic.
but can't crash at Dabt_handler. help me !!
:(
the ISR :
macro:
static DWORD sysreg; /* used as LR register */
#define IENABLE __asm { MRS sysreg, SPSR; MSR CPSR_c, #SYS32Mode }
#define IDISABLE __asm { MSR CPSR_c, #(IRQ32Mode|I_Bit); MSR SPSR_cxsf, sysreg }

void UART0Handler (void) __irq
{ BYTE IIRValue, LSRValue; BYTE Dummy = Dummy;

IENABLE; /* handles nested interrupt */ IIRValue = U0IIR;

IIRValue >>= 1; /* skip pending bit in IIR */ IIRValue &= 0x07; /* check bit 1~3, interrupt identification */ if ( IIRValue == IIR_RLS ) /* Receive Line Status */ { LSRValue = U0LSR; /* Receive Line Status */ if ( LSRValue & (LSR_OE|LSR_PE|LSR_FE|LSR_RXFE|LSR_BI) ) { /* There are errors or break interrupt */ /* Read LSR will clear the interrupt */ UART0Status = LSRValue; Dummy = U0RBR; /* Dummy read on RX to clear interrupt, then bail out */ IDISABLE; VICVectAddr = 0; /* Acknowledge Interrupt */ return; } if ( LSRValue & LSR_RDR ) /* Receive Data Ready */ { /* If no error on RLS, normal ready, save into the data buffer. */ /* Note: read RBR will clear the interrupt */ UART0Buffer[UART0Count] = U0RBR; UART0Count++; if ( UART0Count == BUFSIZE ) { UART0Count = 0; /* buffer overflow */ } } } else if ( IIRValue == IIR_RDA ) /* Receive Data Available */ { /* Receive Data Available */ UART0Buffer[UART0Count] = U0RBR; UART0Count++; if ( UART0Count == BUFSIZE ) { UART0Count = 0; /* buffer overflow */ } } else if ( IIRValue == IIR_CTI ) /* Character timeout indicator */ { /* Character Time-out indicator */ UART0Status |= 0x100; /* Bit 9 as the CTI error */ } else if ( IIRValue == IIR_THRE ) /* THRE, transmit holding register empty */ { /* THRE interrupt */ LSRValue = U0LSR; /* Check status in the LSR to see if valid data in U0THR or not */ if ( LSRValue & LSR_THRE ) { UART0TxEmpty = 1; } else { UART0TxEmpty = 0; } }

IDISABLE; VICVectAddr = 0; /* Acknowledge Interrupt */
}

0