build system refresh

This commit is contained in:
2026-07-16 16:09:12 -05:00
parent b588634253
commit 3246dbbd19
49 changed files with 185 additions and 203 deletions

View File

@@ -2,6 +2,8 @@
#include <drivers/ps2/ps2.h>
#include <vfs.h>
static const char scancode_to_ascii[] = {
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',
@@ -73,7 +75,11 @@ int init_ps2() {
write_ccb(ccb);
return 0;
}
}
void ps2_init_kbd(vfs_node_t* dev) {
}
char ps2_get_ascii(uint8_t scancode) {
if (scancode & 0x80) {
@@ -88,4 +94,5 @@ char ps2_get_ascii(uint8_t scancode) {
}
return 0;
}
}

View File

@@ -18,8 +18,10 @@
#ifndef __ASSEMBLER__
#include <stdint.h>
#include <vfs.h>
int init_ps2();
void ps2_init_kbd(vfs_node_t* dev);
uint8_t ps2_read_data();
char ps2_get_ascii(uint8_t scancode);

View File

@@ -2,7 +2,7 @@
#include <stddef.h>
#include <stdint.h>
#include <lib/stream.h>
#include <lib/print.h>
#include <drivers/vga/vga.h>
#include <drivers/serial/serial.h>
@@ -10,7 +10,7 @@
#include <common.h>
#include <memory/mm.h>
#include <user/video.h>
#include <sys/video.h>
static uint32_t framebuffer_address;
static uint32_t framebuffer_width;
@@ -19,25 +19,11 @@ static uint32_t framebuffer_total_pixels;
static uint32_t framebuffer_pitch;
static uint32_t framebuffer_bpp;
static uint8_t red_mask_sz;
static uint8_t red_field_pos;
static uint8_t green_mask_sz;
static uint8_t green_field_pos;
static uint8_t blue_mask_sz;
static uint8_t blue_field_pos;
static uint32_t create_pixel(uint8_t r, uint8_t g, uint8_t b) {
return (r >> (8 - red_mask_sz)) << red_field_pos
| (g >> (8 - green_mask_sz)) << green_field_pos
| (b >> (8 - blue_mask_sz)) << blue_field_pos;
}
vga_color_t VGA_COLOR_BLACK = {0, 0, 0, 255};
vga_color_t VGA_COLOR_RED = {0, 0, 255, 255};
vga_color_t VGA_COLOR_GREEN = {0, 255, 0, 255};
vga_color_t VGA_COLOR_BLUE = {255, 0, 0, 255};
uint32_t vga_mmap(vfs_node_t* node, uint32_t address) {
uint32_t fb_size_bytes = framebuffer_height * framebuffer_pitch;
uint32_t num_pages = (fb_size_bytes + 4095) / 4096;
@@ -77,6 +63,8 @@ void vga_init(
framebuffer_pitch = fb_pitch;
framebuffer_bpp = fb_bpp;
kprintf("mapping vga pages\n");
uint32_t fb_size_bytes = fb_height * fb_pitch;
uint32_t num_pages = (fb_size_bytes + 4095) / 4096;
for (uint32_t i = 0; i < num_pages; i++) {
@@ -113,9 +101,7 @@ uint8_t vga_get_bpp() {
}
void vga_clear_scrn(uint32_t color) {
if (framebuffer_address == 0) return;
uint8_t* fb_bytes = (uint8_t*)framebuffer_address;
uint8_t* fb_bytes = (uint8_t*)VGA_FRAMEBUFFER;
uint8_t bytes_per_pixel = framebuffer_bpp / 8;
for (uint32_t y = 0; y < framebuffer_height; y++) {