🆕 uart驱动

This commit is contained in:
fslongjin
2022-04-15 15:23:17 +08:00
parent be8ac71aa9
commit 22359344e4
8 changed files with 188 additions and 26 deletions

View File

@ -17,6 +17,7 @@
: "memory") //关闭外部中断
#define nop() __asm__ __volatile__("nop\n\t")
#define hlt() __asm__ __volatile__("hlt\n\t")
#define pause() asm volatile ("pause\n\t"); // 处理器等待一段时间
//内存屏障
#define io_mfence() __asm__ __volatile__("mfence\n\t" :: \

View File

@ -7,6 +7,8 @@
#include "../mm/mm.h"
#include "../process/spinlock.h"
#include <driver/uart/uart.h>
//#include "linkage.h"
struct screen_info pos;
@ -110,13 +112,16 @@ void auto_newline()
* @brief 超过每行最大字符数,自动换行
*
*/
if (pos.x > pos.max_x)
{
uart_send(COM1, '\n');
pos.x = 0;
++pos.y;
}
if (pos.y > pos.max_y)
{
uart_send(COM1, '\n');
pos.y = pos.max_y;
int lines_to_scroll = 1;
scroll(true, lines_to_scroll * pos.char_size_y, false);
@ -625,6 +630,8 @@ static void putchar(uint *fb, int Xsize, int x, int y, unsigned int FRcolor, uns
* @param BKcolor 背景颜色
* @param font 字符的bitmap
*/
// 输出到串口
uart_send(COM1, font);
unsigned char *font_ptr = font_ascii[font];
unsigned int *addr;