1 /* -*- linux-c -*- ------------------------------------------------------- *
3 * Copyright (C) 1991, 1992 Linus Torvalds
4 * Copyright 2007 rPath, Inc. - All Rights Reserved
5 * Copyright 2009 Intel Corporation; author H. Peter Anvin
7 * This file is part of the Linux kernel, and is made available under
8 * the terms of the GNU General Public License version 2.
10 * ----------------------------------------------------------------------- */
13 * Very simple screen I/O
14 * XXX: Probably should add very simple serial I/O?
20 * These functions are in .inittext so they can be used to signal
21 * error during initialization.
24 void __attribute__((section(".inittext"))) putchar(int ch)
29 putchar('\r'); /* \n -> \r\n */
36 intcall(0x10, &ireg, NULL);
39 void __attribute__((section(".inittext"))) puts(const char *str)
46 * Read the CMOS clock through the BIOS, and return the
50 static u8 gettime(void)
52 struct biosregs ireg, oreg;
56 intcall(0x1a, &ireg, &oreg);
62 * Read from the keyboard
66 struct biosregs ireg, oreg;
70 intcall(0x16, &ireg, &oreg);
75 static int kbd_pending(void)
77 struct biosregs ireg, oreg;
81 intcall(0x16, &ireg, &oreg);
83 return !(oreg.eflags & X86_EFLAGS_ZF);
95 int getchar_timeout(void)
113 return 0; /* Timeout! */