PatchworkOS
Loading...
Searching...
No Matches
module.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <stdint.h>
6#include <sys/io.h>
7#include <sys/list.h>
8
9typedef struct module module_t;
10
29
36typedef struct module_event
37{
39 union {
40 struct
41 {
42 const char* hid;
43 } load;
44 struct
45 {
46 const char* hid;
47 } unload;
48 };
50
55typedef struct module
56{
58 char name[MAX_NAME];
61 void (*procedure)(module_event_t* event);
62} module_t;
63
76#define MODULE_ACPI_HIDS(...) \
77 static const char* _moduleAcpiHids __attribute__((section(".module_acpi_hids"), used)) = \
78 __VA_ARGS__
79
83void module_init(void);
84
95
#define MAX_NAME
Maximum length of names.
Definition MAX_NAME.h:11
module_event_type_t
Module event types.
Definition module.h:24
uint64_t module_event(module_event_t *event)
Propagates a module event to all registered modules.
Definition module.c:13
void module_init(void)
Initializes the module system.
Definition module.c:8
@ MODULE_EVENT_NONE
Definition module.h:25
@ MODULE_EVENT_LOAD
Definition module.h:26
@ MODULE_EVENT_UNLOAD
Definition module.h:27
static uint64_t procedure(window_t *win, element_t *elem, const event_t *event)
Definition main.c:46
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
A entry in a doubly linked list.
Definition list.h:38
const char * hid
Definition module.h:42
module_event_type_t type
Definition module.h:38
uint64_t size
The size of the modules loaded image in memory.
Definition module.h:60
void * baseAddress
The address where the modules image is loaded in memory.
Definition module.h:59
list_entry_t entry
Definition module.h:57