Upload files to "drivers"
This commit is contained in:
1
drivers/ahci.c
Normal file
1
drivers/ahci.c
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include <drivers/ahci.h>
|
29
drivers/ehci.c
Normal file
29
drivers/ehci.c
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define EHCI_BASE_ADDR 0xF0000000 // Example, your base address will be different
|
||||||
|
|
||||||
|
// EHCI Register Offsets (from EHCI spec)
|
||||||
|
#define EHCI_CAPLENGTH_OFFSET 0x00
|
||||||
|
#define EHCI_HCIVERSION_OFFSET 0x02
|
||||||
|
#define EHCI_CONTROL_OFFSET 0x04
|
||||||
|
#define EHCI_STATUS_OFFSET 0x08
|
||||||
|
#define EHCI_COMMAND_OFFSET 0x10
|
||||||
|
|
||||||
|
// Registers access
|
||||||
|
uint32_t read_ehci_register(uint32_t* base, uint32_t offset) {
|
||||||
|
return *(volatile uint32_t*)(base + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_ehci_register(uint32_t* base, uint32_t offset, uint32_t value) {
|
||||||
|
*(volatile uint32_t*)(base + offset) = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize EHCI controller
|
||||||
|
void initialize_ehci(uint32_t* base) {
|
||||||
|
uint32_t control = read_ehci_register(base, EHCI_CONTROL_OFFSET);
|
||||||
|
control |= (1 << 1); // Enable controller
|
||||||
|
write_ehci_register(base, EHCI_CONTROL_OFFSET, control);
|
||||||
|
|
||||||
|
// Set up frame list pointer and other initialization steps as per EHCI specs
|
||||||
|
}
|
Reference in New Issue
Block a user