Fix some naming convention

This commit is contained in:
Mathieu Maret 2018-11-08 22:08:27 +01:00
parent 00d7004815
commit cb65400d60
10 changed files with 31 additions and 20 deletions

View File

@ -25,5 +25,5 @@ __attribute__((interrupt)) void timer_handler(struct interrupt_frame *frame)
__attribute__((interrupt)) void serial_handler(struct interrupt_frame *frame)
{
EOIIrq(IRQ_COM1);
serial_do_irq(frame);
serialDoIrq(frame);
}

View File

@ -10,6 +10,9 @@
#include "pit.h"
#include "serial.h"
#include "stdarg.h"
#ifdef RUN_TEST
#include "test.h"
#endif
#include "vga.h"
#define CHECK_FLAG(flags, bit) ((flags) & (1 << (bit)))
@ -23,12 +26,13 @@ void cpuid(int code, uint32_t *a, uint32_t *d)
void kmain(unsigned long magic, unsigned long addr)
{
unsigned long upper_mem = 0;
initVGA(BLACK, GREEN);
printf("Setting up IDT\n");
VGASetup(BLACK, GREEN);
printf("Setting up Interruptions\n");
gdtSetup();
idtSetup();
irqSetup();
initPit(100);
pitSetup(100);
if (magic == MULTIBOOT_BOOTLOADER_MAGIC) { // Get loaded by Grub wuth mutliboot version 1
multiboot_info_t *mbi = (multiboot_info_t *)addr;
@ -53,16 +57,23 @@ void kmain(unsigned long magic, unsigned long addr)
printf("Cannot get upper phy mem bound. Using default value 32MB\n");
upper_mem = 32 * 1024;
}
memInit(upper_mem);
printf("Setting up Pagination\n");
memSetup(upper_mem);
printf("Setting up IRQ handlers\n");
irqSetRoutine(IRQ_KEYBOARD, keyboard_handler);
printf("Enabling HW interrupts\n");
exceptionSetRoutine(EXCEPTION_DOUBLE_FAULT, print_handler);
// Enabling the HW interrupts
asm volatile("sti\n");
printf("Init Serial\n");
initSerial(115200);
printf("Setting up Serial link (115200)\n");
serialSetup(115200);
#ifdef RUN_TEST
run_test();
#endif
int count = 0;
while (1) {

View File

@ -9,7 +9,7 @@ static unsigned long bottom_mem;
static unsigned long top_mem;
int memInit(unsigned long upper_mem)
int memSetup(unsigned long upper_mem)
{
printf("Free Mem going from %d to %d\n", &__ld_kernel_end, upper_mem * 1024);
unsigned long memdesc_end =

View File

@ -16,6 +16,6 @@ struct mem_desc{
};
int memInit(unsigned long upper_mem);
int memSetup(unsigned long upper_mem);
unsigned long allocPage(void);
int unrefPage(unsigned long addr);

View File

@ -2,7 +2,7 @@
#include "io.h"
#include "irq.h"
int initPit(unsigned int freq)
int pitSetup(unsigned int freq)
{
unsigned int divisor = PIT_FREQ / freq;
if (divisor > 65535)

View File

@ -12,5 +12,5 @@
// 5-4: access mode. 0 -> latch count; 1 -> low value only; 2 -> high value only;
// 3 -> low then high 3-1: mode. See https://wiki.osdev.org/PIT
int initPit(unsigned int freq);
int pitSetup(unsigned int freq);

View File

@ -21,7 +21,7 @@
#define UART_1_STOP_BIT 0x00
#define UART_2_STOP_BITS 0x04
void initSerial(int speed)
void serialSetup(int speed)
{
unsigned short div = SERIAL_MAX_SPEED / speed;
outb(PORT + 1, 0x00); // Disable all interrupts
@ -40,7 +40,7 @@ int isTransmitEmpty()
return (inb(PORT + 5) & 0x20);
}
void writeSerial(char a)
void serialWrite(char a)
{
while (isTransmitEmpty() == 0)
;
@ -48,9 +48,9 @@ void writeSerial(char a)
outb(PORT, a);
}
void serial_do_irq(struct interrupt_frame *level)
void serialDoIrq(struct interrupt_frame *level)
{
(void)level;
char c = inb(PORT);
writeSerial(c);
serialWrite(c);
}

View File

@ -1,6 +1,6 @@
#pragma once
#include "irq.h"
void initSerial(int speed);
void writeSerial(char a);
void serial_do_irq(struct interrupt_frame *frame);
void serialSetup(int speed);
void serialWrite(char a);
void serialDoIrq(struct interrupt_frame *frame);

View File

@ -6,7 +6,7 @@ static uint vgaBgColor;
static uint vgaColor;
static int line, col;
int initVGA(uint bgColor, uint color)
int VGASetup(uint bgColor, uint color)
{
vgaBgColor = bgColor;
vgaColor = color;

View File

@ -18,7 +18,7 @@
void vprintf(const char *format, va_list ap);
void printf(const char *format, ...);
int initVGA(uint bgColor, uint color);
int VGASetup(uint bgColor, uint color);
void clearScreen(uint bgColor);
void printInt(int integer);
void printIntDetails(int integer, uint color, uint bgColor, int startX, int startY);