diff options
author | Marvin Borner | 2021-02-25 17:42:46 +0100 |
---|---|---|
committer | Marvin Borner | 2021-02-25 17:42:46 +0100 |
commit | 34885f1c73824a0fe47aa095e9d55a57021239d2 (patch) | |
tree | b59dfe47069d1f42bd8123e647fadf74bff835a6 /kernel/drivers | |
parent | b85ba196c47920b9d1b6622718a34f8f6f23bef3 (diff) |
Added *many* static keywords
Diffstat (limited to 'kernel/drivers')
-rw-r--r-- | kernel/drivers/ide.c | 14 | ||||
-rw-r--r-- | kernel/drivers/interrupts.c | 10 | ||||
-rw-r--r-- | kernel/drivers/keyboard.c | 13 | ||||
-rw-r--r-- | kernel/drivers/mouse.c | 13 | ||||
-rw-r--r-- | kernel/drivers/rtl8139.c | 8 | ||||
-rw-r--r-- | kernel/drivers/timer.c | 3 |
6 files changed, 33 insertions, 28 deletions
diff --git a/kernel/drivers/ide.c b/kernel/drivers/ide.c index 9be7956..2d02f94 100644 --- a/kernel/drivers/ide.c +++ b/kernel/drivers/ide.c @@ -14,7 +14,7 @@ struct ata_data { u8 drive; }; -void ide_select_drive(u8 bus, u8 drive) +static void ide_select_drive(u8 bus, u8 drive) { if (bus == ATA_PRIMARY) { if (drive == ATA_MASTER) @@ -29,7 +29,7 @@ void ide_select_drive(u8 bus, u8 drive) } } -u8 ide_find(u8 bus, u8 drive) +static u8 ide_find(u8 bus, u8 drive) { u16 io = bus == ATA_PRIMARY ? ATA_PRIMARY_IO : ATA_SECONDARY_IO; ide_select_drive(bus, drive); @@ -61,13 +61,13 @@ u8 ide_find(u8 bus, u8 drive) return 1; } -void ide_delay(u16 io) // 400ns +static void ide_delay(u16 io) // 400ns { for (int i = 0; i < 4; i++) inb(io + ATA_REG_ALTSTATUS); } -void ide_poll(u16 io) +static void ide_poll(u16 io) { for (int i = 0; i < 4; i++) inb(io + ATA_REG_ALTSTATUS); @@ -83,7 +83,7 @@ void ide_poll(u16 io) } while (!(status & ATA_SR_DRQ)); } -u8 ata_read_one(u8 *buf, u32 lba, struct device *dev) +static u8 ata_read_one(u8 *buf, u32 lba, struct device *dev) { u8 drive = ((struct ata_data *)dev->data)->drive; u16 io = (drive & ATA_PRIMARY << 1) == ATA_PRIMARY ? ATA_PRIMARY_IO : ATA_SECONDARY_IO; @@ -106,7 +106,7 @@ u8 ata_read_one(u8 *buf, u32 lba, struct device *dev) return 1; } -s32 ata_read(void *buf, u32 lba, u32 sector_count, struct device *dev) +static s32 ata_read(void *buf, u32 lba, u32 sector_count, struct device *dev) { u8 *b = buf; // I love bytes, yk for (u32 i = 0; i < sector_count; i++) { @@ -117,7 +117,7 @@ s32 ata_read(void *buf, u32 lba, u32 sector_count, struct device *dev) } int ata_pm = 0, ata_ps = 0, ata_sm = 0, ata_ss = 0; -void ata_probe(void) +static void ata_probe(void) { for (int i = 0; i < 4; i++) { int bus = i < 2 ? ATA_PRIMARY : ATA_SECONDARY; diff --git a/kernel/drivers/interrupts.c b/kernel/drivers/interrupts.c index 4c5c3b7..d9d514c 100644 --- a/kernel/drivers/interrupts.c +++ b/kernel/drivers/interrupts.c @@ -29,7 +29,7 @@ void idt_set_gate(u8 num, u32 base, u16 sel, u8 flags) } // Install IDT -void idt_install() +static void idt_install() { // Set IDT pointer and limit idt_ptr.limit = (sizeof(struct idt_entry) * 256) - 1; @@ -60,7 +60,7 @@ void irq_uninstall_handler(int irq) } // Remap the IRQ table -void irq_remap() +static void irq_remap() { outb(0x20, 0x11); outb(0xA0, 0x11); @@ -75,6 +75,7 @@ void irq_remap() } // Handle IRQ ISRs +void irq_handler(struct regs *r); void irq_handler(struct regs *r) { void (*handler)(struct regs * r); @@ -93,7 +94,7 @@ void irq_handler(struct regs *r) } // Map ISRs to the correct entries in the IDT -void irq_install(void) +static void irq_install(void) { irq_remap(); @@ -168,6 +169,7 @@ void isr_uninstall_handler(int isr) isr_routines[isr] = 0; } +void isr_handler(struct regs *r); void isr_handler(struct regs *r) { if (r->int_no <= 32) { @@ -186,7 +188,7 @@ void isr_handler(struct regs *r) } } -void isr_install(void) +static void isr_install(void) { idt_set_gate(0, (u32)isr0, 0x08, 0x8E); idt_set_gate(1, (u32)isr1, 0x08, 0x8E); diff --git a/kernel/drivers/keyboard.c b/kernel/drivers/keyboard.c index f22af80..f7f9d2d 100644 --- a/kernel/drivers/keyboard.c +++ b/kernel/drivers/keyboard.c @@ -4,6 +4,7 @@ #include <def.h> #include <fs.h> #include <interrupts.h> +#include <keyboard.h> #include <mem.h> #include <print.h> #include <proc.h> @@ -17,7 +18,7 @@ static u32 dev_id = 0; static int state = 0; static int merged = 0; -void keyboard_handler() +static void keyboard_handler() { int scancode = inb(0x60); @@ -45,20 +46,20 @@ void keyboard_handler() proc_enable_waiting(dev_id, PROC_WAIT_DEV); } -void keyboard_acknowledge(void) +/*static void keyboard_acknowledge(void) { while (inb(0x60) != 0xfa) ; } -void keyboard_rate(void) +static void keyboard_rate(void) { outb(0x60, 0xF3); keyboard_acknowledge(); outb(0x60, 0x0); // Rate{00000} Delay{00} 0 -} +}*/ -s32 keyboard_read(void *buf, u32 offset, u32 count, struct device *dev) +static s32 keyboard_read(void *buf, u32 offset, u32 count, struct device *dev) { (void)dev; if (stack_empty(queue)) @@ -70,7 +71,7 @@ s32 keyboard_read(void *buf, u32 offset, u32 count, struct device *dev) return count; } -u8 keyboard_ready(void) +static u8 keyboard_ready(void) { return !stack_empty(queue); } diff --git a/kernel/drivers/mouse.c b/kernel/drivers/mouse.c index e2f7311..ce9d15c 100644 --- a/kernel/drivers/mouse.c +++ b/kernel/drivers/mouse.c @@ -5,6 +5,7 @@ #include <fs.h> #include <interrupts.h> #include <mem.h> +#include <mouse.h> #include <print.h> #include <proc.h> #include <stack.h> @@ -18,7 +19,7 @@ static u32 dev_id = 0; static struct event_mouse *event = NULL; -void mouse_handler() +static void mouse_handler() { switch (mouse_cycle) { case 0: @@ -51,7 +52,7 @@ void mouse_handler() } } -void mouse_serial_wait(u8 a_type) +static void mouse_serial_wait(u8 a_type) { u32 time_out = 100000; if (a_type == 0) { @@ -67,7 +68,7 @@ void mouse_serial_wait(u8 a_type) } } -void mouse_serial_write(u8 a_write) +static void mouse_serial_write(u8 a_write) { mouse_serial_wait(1); outb(0x64, 0xD4); @@ -75,18 +76,18 @@ void mouse_serial_write(u8 a_write) outb(0x60, a_write); } -u8 mouse_serial_read(void) +static u8 mouse_serial_read(void) { mouse_serial_wait(0); return inb(0x60); } -u8 mouse_ready(void) +static u8 mouse_ready(void) { return !stack_empty(queue); } -s32 mouse_read(void *buf, u32 offset, u32 count, struct device *dev) +static s32 mouse_read(void *buf, u32 offset, u32 count, struct device *dev) { (void)dev; if (stack_empty(queue)) diff --git a/kernel/drivers/rtl8139.c b/kernel/drivers/rtl8139.c index 9317d7b..1f9eed9 100644 --- a/kernel/drivers/rtl8139.c +++ b/kernel/drivers/rtl8139.c @@ -27,7 +27,7 @@ u8 *rtl8139_get_mac(void) return mac; } -void rtl8139_receive_packet(void) +static void rtl8139_receive_packet(void) { while ((inb(rtl_iobase + RTL_PORT_CMD) & 0x01) == 0) { int offset = cur_rx % 0x2000; @@ -75,14 +75,14 @@ void rtl8139_send_packet(void *data, u32 len) tx_current = 0; } -void rtl8139_find(u32 device, u16 vendor_id, u16 device_id, void *extra) +static void rtl8139_find(u32 device, u16 vendor_id, u16 device_id, void *extra) { if ((vendor_id == 0x10ec) && (device_id == 0x8139)) { *((u32 *)extra) = device; } } -void rtl8139_irq_handler() +static void rtl8139_irq_handler() { u16 status = inw(rtl_iobase + RTL_PORT_ISR); if (!status) @@ -93,7 +93,7 @@ void rtl8139_irq_handler() rtl8139_receive_packet(); } -void rtl8139_init(void) +static void rtl8139_init(void) { if (!rtl_device_pci) return; diff --git a/kernel/drivers/timer.c b/kernel/drivers/timer.c index 766512f..8887279 100644 --- a/kernel/drivers/timer.c +++ b/kernel/drivers/timer.c @@ -4,11 +4,12 @@ #include <def.h> #include <interrupts.h> #include <proc.h> +#include <timer.h> static u32 timer_ticks = 0; static u8 call_scheduler = 0; -void timer_phase(int hz) +static void timer_phase(int hz) { int divisor = 3579545 / 3 / hz; outb(0x43, 0x36); // 01 10 11 0b // CTR, RW, MODE, BCD |