AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
fb.c File Reference

Virtual terminals on the framebuffer. More...

#include <core/system.h>
#include <core/string.h>
#include <dev/fbdev.h>
#include <dev/vt.h>

Go to the source code of this file.

Macros

#define FONT_W   8
#define FONT_H   16

Functions

struct fbdev * fbdev_primary (void)
 Returns the first framebuffer, once it is set up, for the virtual terminals.
static void put_pixel (uint8_t *p, uint32_t rgb)
 Writes one pixel of colour rgb (0xRRGGBB) at p, in the framebuffer's pixel format.
static void fb_draw (int row, int col, struct vt_cell cell)
 Draws one cell of the terminal: its character's glyph, in its colours and attributes (bold, reverse, dim, invisible, underline, cursor).
int vt_fb_probe (void)
 Sets up the virtual terminals on the framebuffer, if there is one the terminals can draw on, and clears the screen.

Variables

const unsigned char font_8x16 []
static uint8_t * fb
static uint32_t pitch
static uint32_t bytes_pp
struct vt_display vt_fb_display

Detailed Description

Virtual terminals on the framebuffer.

Each cell of the terminal is drawn as a character of the early console's 8x16 font, in the cell's colours, pixel by pixel. Framebuffers of 16, 24 and 32 bits per pixel are supported. The virtual terminals (vt.c) draw through vt_fb_display.

Definition in file fb.c.

Macro Definition Documentation

◆ FONT_H

#define FONT_H   16

Definition at line 16 of file fb.c.

Referenced by fb_draw(), and vt_fb_probe().

◆ FONT_W

#define FONT_W   8

Definition at line 15 of file fb.c.

Referenced by fb_draw(), and vt_fb_probe().

Function Documentation

◆ fb_draw()

void fb_draw ( int row,
int col,
struct vt_cell cell )
static

Draws one cell of the terminal: its character's glyph, in its colours and attributes (bold, reverse, dim, invisible, underline, cursor).

Definition at line 48 of file fb.c.

References vt_cell::attr, vt_cell::bg, bytes_pp, vt_cell::ch, fb, fb_draw(), vt_cell::fg, font_8x16, FONT_H, FONT_W, pitch, put_pixel(), VT_BOLD, VT_CURSOR, VT_DIM, VT_INVISIBLE, vt_palette(), VT_REVERSE, and VT_UNDERLINE.

Referenced by fb_draw().

◆ fbdev_primary()

struct fbdev * fbdev_primary ( void )
extern

Returns the first framebuffer, once it is set up, for the virtual terminals.

Returns
the framebuffer, or NULL if there is none

Definition at line 63 of file fbdev.c.

◆ put_pixel()

void put_pixel ( uint8_t * p,
uint32_t rgb )
inlinestatic

Writes one pixel of colour rgb (0xRRGGBB) at p, in the framebuffer's pixel format.

Definition at line 29 of file fb.c.

References bytes_pp, and put_pixel().

Referenced by fb_draw(), and put_pixel().

◆ vt_fb_probe()

int vt_fb_probe ( void )

Sets up the virtual terminals on the framebuffer, if there is one the terminals can draw on, and clears the screen.

Returns
0, or -ENODEV if there is no framebuffer, or not one of 16, 24 or 32 bits per pixel

Definition at line 100 of file fb.c.

References bytes_pp, vt_display::cols, fb, fbdev_primary(), FONT_H, FONT_W, memset(), NULL, pitch, vt_display::rows, vt_fb_display, and vt_fb_probe().

Referenced by vt_fb_probe(), and vt_probe().

Variable Documentation

◆ bytes_pp

uint32_t bytes_pp
static

Definition at line 25 of file fb.c.

Referenced by fb_draw(), put_pixel(), and vt_fb_probe().

◆ fb

◆ font_8x16

const unsigned char font_8x16[]
extern

Definition at line 7 of file font.h.

Referenced by fb_draw(), and fb_putc().

◆ pitch

uint32_t pitch
static

Definition at line 25 of file fb.c.

Referenced by fb_draw(), and vt_fb_probe().

◆ vt_fb_display

struct vt_display vt_fb_display
Initial value:
= {
.name = "framebuffer",
.draw = fb_draw,
}
static void fb_draw(int row, int col, struct vt_cell cell)
Draws one cell of the terminal: its character's glyph, in its colours and attributes (bold,...
Definition fb.c:48

Definition at line 130 of file fb.c.

Referenced by vt_fb_probe(), and vt_probe().