build system refresh
This commit is contained in:
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user