Sending data (debug printing) to serial port

This commit is contained in:
2017-12-01 22:50:51 +01:00
parent d05ddfeab4
commit 034a870ac7
6 changed files with 58 additions and 4 deletions

View File

@@ -1,11 +1,10 @@
#include <stddef.h>
#include <stdarg.h>
#include <stdint.h>
#include <serial.h>
// TODO: Temporary declarations
void vga_write(char c);
void serial_write(int port, char c);
#define PORT_COM1 0
void num2str(char *buf, uint64_t num, uint64_t base)

View File

@@ -20,11 +20,11 @@ void vga_write(char c)
static int i = 0;
vga_recv[i++] = c;
}
void serial_write(int port, char c)
void serial_write(uint16_t port, uint8_t c)
{
(void)port;
static int i = 0;
serial_recv[i++] = c;
serial_recv[i++] = (char)c;
}
TEST(putch_sends_character_to_vga)

View File

@@ -1,4 +1,6 @@
#include <memory.h>
#include <serial.h>
#include <debug.h>
void clear_screen()
{
@@ -17,10 +19,20 @@ void print_string(char *str)
}
}
void vga_write(char c)
{
// TODO: DUMMY
(void)c;
}
void kmain()
{
clear_screen();
print_string("Hello from c, world!");
serial_init(PORT_COM1);
debug_printf("Hello from debug printing function!\n");
debug_printf("A number:%d\n", 12345);
for(;;);
}