Use clang-format
This commit is contained in:
@@ -1,46 +1,47 @@
|
||||
#include <libk/std.h>
|
||||
#include <libk/string.h>
|
||||
#include <libk/printf.h>
|
||||
#include <sys/debug.h>
|
||||
#include <amd64/debug.h>
|
||||
#include <amd64/io.h>
|
||||
#include <libk/printf.h>
|
||||
#include <libk/std.h>
|
||||
#include <libk/string.h>
|
||||
#include <sys/debug.h>
|
||||
|
||||
#define PORT_COM1 0x03F8
|
||||
#define PORT_COM1 0x03F8
|
||||
#define BUFFER_SIZE 1024
|
||||
|
||||
static bool amd64_debug_serial_tx_empty(void) {
|
||||
return (bool)(amd64_io_inb(PORT_COM1 + 5) & 0x20);
|
||||
static bool amd64_debug_serial_tx_empty (void) {
|
||||
return (bool)(amd64_io_inb (PORT_COM1 + 5) & 0x20);
|
||||
}
|
||||
|
||||
static void amd64_debug_serial_write(char x) {
|
||||
while (!amd64_debug_serial_tx_empty());
|
||||
amd64_io_outb(PORT_COM1, (uint8_t)x);
|
||||
static void amd64_debug_serial_write (char x) {
|
||||
while (!amd64_debug_serial_tx_empty ())
|
||||
;
|
||||
amd64_io_outb (PORT_COM1, (uint8_t)x);
|
||||
}
|
||||
|
||||
void debugprintf(const char *fmt, ...) {
|
||||
void debugprintf (const char* fmt, ...) {
|
||||
char buffer[BUFFER_SIZE];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
memset (buffer, 0, sizeof (buffer));
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
||||
va_end(ap);
|
||||
va_start (ap, fmt);
|
||||
vsnprintf (buffer, sizeof (buffer), fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
buffer[sizeof (buffer) - 1] = '\0';
|
||||
|
||||
const char *p = buffer;
|
||||
const char* p = buffer;
|
||||
while (*p) {
|
||||
amd64_debug_serial_write(*p);
|
||||
amd64_debug_serial_write (*p);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
void amd64_debug_init(void) {
|
||||
amd64_io_outb(PORT_COM1 + 1, 0x00);
|
||||
amd64_io_outb(PORT_COM1 + 3, 0x80);
|
||||
amd64_io_outb(PORT_COM1 + 0, 0x03);
|
||||
amd64_io_outb(PORT_COM1 + 1, 0x00);
|
||||
amd64_io_outb(PORT_COM1 + 3, 0x03);
|
||||
amd64_io_outb(PORT_COM1 + 2, 0xC7);
|
||||
amd64_io_outb(PORT_COM1 + 4, 0x0B);
|
||||
void amd64_debug_init (void) {
|
||||
amd64_io_outb (PORT_COM1 + 1, 0x00);
|
||||
amd64_io_outb (PORT_COM1 + 3, 0x80);
|
||||
amd64_io_outb (PORT_COM1 + 0, 0x03);
|
||||
amd64_io_outb (PORT_COM1 + 1, 0x00);
|
||||
amd64_io_outb (PORT_COM1 + 3, 0x03);
|
||||
amd64_io_outb (PORT_COM1 + 2, 0xC7);
|
||||
amd64_io_outb (PORT_COM1 + 4, 0x0B);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user