OurOS 0.1
Operating System built by McGill Students
 
Loading...
Searching...
No Matches
hal.h
Go to the documentation of this file.
1/**
2 * @file hal.h
3 * @brief Drawing to the frame buffer
4 *
5 * The HAL (hardware abstraction layer) generally provides a way for other parts of the
6 * OS to interact with low-lever hardware functions without needing to know details
7 * specific to a particular platform.
8 *
9 * In this case, the HAL provides a generatic way to draw pixels to the screen.
10 */
11#ifndef _HAL_H
12#define _HAL_H
13
14#include <stdint.h>
15#include "color.h"
16
17/**
18 * @brief Initialize the frame buffer
19 *
20 * This should be called before any other function in this header, otherwise the behavior
21 * is undefined.
22 *
23 * @return 0 on success, non-zero on error
24 */
25int hal_init(void);
26
27/**
28 * @brief Draw a pixel to the screen
29 * @param x Pixels from left edge
30 * @param y Pixels from top edge
31 * @param color Color value to set the pixel to
32 */
33void hal_putpixel(uint32_t x, uint32_t y, color_t color);
34
35/**
36 * @brief Draw a rectangle to the screen
37 * @param x Pixels from left edge of screen to left edge of rectangle
38 * @param y Pixels from top edge of screen to top edge of rectangle
39 * @param w Width of rectangle in pixels
40 * @param h Height of rectangle in pixels
41 * @param color Color value to set all pixels within the rectangle to
42 */
44
45/**
46 * @brief Get screen width
47 * @return Width of the screen in pixels
48 */
50
51/**
52 * @brief Get screen height
53 * @return Height of the screen in pixels
54 */
56
57#endif
uint32_t color_t
Represents a color.
Definition color.h:18
uint64_t hal_height(void)
Get screen height.
Definition hal.c:58
void hal_fillrect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, color_t color)
Draw a rectangle to the screen.
Definition hal.c:44
int hal_init(void)
Initialize the frame buffer.
Definition hal.c:20
uint64_t hal_width(void)
Get screen width.
Definition hal.c:54
void hal_putpixel(uint32_t x, uint32_t y, color_t color)
Draw a pixel to the screen.
Definition hal.c:37
unsigned int uint32_t
Definition stdint.h:6
unsigned long uint64_t
Definition stdint.h:7