Efficient DEBUG logging system with __FILE__ and fctprintf
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
// PS/2 Keyboard support
|
||||
|
||||
#include "../serial/serial.h"
|
||||
#include "../term/printf.h"
|
||||
#include "ps2.h"
|
||||
#include <stdint.h>
|
||||
#include "../term/term.h"
|
||||
#include <kernel.h>
|
||||
|
||||
// The key status bitfield will be used to see if ALT, CONTROL, or SHIFT is pressed
|
||||
uint8_t key_status = 0b00000000;
|
||||
@@ -206,7 +206,7 @@ void keyboard_handler()
|
||||
}
|
||||
}
|
||||
|
||||
serial_kputs("key pressed!\n");
|
||||
skputs("key pressed!\n");
|
||||
}
|
||||
|
||||
// End of Interrupt (to master PIC)
|
||||
@@ -230,7 +230,8 @@ void keyboard_init(unsigned char layout)
|
||||
break;
|
||||
|
||||
default:
|
||||
serial_kputs("Unsupported layout.");
|
||||
break;
|
||||
skputs("Unsupported layout.");
|
||||
return;
|
||||
}
|
||||
DEBUG("PS/2 Keyboard initialized");
|
||||
}
|
||||
@@ -36,7 +36,7 @@ int serial_init()
|
||||
// Set normal operation mode
|
||||
outb(PORT + 4, 0x0F);
|
||||
|
||||
serial_kputs("\n\nkernel: serial: Serial initialization OK!\n");
|
||||
DEBUG("serial initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -45,18 +45,20 @@ static int is_transmit_empty()
|
||||
return inb(PORT + 5) & 0x20;
|
||||
}
|
||||
|
||||
void write_serial(char c)
|
||||
// Serial kernel putchar
|
||||
void skputc(char c)
|
||||
{
|
||||
while (!is_transmit_empty()); // wait for free spot
|
||||
outb(PORT, c);
|
||||
}
|
||||
|
||||
void serial_kputs(const char* str)
|
||||
// Serial kernel putstring
|
||||
void skputs(const char* str)
|
||||
{
|
||||
unsigned int i=0;
|
||||
while (str[i])
|
||||
{
|
||||
write_serial(str[i]);
|
||||
skputc(str[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ void outb(int port, unsigned char data);
|
||||
unsigned char inb(int port);
|
||||
|
||||
int serial_init();
|
||||
void serial_kputs(const char* str);
|
||||
void skputs(const char* str);
|
||||
void skputc(char c);
|
||||
|
||||
#endif
|
||||
@@ -35,6 +35,7 @@ int term_init()
|
||||
if (framebuffer)
|
||||
{
|
||||
fb = framebuffer->address;
|
||||
DEBUG("terminal initialized");
|
||||
return 0;
|
||||
}
|
||||
return -ENOMEM;
|
||||
|
||||
Reference in New Issue
Block a user