OurOS 0.1
Operating System built by McGill Students
 
Loading...
Searching...
No Matches
hal.c File Reference
#include <stddef.h>
#include "hal.h"
#include "limine.h"
#include "color.h"

Functions

int hal_init (void)
 Initialize the frame buffer.
 
void hal_putpixel (uint32_t x, uint32_t y, color_t color)
 Draw a pixel to the screen.
 
void hal_fillrect (uint32_t x, uint32_t y, uint32_t w, uint32_t h, color_t color)
 Draw a rectangle to the screen.
 
uint64_t hal_width (void)
 Get screen width.
 
uint64_t hal_height (void)
 Get screen height.
 

Variables

static struct limine_framebuffer * fb = NULL
 
static volatile struct limine_framebuffer_request frame_buf_req
 

Function Documentation

◆ hal_fillrect()

void hal_fillrect ( uint32_t  x,
uint32_t  y,
uint32_t  w,
uint32_t  h,
color_t  color 
)

Draw a rectangle to the screen.

Parameters
xPixels from left edge of screen to left edge of rectangle
yPixels from top edge of screen to top edge of rectangle
wWidth of rectangle in pixels
hHeight of rectangle in pixels
colorColor value to set all pixels within the rectangle to

◆ hal_height()

uint64_t hal_height ( void  )

Get screen height.

Returns
Height of the screen in pixels

◆ hal_init()

int hal_init ( void  )

Initialize the frame buffer.

This should be called before any other function in this header, otherwise the behavior is undefined.

Returns
0 on success, non-zero on error

◆ hal_putpixel()

void hal_putpixel ( uint32_t  x,
uint32_t  y,
color_t  color 
)

Draw a pixel to the screen.

Parameters
xPixels from left edge
yPixels from top edge
colorColor value to set the pixel to

◆ hal_width()

uint64_t hal_width ( void  )

Get screen width.

Returns
Width of the screen in pixels

Variable Documentation

◆ fb

struct limine_framebuffer* fb = NULL
static

◆ frame_buf_req

volatile struct limine_framebuffer_request frame_buf_req
static
Initial value:
= {
.response = NULL,
.revision = 0,
}
#define LIMINE_FRAMEBUFFER_REQUEST_ID
Definition limine.h:158
#define NULL
Definition stddef.h:4