Desktop/xinu_mips-1.0.2.tar/xinu_mips-1.0.2/include/uart.h File Reference

#include <semaphore.h>
#include <device.h>

Include dependency graph for uart.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  uart_csreg
struct  uart

Defines

#define rbr   buffer
#define thr   buffer
#define fcr   iir
#define dll   buffer
#define dlm   ier
#define UART_IER_ERBFI   0x01
#define UART_IER_ETBEI   0x02
#define UART_IER_ELSI   0x04
#define UART_IER_EMSI   0x08
#define UART_IIR_IRQ   0x01
#define UART_IIR_IDMASK   0x0E
#define UART_IIR_MSC   0x00
#define UART_IIR_THRE   0x02
#define UART_IIR_RTO   0x04
#define UART_IIR_RLSI   0x06
#define UART_IIR_RDA   0x0C
#define UART_FCR_EFIFO   0x01
#define UART_FCR_RRESET   0x02
#define UART_FCR_TRESET   0x04
#define UART_FCR_TRIG0   0x00
#define UART_FCR_TRIG1   0x40
#define UART_FCR_TRIG2   0x80
#define UART_FCR_TRIG3   0xC0
#define UART_LCR_DLAB   0x80
#define UART_LCR_8N1   0x03
#define UART_MCR_OUT2   0x08
#define UART_MCR_LOOP   0x10
#define UART_LSR_DR   0x01
#define UART_LSR_THRE   0x20
#define UART_LSR_TEMT   0x40
#define UART_FIFO_LEN   64
#define UART_IBLEN   1024
#define UART_OBLEN   1024
#define UART_IFLAG_NOBLOCK   0x0001
#define UART_IFLAG_ECHO   0x0002
#define UART_OFLAG_NOBLOCK   0x0001
#define UART_IOC_SETIFLAG   0x0010
#define UART_IOC_CLRIFLAG   0x0011
#define UART_IOC_GETIFLAG   0x0012
#define UART_IOC_SETOFLAG   0x0013
#define UART_IOC_CLROFLAG   0x0014
#define UART_IOC_GETOFLAG   0x0015
#define UART_IOC_OUTPUT_IDLE   0x0016

Functions

devcall uartInit (device *)
devcall uartRead (device *, unsigned char *, int)
devcall uartWrite (device *, unsigned char *, int)
devcall uartGetChar (device *)
devcall uartPutChar (device *, unsigned char)
devcall uartControl (device *, int, unsigned char, unsigned char)
interrupt uartIntr (void)

Variables

struct uart uarttab []


Detailed Description

Id
uart.h 241 2007-07-13 22:24:20Z agember

Definition in file uart.h.


Define Documentation

#define dll   buffer

divisor latch low byte

Definition at line 36 of file uart.h.

#define dlm   ier

divisor latch high byte

Definition at line 37 of file uart.h.

#define fcr   iir

FIFO control (write only)

Definition at line 35 of file uart.h.

#define rbr   buffer

receive buffer (read only)

Definition at line 33 of file uart.h.

#define thr   buffer

transmit hold (write only)

Definition at line 34 of file uart.h.

#define UART_FCR_EFIFO   0x01

Enable in and out hardware FIFOs

Definition at line 56 of file uart.h.

Referenced by uartInit().

#define UART_FCR_RRESET   0x02

Reset receiver FIFO

Definition at line 57 of file uart.h.

Referenced by uartInit().

#define UART_FCR_TRESET   0x04

Reset transmit FIFO

Definition at line 58 of file uart.h.

Referenced by uartInit().

#define UART_FCR_TRIG0   0x00

RCVR FIFO trigger level of one.

Definition at line 59 of file uart.h.

#define UART_FCR_TRIG1   0x40

RCVR FIFO trigger level one quarter

Definition at line 60 of file uart.h.

#define UART_FCR_TRIG2   0x80

RCVR FIFO trigger level about half

Definition at line 61 of file uart.h.

Referenced by uartInit().

#define UART_FCR_TRIG3   0xC0

RCVR FIFO trigger level almost full

Definition at line 62 of file uart.h.

#define UART_FIFO_LEN   64

At least 64 bytes on WRT54.

Definition at line 77 of file uart.h.

Referenced by uartIntr().

#define UART_IBLEN   1024

Definition at line 80 of file uart.h.

Referenced by uartIntr(), and uartRead().

#define UART_IER_ELSI   0x04

Receiver line status interrupt mask

Definition at line 43 of file uart.h.

Referenced by uartInit(), and uartStat().

#define UART_IER_EMSI   0x08

Modem status interrupt mask

Definition at line 44 of file uart.h.

Referenced by uartStat().

#define UART_IER_ERBFI   0x01

Received data interrupt mask

Definition at line 41 of file uart.h.

Referenced by uartInit(), and uartStat().

#define UART_IER_ETBEI   0x02

Transmitter buffer empty interrupt

Definition at line 42 of file uart.h.

Referenced by uartInit(), and uartStat().

#define UART_IFLAG_ECHO   0x0002

echo input

Definition at line 118 of file uart.h.

Referenced by uartRead().

#define UART_IFLAG_NOBLOCK   0x0001

do non-blocking input

Definition at line 117 of file uart.h.

Referenced by uartRead().

#define UART_IIR_IDMASK   0x0E

3-bit field for interrupt ID

Definition at line 48 of file uart.h.

Referenced by uartIntr().

#define UART_IIR_IRQ   0x01

Interrupt pending bit

Definition at line 47 of file uart.h.

Referenced by uartIntr().

#define UART_IIR_MSC   0x00

Modem status change

Definition at line 49 of file uart.h.

Referenced by uartIntr().

#define UART_IIR_RDA   0x0C

Receiver data available

Definition at line 53 of file uart.h.

Referenced by uartIntr().

#define UART_IIR_RLSI   0x06

Receiver line status interrupt

Definition at line 52 of file uart.h.

Referenced by uartIntr().

#define UART_IIR_RTO   0x04

Receiver timed out

Definition at line 51 of file uart.h.

Referenced by uartIntr().

#define UART_IIR_THRE   0x02

Transmitter holding register empty

Definition at line 50 of file uart.h.

Referenced by uartIntr().

#define UART_IOC_CLRIFLAG   0x0011

clear input flags

Definition at line 125 of file uart.h.

Referenced by uartControl().

#define UART_IOC_CLROFLAG   0x0014

clear output flags

Definition at line 128 of file uart.h.

Referenced by uartControl().

#define UART_IOC_GETIFLAG   0x0012

get input flags

Definition at line 126 of file uart.h.

Referenced by uartControl().

#define UART_IOC_GETOFLAG   0x0015

get output flags

Definition at line 129 of file uart.h.

Referenced by uartControl().

#define UART_IOC_OUTPUT_IDLE   0x0016

determine if transmit idle

Definition at line 130 of file uart.h.

Referenced by uartControl().

#define UART_IOC_SETIFLAG   0x0010

set input flags

Definition at line 124 of file uart.h.

Referenced by uartControl().

#define UART_IOC_SETOFLAG   0x0013

set output flags

Definition at line 127 of file uart.h.

Referenced by uartControl().

#define UART_LCR_8N1   0x03

8 bits, no parity, 1 stop

Definition at line 66 of file uart.h.

Referenced by uartInit().

#define UART_LCR_DLAB   0x80

Divisor latch access bit

Definition at line 65 of file uart.h.

Referenced by uartInit().

#define UART_LSR_DR   0x01

Data ready

Definition at line 73 of file uart.h.

Referenced by uartIntr().

#define UART_LSR_TEMT   0x40

Transmitter empty

Definition at line 75 of file uart.h.

Referenced by kputc().

#define UART_LSR_THRE   0x20

Transmit-hold-register empty

Definition at line 74 of file uart.h.

#define UART_MCR_LOOP   0x10

Enable loopback test mode

Definition at line 70 of file uart.h.

#define UART_MCR_OUT2   0x08

User-defined OUT2.

Definition at line 69 of file uart.h.

Referenced by uartInit().

#define UART_OBLEN   1024

Definition at line 81 of file uart.h.

Referenced by uartInit(), uartIntr(), and uartWrite().

#define UART_OFLAG_NOBLOCK   0x0001

do non-blocking output

Definition at line 121 of file uart.h.

Referenced by uartWrite().


Function Documentation

devcall uartControl ( device pdev,
int  func,
unsigned char  arg1,
unsigned char  arg2 
)

Control parameters to a UART.

Parameters:
pdev pointer to UART device
func index of function to run (defined in uart.h)
arg1 first argument to called function
arg2 second argument to called function

Definition at line 20 of file uartControl.c.

References dentry::controlblk, uart::iflags, uart::oflags, uart::oidle, SYSERR, UART_IOC_CLRIFLAG, UART_IOC_CLROFLAG, UART_IOC_GETIFLAG, UART_IOC_GETOFLAG, UART_IOC_OUTPUT_IDLE, UART_IOC_SETIFLAG, and UART_IOC_SETOFLAG.

devcall uartGetChar ( device pdev  ) 

Read a single character from UART.

Parameters:
pdev pointer to UART device

Definition at line 17 of file uartGetChar.c.

References uartRead().

devcall uartInit ( device pdev  ) 

interrupt uartIntr ( void   ) 

Decode hardware interrupt request from UART device.

Definition at line 17 of file uartIntr.c.

devcall uartPutChar ( device ,
unsigned  char 
)

Referenced by uartRead().

devcall uartRead ( device pdev,
unsigned char *  buf,
int  len 
)

Read into a buffer from the UART.

Parameters:
pdev UART device table entry
buf buffer to read bytes into
len size of the buffer
Returns:
count of bytes read

Definition at line 20 of file uartRead.c.

References ASSERT, dentry::controlblk, uart::dev, disable(), uart::icount, uart::iflags, uart::in, uart::isema, uart::istart, NULL, restore(), scount(), SYSERR, UART_IBLEN, UART_IFLAG_ECHO, UART_IFLAG_NOBLOCK, uartPutChar(), and wait().

Referenced by uartGetChar().

devcall uartWrite ( device pdev,
unsigned char *  buf,
int  len 
)

Write a buffer to the UART.

Parameters:
pdev pointer to UART device
buf buffer of characters to write
len number of characters to write from the buffer

Definition at line 20 of file uartWrite.c.

References dentry::controlblk, uart::cout, uart::csr, disable(), NULL, uart::ocount, uart::oflags, uart::oidle, uart::osema, uart::ostart, uart::out, restore(), scount(), SYSERR, UART_OBLEN, UART_OFLAG_NOBLOCK, and wait().

Referenced by uartPutChar().


Variable Documentation

struct uart uarttab[]

Definition at line 17 of file uartInit.c.

Referenced by kputc(), uartInit(), uartIntr(), and uartStat().


Generated on Thu Oct 9 22:34:46 2008 for xinu by  doxygen 1.5.5