uniLoader/include/drivers/framework.h
Ivaylo Ivanov 81d26edaa3 uniLoader: Mass rework
arch: aarch64: Load addresses via page + offset
arch: aarch64: Align the TEXT region
drivers: Introduce an empty framework
board: Rework to be PIC

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-10-08 21:22:21 +03:00

34 lines
795 B
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Drivers registration framework
* Copyright (c) 2024, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
*/
#ifndef DRIVERS_H_ /* Include guard */
#define DRIVERS_H_
#include <stddef.h>
#include <string.h>
// Define the type for the probe function pointer
typedef void (*probe_func_t)(void *data);
extern probe_func_t find_driver_probe(const char *name);
// Function registry entry
struct driver_registry_entry {
const char *name; // Driver name
probe_func_t probe; // Function pointer to the probe function
};
#define REGISTER_DRIVER(name, probe_func, data) \
do { \
(probe_func)(data); \
} while (0)
#define PASS_STRUCT(name, probe_func, data) \
do { \
(probe_func)(data); \
} while (0)
#endif // DRIVERS_H_