summaryrefslogtreecommitdiff
path: root/console-client/vga-support.h
blob: 17c0b5fd36a91128397e0d605cf8cf366f62f8d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* vga-support.h - Interface for VGA hardware access.
   Copyright (C) 2002 Free Software Foundation, Inc.
   Written by Marcus Brinkmann.

   This file is part of the GNU Hurd.

   The GNU Hurd is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2, or (at
   your option) any later version.

   The GNU Hurd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA. */

#ifndef _VGA_SUPPORT_H_
#define _VGA_SUPPORT_H_ 1

#include <errno.h>
#include <sys/types.h>


/* The VGA interface does not do locking on its own, for maximum
   efficiency it relies on locking by the caller (because usually the
   caller has some other data structures to lock along with the
   VGA hardware.  */

/* The mapped video memory.  */
extern char *vga_videomem;

/* Initialize the VGA hardware and set up the permissions and memory
   mappings.  */
error_t vga_init (void);

/* Release the resources and privileges associated with the VGA
   hardware access.  */
void vga_fini (void);

/* Write DATALEN bytes from DATA to the font buffer BUFFER, starting
   from glyph index.  */
void vga_write_font_buffer (int buffer, int index,
			    unsigned char *data, size_t datalen);

/* Read DATALEN bytes into DATA from the font buffer BUFFER, starting
   from glyph INDEX.  */
void vga_read_font_buffer (int buffer, int index,
			   unsigned char *data, size_t datalen);

/* Set FONT_BUFFER_SUPP to FONT_BUFFER if the font is small.  */
void vga_select_font_buffer (int font_buffer, int font_buffer_supp);

/* Set the font height in pixel.  */
void vga_set_font_height (int height);

/* Get the font height in pixel.  Can be 8 or 9.  */
int vga_get_font_width (void);

/* Set the font height in pixel.  WIDTH can be 8 or 9.  */
void vga_set_font_width (int width);

/* Enable (if ON is true) or disable (otherwise) the cursor.  Expects
   the VGA hardware to be locked.  */
void vga_display_cursor (int on);

/* Set cursor size from START to END (set to -1 to not set one of the
   values).  */
void vga_set_cursor_size (int start, int end);

/* Set the cursor position to POS, which is (x_pos + y_pos *
   width).  */
void vga_set_cursor_pos (unsigned int pos);

/* Read NR entries from the color palette, starting from INDEX.  */
void vga_read_palette (unsigned char index, unsigned char *data, int nr);

/* Write NR entries to the color palette, starting from INDEX.  */
void vga_write_palette (unsigned char index,
			const unsigned char *data, int nr);

void vga_exchange_palette_attributes (unsigned char index,
				      unsigned char *saved_palette_attr,
				      int nr);

#endif	/* _VGA_SUPPORT_H_ */