Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/alphapc/ns16552.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname alphapc/ns16552.h 1999/0415
## diff -e /dev/null /n/emeliedump/1999/0415/sys/src/brazil/alphapc/ns16552.h
0a
#define uartwrreg(u,r,v)	outb((u)->port + (r), (u)->sticky[r] | (v))
#define uartrdreg(u,r)		inb((u)->port + (r))

#define uartpower(x, y)

/*
 *  handle an interrupt to a single uart
 */
static void
ns16552intrx(Ureg*, void* arg)
{
	ns16552intr((ulong)arg);
}

void
ns16552install(void)
{
	static int already;

	if(already)
		return;
	already = 1;

	ns16552setup(Uart0, UartFREQ, "eia0");
	intrenable(VectorUART0, ns16552intrx, (void*)0, BUSUNKNOWN);
	ns16552setup(Uart1, UartFREQ, "eia1");
	intrenable(VectorUART1, ns16552intrx, (void*)0, BUSUNKNOWN);
}

#define RD(r)	inb(Uart0+(r))
static void
ns16552iputc(char c)
{
	mb();
	while((RD(5) & (1<<5)) == 0)
		mb();
	outb(Uart0, c);
	mb();
	while((RD(5) & (1<<5)) == 0)
		mb();
}

int
iprint(char *fmt, ...)
{
	int n, i, s;
	char buf[512];
	va_list arg;

	va_start(arg, fmt);
	n = doprint(buf, buf+sizeof(buf), fmt, arg) - buf;
	va_end(arg);

	s = splhi();
	for(i = 0; i < n; i++)
		ns16552iputc(buf[i]);
	splx(s);

	return n;
}
.
## diffname alphapc/ns16552.h 1999/0514
## diff -e /n/emeliedump/1999/0415/sys/src/brazil/alphapc/ns16552.h /n/emeliedump/1999/0514/sys/src/brazil/alphapc/ns16552.h
26c
	ns16552setup(Uart1, UartFREQ, "eia1", Ns550);
.
24c
	ns16552setup(Uart0, UartFREQ, "eia0", Ns550);
.
5a
void ns16552setup(ulong, ulong, char*, int);
void ns16552intr(int);

.
## diffname alphapc/ns16552.h 2000/0108
## diff -e /n/emeliedump/1999/0514/sys/src/brazil/alphapc/ns16552.h /n/emeliedump/2000/0108/sys/src/9/alphapc/ns16552.h
46,63d
30a
	addclock0link(uartclock);
.
7a
void uartclock(void);
.
## diffname alphapc/ns16552.h 2000/0401
## diff -e /n/emeliedump/2000/0108/sys/src/9/alphapc/ns16552.h /n/emeliedump/2000/0401/sys/src/9/alphapc/ns16552.h
31c
	intrenable(IrqUART1, ns16552intrx, (void*)0, BUSUNKNOWN, "eia1");
.
29c
	intrenable(IrqUART0, ns16552intrx, (void*)0, BUSUNKNOWN, "eia0");
	if(ioalloc(Uart1, 8, 0, "eia1") < 0)
		print("eia1: port %d in use\n", Uart1);
.
27a
	if(ioalloc(Uart0, 8, 0, "eia0") < 0)
		print("eia0: port %d in use\n", Uart0);
.
## diffname alphapc/ns16552.h 2001/0527 # deleted
## diff -e /n/emeliedump/2000/0401/sys/src/9/alphapc/ns16552.h /n/emeliedump/2001/0527/sys/src/9/alphapc/ns16552.h
1,51d

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].