Transferred to UART communication
This commit is contained in:
parent
5c682c4209
commit
10ee4fcbd9
9 changed files with 33832 additions and 19 deletions
56
boot/arch/x86_64/common/uart/uart.c
Normal file
56
boot/arch/x86_64/common/uart/uart.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*********************************************************************************/
|
||||
/* Module Name: uart.c */
|
||||
/* Project: AurixOS */
|
||||
/* */
|
||||
/* Copyright (c) 2024-2025 Jozef Nagy */
|
||||
/* */
|
||||
/* This source is subject to the MIT License. */
|
||||
/* See License.txt in the root of this repository. */
|
||||
/* All other rights reserved. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
|
||||
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
|
||||
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */
|
||||
/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
|
||||
/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
|
||||
/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
|
||||
/* SOFTWARE. */
|
||||
/*********************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <arch/cpu/cpu.h>
|
||||
#include <uart/uart.h>
|
||||
|
||||
#define COM1 0x3f8
|
||||
|
||||
void uart_init(uint16_t baud_rate)
|
||||
{
|
||||
uint8_t divisor = 115200 / baud_rate;
|
||||
|
||||
outb(COM1 + 1, 0x00);
|
||||
outb(COM1 + 3, 0x80);
|
||||
outb(COM1 + 0, divisor & 0xFF);
|
||||
outb(COM1 + 1, (divisor >> 8) & 0xFF);
|
||||
outb(COM1 + 3, 0x03);
|
||||
outb(COM1 + 2, 0xC7);
|
||||
outb(COM1 + 4, 0x0B);
|
||||
outb(COM1 + 4, 0x0F);
|
||||
}
|
||||
|
||||
void uart_send(char c)
|
||||
{
|
||||
while ((inb(COM1 + 5) & 0x20) == 0);
|
||||
outb(COM1, c);
|
||||
}
|
||||
|
||||
void uart_sendstr(char *str)
|
||||
{
|
||||
while (*str != '\0') {
|
||||
if (*str == '\n') {
|
||||
uart_send('\r');
|
||||
}
|
||||
uart_send(*str);
|
||||
str++;
|
||||
}
|
||||
}
|
|
@ -17,12 +17,15 @@
|
|||
/* SOFTWARE. */
|
||||
/*********************************************************************************/
|
||||
|
||||
#include <uart/uart.h>
|
||||
#include <vfs/vfs.h>
|
||||
#include <ui/ui.h>
|
||||
#include <print.h>
|
||||
|
||||
void axboot_init()
|
||||
{
|
||||
uart_init(115200);
|
||||
|
||||
if (!vfs_init("\\")) {
|
||||
debug("axboot_init(): Failed to mount boot drive! Halting...\n");
|
||||
// TODO: Halt
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#define NANOPRINTF_USE_WRITEBACK_FORMAT_SPECIFIERS 0
|
||||
#include <nanoprintf.h>
|
||||
|
||||
#include <uart/uart.h>
|
||||
#include <print.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
@ -46,10 +47,7 @@ void log(const char *fmt, ...)
|
|||
npf_vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
// TODO: Get rid of this
|
||||
#ifdef AXBOOT_UEFI
|
||||
printstr(buf);
|
||||
#endif
|
||||
uart_sendstr(buf);
|
||||
}
|
||||
|
||||
void debug(const char *fmt, ...)
|
||||
|
@ -61,9 +59,7 @@ void debug(const char *fmt, ...)
|
|||
npf_vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
#ifdef AXBOOT_UEFI
|
||||
printstr(buf);
|
||||
#endif
|
||||
uart_sendstr(buf);
|
||||
}
|
||||
|
||||
void snprintf(char *buf, size_t size, const char *fmt, ...)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*********************************************************************************/
|
||||
/* Module Name: gui.c */
|
||||
/* Module Name: ui.c */
|
||||
/* Project: AurixOS */
|
||||
/* */
|
||||
/* Copyright (c) 2024-2025 Jozef Nagy */
|
||||
|
|
33701
boot/include/sounds/chime.h
Normal file
33701
boot/include/sounds/chime.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
/*********************************************************************************/
|
||||
/* Module Name: print.c */
|
||||
/* Module Name: uart.h */
|
||||
/* Project: AurixOS */
|
||||
/* */
|
||||
/* Copyright (c) 2024-2025 Jozef Nagy */
|
||||
|
@ -17,14 +17,14 @@
|
|||
/* SOFTWARE. */
|
||||
/*********************************************************************************/
|
||||
|
||||
#include <lib/string.h>
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
#ifndef _UART_UART_H
|
||||
#define _UART_UART_H
|
||||
|
||||
void printstr(const char *str)
|
||||
{
|
||||
CHAR16 wstr[4096];
|
||||
mbstowcs(wstr, &str, strlen(str));
|
||||
wstr[strlen(str)] = '\0';
|
||||
gSystemTable->ConOut->OutputString(gSystemTable->ConOut, wstr);
|
||||
}
|
||||
#include <stdint.h>
|
||||
|
||||
void uart_init(uint16_t baud_rate);
|
||||
|
||||
void uart_send(char c);
|
||||
void uart_sendstr(char *str);
|
||||
|
||||
#endif /* _UART_UART_H */
|
|
@ -1,3 +1,22 @@
|
|||
/*********************************************************************************/
|
||||
/* Module Name: framebuffer.h */
|
||||
/* Project: AurixOS */
|
||||
/* */
|
||||
/* Copyright (c) 2024-2025 Jozef Nagy */
|
||||
/* */
|
||||
/* This source is subject to the MIT License. */
|
||||
/* See License.txt in the root of this repository. */
|
||||
/* All other rights reserved. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
|
||||
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
|
||||
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */
|
||||
/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
|
||||
/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
|
||||
/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
|
||||
/* SOFTWARE. */
|
||||
/*********************************************************************************/
|
||||
|
||||
#ifndef _UI_FRAMEBUFFER_H
|
||||
#define _UI_FRAMEBUFFER_H
|
||||
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*********************************************************************************/
|
||||
/* Module Name: ui.h */
|
||||
/* Project: AurixOS */
|
||||
/* */
|
||||
/* Copyright (c) 2024-2025 Jozef Nagy */
|
||||
/* */
|
||||
/* This source is subject to the MIT License. */
|
||||
/* See License.txt in the root of this repository. */
|
||||
/* All other rights reserved. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
|
||||
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
|
||||
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */
|
||||
/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
|
||||
/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
|
||||
/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
|
||||
/* SOFTWARE. */
|
||||
/*********************************************************************************/
|
||||
|
||||
#ifndef _UI_UI_H
|
||||
#define _UI_UI_H
|
||||
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*********************************************************************************/
|
||||
/* Module Name: framebuffer.c */
|
||||
/* Project: AurixOS */
|
||||
/* */
|
||||
/* Copyright (c) 2024-2025 Jozef Nagy */
|
||||
/* */
|
||||
/* This source is subject to the MIT License. */
|
||||
/* See License.txt in the root of this repository. */
|
||||
/* All other rights reserved. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
|
||||
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
|
||||
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */
|
||||
/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
|
||||
/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
|
||||
/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
|
||||
/* SOFTWARE. */
|
||||
/*********************************************************************************/
|
||||
|
||||
#include <mm/mman.h>
|
||||
#include <ui/framebuffer.h>
|
||||
#include <print.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue