main, runtime: init serial at EFI boot stage, use serial as output
This commit is contained in:
parent
84a2f11284
commit
ad0bab89be
3
main.c
3
main.c
@ -7,6 +7,7 @@
|
|||||||
#include "graphics/graphics.h"
|
#include "graphics/graphics.h"
|
||||||
#include "graphics/unifont.h"
|
#include "graphics/unifont.h"
|
||||||
#include "memory/memory.h"
|
#include "memory/memory.h"
|
||||||
|
#include "driver/irq/pic/serial/serial.h"
|
||||||
|
|
||||||
|
|
||||||
FASTCALL_ABI EFI_STATUS efiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
|
FASTCALL_ABI EFI_STATUS efiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
|
||||||
@ -22,6 +23,8 @@ FASTCALL_ABI EFI_STATUS efiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *System
|
|||||||
// disable the watchdog timer so that the application does not reset after 5mins
|
// disable the watchdog timer so that the application does not reset after 5mins
|
||||||
efiBootServices->SetWatchdogTimer(0, 0, 0, NULL);
|
efiBootServices->SetWatchdogTimer(0, 0, 0, NULL);
|
||||||
|
|
||||||
|
pic_serial_Init(&pic_serial_COM1, 115200, 0);
|
||||||
|
|
||||||
io_WriteConsole(PROJECT_NAME "\r\n\r\nAWAITING FOR USER INPUT");
|
io_WriteConsole(PROJECT_NAME "\r\n\r\nAWAITING FOR USER INPUT");
|
||||||
|
|
||||||
// wait for a user keypress
|
// wait for a user keypress
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "../memory/memory.h"
|
#include "../memory/memory.h"
|
||||||
#include "../graphics/graphics.h"
|
#include "../graphics/graphics.h"
|
||||||
|
#include "../driver/irq/pic/serial/serial.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@ -11,6 +12,8 @@
|
|||||||
|
|
||||||
// printf wants this
|
// printf wants this
|
||||||
void _putchar(char c) {
|
void _putchar(char c) {
|
||||||
|
pic_serial_Write(&pic_serial_COM1, &c, 1);
|
||||||
|
|
||||||
if (!graphics_Framebuffer) {
|
if (!graphics_Framebuffer) {
|
||||||
UINT16 buf[2] = {c, 0};
|
UINT16 buf[2] = {c, 0};
|
||||||
efiStdout->OutputString(efiStdout, buf);
|
efiStdout->OutputString(efiStdout, buf);
|
||||||
@ -43,6 +46,8 @@ void io_WriteConsole(const char *str) {
|
|||||||
int size = 0; // don't include the \0 at the end here
|
int size = 0; // don't include the \0 at the end here
|
||||||
int len = strlen(str); // left the \0 out here too
|
int len = strlen(str); // left the \0 out here too
|
||||||
|
|
||||||
|
pic_serial_Write(&pic_serial_COM1, str, len);
|
||||||
|
|
||||||
for (int i = 0;
|
for (int i = 0;
|
||||||
i < len;
|
i < len;
|
||||||
i += utf8_Decode(str + i, len - i, NULL), size++) {}
|
i += utf8_Decode(str + i, len - i, NULL), size++) {}
|
||||||
@ -64,6 +69,8 @@ void io_WriteConsole(const char *str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void io_WriteConsoleASCII(const char *str) {
|
void io_WriteConsoleASCII(const char *str) {
|
||||||
|
pic_serial_Write(&pic_serial_COM1, str, 0);
|
||||||
|
|
||||||
if (!graphics_Framebuffer) {
|
if (!graphics_Framebuffer) {
|
||||||
int len = strlen(str);
|
int len = strlen(str);
|
||||||
__io_WriteConsole_ResizeBuffer(len + 1);
|
__io_WriteConsole_ResizeBuffer(len + 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user