Services and Modeling for Embedded Software Development
Embecosm divider strip
Prev  Next

10.5.1.  Simple Test for the Interrupt Driven SoC Model

A simple test is provided in uart-loop-intr.c as an extension of uart-loop.c. After a character is read, the program loops to wait until the interrupt pending flag is clear (indicating the transmit buffer is empty).

    do {                        /* Wait for interrupts to clear */
      ;
    } while( is_set( uart->iir, UART_IIR_IPEND ) );
	  

This is a very basic test—if all is well it behaves identically to the existing loop program. If there is a problem clearing the transmit buffer empty interrupt, or the received data available interrupt is not cleared when data is read, then the program will lock up waiting for the interrupt pending flag to clear.

The source code for the interrupt driven UART program may be found in progs-or32/uart-loop-intr.c in the distribution. It is built using the standard OpenRISC 1000 tool chain as part of the main system build.

Embecosm divider strip