Linux Audio

Check our new training course

Loading...
v3.5.6
 
  1/* -*- linux-c -*- ------------------------------------------------------- *
  2 *
  3 *   Copyright (C) 1991, 1992 Linus Torvalds
  4 *   Copyright 2007 rPath, Inc. - All Rights Reserved
  5 *
  6 *   This file is part of the Linux kernel, and is made available under
  7 *   the terms of the GNU General Public License version 2.
  8 *
  9 * ----------------------------------------------------------------------- */
 10
 11/*
 12 * Header file for the real-mode video probing code
 13 */
 14
 15#ifndef BOOT_VIDEO_H
 16#define BOOT_VIDEO_H
 17
 18#include <linux/types.h>
 19
 20/*
 21 * This code uses an extended set of video mode numbers. These include:
 22 * Aliases for standard modes
 23 *      NORMAL_VGA (-1)
 24 *      EXTENDED_VGA (-2)
 25 *      ASK_VGA (-3)
 26 * Video modes numbered by menu position -- NOT RECOMMENDED because of lack
 27 * of compatibility when extending the table. These are between 0x00 and 0xff.
 28 */
 29#define VIDEO_FIRST_MENU 0x0000
 30
 31/* Standard BIOS video modes (BIOS number + 0x0100) */
 32#define VIDEO_FIRST_BIOS 0x0100
 33
 34/* VESA BIOS video modes (VESA number + 0x0200) */
 35#define VIDEO_FIRST_VESA 0x0200
 36
 37/* Video7 special modes (BIOS number + 0x0900) */
 38#define VIDEO_FIRST_V7 0x0900
 39
 40/* Special video modes */
 41#define VIDEO_FIRST_SPECIAL 0x0f00
 42#define VIDEO_80x25 0x0f00
 43#define VIDEO_8POINT 0x0f01
 44#define VIDEO_80x43 0x0f02
 45#define VIDEO_80x28 0x0f03
 46#define VIDEO_CURRENT_MODE 0x0f04
 47#define VIDEO_80x30 0x0f05
 48#define VIDEO_80x34 0x0f06
 49#define VIDEO_80x60 0x0f07
 50#define VIDEO_GFX_HACK 0x0f08
 51#define VIDEO_LAST_SPECIAL 0x0f09
 52
 53/* Video modes given by resolution */
 54#define VIDEO_FIRST_RESOLUTION 0x1000
 55
 56/* The "recalculate timings" flag */
 57#define VIDEO_RECALC 0x8000
 58
 59void store_screen(void);
 60#define DO_STORE() store_screen()
 61
 62/*
 63 * Mode table structures
 64 */
 65
 66struct mode_info {
 67	u16 mode;		/* Mode number (vga= style) */
 68	u16 x, y;		/* Width, height */
 69	u16 depth;		/* Bits per pixel, 0 for text mode */
 70};
 71
 72struct card_info {
 73	const char *card_name;
 74	int (*set_mode)(struct mode_info *mode);
 75	int (*probe)(void);
 76	struct mode_info *modes;
 77	int nmodes;		/* Number of probed modes so far */
 78	int unsafe;		/* Probing is unsafe, only do after "scan" */
 79	u16 xmode_first;	/* Unprobed modes to try to call anyway */
 80	u16 xmode_n;		/* Size of unprobed mode range */
 81};
 82
 83#define __videocard struct card_info __attribute__((section(".videocards")))
 84extern struct card_info video_cards[], video_cards_end[];
 85
 86int mode_defined(u16 mode);	/* video.c */
 87
 88/* Basic video information */
 89#define ADAPTER_CGA	0	/* CGA/MDA/HGC */
 90#define ADAPTER_EGA	1
 91#define ADAPTER_VGA	2
 92
 93extern int adapter;
 94extern u16 video_segment;
 95extern int force_x, force_y;	/* Don't query the BIOS for cols/rows */
 96extern int do_restore;		/* Restore screen contents */
 97extern int graphic_mode;	/* Graphics mode with linear frame buffer */
 98
 99/* Accessing VGA indexed registers */
100static inline u8 in_idx(u16 port, u8 index)
101{
102	outb(index, port);
103	return inb(port+1);
104}
105
106static inline void out_idx(u8 v, u16 port, u8 index)
107{
108	outw(index+(v << 8), port);
109}
110
111/* Writes a value to an indexed port and then reads the port again */
112static inline u8 tst_idx(u8 v, u16 port, u8 index)
113{
114	out_idx(port, index, v);
115	return in_idx(port, index);
116}
117
118/* Get the I/O port of the VGA CRTC */
119u16 vga_crtc(void);		/* video-vga.c */
120
121#endif /* BOOT_VIDEO_H */
v5.4
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/* -*- linux-c -*- ------------------------------------------------------- *
  3 *
  4 *   Copyright (C) 1991, 1992 Linus Torvalds
  5 *   Copyright 2007 rPath, Inc. - All Rights Reserved
  6 *
 
 
 
  7 * ----------------------------------------------------------------------- */
  8
  9/*
 10 * Header file for the real-mode video probing code
 11 */
 12
 13#ifndef BOOT_VIDEO_H
 14#define BOOT_VIDEO_H
 15
 16#include <linux/types.h>
 17
 18/*
 19 * This code uses an extended set of video mode numbers. These include:
 20 * Aliases for standard modes
 21 *      NORMAL_VGA (-1)
 22 *      EXTENDED_VGA (-2)
 23 *      ASK_VGA (-3)
 24 * Video modes numbered by menu position -- NOT RECOMMENDED because of lack
 25 * of compatibility when extending the table. These are between 0x00 and 0xff.
 26 */
 27#define VIDEO_FIRST_MENU 0x0000
 28
 29/* Standard BIOS video modes (BIOS number + 0x0100) */
 30#define VIDEO_FIRST_BIOS 0x0100
 31
 32/* VESA BIOS video modes (VESA number + 0x0200) */
 33#define VIDEO_FIRST_VESA 0x0200
 34
 35/* Video7 special modes (BIOS number + 0x0900) */
 36#define VIDEO_FIRST_V7 0x0900
 37
 38/* Special video modes */
 39#define VIDEO_FIRST_SPECIAL 0x0f00
 40#define VIDEO_80x25 0x0f00
 41#define VIDEO_8POINT 0x0f01
 42#define VIDEO_80x43 0x0f02
 43#define VIDEO_80x28 0x0f03
 44#define VIDEO_CURRENT_MODE 0x0f04
 45#define VIDEO_80x30 0x0f05
 46#define VIDEO_80x34 0x0f06
 47#define VIDEO_80x60 0x0f07
 48#define VIDEO_GFX_HACK 0x0f08
 49#define VIDEO_LAST_SPECIAL 0x0f09
 50
 51/* Video modes given by resolution */
 52#define VIDEO_FIRST_RESOLUTION 0x1000
 53
 54/* The "recalculate timings" flag */
 55#define VIDEO_RECALC 0x8000
 56
 57void store_screen(void);
 58#define DO_STORE() store_screen()
 59
 60/*
 61 * Mode table structures
 62 */
 63
 64struct mode_info {
 65	u16 mode;		/* Mode number (vga= style) */
 66	u16 x, y;		/* Width, height */
 67	u16 depth;		/* Bits per pixel, 0 for text mode */
 68};
 69
 70struct card_info {
 71	const char *card_name;
 72	int (*set_mode)(struct mode_info *mode);
 73	int (*probe)(void);
 74	struct mode_info *modes;
 75	int nmodes;		/* Number of probed modes so far */
 76	int unsafe;		/* Probing is unsafe, only do after "scan" */
 77	u16 xmode_first;	/* Unprobed modes to try to call anyway */
 78	u16 xmode_n;		/* Size of unprobed mode range */
 79};
 80
 81#define __videocard struct card_info __attribute__((used,section(".videocards")))
 82extern struct card_info video_cards[], video_cards_end[];
 83
 84int mode_defined(u16 mode);	/* video.c */
 85
 86/* Basic video information */
 87#define ADAPTER_CGA	0	/* CGA/MDA/HGC */
 88#define ADAPTER_EGA	1
 89#define ADAPTER_VGA	2
 90
 91extern int adapter;
 
 92extern int force_x, force_y;	/* Don't query the BIOS for cols/rows */
 93extern int do_restore;		/* Restore screen contents */
 94extern int graphic_mode;	/* Graphics mode with linear frame buffer */
 95
 96/* Accessing VGA indexed registers */
 97static inline u8 in_idx(u16 port, u8 index)
 98{
 99	outb(index, port);
100	return inb(port+1);
101}
102
103static inline void out_idx(u8 v, u16 port, u8 index)
104{
105	outw(index+(v << 8), port);
106}
107
108/* Writes a value to an indexed port and then reads the port again */
109static inline u8 tst_idx(u8 v, u16 port, u8 index)
110{
111	out_idx(port, index, v);
112	return in_idx(port, index);
113}
114
115/* Get the I/O port of the VGA CRTC */
116u16 vga_crtc(void);		/* video-vga.c */
117
118#endif /* BOOT_VIDEO_H */