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

10.4.  Main Program for the Interrupt Driven Model

The main program for the model supporting interrupts is in intrSocSC.cpp. It has a very similar structure to the main program used with the temporal decoupling example in Section 9.6, but uses the new versions of the Or1ksim wrapper class and UART module, Or1ksimIntrSC and UartIntrSC.

A baud rate of 115,200 is expected for the Linux kernel serial port and a global quantum of 10μs is appropriate for this. A constant is defined to hold the interrupt port number used by the UART (2).

#define BAUD_RATE   115200
#define QUANTUM_US      10

#define INTR_UART        2
	

The main program structure is unchanged, except that the UART interrupt output port needs to be connected to the correct signal in the Or1ksim wrapper:

  uart.intr( iss.intr[INTR_UART] );
	

The code for the SystemC main program for the SoC with interrupts may be found in sys-models/intr-soc/intrSocMainSC.h in the distribution.

Embecosm divider strip