Merging upstream version 5.01+dfsg.
[syslinux-debian/hramrach.git] / core / include / bios.h
blob889443ab124c1f1cde454b2197618ca05c85166c
1 /*
2 * -----------------------------------------------------------------------
4 * Copyright 1994-2008 H. Peter Anvin - All Rights Reserved
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 * Boston MA 02111-1307, USA; either version 2 of the License, or
10 * (at your option) any later version; incorporated herein by reference.
12 * -----------------------------------------------------------------------
15 * bios.h
17 * Header file for the BIOS data structures etc.
20 #ifndef _BIOS_H
21 #define _BIOS_H
23 #include <sys/io.h>
26 * Interrupt vectors
28 #define BIOS_timer_hook (4 * 0x1C)
29 #define fdctab (4 * 0x1E)
30 #define fdctab1 fdctab
31 #define fdctab2 (fdctab + 2)
33 #define serial_base 0x0400 /* Base address for 4 serial ports */
34 #define BIOS_fbm 0x0413 /* Free Base Memory (kilobytes) */
35 #define BIOS_page 0x0462 /* Current video page */
36 #define BIOS_timer 0x046C /* Timer ticks */
37 #define BIOS_magic 0x0472 /* BIOS reset magic */
38 #define BIOS_vidrows 0x0484 /* Number of screen rows */
40 static inline uint16_t bios_fbm(void)
42 return *(volatile uint16_t *)BIOS_fbm;
45 static inline void set_bios_fbm(uint16_t mem)
47 *(volatile uint16_t *)BIOS_fbm = mem;
50 #define serial_buf_size 4096
51 #define IO_DELAY_PORT 0x80 /* Invalid port (we hope!) */
53 static inline void io_delay(void)
55 outb(0x0, IO_DELAY_PORT);
56 outb(0x0, IO_DELAY_PORT);
59 /* conio.c */
60 extern unsigned short SerialPort;
61 extern unsigned char FlowIgnore;
62 extern uint8_t ScrollAttribute;
63 extern uint16_t DisplayCon;
66 * Sometimes we need to access screen coordinates as separate 8-bit
67 * entities and sometimes we need to use them as 16-bit entities. Using
68 * this structure allows the compiler to do it for us.
70 union screen {
71 struct {
72 uint8_t col; /* Cursor column for message file */
73 uint8_t row; /* Cursor row for message file */
74 } b;
75 uint16_t dx;
77 extern union screen _cursor;
78 extern union screen _screensize;
80 #define CursorDX _cursor.dx
81 #define CursorCol _cursor.b.col
82 #define CursorRow _cursor.b.row
84 #define ScreenSize _screensize.dx
85 #define VidCols _screensize.b.col
86 #define VidRows _screensize.b.row
88 /* font.c */
89 extern void use_font(void);
90 extern void bios_adjust_screen(void);
92 /* serirq.c */
93 extern char *SerialHead;
94 extern char *SerialTail;
96 extern void bios_init(void);
97 extern void bios_cleanup_hardware(void);
99 #endif /* _BIOS_H */