Feat: lab 3 w/o adv 2

This commit is contained in:
2025-03-26 15:30:57 +08:00
parent c5fc7e3102
commit 96cfdc4de2
25 changed files with 618 additions and 113 deletions

25
kernel/include/uart.h Normal file
View File

@@ -0,0 +1,25 @@
#pragma once
#include <stddef.h>
#include <ringbuffer.h>
#define UART_BUFLEN 0x800
void uart_init(void);
char uart_getc(void);
void uart_puts(const char *s);
void uart_hex(uint64_t d);
void uart_irq_handler(void);
size_t uart_putb_sync(const uint8_t *bytes, size_t len);
size_t uart_getb_sync(uint8_t *bytes, size_t len);
size_t uart_putb_async(const uint8_t *bytes, size_t len);
size_t uart_getb_async(uint8_t *bytes, size_t len);
extern size_t (*uart_putb)(const uint8_t *bytes, size_t len);
extern size_t (*uart_getb)(uint8_t *bytes, size_t len);
extern int is_uart_inited;
extern ringbuffer_t *uart_readbuf;