PatchworkOS
966e257
A non-POSIX operating system.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
fb.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
kernel/fs/sysfs.h
>
4
#include <
kernel/mem/vmm.h
>
5
6
#include <
stdint.h
>
7
#include <
sys/fb.h
>
8
#include <
sys/proc.h
>
9
10
typedef
struct
fb
fb_t
;
11
12
/**
13
* @brief Framebuffer driver abstraction.
14
* @defgroup kernel_drivers_abstract_fb Framebuffer Abstraction
15
* @ingroup kernel_drivers_abstract
16
*
17
* Framebuffer devices are exposed as a `/dev/fb/[id]/` directory, containing the following files:
18
* - `buffer`: A file that can be `mmap`ed to access the framebuffer memory.
19
* - `info`: A read-only file that contains the `fb_info_t` struct for the framebuffer.
20
*
21
* @{
22
*/
23
24
/**
25
* @brief Framebuffer mmap callback type.
26
*/
27
typedef
void
* (*fb_mmap_t)(
fb_t
*,
void
*,
uint64_t
,
uint64_t
*,
pml_flags_t
);
28
29
/**
30
* @brief Framebuffer structure.
31
* @struct fb_t
32
*/
33
typedef
struct
fb
34
{
35
fb_info_t
info
;
36
fb_mmap_t
mmap
;
37
dentry_t
*
dir
;
38
dentry_t
*
bufferFile
;
39
dentry_t
*
infoFile
;
40
}
fb_t
;
41
42
/**
43
* @brief Allocate and initialize a framebuffer structure.
44
*
45
* Will make the framebuffer available under `/dev/fb/[id]`.
46
*
47
* @param info Pointer to the framebuffer information.
48
* @param mmap Function that user space will invoke to mmap the framebuffer.
49
* @return On success, the new framebuffer structure. On failure, `NULL` and `errno` is set.
50
*/
51
fb_t
*
fb_new
(
const
fb_info_t
*
info
,
fb_mmap_t
mmap
);
52
53
/**
54
* @brief Free and deinitialize a framebuffer structure.
55
*
56
* Removes the framebuffer from `/dev/fb/[id]`.
57
*
58
* @param fb Pointer to the framebuffer structure to free.
59
*/
60
void
fb_free
(
fb_t
*
fb
);
61
62
/** @} */
fb_free
void fb_free(fb_t *fb)
Free and deinitialize a framebuffer structure.
Definition
fb.c:111
fb_mmap_t
void *(* fb_mmap_t)(fb_t *, void *, uint64_t, uint64_t *, pml_flags_t)
Framebuffer mmap callback type.
Definition
fb.h:27
fb_new
fb_t * fb_new(const fb_info_t *info, fb_mmap_t mmap)
Allocate and initialize a framebuffer structure.
Definition
fb.c:56
mmap
void * mmap(fd_t fd, void *address, uint64_t length, prot_t prot)
System call to map memory from a file.
Definition
mmap.c:6
fb
static fb_t * fb
Definition
gop.c:27
info
static fb_info_t info
Definition
gop.c:51
fb.h
proc.h
stdint.h
uint64_t
__UINT64_TYPE__ uint64_t
Definition
stdint.h:17
dentry_t
Directory entry structure.
Definition
dentry.h:84
fb_info_t
Framebuffer info struct.
Definition
fb.h:39
fb_t
Framebuffer structure.
Definition
fb.h:34
fb_t::mmap
fb_mmap_t mmap
Definition
fb.h:36
fb_t::infoFile
dentry_t * infoFile
Definition
fb.h:39
fb_t::dir
dentry_t * dir
Definition
fb.h:37
fb_t::bufferFile
dentry_t * bufferFile
Definition
fb.h:38
fb_t::info
fb_info_t info
Definition
fb.h:35
pml_flags_t
A entry in a page table without a specified address or callback ID.
sysfs.h
vmm.h
include
kernel
drivers
abstract
fb.h
Generated on Mon Dec 15 2025 21:55:53 for PatchworkOS by
1.9.8