2021-01-12 18:22:11 +00:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
|
|
|
|
#ifndef FB_H
|
|
|
|
#define FB_H
|
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
2021-02-12 19:09:49 +00:00
|
|
|
typedef struct {
|
|
|
|
u32 *ptr; /* pointer to the start of the framebuffer */
|
2021-11-02 06:24:26 +00:00
|
|
|
u32 *hwptr; /* pointer to the start of the real framebuffer */
|
2021-02-12 19:09:49 +00:00
|
|
|
u32 stride; /* framebuffer stride divided by four (i.e. stride in pixels) */
|
|
|
|
u32 depth; /* framebuffer depth (i.e. bits per pixel) */
|
|
|
|
u32 width; /* width of the framebuffer in pixels */
|
|
|
|
u32 height; /* height of the framebuffer in pixels */
|
2021-11-02 06:24:26 +00:00
|
|
|
u32 size; /* size of the framebuffer in bytes */
|
2021-02-12 19:09:49 +00:00
|
|
|
} fb_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
u8 r;
|
|
|
|
u8 g;
|
|
|
|
u8 b;
|
|
|
|
} rgb_t;
|
|
|
|
|
|
|
|
extern fb_t fb;
|
2021-01-12 18:22:11 +00:00
|
|
|
|
2021-05-07 18:42:21 +00:00
|
|
|
static inline rgb_t int2rgb(u32 c)
|
|
|
|
{
|
|
|
|
return (rgb_t){c >> 16, c >> 8, c};
|
|
|
|
}
|
|
|
|
|
2021-01-12 18:22:11 +00:00
|
|
|
void fb_init(void);
|
2021-08-31 05:10:03 +00:00
|
|
|
void fb_shutdown(bool restore_logo);
|
2021-11-02 06:24:26 +00:00
|
|
|
void fb_update(void);
|
2021-05-07 03:18:07 +00:00
|
|
|
|
2021-02-12 19:09:49 +00:00
|
|
|
void fb_blit(u32 x, u32 y, u32 w, u32 h, void *data, u32 stride);
|
2021-05-07 18:42:21 +00:00
|
|
|
void fb_unblit(u32 x, u32 y, u32 w, u32 h, void *data, u32 stride);
|
2021-02-12 19:09:49 +00:00
|
|
|
void fb_fill(u32 x, u32 y, u32 w, u32 h, rgb_t color);
|
2021-05-07 18:42:21 +00:00
|
|
|
void fb_clear(rgb_t color);
|
2021-01-12 18:22:11 +00:00
|
|
|
|
|
|
|
void fb_display_logo(void);
|
2021-05-07 18:42:21 +00:00
|
|
|
void fb_restore_logo(void);
|
|
|
|
void fb_improve_logo(void);
|
2021-01-12 18:22:11 +00:00
|
|
|
|
2021-03-14 22:50:01 +00:00
|
|
|
void fb_console_scroll(u32 n);
|
2021-04-15 13:44:55 +00:00
|
|
|
void fb_console_reserve_lines(u32 n);
|
2021-04-15 13:47:33 +00:00
|
|
|
ssize_t fb_console_write(const char *bfr, size_t len);
|
2021-03-14 22:50:01 +00:00
|
|
|
|
2021-01-12 18:22:11 +00:00
|
|
|
#endif
|