diff options
author | Joursoir <chat@joursoir.net> | 2021-10-12 20:33:29 +0000 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2021-10-12 21:11:25 +0000 |
commit | 79e990add09938e91be560869157ef77edf4df58 (patch) | |
tree | b613b72ed1353908a3f6e83544198505f3d2ac57 /lib/tbi/screen.c | |
parent | defa660cbcfdb4e8db516ed425e6221aa18e0011 (diff) | |
download | ufm-79e990add09938e91be560869157ef77edf4df58.tar.gz ufm-79e990add09938e91be560869157ef77edf4df58.tar.bz2 ufm-79e990add09938e91be560869157ef77edf4df58.zip |
tbi: add sub-module 'screen'
Diffstat (limited to 'lib/tbi/screen.c')
-rw-r--r-- | lib/tbi/screen.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/tbi/screen.c b/lib/tbi/screen.c new file mode 100644 index 0000000..7eb9ac2 --- /dev/null +++ b/lib/tbi/screen.c @@ -0,0 +1,35 @@ +#include <Uefi.h> +#include <Library/DebugLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/MemoryAllocationLib.h> +#include <Library/UefiBootServicesTableLib.h> + +#include "screen.h" + +struct screen *prepare_screen(VOID) +{ + struct screen *scr; + scr = AllocateZeroPool(sizeof(struct screen)); + if(!scr) + return NULL; + + scr->stdin = gST->ConIn; + scr->stdout = gST->ConOut; + scr->stderr = gST->StdErr; + + gST->ConOut->QueryMode( + gST->ConOut, + gST->ConOut->Mode->Mode, + &(scr->columns), + &(scr->lines) + ); + + return scr; +} + +VOID forget_screen(struct screen *scr) +{ + ASSERT(scr != NULL); + + FreePool(scr); +} |