OurOS 0.1
Operating System built by McGill Students
 
Loading...
Searching...
No Matches
hal.h File Reference

Drawing to the frame buffer. More...

#include <stdint.h>
#include "color.h"

Go to the source code of this file.

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.
 

Detailed Description

Drawing to the frame buffer.

The HAL (hardware abstraction layer) generally provides a way for other parts of the OS to interact with low-lever hardware functions without needing to know details specific to a particular platform.

In this case, the HAL provides a generatic way to draw pixels to the screen.

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