xref: /inferno-os/os/js/ns16552.h (revision 74a4d8c26dd3c1e9febcb717cfd6cb6512991a7a)
1 /*
2  *  Javastation specific code for the ns16552 (really the superio chip,
3  *  but it has a serial port that looks like the ns16552).
4  */
5 enum
6 {
7 	UartFREQ= 1843200,
8 	TTYABase = 0x2F8
9 };
10 
11 #define uartwrreg(u,r,v)	outb((u)->port + r, (u)->sticky[r] | (v))
12 #define uartrdreg(u,r)		inb((u)->port + r)
13 
14 void	ns16552setup(ulong, ulong, char*);
15 
16 static void
uartpower(int,int)17 uartpower(int, int)
18 {
19 }
20 
21 /*
22  *  handle an interrupt to a single uart
23  */
24 static void
ns16552intrx(Ureg * ur,void * arg)25 ns16552intrx(Ureg *ur, void *arg)
26 {
27 	USED(ur);
28 
29 	ns16552intr((ulong)arg);
30 }
31 
32 /*
33  *  install the uarts (called by reset)
34  */
35 void
ns16552install(void)36 ns16552install(void)
37 {
38 	static int already;
39 	void uartclock(void);
40 
41 	if(already)
42 		return;
43 	already = 1;
44 
45 	/* first two ports are always there and always the normal frequency */
46 	ns16552setup(superiova()+TTYABase, UartFREQ, "eia0");
47 	ns16552special(0, 38400, &kbdq, &printq, kbdputc);
48 	addclock0link(uartclock, 22);
49 }
50 
51 /*
52  * If the UART's receiver can be connected to a DMA channel,
53  * this function does what is necessary to create the
54  * connection and returns the DMA channel number.
55  * If the UART's receiver cannot be connected to a DMA channel,
56  * a -1 is returned.
57  */
58 char
ns16552dmarcv(int dev)59 ns16552dmarcv(int dev)
60 {
61 
62 	USED(dev);
63         return -1;
64 }
65 
66 long
dmasetup(int,void *,long,int)67 dmasetup(int,void*,long,int)
68 {
69 	return 0;
70 }
71 
72 void
dmaend(int)73 dmaend(int)
74 {
75 }
76 
77 int
dmacount(int)78 dmacount(int)
79 {
80 	return 0;
81 }
82