Decouple I/O from HAL
This commit is contained in:
@ -59,6 +59,7 @@ SRCFILES += $(call GRABSRC, \
|
|||||||
time \
|
time \
|
||||||
diskpart \
|
diskpart \
|
||||||
FastLZ \
|
FastLZ \
|
||||||
|
io \
|
||||||
)
|
)
|
||||||
|
|
||||||
CFILES := $(call GET_CFILES, $(SRCFILES))
|
CFILES := $(call GET_CFILES, $(SRCFILES))
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
#include "hshtb.h"
|
#include "hshtb.h"
|
||||||
#include "sysdefs/dev.h"
|
#include "sysdefs/dev.h"
|
||||||
#include "proc/proc.h"
|
#include "proc/proc.h"
|
||||||
|
#include "io/io.h"
|
||||||
|
|
||||||
#define KB_CTL_STATUS 0x64
|
#define KB_CTL_STATUS 0x64
|
||||||
#define KB_DATA_IN_BUF 0x01
|
#define KB_DATA_IN_BUF 0x01
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include "sysdefs/dev.h"
|
#include "sysdefs/dev.h"
|
||||||
#include "kprintf.h"
|
#include "kprintf.h"
|
||||||
#include "hal/hal.h"
|
#include "hal/hal.h"
|
||||||
|
#include "io/io.h"
|
||||||
|
|
||||||
// https://wiki.osdev.org/Serial_Ports
|
// https://wiki.osdev.org/Serial_Ports
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,6 @@ int32_t hal_randnum(void);
|
|||||||
#include "x86_64/switch.h"
|
#include "x86_64/switch.h"
|
||||||
#include "x86_64/paging.h"
|
#include "x86_64/paging.h"
|
||||||
#include "x86_64/intr.h"
|
#include "x86_64/intr.h"
|
||||||
#include "x86_64/io.h"
|
|
||||||
#include "x86_64/gdt.h"
|
#include "x86_64/gdt.h"
|
||||||
|
|
||||||
#endif // KERNEL_HAL_HAL_H_
|
#endif // KERNEL_HAL_HAL_H_
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "intr.h"
|
#include "intr.h"
|
||||||
#include "io.h"
|
#include "io/io.h"
|
||||||
#include "gdt.h"
|
#include "gdt.h"
|
||||||
#include "hal/hal.h"
|
#include "hal/hal.h"
|
||||||
#include "kprintf.h"
|
#include "kprintf.h"
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "pic.h"
|
#include "pic.h"
|
||||||
#include "io.h"
|
#include "io/io.h"
|
||||||
#include "intr.h"
|
#include "intr.h"
|
||||||
|
|
||||||
void pic_init(void) {
|
void pic_init(void) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "pit.h"
|
#include "pit.h"
|
||||||
#include "io.h"
|
#include "io/io.h"
|
||||||
|
|
||||||
#define PIT_COUNTER0 0x40
|
#define PIT_COUNTER0 0x40
|
||||||
#define PIT_CMD 0x43
|
#define PIT_CMD 0x43
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "io.h"
|
||||||
|
|
||||||
uint8_t io_in8(uint16_t port) {
|
uint8_t io_in8(uint16_t port) {
|
||||||
uint8_t r;
|
uint8_t r;
|
||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef HAL_IO_H_
|
#ifndef IO_IO_H_
|
||||||
#define HAL_IO_H_
|
#define IO_IO_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@ -15,4 +15,4 @@ void io_out32(uint16_t port, uint32_t value);
|
|||||||
void io_ins16(uint16_t port, void *addr, int cnt);
|
void io_ins16(uint16_t port, void *addr, int cnt);
|
||||||
void io_outs16(uint16_t port, const void *addr, int cnt);
|
void io_outs16(uint16_t port, const void *addr, int cnt);
|
||||||
|
|
||||||
#endif // HAL_IO_H_
|
#endif // IO_IO_H_
|
||||||
@ -9,6 +9,7 @@
|
|||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
#include "hshtb.h"
|
#include "hshtb.h"
|
||||||
#include "vfs/vfs.h"
|
#include "vfs/vfs.h"
|
||||||
|
#include "io/io.h"
|
||||||
|
|
||||||
#define ATA_REG_DATA 0x00
|
#define ATA_REG_DATA 0x00
|
||||||
#define ATA_REG_ERROR 0x01
|
#define ATA_REG_ERROR 0x01
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "hal/hal.h"
|
#include "hal/hal.h"
|
||||||
#include "std/string.h"
|
#include "std/string.h"
|
||||||
|
#include "io/io.h"
|
||||||
|
|
||||||
#define CMOS_PORT 0x70
|
#define CMOS_PORT 0x70
|
||||||
#define CMOS_RETURN 0x71
|
#define CMOS_RETURN 0x71
|
||||||
|
|||||||
Reference in New Issue
Block a user