]> 4ch.mooo.com Git - 16.git/blob - src/lib/doslib/hw/8250/8250pnp.c
added a bunch of things~ and midi stuff~
[16.git] / src / lib / doslib / hw / 8250 / 8250pnp.c
1
2 #include <stdio.h>
3 #include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
4 #include <stdlib.h>
5 #include <unistd.h>
6 #include <string.h>
7 #include <fcntl.h>
8 #include <dos.h>
9
10 #include <hw/cpu/cpu.h>
11 #include <hw/dos/dos.h>
12 #include <hw/8250/8250.h>
13 #include <hw/isapnp/isapnp.h>
14
15 int is_rs232_or_compat_pnp_device(struct isa_pnp_device_node far *devn) {
16         char id[9];
17
18         if (devn->type_code[0] == 7 && devn->type_code[1] == 0)
19                 return 1;
20
21         /* and then there are known devices that act like RS-232 but do not list themselves as RS-232 */
22         isa_pnp_product_id_to_str(id,devn->product_id);
23
24         /* Toshiba Satellite Pro 465CDX: The IR port is a 0x07,0x80 ("other" communications device)
25          * when in fact it looks and acts like a UART on IO port 0x3E8 IRQ 9. Identifies itself
26          * as "TOS7009" (TODO: The PnP BIOS also announces something at 0x3E0, is that related to this?).
27          * UART notes: For the most part you can treat it like a serial port BUT there is one catch
28          *             that is related to IR transmission: both computers cannot send bytes at the
29          *             same time. If you do, the light interferes and both computers end up receiving
30          *             gibberish. In some cases, it can throw off the bit clock and make the remaining
31          *             valid data also gibberish. The only way to resolve the issue it seems, is to
32          *             temporarily stop transmitting and give each IR port a chance to reset themselves. */
33         if (devn->type_code[0] == 7 && devn->type_code[1] == 0x80 && !memcmp(id,"TOS7009",7))
34                 return 1;
35
36         return 0;
37 }
38