42 lines
852 B
C
Executable File
42 lines
852 B
C
Executable File
#ifndef VRAM_H
|
|
#define VRAM_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "boot/typedef.h"
|
|
|
|
typedef int32_t vram_handle_t;
|
|
|
|
typedef struct {
|
|
uint32_t offset;
|
|
uint32_t size;
|
|
bool is_free;
|
|
vram_handle_t id;
|
|
} vram_block_t;
|
|
|
|
typedef struct {
|
|
uint8_t* base_ptr;
|
|
uint32_t capacity;
|
|
vram_block_t* blocks;
|
|
int blocks_count;
|
|
int max_blocks;
|
|
vram_handle_t next_id;
|
|
} vram_manager_t;
|
|
|
|
|
|
extern vram_manager_t *vram_sys;
|
|
|
|
int init_vram(apios_main_table_t *apios_table_);
|
|
vram_handle_t vram_alloc(uint32_t size);
|
|
void vram_free(vram_handle_t handle);
|
|
void* vram_get_ptr(vram_handle_t handle);
|
|
int vram_write(vram_handle_t handle, const void* src, uint32_t size);
|
|
int vram_read(vram_handle_t handle, void* dst, uint32_t size);
|
|
void vram_defrag();
|
|
|
|
|
|
|
|
#endif
|