IBNOS
|
Macros | |
#define | MAKE_COLOR(foreground, background) (((foreground) & 15) | (background) << 4) |
#define | MAKE_RAW_CHAR(color, chr) ((((uint32_t)(chr)) & 0xFF) | (((uint32_t)(color)) & 0xFF) << 8) |
#define | RAW_CHAR_COLOR(raw) (((raw) >> 8) & 0xFF) |
#define | RAW_CHAR_CHR(raw) ((raw) & 0xFF) |
#define | BG_COLOR(color) ((color >> 4) & 15) |
#define | FG_COLOR(color) (color & 15) |
#define | CONSOLE_WIDTH(size) (size & 0xFFFF) |
#define | CONSOLE_HEIGHT(size) ((size >> 16) & 0xFFFF) |
#define | CONSOLE_POSX(pos) (pos & 0xFFFF) |
#define | CONSOLE_POSY(pos) ((pos >> 16) & 0xFFFF) |
Enumerations | |
enum | VGA_COLOR { COLOR_BLACK = 0, COLOR_BLUE = 1, COLOR_GREEN = 2, COLOR_CYAN = 3, COLOR_RED = 4, COLOR_MAGENTA = 5, COLOR_BROWN = 6, COLOR_LIGHT_GREY = 7, COLOR_DARK_GREY = 8, COLOR_LIGHT_BLUE = 9, COLOR_LIGHT_GREEN = 10, COLOR_LIGHT_CYAN = 11, COLOR_LIGHT_RED = 12, COLOR_LIGHT_MAGENTA = 13, COLOR_LIGHT_BROWN = 14, COLOR_WHITE = 15 } |
enum | CONSOLE_FLAGS { CONFLAGS_ECHO = 1, CONFLAGS_HWCURSOR = 2, CONFLAGS_HWCURSOR_AUTO = 4, CONFLAGS_RAW_MODE = 8 } |
Functions | |
void | consoleInit () |
Initializes the console. More... | |
void | consoleClear () |
Clear the screen contents. More... | |
void | consoleSetColor (uint8_t color) |
Set the text and background color of the console. More... | |
uint8_t | consoleGetColor () |
Get current color. More... | |
uint8_t | consoleGetColorForeground () |
Get current foreground color. More... | |
uint8_t | consoleGetColorBackground () |
Get current background color. More... | |
void | consolePutChar (char chr) |
Write a character on the console. More... | |
void | consoleEchoChar (char chr) |
Echo keyboard input on the console. More... | |
void | consolePutCharRaw (uint16_t chr) |
Write a raw character and color on the console. More... | |
void | consoleWriteString (const char *str) |
Write a C string to the console. More... | |
void | consoleWriteStringLen (const char *str, size_t len) |
Write a string with a fixed size to the console. More... | |
void | consoleWriteRawLen (const uint16_t *data, size_t count) |
Write raw data with a fixed size to the console. More... | |
void | consoleWriteStringMax (const char *str, size_t len) |
Write a nullterminated string or a maximum of len characters. More... | |
void | consoleWriteHex32 (uint32_t value) |
Write a 32 bit integer as hex value on the console. More... | |
void | consoleWriteInt32 (uint32_t value) |
Write a 32 bit integer as decimal value on the console. More... | |
void | consoleWriteHex16 (uint16_t value) |
Write a 16 bit integer as hex value on the console. More... | |
bool | consoleSetCursorPos (uint8_t x, uint8_t y) |
Set the position of the text cursor. More... | |
uint32_t | consoleGetCursorPos () |
Get packed position of the text cursor. More... | |
uint32_t | consoleGetCursorPosX () |
Get X position of the text cursor. More... | |
uint32_t | consoleGetCursorPosY () |
Get Y position of the text cursor. More... | |
void | consoleScrollUp () |
Scroll the console up one line. More... | |
uint32_t | consoleGetSize () |
Returns the packed size of the console. More... | |
uint8_t | consoleGetHeight () |
Returns the height (text rows) of the console. More... | |
uint8_t | consoleGetWidth () |
Returns the width (text cols) of the console. More... | |
void | consoleShowHardwareCursor (bool changed) |
Show / hide blinking hardware cursor. More... | |
void | consoleSetHardwareCursor (uint8_t x, uint8_t y) |
Set the position of the hardware cursor. More... | |
uint32_t | consoleGetHardwareCursor () |
Get packed position of the hardware cursor. More... | |
void | consoleSetFont () |
Load a custom font supporting latin1 characters. More... | |
void | consoleSetFlags (uint32_t newFlags) |
Set console flags. More... | |
uint32_t | consoleGetFlags () |
Get console flags. More... | |
void | consoleSystemFailure (const char **lines, uint32_t numArgs, uint32_t *args, struct taskContext *context) |
Print a system failure message and halts the system. More... | |
#define BG_COLOR | ( | color | ) | ((color >> 4) & 15) |
#define CONSOLE_POSX | ( | pos | ) | (pos & 0xFFFF) |
#define CONSOLE_POSY | ( | pos | ) | ((pos >> 16) & 0xFFFF) |
#define FG_COLOR | ( | color | ) | (color & 15) |
#define MAKE_COLOR | ( | foreground, | |
background | |||
) | (((foreground) & 15) | (background) << 4) |
#define MAKE_RAW_CHAR | ( | color, | |
chr | |||
) | ((((uint32_t)(chr)) & 0xFF) | (((uint32_t)(color)) & 0xFF) << 8) |
#define RAW_CHAR_CHR | ( | raw | ) | ((raw) & 0xFF) |
#define RAW_CHAR_COLOR | ( | raw | ) | (((raw) >> 8) & 0xFF) |
enum CONSOLE_FLAGS |
enum VGA_COLOR |
void consoleClear | ( | ) |
void consoleEchoChar | ( | char | chr | ) |
uint8_t consoleGetColor | ( | ) |
uint8_t consoleGetColorBackground | ( | ) |
uint8_t consoleGetColorForeground | ( | ) |
uint32_t consoleGetCursorPos | ( | ) |
Get packed position of the text cursor.
Use the CONSOLE_POSX and CONSOLE_POSY macro to extract the the X and Y position from this value.
uint32_t consoleGetCursorPosX | ( | ) |
uint32_t consoleGetCursorPosY | ( | ) |
uint32_t consoleGetFlags | ( | ) |
Get console flags.
uint32_t consoleGetHardwareCursor | ( | ) |
Get packed position of the hardware cursor.
Use the CONSOLE_POSX and CONSOLE_POSY macro to extract the the X and Y position from this value.
uint8_t consoleGetHeight | ( | ) |
uint32_t consoleGetSize | ( | ) |
Returns the packed size of the console.
Use the CONSOLE_HEIGHT and CONSOLE_WIDTH macros to get the individual values.
uint8_t consoleGetWidth | ( | ) |
void consoleInit | ( | ) |
void consolePutChar | ( | char | chr | ) |
Write a character on the console.
This functions writes a character on the terminal at the current cursor position. It will automatically insert line breaks if necessary (i.e. the end of the line is reached).
chr | The character which should be printed |
void consolePutCharRaw | ( | uint16_t | chr | ) |
Write a raw character and color on the console.
This functions writes a character and color on the terminal at the current cursor position. The character code and color is packed in a 16 bit value. Use the MAKE_RAW_CHAR macro to create such values.
chr | The character which should be printed |
void consoleScrollUp | ( | ) |
void consoleSetColor | ( | uint8_t | color | ) |
Set the text and background color of the console.
This function alters the current color of the console and will affect all further write operations. The color will stay active till it is changed again.
color | The color to set, use the MAKE_COLOR() macro |
bool consoleSetCursorPos | ( | uint8_t | x, |
uint8_t | y | ||
) |
void consoleSetFlags | ( | uint32_t | flags | ) |
Set console flags.
flags | Combination of the CONSOLE_FLAGS values |
void consoleSetFont | ( | ) |
void consoleSetHardwareCursor | ( | uint8_t | x, |
uint8_t | y | ||
) |
void consoleShowHardwareCursor | ( | bool | changed | ) |
void consoleSystemFailure | ( | const char ** | lines, |
uint32_t | numArgs, | ||
uint32_t * | args, | ||
struct taskContext * | context | ||
) |
Print a system failure message and halts the system.
This function displays an error message, some optional hex values (for example the error code or offending function arguments), plus the current CPU context. The first line defines the header of the crash screen and all other lines will be shown as normal text.
lines | Array of string pointers, terminated with a NULL pointer |
numArgs | Number of 32 bit integers to print |
args | Array of 32 bit integers |
context | The CPU context which should be shown or NULL otherwise |
void consoleWriteHex16 | ( | uint16_t | value | ) |
void consoleWriteHex32 | ( | uint32_t | value | ) |
void consoleWriteInt32 | ( | uint32_t | value | ) |
void consoleWriteRawLen | ( | const uint16_t * | data, |
size_t | count | ||
) |
void consoleWriteString | ( | const char * | str | ) |
void consoleWriteStringLen | ( | const char * | str, |
size_t | len | ||
) |
void consoleWriteStringMax | ( | const char * | str, |
size_t | len | ||
) |
Write a nullterminated string or a maximum of len characters.
This function writes a string to the console, but will stop after either len character have been written or when it detects a NULL character inside of the string.
str | Pointer to the string |
len | Maximum number of bytes to print |