UARTP8250 9
NAME
uartp8250 - portable 8250-style uarts
SYNOPSIS
.EX
#include "../port/uartp8250.h"
typedef struct Ctlr Ctlr;
struct Ctlr {
void *reg;
uint (*get)(void*, int);
void (*set)(void*, int, uint);
int (*itr)(Uart*, int);
int irq;
int tbdf;
int iena;
uchar sticky[8];
Lock;
int hasfifo;
int checkfifo;
int fena;
};
PhysUart p8250physuart;
void i8250interrupt(Ureg*, void*);
DESCRIPTION
P8250 provides a portable interface for 8250-style uarts.
All necessary functions are provided except for
get , set , and
itr . These functions get or set an 8250 register or enable
or disable the interrupt, respectively. Since the
PhysUart structure is required for device discovery, a dummy
version needs to be provided
.EX
PhysUart myphysuart = {
.name = "myuart",
.pnp = mypnp,
};
On entry of the pnp function, the PhysUart can be filled out: .EX memmove(&myphysuart, &p8250physuart, sizeof(PhysUart)); myphysuart.name = "myuart"; myphysuart.pnp = mypnp;
as can the Ctlr structure, which is assigned to "uart->regs" .
SOURCE
/sys/src/9/port/uartp8250.h /sys/src/9/port/uartp8250.c
"SEE ALSO"
uart (3). BUGS
The
PhysUart is uncomfortable to use for device discovery.