The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
console.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
common/boot/boot_info.h
"
4
#include "
kernel/device/device.h
"
5
6
// the console's device number, Linux's for tty0 (st_rdev; ttyname)
7
#define CONSOLE_DEVICE_NUMBER DEVICE_NUMBER(4, 0)
8
9
/**
10
* initialize the console driver.
11
* chooses the framebuffer backend when the bootloader provided a graphics-mode
12
* framebuffer, otherwise the VGA text backend. must be called before any other
13
* console functions are used.
14
* @param boot boot information (carries the framebuffer description).
15
*/
16
void
console_initialize
(
const
boot_info_t
*boot);
17
18
/**
19
* write a single character to the console. safe from any context,
20
* including interrupt handlers.
21
* @param c the character to write
22
*/
23
void
console_putchar
(
char
c);
24
25
/**
26
* write a null-terminated string to the console. safe from any context.
27
* @param str the string to write
28
*/
29
void
console_write
(
const
char
*str);
30
31
/**
32
* write a buffer to the console as one update: the whole buffer is drawn,
33
* then the caret is placed and the display flushed once. translates \n to
34
* \r\n. this is the write syscall's path to the terminal. process context
35
* only: it may sleep until another process's write has finished.
36
* @param buf bytes to write (need not be null-terminated).
37
* @param len number of bytes.
38
*/
39
void
console_write_bytes
(
const
char
*buf,
uint32_t
len);
40
41
/**
42
* stop locking the console: a panic is printing and the CPU will halt, so
43
* nothing else runs, and the panic may have hit while the lock was held.
44
*/
45
void
console_panic_mode
(
void
);
46
47
/**
48
* the size of the console in character cells.
49
* @param rows receives the number of rows.
50
* @param cols receives the number of columns.
51
*/
52
void
console_size
(
uint32_t
*rows,
uint32_t
*cols);
53
54
/**
55
* take the console lock, unless a panic is printing. the console is the
56
* kernel's drawer on the framebuffer, so a change of the screen mode holds
57
* it too (as Linux changes the mode with console_lock held).
58
* @return the interrupt state for console_lock_release().
59
*/
60
uint32_t
console_lock_acquire
(
void
);
61
62
/**
63
* release the console lock that console_lock_acquire() took.
64
* @param flags the value console_lock_acquire() returned.
65
*/
66
void
console_lock_release
(
uint32_t
flags
);
boot_info.h
console_size
void console_size(uint32_t *rows, uint32_t *cols)
the size of the console in character cells.
Definition
console.c:160
console_initialize
void console_initialize(const boot_info_t *boot)
initialize the console driver.
Definition
console.c:75
console_lock_acquire
uint32_t console_lock_acquire(void)
take the console lock, unless a panic is printing.
Definition
console.c:57
console_write
void console_write(const char *str)
write a null-terminated string to the console.
Definition
console.c:115
console_putchar
void console_putchar(char c)
write a single character to the console.
Definition
console.c:108
console_panic_mode
void console_panic_mode(void)
stop locking the console: a panic is printing and the CPU will halt, so nothing else runs,...
Definition
console.c:153
console_write_bytes
void console_write_bytes(const char *buf, uint32_t len)
write a buffer to the console as one update: the whole buffer is drawn, then the caret is placed and ...
Definition
console.c:123
console_lock_release
void console_lock_release(uint32_t flags)
release the console lock that console_lock_acquire() took.
Definition
console.c:66
device.h
generic device model: a named/typed handle plus a registry.
flags
uint8_t flags
Definition
idt.c:3
uint32_t
unsigned int uint32_t
Definition
fb.h:17
boot_info_t
information the bootloader hands to the kernel.
Definition
boot_info.h:21
src
kernel
console
console.h
Generated by
1.18.0