dummyuart.c (1264B)
1 #include <os9/os9.h> 2 3 #include "dev.h" 4 #include "uart.h" 5 6 #include "../../libc/syscall.h" 7 8 static int 9 setbauds(Uart *up, long rate) 10 { 11 return 0; 12 } 13 14 static void 15 dummyuartinit(Uart *up, Attr *attr) 16 { 17 return; 18 } 19 20 static int 21 dummyuartread(Uart *up, void *buf, int n) 22 { 23 return _read(0, buf, n); 24 } 25 26 static int 27 dummyuartwrite(Uart *up, void *buf, int n) 28 { 29 return _write(1, buf, n); 30 } 31 32 static int 33 dummyuartsignal(Uart *up, int sign, int val) 34 { 35 return 1; 36 } 37 38 static int 39 dummyuartflush(Uart *up) 40 { 41 return 0; 42 } 43 44 static int 45 dummyuartfifo(Uart *up, int trigger) 46 { 47 return 0; 48 } 49 50 static int 51 dummyuartbits(Uart *up, int nbits) 52 { 53 return 0; 54 } 55 56 static int 57 dummyuartparity(Uart *up, int mode) 58 { 59 return 0; 60 } 61 62 static int 63 dummyuartstop(Uart *up, int nbits) 64 { 65 return 0; 66 } 67 68 static int 69 dummyuartobey(Uart *up, int signal, int ena) 70 { 71 return 0; 72 } 73 74 static int 75 dummyuartstatus(Uart *up, struct uartstat *st) 76 { 77 return 0; 78 } 79 80 Uartphy dummyuartphy = { 81 .name = "dummyuart", 82 .init = dummyuartinit, 83 .setbauds = setbauds, 84 .read = dummyuartread, 85 .write = dummyuartwrite, 86 .signal = dummyuartsignal, 87 .flush = dummyuartflush, 88 .setfifo = dummyuartfifo, 89 .numbits = dummyuartbits, 90 .parity = dummyuartparity, 91 .bitstop = dummyuartstop, 92 .obey = dummyuartobey, 93 .status = dummyuartstatus, 94 };