This commit is contained in:
2025-05-28 14:41:02 -05:00
commit 6d366537dd
73 changed files with 4448 additions and 0 deletions

6
include/drivers/ahci.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef _AHCI_H
#define _AHCI_H
#endif

40
include/drivers/ide.h Normal file
View File

@ -0,0 +1,40 @@
#ifndef _IDE_H
#define _IDE_H
#include <stdint.h>
#include <stddef.h>
#define ATA_PRIMARY_IO 0x1F0
#define ATA_PRIMARY_CTRL 0x3F6
#define ATA_MASTER 0x00
#define ATA_SLAVE 0x10
#define ATA_REG_DATA 0x00
#define ATA_REG_ERROR 0x01
#define ATA_REG_SECCOUNT0 0x02
#define ATA_REG_LBA0 0x03
#define ATA_REG_LBA1 0x04
#define ATA_REG_LBA2 0x05
#define ATA_REG_LBA3 0x06 // LBA48 higher bits
#define ATA_REG_LBA4 0x07 // LBA48 higher bits
#define ATA_REG_LBA5 0x08 // LBA48 higher bits
#define ATA_REG_HDDEVSEL 0x06
#define ATA_REG_COMMAND 0x07
#define ATA_REG_STATUS 0x07
#define ATA_CMD_READ_SECTORS 0x20
#define ATA_CMD_WRITE_SECTORS 0x30
#define ATA_CMD_READ_SECTORS_EXT 0x24
#define ATA_CMD_WRITE_SECTORS_EXT 0x34
#define ATA_SR_BSY 0x80
#define ATA_SR_DRDY 0x40
#define ATA_SR_DRQ 0x08
#define ATA_SR_ERR 0x01
void ide_initialize(void);
int32_t ide_identify(uint8_t drive, uint16_t* buffer);
int32_t ide_read48(uint8_t drive, uint64_t lba, uint8_t sector_count, void* buffer);
int32_t ide_write48(uint8_t drive, uint64_t lba, uint8_t sector_count, const void* buffer);
#endif

10
include/drivers/pci.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef _PCI_H
#define _PCI_H
#include <stdint.h>
uint32_t pci_config_read(uint8_t bus, uint8_t device, uint8_t function, uint8_t offset);
void pci_config_write(uint8_t bus, uint8_t device, uint8_t function, uint8_t offset, uint32_t value);
void pci_enumerate(void);
#endif

7
include/drivers/pit.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef _PIT_H
#define _PIT_H
#include <types.h>
#endif

View File

@ -0,0 +1,10 @@
#ifndef _PS2_KEYBOARD_H
#define _PS2_KEYBOARD_H
#include <types.h>
#include <isr.h>
void keyboard_init(void);
void keyboard_handler(isr_stack_t* regs);
#endif