Desktop/xinu_mips-1.0.2.tar/xinu_mips-1.0.2/include/uart.h File Reference
#include <semaphore.h>
#include <device.h>
Go to the source code of this file.
Detailed Description
- Id
- uart.h 241 2007-07-13 22:24:20Z agember
Definition in file uart.h.
Define Documentation
divisor latch low byte
Definition at line 36 of file uart.h.
divisor latch high byte
Definition at line 37 of file uart.h.
FIFO control (write only)
Definition at line 35 of file uart.h.
receive buffer (read only)
Definition at line 33 of file uart.h.
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 |
#define UART_FCR_TRESET 0x04 |
#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.
At least 64 bytes on WRT54.
Definition at line 77 of file uart.h.
Referenced by uartIntr().
#define UART_IER_ELSI 0x04 |
#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 |
#define UART_IER_ETBEI 0x02 |
#define UART_IFLAG_ECHO 0x0002 |
#define UART_IFLAG_NOBLOCK 0x0001 |
#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 |
#define UART_IIR_MSC 0x00 |
#define UART_IIR_RDA 0x0C |
#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 |
#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 |
#define UART_IOC_CLROFLAG 0x0014 |
#define UART_IOC_GETIFLAG 0x0012 |
#define UART_IOC_GETOFLAG 0x0015 |
#define UART_IOC_OUTPUT_IDLE 0x0016 |
#define UART_IOC_SETIFLAG 0x0010 |
#define UART_IOC_SETOFLAG 0x0013 |
#define UART_LCR_8N1 0x03 |
#define UART_LCR_DLAB 0x80 |
#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 |
#define UART_OFLAG_NOBLOCK 0x0001 |
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 |
) |
|
Initialize UART control and status registers and buffers.
- Parameters:
-
| pdev | pointer to a uart device |
Definition at line 25 of file uartInit.c.
References bzero(), dentry::controlblk, dentry::csr, enable_irq(), uart_csreg::ier, dentry::inintr, dentry::inmask, interruptVector, IRQ_UART, uart_csreg::lcr, uart_csreg::mcr, dentry::minor, newsem(), OK, UART_FCR_EFIFO, UART_FCR_RRESET, UART_FCR_TRESET, UART_FCR_TRIG2, UART_IER_ELSI, UART_IER_ERBFI, UART_IER_ETBEI, UART_LCR_8N1, UART_LCR_DLAB, UART_MCR_OUT2, UART_OBLEN, and uarttab.
interrupt uartIntr |
( |
void |
|
) |
|
Decode hardware interrupt request from UART device.
Definition at line 17 of file uartIntr.c.
devcall uartPutChar |
( |
device * |
, |
|
|
unsigned |
char | |
|
) |
| | |
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