Hi! For a few months i started programming with ARM7(CPU:LPC 2138).I have this interrupt driven UART I/O:
void sio_irq (void) __irq { volatile char dummy; volatile char IIR; struct buf_st *p; /*------------------------------------------------ Repeat while there is at least one interrupt source. ------------------------------------------------*/ while (((IIR = U1IIR) & 0x01) == 0) { switch (IIR & 0x0E) { case 0x06: /* Receive Line Status */ dummy = U1LSR; /* Just clear the interrupt source */ break; case 0x04: /* Receive Data Available */ case 0x0C: /* Character Time-Out */ p = &rbuf; if (((p->in - p->out) & ~(RBUF_SIZE-1)) == 0) { p->buf [p->in & (RBUF_SIZE-1)] = U1RBR; p->in++; } break; case 0x02: /* THRE Interrupt */ p = &tbuf; if (p->in != p->out) { U1THR = p->buf [p->out & (TBUF_SIZE-1)]; p->out++; tx_restart = 0; } else { tx_restart = 1; } break; case 0x00: /* Modem Interrupt */ dummy = U1MSR; /* Just clear the interrupt source */ break; default: break; } } VICVectAddr = 0; /* Acknowledge Interrupt */ }
....
int __swi(8) com_putchar (int c); int __SWI_8 (int c) { struct buf_st *p = &tbuf; /*------------------------------------------------ If the buffer is full, return an error value. ------------------------------------------------*/ if (SIO_TBUFLEN >= TBUF_SIZE) return (-1); /*------------------------------------------------ Add the data to the transmit buffer. If the transmit interrupt is disabled, then enable it. ------------------------------------------------*/ if (tx_restart) { tx_restart = 0; U1THR = c; } else { p->buf [p->in & (TBUF_SIZE - 1)] = c; p->in++; } return (0); }
/*------------------------------------------------------------------------------ ------------------------------------------------------------------------------*/
int __swi(9) com_getchar (void); int __SWI_9 (int c) { struct buf_st *p = &rbuf; if (SIO_RBUFLEN == 0) return (-1); return (p->buf [(p->out++) & (RBUF_SIZE - 1)]); }
How can i modify this so that only when a specific character(for example:'#') is given then the interrupt flag is setting? Thank you in advance for any help.