mirror of
https://github.com/gbowne1/ClassicOS.git
synced 2026-03-09 08:25:19 -07:00
Compare commits
10 Commits
gbowne1-pa
...
gbowne1-ad
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c69b5fd6a | |||
| 1037ba4f54 | |||
| 745deeddde | |||
| f9e281a7ae | |||
| 18801a742f | |||
| a08648eff5 | |||
| 5a664c6e31 | |||
| 4c7de228f9 | |||
| cca6aafd65 | |||
| 49c1bad935 |
@@ -1,24 +0,0 @@
|
||||
BasedOnStyle: Google
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
ColumnLimit: 80
|
||||
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Right
|
||||
ReferenceAlignment: Right
|
||||
|
||||
AlignConsecutiveMacros: Consecutive
|
||||
AlignTrailingComments:
|
||||
Kind: Always
|
||||
OverEmptyLines: 0
|
||||
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
# Std headers
|
||||
- Regex: '<[[:alnum:]_.]+>'
|
||||
Priority: 2
|
||||
|
||||
# Other headers
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
6
.clangd
6
.clangd
@@ -1,6 +0,0 @@
|
||||
CompileFlags:
|
||||
CompilationDatabase: build
|
||||
|
||||
Diagnostics:
|
||||
UnusedIncludes: Strict
|
||||
MissingIncludes: Strict
|
||||
@@ -1,12 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
tab_width = 8
|
||||
6
Makefile
6
Makefile
@@ -18,9 +18,9 @@ KERNEL_OBJ += $(patsubst kernel/%.asm, $(BUILD_DIR)/asm_%.o, $(KERNEL_ASM_SRC))
|
||||
KLIBC_SRC = $(wildcard klibc/src/*.c)
|
||||
KLIBC_OBJ = $(patsubst klibc/src/%.c, $(BUILD_DIR)/klibc/%.o, $(KLIBC_SRC))
|
||||
|
||||
.PHONY: all stage1 stage2 kernel compile-commands $(BUILD_DIR)/compile_commands.json run gdb clean clean-cross clean-all
|
||||
all: $(DISK_IMG)
|
||||
|
||||
.PHONY: stage1 stage2 kernel run gdb clean
|
||||
stage1: $(BUILD_DIR)
|
||||
$(AS) $(ASFLAGS) -o $(BUILD_DIR)/$@.o bootloader/$@.asm
|
||||
$(LD) -Ttext=0x7c00 -melf_i386 -o $(BUILD_DIR)/$@.elf $(BUILD_DIR)/$@.o
|
||||
@@ -57,10 +57,6 @@ $(BUILD_DIR):
|
||||
mkdir -p $@
|
||||
mkdir -p $(BUILD_DIR)/klibc
|
||||
|
||||
compile-commands: $(BUILD_DIR)/compile_commands.json
|
||||
$(BUILD_DIR)/compile_commands.json: $(BUILD_DIR)
|
||||
bear --output $@ -- make -B
|
||||
|
||||
run:
|
||||
qemu-system-i386 -s -S $(DISK_IMG)
|
||||
|
||||
|
||||
65
kernel/hid.c
Normal file
65
kernel/hid.c
Normal file
@@ -0,0 +1,65 @@
|
||||
#include "hid.h"
|
||||
#include "usb.h"
|
||||
#include "mouse.h"
|
||||
#include "keyboard.h"
|
||||
#include "print.h"
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
// Global variables
|
||||
static bool hid_initialized = false;
|
||||
|
||||
void hid_init(void) {
|
||||
if (hid_initialized) return;
|
||||
hid_initialized = true;
|
||||
|
||||
// Initialize keyboard and mouse HID handling
|
||||
keyboard_init();
|
||||
// Assume USB mouse has been initialized and is connected.
|
||||
usb_hid_init(); // Initializes USB HID for both keyboard and mouse
|
||||
}
|
||||
|
||||
void hid_process_report(uint8_t* report, uint8_t length) {
|
||||
// Process the HID report based on its type
|
||||
if (length == 8) { // Assuming a standard 8-byte report for HID keyboard
|
||||
keyboard_hid_report_t* k_report = (keyboard_hid_report_t*) report;
|
||||
hid_process_keyboard_report(k_report);
|
||||
} else if (length == 3) { // Assuming a standard 3-byte report for HID mouse
|
||||
mouse_hid_report_t* m_report = (mouse_hid_report_t*) report;
|
||||
hid_process_mouse_report(m_report);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle HID keyboard report
|
||||
void hid_process_keyboard_report(const keyboard_hid_report_t* report) {
|
||||
// Iterate over the keycodes and process key presses
|
||||
for (int i = 0; i < 6; i++) {
|
||||
uint8_t keycode = report->keycodes[i];
|
||||
if (keycode != 0) {
|
||||
char key = scancode_map[keycode];
|
||||
if (key) {
|
||||
keyboard_buffer_add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle HID mouse report
|
||||
void hid_process_mouse_report(const mouse_hid_report_t* report) {
|
||||
// Process mouse movement and button clicks
|
||||
mouse_data.x += report->x;
|
||||
mouse_data.y += report->y;
|
||||
mouse_data.left_button = (report->buttons & 0x01) != 0;
|
||||
mouse_data.right_button = (report->buttons & 0x02) != 0;
|
||||
|
||||
print_hex((uint32_t)mouse_data.x, 1, 1);
|
||||
print_hex((uint32_t)mouse_data.y, 1, 1);
|
||||
print_hex((uint32_t)report->buttons, 1, 1);
|
||||
}
|
||||
|
||||
// Parse the HID descriptor (for parsing USB HID device descriptors)
|
||||
bool hid_parse_descriptor(uint8_t* descriptor, uint32_t length) {
|
||||
// HID descriptors are defined in the USB HID specification, we'll need to parse them here.
|
||||
// For now, just return true assuming we have a valid descriptor.
|
||||
return true;
|
||||
}
|
||||
46
kernel/hid.h
Normal file
46
kernel/hid.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef HID_H
|
||||
#define HID_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
// HID Report types
|
||||
#define HID_REPORT_INPUT 0x01
|
||||
#define HID_REPORT_OUTPUT 0x02
|
||||
#define HID_REPORT_FEATURE 0x03
|
||||
|
||||
// HID usage page constants (USB HID)
|
||||
#define HID_USAGE_PAGE_GENERIC 0x01
|
||||
#define HID_USAGE_KEYBOARD 0x06
|
||||
#define HID_USAGE_MOUSE 0x02
|
||||
|
||||
// HID keyboard and mouse data
|
||||
typedef struct {
|
||||
uint8_t modifier; // Modifier keys (shift, ctrl, alt, etc.)
|
||||
uint8_t reserved; // Reserved byte
|
||||
uint8_t keycodes[6]; // Keycodes for keys pressed
|
||||
} keyboard_hid_report_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t buttons; // Mouse buttons (bitwise: 0x01 = left, 0x02 = right, 0x04 = middle)
|
||||
int8_t x; // X axis movement
|
||||
int8_t y; // Y axis movement
|
||||
int8_t wheel; // Mouse wheel
|
||||
} mouse_hid_report_t;
|
||||
|
||||
// Initialize the HID subsystem
|
||||
void hid_init(void);
|
||||
|
||||
// Process an incoming HID report
|
||||
void hid_process_report(uint8_t* report, uint8_t length);
|
||||
|
||||
// Process HID keyboard report
|
||||
void hid_process_keyboard_report(const keyboard_hid_report_t* report);
|
||||
|
||||
// Process HID mouse report
|
||||
void hid_process_mouse_report(const mouse_hid_report_t* report);
|
||||
|
||||
// USB HID report descriptor parsing
|
||||
bool hid_parse_descriptor(uint8_t* descriptor, uint32_t length);
|
||||
|
||||
#endif // HID_H
|
||||
@@ -2,64 +2,91 @@
|
||||
#include "io.h"
|
||||
#include "isr.h"
|
||||
#include "terminal.h"
|
||||
#include <stddef.h>
|
||||
|
||||
#define KEYBOARD_DATA_PORT 0x60
|
||||
#define KEY_BUFFER_SIZE 256
|
||||
|
||||
static char key_buffer[KEY_BUFFER_SIZE];
|
||||
static uint8_t buffer_head = 0; // Write position (interrupt)
|
||||
static uint8_t buffer_tail = 0; // Read position (get_char)
|
||||
static uint8_t buffer_count = 0;
|
||||
static uint8_t buffer_index = 0;
|
||||
// Use volatile so the compiler knows these change inside interrupts
|
||||
static volatile char key_buffer[KEY_BUFFER_SIZE];
|
||||
static volatile uint8_t buffer_head = 0;
|
||||
static volatile uint8_t buffer_tail = 0;
|
||||
static volatile uint8_t buffer_count = 0;
|
||||
|
||||
// Basic US QWERTY keymap (scancode to ASCII)
|
||||
static const char scancode_map[128] = {
|
||||
0, 27, '1', '2', '3', '4', '5', '6', '7', '8', // 0x00 - 0x09
|
||||
'9', '0', '-', '=', '\b', '\t', 'q', 'w', 'e', 'r', // 0x0A - 0x13
|
||||
't', 'y', 'z', 'u', 'i', 'o', 'p', '[', ']', '\n', // 0x14 - 0x1D
|
||||
0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', // 0x1E - 0x27
|
||||
';', '\'', '`', 0, '\\', 'x', 'c', 'v', 'b', // 0x28 - 0x31
|
||||
'n', 'm', ',', '.', '/', 0, '*', 0, ' ', 0, // 0x32 - 0x3B
|
||||
// rest can be filled as needed
|
||||
// Exported map: Removed 'static' so hid.c can reference it if needed
|
||||
const char scancode_map[128] = {
|
||||
0, 27, '1', '2', '3', '4', '5', '6', '7', '8',
|
||||
'9', '0', '-', '=', '\b', '\t', 'q', 'w', 'e', 'r',
|
||||
't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', 0,
|
||||
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
|
||||
'\'', '`', 0, '\\', 'z', 'x', 'c', 'v', 'b', 'n',
|
||||
'm', ',', '.', '/', 0, '*', 0, ' ', 0
|
||||
};
|
||||
|
||||
// Interrupt handler for IRQ1
|
||||
void keyboard_callback(void) {
|
||||
uint8_t scancode = inb(KEYBOARD_DATA_PORT);
|
||||
|
||||
if (scancode & 0x80) return; // Ignore key release
|
||||
|
||||
char c = scancode_map[scancode];
|
||||
/**
|
||||
* Shared function used by both PS/2 (callback) and USB (hid.c)
|
||||
* This fixes the "undefined reference to keyboard_buffer_add" error.
|
||||
*/
|
||||
void keyboard_buffer_add(char c) {
|
||||
if (!c) return;
|
||||
|
||||
uint8_t next_head = (buffer_head + 1) % KEY_BUFFER_SIZE;
|
||||
|
||||
// Drop key if buffer full
|
||||
if (next_head == buffer_tail) return;
|
||||
// If buffer is full, we must drop the key
|
||||
if (next_head == buffer_tail) {
|
||||
return;
|
||||
}
|
||||
|
||||
key_buffer[buffer_head] = c;
|
||||
buffer_head = next_head;
|
||||
buffer_count++;
|
||||
|
||||
// Echo to terminal
|
||||
terminal_putchar(c);
|
||||
}
|
||||
|
||||
void keyboard_init() {
|
||||
register_interrupt_handler(33, keyboard_callback); // IRQ1 = int 33 (0x21)
|
||||
/**
|
||||
* Hardware Interrupt Handler for PS/2
|
||||
*/
|
||||
void keyboard_callback(void) {
|
||||
uint8_t scancode = inb(KEYBOARD_DATA_PORT);
|
||||
|
||||
// Ignore break codes (key release)
|
||||
if (scancode & 0x80) return;
|
||||
|
||||
char c = scancode_map[scancode];
|
||||
keyboard_buffer_add(c);
|
||||
}
|
||||
|
||||
// Blocking read (returns one char)
|
||||
void keyboard_init(void) {
|
||||
buffer_head = 0;
|
||||
buffer_tail = 0;
|
||||
buffer_count = 0;
|
||||
// IRQ1 is usually mapped to IDT entry 33
|
||||
register_interrupt_handler(33, keyboard_callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocking read with a safe HLT to prevent CPU 100% usage
|
||||
*/
|
||||
char keyboard_get_char(void) {
|
||||
while (buffer_count == 0) {
|
||||
__asm__ __volatile__("hlt"); // Better than busy loop
|
||||
}
|
||||
|
||||
char c;
|
||||
__asm__ __volatile__("cli");
|
||||
c = key_buffer[buffer_tail];
|
||||
buffer_tail = (buffer_tail + 1) % KEY_BUFFER_SIZE;
|
||||
buffer_count--;
|
||||
__asm__ __volatile__("sti");
|
||||
|
||||
return c;
|
||||
while (1) {
|
||||
__asm__ __volatile__("cli"); // Disable interrupts to check buffer_count safely
|
||||
|
||||
if (buffer_count > 0) {
|
||||
c = key_buffer[buffer_tail];
|
||||
buffer_tail = (buffer_tail + 1) % KEY_BUFFER_SIZE;
|
||||
buffer_count--;
|
||||
__asm__ __volatile__("sti"); // Re-enable interrupts after reading
|
||||
return c;
|
||||
}
|
||||
|
||||
/* * IMPORTANT: 'sti' followed by 'hlt' is guaranteed by x86
|
||||
* to execute 'hlt' BEFORE the next interrupt can trigger.
|
||||
* This prevents the race condition hang.
|
||||
*/
|
||||
__asm__ __volatile__("sti; hlt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#ifndef KEYBOARD_H
|
||||
#define KEYBOARD_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void keyboard_init(void);
|
||||
char keyboard_get_char(void); // Blocking read from buffer
|
||||
void keyboard_buffer_add(char c);
|
||||
char keyboard_get_char(void);
|
||||
|
||||
extern const char scancode_map[128];
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
// Mouse buffer
|
||||
static mouse_data_t mouse_data;
|
||||
mouse_data_t mouse_data;
|
||||
|
||||
// Read USB mouse data
|
||||
mouse_data_t usb_read_mouse(void) {
|
||||
|
||||
@@ -12,6 +12,8 @@ typedef struct {
|
||||
bool right_button;
|
||||
} mouse_data_t;
|
||||
|
||||
extern mouse_data_t mouse_data;
|
||||
|
||||
// Function declarations for USB 1.x HID mouse support
|
||||
bool usb_mouse_init(void);
|
||||
bool usb_mouse_detected(void);
|
||||
|
||||
112
kernel/vesa.c
112
kernel/vesa.c
@@ -1,112 +0,0 @@
|
||||
#include <stddef.h>
|
||||
#include "vesa.h"
|
||||
#include "io.h"
|
||||
#include "print.h"
|
||||
|
||||
// VESA mode and controller information
|
||||
#define VESA_BIOS_INT 0x10
|
||||
#define VESA_BIOS_FUNC 0x4F
|
||||
|
||||
// Function to call BIOS with specific VESA function
|
||||
static bool vesa_bios_call(uint16_t function, uint16_t* eax, uint32_t* ebx, uint32_t* ecx, uint32_t* edx) {
|
||||
// Set up registers for VESA function call
|
||||
__asm__ __volatile__(
|
||||
"movw %1, %%ax\n" // Move function number into AX
|
||||
"int $0x10\n" // Call BIOS interrupt 0x10 (VESA)
|
||||
"movw %%ax, %0\n" // Move return value in AX to the return variable
|
||||
: "=m"(*eax) // Output operand (eax)
|
||||
: "m"(function) // Input operand (function number)
|
||||
: "%eax", "%ebx", "%ecx", "%edx", "memory"
|
||||
);
|
||||
// Check for success (return values vary depending on the function)
|
||||
return *eax == 0x004F;
|
||||
}
|
||||
|
||||
// Set the VESA video mode
|
||||
bool vesa_set_mode(uint16_t mode) {
|
||||
uint16_t eax = VBE_FUNCTION_SET_MODE;
|
||||
uint32_t ebx = mode;
|
||||
uint32_t ecx = 0;
|
||||
uint32_t edx = 0;
|
||||
|
||||
if (vesa_bios_call(VBE_FUNCTION_SET_MODE, &eax, &ebx, &ecx, &edx)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the VESA mode information
|
||||
bool vesa_get_mode_info(uint16_t mode, vbe_mode_info_t* info) {
|
||||
uint16_t ax_ret;
|
||||
|
||||
// Convert the 32-bit pointer to a Segment:Offset pair
|
||||
// IMPORTANT: 'info' MUST be located in the first 1MB of RAM
|
||||
uint32_t ptr = (uint32_t)info;
|
||||
uint16_t segment = (uint16_t)((ptr >> 4) & 0xFFFF);
|
||||
uint16_t offset = (uint16_t)(ptr & 0x000F);
|
||||
|
||||
__asm__ __volatile__(
|
||||
"push %%es\n\t" // Save Protected Mode ES
|
||||
"movw %1, %%es\n\t" // Load the segment into ES
|
||||
"int $0x10\n\t" // BIOS Interrupt
|
||||
"pop %%es\n\t" // Restore Protected Mode ES
|
||||
: "=a"(ax_ret) // Result in AX
|
||||
: "r"(segment), // %1
|
||||
"D"(offset), // %2 (DI)
|
||||
"a"((uint16_t)VBE_FUNCTION_GET_MODE_INFO), // AX (0x4F01)
|
||||
"c"(mode) // CX (The Mode Number)
|
||||
: "memory", "cc" // Removed %es from clobbers
|
||||
);
|
||||
|
||||
return ax_ret == 0x004F;
|
||||
}
|
||||
|
||||
bool vesa_get_controller_info(vbe_controller_info_t* info) {
|
||||
uint16_t ax_ret;
|
||||
|
||||
// We must use Segment:Offset for BIOS
|
||||
uint32_t ptr = (uint32_t)info;
|
||||
uint16_t segment = (uint16_t)((ptr >> 4) & 0xF000); // Base segment
|
||||
uint16_t offset = (uint16_t)(ptr & 0xFFFF); // Offset
|
||||
|
||||
// Copy "VBE2" into signature to tell BIOS we want VBE 2.0+ info
|
||||
info->Signature[0] = 'V';
|
||||
info->Signature[1] = 'B';
|
||||
info->Signature[2] = 'E';
|
||||
info->Signature[3] = '2';
|
||||
|
||||
// To fix the error: Do not use %es in clobber.
|
||||
// Use a temporary register or a push/pop sequence if we MUST touch ES.
|
||||
__asm__ __volatile__(
|
||||
"push %%es\n\t"
|
||||
"movw %1, %%es\n\t"
|
||||
"int $0x10\n\t"
|
||||
"pop %%es\n\t"
|
||||
: "=a"(ax_ret)
|
||||
: "r"(segment), "D"(offset), "a"(0x4F00)
|
||||
: "memory", "cc"
|
||||
);
|
||||
|
||||
return ax_ret == 0x004F;
|
||||
}
|
||||
|
||||
// Return pointer to the VESA framebuffer
|
||||
void* vesa_get_framebuffer(void) {
|
||||
vbe_mode_info_t mode_info;
|
||||
if (vesa_get_mode_info(0x101, &mode_info)) {
|
||||
return (void*)mode_info.PhysBasePtr;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Clear the screen with a color
|
||||
void vesa_clear_screen(uint32_t color) {
|
||||
uint32_t* framebuffer = (uint32_t*)vesa_get_framebuffer();
|
||||
if (framebuffer) {
|
||||
for (int y = 0; y < 480; y++) { // For 640x480 mode
|
||||
for (int x = 0; x < 640; x++) {
|
||||
framebuffer[y * 640 + x] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
#ifndef VESA_H
|
||||
#define VESA_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
// VESA BIOS Extension 2.0 Function Calls
|
||||
#define VBE_FUNCTION_SET_MODE 0x4F02
|
||||
#define VBE_FUNCTION_GET_MODE_INFO 0x4F01
|
||||
#define VBE_FUNCTION_GET_CONTROLLER_INFO 0x4F00
|
||||
#define VBE_FUNCTION_SET_DISPLAY_START 0x4F05
|
||||
|
||||
// VESA Mode Information Structure (VBE 2.0)
|
||||
typedef struct {
|
||||
uint16_t ModeAttributes; // Mode attributes
|
||||
uint8_t WinAAttributes; // Window A attributes
|
||||
uint8_t WinBAttributes; // Window B attributes
|
||||
uint16_t WinGranularity; // Window granularity
|
||||
uint16_t WinSize; // Window size
|
||||
uint16_t WinASegment; // Window A segment address
|
||||
uint16_t WinBSegment; // Window B segment address
|
||||
uint32_t WinFuncPtr; // Function pointer for window
|
||||
uint16_t BytesPerScanLine; // Bytes per scanline
|
||||
uint16_t XResolution; // Horizontal resolution in pixels
|
||||
uint16_t YResolution; // Vertical resolution in pixels
|
||||
uint8_t XCharSize; // Character cell width
|
||||
uint8_t YCharSize; // Character cell height
|
||||
uint8_t NumberOfPlanes; // Number of memory planes
|
||||
uint8_t BitsPerPixel; // Bits per pixel
|
||||
uint8_t NumberOfBanks; // Number of banks
|
||||
uint8_t MemoryModel; // Memory model type
|
||||
uint8_t BankSize; // Bank size in kB
|
||||
uint8_t NumberOfImagePages; // Number of image pages
|
||||
uint8_t Reserved0; // Reserved
|
||||
uint8_t RedMaskSize; // Red mask size
|
||||
uint8_t RedFieldPosition; // Red field position
|
||||
uint8_t GreenMaskSize; // Green mask size
|
||||
uint8_t GreenFieldPosition; // Green field position
|
||||
uint8_t BlueMaskSize; // Blue mask size
|
||||
uint8_t BlueFieldPosition; // Blue field position
|
||||
uint8_t RsvdMaskSize; // Reserved mask size
|
||||
uint8_t RsvdFieldPosition; // Reserved field position
|
||||
uint8_t DirectColorModeInfo; // Direct color mode info
|
||||
uint32_t PhysBasePtr; // Physical base address of the linear framebuffer
|
||||
uint32_t OffScreenMemOff; // Offset to off-screen memory
|
||||
uint16_t OffScreenMemSize; // Size of off-screen memory
|
||||
uint8_t Reserved1[206]; // Reserved
|
||||
} __attribute__((packed)) vbe_mode_info_t;
|
||||
|
||||
// VESA Controller Information
|
||||
|
||||
typedef struct {
|
||||
char Signature[4]; // Should be "VESA" (or "VBE2" for request)
|
||||
uint16_t Version; // VBE version; high byte is major, low is minor
|
||||
uint32_t OEMStringPtr; // Segment:Offset pointer to OEM string
|
||||
uint32_t Capabilities; // Capabilities of graphics controller
|
||||
uint32_t VideoModePtr; // Segment:Offset pointer to supported modes list
|
||||
uint16_t TotalMemory; // Number of 64KB memory blocks
|
||||
uint16_t OEMSoftwareRev; // VBE implementation Software revision
|
||||
uint32_t OEMVendorNamePtr; // Segment:Offset pointer to Vendor Name string
|
||||
uint32_t OEMProductNamePtr; // Segment:Offset pointer to Product Name string
|
||||
uint32_t OEMProductRevPtr; // Segment:Offset pointer to Product Revision string
|
||||
uint8_t Reserved[222]; // Reserved for VBE implementation scratch area
|
||||
uint8_t OEMData[256]; // Data area for OEM strings
|
||||
} __attribute__((packed)) vbe_controller_info_t;
|
||||
|
||||
// Function Prototypes
|
||||
bool vesa_set_mode(uint16_t mode);
|
||||
bool vesa_get_mode_info(uint16_t mode, vbe_mode_info_t* info);
|
||||
bool vesa_get_controller_info(vbe_controller_info_t* info);
|
||||
void* vesa_get_framebuffer(void);
|
||||
void vesa_clear_screen(uint32_t color);
|
||||
|
||||
#endif // VESA_H
|
||||
Reference in New Issue
Block a user