| plan 9 kernel history: overview | file list | diff list |
1997/0327/pc/ns16552.h (diff list | history)
| 1995/0222/sys/src/9/pc/ns16552.h:15,21 – 1997/0327/sys/src/9/pc/ns16552.h:15,22 (short | long | prev | next) | ||
|
SMP fixes XXX. Add ns16552special, uartclock. Use arch-specific modempower, serialport functions. Anonymize.
rsc Fri Mar 4 12:44:25 2005 | ||
| 1994/0902 | #define uartrdreg(u,r) inb((u)->port + r) | |
| 1994/1108 | void ns16552setup(ulong, ulong, char*); | |
| 1994/0902 | ||
| 1997/0327 | void ns16552special(int, int, Queue**, Queue**, int (*)(Queue*, int)); void uartclock(void); | |
| 1994/0902 | /* * definition of an optional serial card */ | |
| 1995/0222/sys/src/9/pc/ns16552.h:32,42 – 1997/0327/sys/src/9/pc/ns16552.h:33,43 | ||
| 1994/0902 | { switch(dev){ case Modem: | |
| 1997/0327 | if((*arch->modempower)(onoff) < 0) | |
| 1994/0902 | print("can't turn %s modem speaker\n", onoff?"on":"off"); break; case Serial: | |
| 1997/0327 | if((*arch->serialpower)(onoff) < 0) | |
| 1994/0902 | print("can't turn %s serial port power\n", onoff?"on":"off"); break; } | |
| 1995/0222/sys/src/9/pc/ns16552.h:46,55 – 1997/0327/sys/src/9/pc/ns16552.h:47,54 | ||
| 1994/0902 | * handle an interrupt to a single uart */ static void | |
| 1997/0327 | ns16552intrx(Ureg*, void* arg) | |
| 1994/0902 | { | |
| 1995/0222/sys/src/9/pc/ns16552.h:58,70 – 1997/0327/sys/src/9/pc/ns16552.h:57,68 | ||
| 1994/0902 | * tells which of 8 devices interrupted. */ static void | |
| 1997/0327 | mp008intr(Ureg* ureg, void* arg) | |
| 1994/0902 | { int i, loops; uchar n; Scard *mp; | |
| 1994/1006 | for(loops = 0; loops < 1024; loops++){ | |
| 1994/0902 | n = ~inb(mp->mem); | |
| 1995/0222/sys/src/9/pc/ns16552.h:72,78 – 1997/0327/sys/src/9/pc/ns16552.h:70,76 | ||
| 1994/0902 | return; for(i = 0; n; i++){ if(n & 1) | |
| 1994/1006 |
| |
| 1997/0327 | ns16552intrx(ureg, (void*)(mp->first+i)); | |
| 1994/0902 | n >>= 1; } } | |
| 1995/0222/sys/src/9/pc/ns16552.h:85,91 – 1997/0327/sys/src/9/pc/ns16552.h:83,89 | ||
| 1994/0902 | ns16552install(void) { | |
| 1994/1118 | int i, j, port, nscard; | |
| 1994/1007 |
| |
| 1997/0327 | char *p, *q; | |
| 1994/0902 | Scard *sc; | |
| 1994/1108 | char name[NAMELEN]; | |
| 1994/1007 | static int already; | |
| 1995/0222/sys/src/9/pc/ns16552.h:96,109 – 1997/0327/sys/src/9/pc/ns16552.h:94,110 | ||
| 1994/1007 | ||
| 1994/0902 | /* first two ports are always there and always the normal frequency */ | |
| 1994/1108 | ns16552setup(0x3F8, UartFREQ, "eia0"); | |
| 1994/0902 |
| |
| 1997/0327 | intrenable(VectorUART0, ns16552intrx, (void*)0, BUSUNKNOWN); | |
| 1994/1108 | ns16552setup(0x2F8, UartFREQ, "eia1"); | |
| 1994/0902 |
| |
| 1997/0327 | intrenable(VectorUART1, ns16552intrx, (void*)1, BUSUNKNOWN); addclock0link(uartclock); | |
| 1994/1007 | /* set up a serial console */ | |
| 1997/0327 | if(p = getconf("console")){ port = strtol(p, &q, 0); if(p != q && (port == 0 || port == 1)) ns16552special(port, 9600, &kbdq, &printq, kbdcr2nl); } | |
| 1994/0902 | /* the rest come out of plan9.ini */ | |
| 1994/1118 | nscard = 0; | |
| 1995/0222/sys/src/9/pc/ns16552.h:128,134 – 1997/0327/sys/src/9/pc/ns16552.h:129,135 | ||
| 1994/0902 | if(sc->freq == 0) sc->freq = UartFREQ; sc->first = nuart; | |
| 1997/0327 | intrenable(VectorPIC+sc->irq, mp008intr, sc, BUSUNKNOWN); | |
| 1994/0902 | port = sc->port; for(j=0; j < sc->size; j++){ | |
| 1994/1118 | sprint(name, "eia%d%2.2d", nscard, j); | |
| 1995/0222/sys/src/9/pc/ns16552.h:145,151 – 1997/0327/sys/src/9/pc/ns16552.h:146,152 | ||
| 1994/1106 | sc->freq = UartFREQ; | |
| 1994/1118 | sprint(name, "eia%d00", nscard); | |
| 1994/1108 | ns16552setup(sc->port, sc->freq, name); | |
| 1994/0902 |
| |
| 1997/0327 | intrenable(VectorPIC+sc->irq, ns16552intrx, (void*)(nuart-1), BUSUNKNOWN); | |
| 1994/0902 | } | |
| 1994/1118 | nscard++; | |
| 1994/0902 | } | |