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

6.4.7.  UART State

struct regs is used to hold the value of each register. There are ten of these, since register 0 is really two registers, depending on whether it is being read (rbr) or written (thr) and the divisor latch is really an extra 16 bit register.

  struct {
    unsigned char       rbr;            // R: Rx buffer,
    unsigned char       thr;            // R: Tx hold reg,
    unsigned char       ier;            // R/W: Interrupt Enable Register
    unsigned char       iir;            // R: Interrupt ID Register
    unsigned char       lcr;            // R/W: Line Control Register
    unsigned char       mcr;            // W: Modem Control Register
    unsigned char       lsr;            // R: Line Status Register
    unsigned char       msr;            // R: Modem Status Register
    unsigned char       scr;            // R/W: Scratch Register            
    unsigned short int  dl;             // R/W: Divisor Latch
  } regs;
	  

An additional register, intrPending, holds flags (corresponding to the interrupt enable register bits) indicating which interrupts are currently pending. A flag initialized at construction records the model endianness, isLittleEndian.

Embecosm divider strip