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
*/
25
int
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
*/
33
void
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
*/
43
void
hal_fillrect
(
uint32_t
x,
uint32_t
y,
uint32_t
w,
uint32_t
h,
color_t
color);
44
45
/**
46
* @brief Get screen width
47
* @return Width of the screen in pixels
48
*/
49
uint64_t
hal_width
(
void
);
50
51
/**
52
* @brief Get screen height
53
* @return Height of the screen in pixels
54
*/
55
uint64_t
hal_height
(
void
);
56
57
#endif
color.h
color_t
uint32_t color_t
Represents a color.
Definition
color.h:18
hal_height
uint64_t hal_height(void)
Get screen height.
Definition
hal.c:58
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.
Definition
hal.c:44
hal_init
int hal_init(void)
Initialize the frame buffer.
Definition
hal.c:20
hal_width
uint64_t hal_width(void)
Get screen width.
Definition
hal.c:54
hal_putpixel
void hal_putpixel(uint32_t x, uint32_t y, color_t color)
Draw a pixel to the screen.
Definition
hal.c:37
stdint.h
uint32_t
unsigned int uint32_t
Definition
stdint.h:6
uint64_t
unsigned long uint64_t
Definition
stdint.h:7
include
hal
hal.h
Generated by
1.9.8