Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Uart Class Reference

Platform independent UART stub. More...

#include <uart.h>

Inheritance diagram for Uart:

Console Kernel_uart List of all members.

Public Types

typedef unsigned TransferMode
 Type UART transfer mode (Bits, Stopbits etc.
typedef unsigned BaudRate
 Type for baud rate.
enum  { Base_rate = 115200, Base_ier_bits = 0 }
enum  {
  PAR_NONE = 0x00, PAR_EVEN = 0x18, PAR_ODD = 0x08, DAT_5 = 0x00,
  DAT_6 = 0x01, DAT_7 = 0x02, DAT_8 = 0x03, STOP_1 = 0x00,
  STOP_2 = 0x04, MODE_8N1 = PAR_NONE | DAT_8 | STOP_1, MODE_7E1 = PAR_EVEN | DAT_7 | STOP_1, MODE_NC = 0x1000000,
  BAUD_NC = 0x1000000
}

Public Member Functions

 Uart ()
 ctor
 ~Uart ()
 dtor
void shutdown ()
 (abstract) Shutdown the serial port.
int const irq () const
 (abstract) Get the IRQ assigned to the port.
void enable_rcv_irq ()
 (abstract) Enable rcv IRQ in UART.
void disable_rcv_irq ()
 (abstract) Disable rcv IRQ in UART.
bool change_mode (TransferMode m, BaudRate r)
 (abstract) Change transfer mode or speed.
TransferMode get_mode ()
 (abstract) Get the current transfer mode.
int write (char const *str, size_t len)
 (abstract) Write str.
int getchar (bool blocking=true)
 (abstract) Read a character.
int char_avail () const
 (abstract) Is there anything to read?
Mword get_attributes () const
 Console attributes.
bool startup (Address port, int irq)
 Start this serial port for I/O.

Private Types

enum  Registers {
  TRB = 0, BRD_LOW = 0, IER = 1, BRD_HIGH = 1,
  IIR = 2, FCR = 2, LCR = 3, MCR = 4,
  LSR = 5, MSR = 6, SPR = 7
}

Private Member Functions

void outb (Unsigned8 b, Registers reg)
Unsigned8 inb (Registers reg) const
void mcr (Unsigned8 b)
Unsigned8 mcr () const
void fcr (Unsigned8 b)
void lcr (Unsigned8 b)
Unsigned8 lcr () const
void ier (Unsigned8 b)
Unsigned8 ier () const
Unsigned8 iir () const
Unsigned8 msr () const
Unsigned8 lsr () const
void trb (Unsigned8 b)
Unsigned8 trb () const
bool valid ()

Private Attributes

Address port
int _irq

Detailed Description

Platform independent UART stub.


Member Typedef Documentation

typedef unsigned Uart::BaudRate
 

Type for baud rate.

typedef unsigned Uart::TransferMode
 

Type UART transfer mode (Bits, Stopbits etc.

).


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
Base_rate 
Base_ier_bits 

anonymous enum
 

Enumeration values:
PAR_NONE 
PAR_EVEN 
PAR_ODD 
DAT_5 
DAT_6 
DAT_7 
DAT_8 
STOP_1 
STOP_2 
MODE_8N1 
MODE_7E1 
MODE_NC 
BAUD_NC 

enum Uart::Registers [private]
 

Enumeration values:
TRB 
BRD_LOW 
IER 
BRD_HIGH 
IIR 
FCR 
LCR 
MCR 
LSR 
MSR 
SPR 


Constructor & Destructor Documentation

Uart::Uart  ) 
 

ctor

Uart::~Uart  ) 
 

dtor


Member Function Documentation

bool Uart::change_mode TransferMode  m,
BaudRate  r
 

(abstract) Change transfer mode or speed.

Parameters:
m the new mode for the transfer, or MODE_NC for no mode change.
r the new baud rate, or BAUD_NC, for no speed change.

int Uart::char_avail  )  const [virtual]
 

(abstract) Is there anything to read?

Reimplemented from Console.

void Uart::disable_rcv_irq  )  [inline]
 

(abstract) Disable rcv IRQ in UART.

void Uart::enable_rcv_irq  )  [inline]
 

(abstract) Enable rcv IRQ in UART.

Reimplemented in Kernel_uart.

void Uart::fcr Unsigned8  b  )  [inline, private]
 

Mword Uart::get_attributes  )  const [virtual]
 

Console attributes.

Reimplemented from Console.

Uart::TransferMode Uart::get_mode  ) 
 

(abstract) Get the current transfer mode.

int Uart::getchar bool  blocking = true  )  [virtual]
 

(abstract) Read a character.

Reimplemented from Console.

Unsigned8 Uart::ier  )  const [inline, private]
 

void Uart::ier Unsigned8  b  )  [inline, private]
 

Unsigned8 Uart::iir  )  const [inline, private]
 

Unsigned8 Uart::inb Registers  reg  )  const [inline, private]
 

int const Uart::irq  )  const [inline]
 

(abstract) Get the IRQ assigned to the port.

Unsigned8 Uart::lcr  )  const [inline, private]
 

void Uart::lcr Unsigned8  b  )  [inline, private]
 

Unsigned8 Uart::lsr  )  const [inline, private]
 

Unsigned8 Uart::mcr  )  const [inline, private]
 

void Uart::mcr Unsigned8  b  )  [inline, private]
 

Unsigned8 Uart::msr  )  const [inline, private]
 

void Uart::outb Unsigned8  b,
Registers  reg
[inline, private]
 

void Uart::shutdown  ) 
 

(abstract) Shutdown the serial port.

bool Uart::startup Address  port,
int  irq
 

Start this serial port for I/O.

Parameters:
port the I/O port base address.
irq the IRQ assigned to this port, -1 if none.

Unsigned8 Uart::trb  )  const [inline, private]
 

void Uart::trb Unsigned8  b  )  [inline, private]
 

bool Uart::valid  )  [private]
 

int Uart::write char const *  str,
size_t  len
[virtual]
 

(abstract) Write str.

Reimplemented from Console.


Member Data Documentation

int Uart::_irq [private]
 

Address Uart::port [private]
 


The documentation for this class was generated from the following files:
Generated on Mon Sep 26 14:20:18 2005 for Fiasco by  doxygen 1.4.2