mirror of
https://github.com/ivoszbg/uniLoader.git
synced 2026-06-13 21:40:05 +00:00
The current drivers/framework.c is useless, as REGISTER_DRIVER() is a macro
that just directly calls the driver probe function. Every board file has to
reference each driver's probe function by name. This was just done to make room
for proper driver probing in the future, where we are now, so implement that.
Make drivers self-register at link time by emitting a struct driver into a
.uniloader_drivers section via DRIVER_REGISTER(). The linker brackets
the section with __drivers_start / __drivers_end symbols.
Boards describe their hardware as a static struct with the format
{ driver_name, plat_data, label }. Remove the drivers_init hook from
struct board_ops as it's no longer necessary.
The drivers probe will now be placed between early_init and splash.
The framework looks up each device's driver_name up in the
linker section and calls probe(plat_data). A failed probe is logged.
Do --whole-archive as well to convince the linker to not drop the drivers
in archived .o files that aren't called outside the archive.
Adopt all boards to use the framework.
All of the changes in this commit are co-dependent on each other, as we're
doing a large change to the ABI.
51 lines
946 B
C
51 lines
946 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
|
* Copyright (c) 2022, Markuss Broks <markuss.broks@gmail.com>
|
|
* Copyright (c) 2022, Michael Srba <Michael.Srba@seznam.cz>
|
|
*/
|
|
|
|
#ifndef SIMPLEFB_H_ /* Include guard */
|
|
#define SIMPLEFB_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
typedef struct _color {
|
|
unsigned char r;
|
|
unsigned char g;
|
|
unsigned char b;
|
|
unsigned char a;
|
|
} color;
|
|
|
|
#define FB_TEXT_TOP_PADDING 5
|
|
|
|
typedef enum {
|
|
FB_FORMAT_RGB888,
|
|
FB_FORMAT_ARGB8888,
|
|
FB_FORMAT_ABGR8888,
|
|
FB_FORMAT_BGRA8888,
|
|
FB_FORMAT_RGB565,
|
|
} video_format;
|
|
|
|
struct video_info {
|
|
video_format format;
|
|
int width;
|
|
int height;
|
|
int stride;
|
|
int scale;
|
|
int scale_f;
|
|
void *address;
|
|
};
|
|
|
|
extern void __simplefb_raw_print(const char *text, int text_x, int text_y,
|
|
color text_color);
|
|
|
|
int get_font_scale_factor(void);
|
|
|
|
typedef struct _font_params {
|
|
int width;
|
|
int height;
|
|
} font_params;
|
|
|
|
#endif // SIMPLEFB_H_
|