• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ----------------------------------------------------------------------- *
2  *
3  *   Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
4  *
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.
10  *
11  * ----------------------------------------------------------------------- */
12 
13 /*
14  * serialinfo.c
15  *
16  * Print serial port info
17  */
18 
19 #include <string.h>
20 #include <stdio.h>
21 #include <console.h>
22 #include <syslinux/config.h>
23 
main(void)24 int main(void)
25 {
26     const struct syslinux_serial_console_info *si;
27 
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
35 
36     si = syslinux_serial_console_info();
37 
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);
43 
44     return 0;
45 }
46