Adding upstream version 6.02~pre8+dfsg.
[syslinux-debian/hramrach.git] / com32 / samples / serialinfo.c
blob2936b4e543898cc41612fe420d8bb5593e44a272
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
14 * serialinfo.c
16 * Print serial port info
19 #include <string.h>
20 #include <stdio.h>
21 #include <console.h>
22 #include <syslinux/config.h>
24 int main(void)
26 const struct syslinux_serial_console_info *si;
28 #if 0
29 /* this hangs! */
30 openconsole(&dev_null_r, &dev_stdcon_w);
31 #else
32 /* this works */
33 openconsole(&dev_rawcon_r, &dev_ansiserial_w);
34 #endif
36 si = syslinux_serial_console_info();
38 printf("Serial port base: %#06x\n", si->iobase);
39 printf("Serial port divisor: %5d", si->divisor);
40 if (si->divisor)
41 printf(" (%d baud)", 115200 / si->divisor);
42 printf("\n" "Flow control bits: %#05x\n", si->flowctl);
44 return 0;