From e957c67ea0f63a668303d087af7ee0c7ecff1f01 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 28 Sep 2011 10:28:56 +0800 Subject: [PATCH] Kernel - Added pointer to IRQ callbacks --- Kernel/arch/x86/irq.c | 18 ++-- Kernel/arch/x86/time.c | 6 +- Kernel/arch/x86_64/desctab.asm | 14 ++- Kernel/include/acess.h | 2 +- Modules/Input/PS2KbMouse/8042.c | 12 +-- Modules/Network/NE2000/ne2000.c | 58 ++++++------- Modules/Network/RTL8139/rtl8139.c | 136 +++++++++++++++--------------- Modules/Storage/ATA/io.c | 12 +-- Modules/Storage/FDD/fdd.c | 6 +- Modules/USB/Core/uhci.c | 11 ++- 10 files changed, 139 insertions(+), 136 deletions(-) diff --git a/Kernel/arch/x86/irq.c b/Kernel/arch/x86/irq.c index 381b1579..e2dcf0e3 100644 --- a/Kernel/arch/x86/irq.c +++ b/Kernel/arch/x86/irq.c @@ -9,13 +9,14 @@ #define TRACE_IRQS 0 // === TYPES === -typedef void (*tIRQ_Callback)(int); +typedef void (*tIRQ_Callback)(int, void *); // === PROTOTYPES === void IRQ_Handler(tRegs *Regs); // === GLOBALS === tIRQ_Callback gIRQ_Handlers[16][MAX_CALLBACKS_PER_IRQ]; +void *gaIRQ_DataPointers[16][MAX_CALLBACKS_PER_IRQ]; // === CODE === /** @@ -24,25 +25,23 @@ tIRQ_Callback gIRQ_Handlers[16][MAX_CALLBACKS_PER_IRQ]; */ void IRQ_Handler(tRegs *Regs) { - int i; - - Regs->int_num -= 0xF0; // Adjust + int i, irq = Regs->int_num - 0xF0; //Log("IRQ_Handler: (Regs={int_num:%i})", Regs->int_num); for( i = 0; i < MAX_CALLBACKS_PER_IRQ; i++ ) { - if( gIRQ_Handlers[Regs->int_num][i] ) { - gIRQ_Handlers[Regs->int_num][i](Regs->int_num); + if( gIRQ_Handlers[irq][i] ) { + gIRQ_Handlers[irq][i](irq, gaIRQ_DataPointers[irq][i]); #if TRACE_IRQS - if( Regs->int_num != 8 ) + if( irq != 8 ) Log("IRQ %i: Call %p", Regs->int_num, gIRQ_Handlers[Regs->int_num][i]); #endif } } //Log(" IRQ_Handler: Resetting"); - if(Regs->int_num >= 8) + if(irq >= 8) outb(0xA0, 0x20); // ACK IRQ (Secondary PIC) outb(0x20, 0x20); // ACK IRQ //Log("IRQ_Handler: RETURN"); @@ -51,7 +50,7 @@ void IRQ_Handler(tRegs *Regs) /** * \fn int IRQ_AddHandler( int Num, void (*Callback)(int) ) */ -int IRQ_AddHandler( int Num, void (*Callback)(int) ) +int IRQ_AddHandler( int Num, void (*Callback)(int, void*), void *Ptr ) { int i; for( i = 0; i < MAX_CALLBACKS_PER_IRQ; i++ ) @@ -59,6 +58,7 @@ int IRQ_AddHandler( int Num, void (*Callback)(int) ) if( gIRQ_Handlers[Num][i] == NULL ) { Log_Log("IRQ", "Added IRQ%i Cb#%i %p", Num, i, Callback); gIRQ_Handlers[Num][i] = Callback; + gaIRQ_DataPointers[Num][i] = Ptr; return 1; } } diff --git a/Kernel/arch/x86/time.c b/Kernel/arch/x86/time.c index 22ea6181..d4bda951 100644 --- a/Kernel/arch/x86/time.c +++ b/Kernel/arch/x86/time.c @@ -30,7 +30,7 @@ volatile Uint64 giTime_TSCPerTick = 0; // === PROTOTYPES === //Sint64 now(void); int Time_Setup(void); -void Time_Interrupt(int); +void Time_Interrupt(int IRQ, void *Ptr); Uint64 Time_ReadTSC(void); // === CODE === @@ -83,7 +83,7 @@ int Time_Setup(void) outb(0x70, inb(0x70)|0x80); // Re-enable NMIs // Install IRQ Handler - IRQ_AddHandler(8, Time_Interrupt); + IRQ_AddHandler(8, Time_Interrupt, NULL); // Make sure the RTC actually fires outb(0x70, 0x0C); // Select register C @@ -96,7 +96,7 @@ int Time_Setup(void) * \brief Called on the timekeeping IRQ * \param irq IRQ number (unused) */ -void Time_Interrupt(int irq) +void Time_Interrupt(int IRQ, void *Ptr) { //Log("RTC Tick"); Uint64 curTSC = Time_ReadTSC(); diff --git a/Kernel/arch/x86_64/desctab.asm b/Kernel/arch/x86_64/desctab.asm index 739b219f..27ba9137 100644 --- a/Kernel/arch/x86_64/desctab.asm +++ b/Kernel/arch/x86_64/desctab.asm @@ -128,7 +128,7 @@ Desctab_Init: ret -; int IRQ_AddHandler(int IRQ, void (*Handler)(int IRQ)) +; int IRQ_AddHandler(int IRQ, void (*Handler)(int IRQ), void *Ptr) ; Return Values: ; 0 on Success ; -1 on an invalid IRQ Number @@ -137,6 +137,7 @@ Desctab_Init: IRQ_AddHandler: ; RDI - IRQ Number ; RSI - Callback + ; RDX - Ptr ; Check for RDI >= 16 cmp rdi, 16 @@ -153,8 +154,8 @@ IRQ_AddHandler: ; Find a free callback slot %rep NUM_IRQ_CALLBACKS - mov rdx, [rax] - test rdx, rdx + mov rcx, [rax] + test rcx, rcx jz .assign add rax, 8 %endrep @@ -170,6 +171,7 @@ IRQ_AddHandler: push rdi push rsi push rax + push rdx sub rsp, 8 mov rcx, rdi ; IRQ Number mov rdx, rsi ; Callback @@ -177,12 +179,15 @@ IRQ_AddHandler: mov rdi, csIRQ_Assigned call Log add rsp, 8 + pop rdx pop rax pop rsi pop rdi ; Assign and return mov [rax], rsi + add rax, gaIRQ_DataPtrs - gaIRQ_Handlers + mov [rax], rdx xor rax, rax .ret: @@ -300,6 +305,7 @@ IrqCommon: jz .skip.%[i] ; Set RDI to IRQ number mov rdi, [rsp+(16+2+1)*8] ; Get IRQ number + mov rsi, [rbx-gaIRQ_Handlers+gaIRQ_DataPtrs] call rax ; Call .skip.%[i]: add rbx, 8 ; Next! @@ -433,3 +439,5 @@ gIDTPtr: gaIRQ_Handlers: times 16*NUM_IRQ_CALLBACKS dq 0 +gaIRQ_DataPtrs: + times 16*NUM_IRQ_CALLBACKS dq 0 diff --git a/Kernel/include/acess.h b/Kernel/include/acess.h index 46bd6fa5..5100c81c 100644 --- a/Kernel/include/acess.h +++ b/Kernel/include/acess.h @@ -107,7 +107,7 @@ typedef struct sKernelSymbol { // === FUNCTIONS === // --- IRQs --- -extern int IRQ_AddHandler(int Num, void (*Callback)(int)); +extern int IRQ_AddHandler(int Num, void (*Callback)(int, void*), void *Ptr); extern void IRQ_RemHandler(int Handle); // --- Logging --- diff --git a/Modules/Input/PS2KbMouse/8042.c b/Modules/Input/PS2KbMouse/8042.c index 7d032c56..fd78bb69 100644 --- a/Modules/Input/PS2KbMouse/8042.c +++ b/Modules/Input/PS2KbMouse/8042.c @@ -9,8 +9,8 @@ // === PROTOTYPES === void KBC8042_Init(void); -void KBC8042_KeyboardHandler(int IRQ); -void KBC8042_MouseHandler(int IRQ); +void KBC8042_KeyboardHandler(int IRQ, void *Ptr); +void KBC8042_MouseHandler(int IRQ, void *Ptr); void KBC8042_EnableMouse(void); static inline void KBC8042_SendDataAlt(Uint8 data); static inline void KBC8042_SendData(Uint8 data); @@ -20,8 +20,8 @@ static void KBC8042_SendMouseCommand(Uint8 cmd); // === CODE === void KBC8042_Init(void) { - IRQ_AddHandler(1, KBC8042_KeyboardHandler); - IRQ_AddHandler(12, KBC8042_MouseHandler); // Set IRQ + IRQ_AddHandler(1, KBC8042_KeyboardHandler, NULL); + IRQ_AddHandler(12, KBC8042_MouseHandler, NULL); // Set IRQ { Uint8 temp; @@ -34,7 +34,7 @@ void KBC8042_Init(void) } } -void KBC8042_KeyboardHandler(int IRQ) +void KBC8042_KeyboardHandler(int IRQ, void *Ptr) { Uint8 scancode; @@ -42,7 +42,7 @@ void KBC8042_KeyboardHandler(int IRQ) KB_HandleScancode( scancode ); } -void KBC8042_MouseHandler(int IRQ) +void KBC8042_MouseHandler(int IRQ, void *Ptr) { PS2Mouse_HandleInterrupt( inb(0x60) ); } diff --git a/Modules/Network/NE2000/ne2000.c b/Modules/Network/NE2000/ne2000.c index eb3673f2..288db5f4 100644 --- a/Modules/Network/NE2000/ne2000.c +++ b/Modules/Network/NE2000/ne2000.c @@ -91,7 +91,7 @@ Uint64 Ne2k_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); int Ne2k_int_ReadDMA(tCard *Card, int FirstPage, int NumPages, void *Buffer); Uint8 Ne2k_int_GetWritePage(tCard *Card, Uint16 Length); -void Ne2k_IRQHandler(int IntNum); +void Ne2k_IRQHandler(int IntNum, void *Ptr); // === GLOBALS === MODULE_DEFINE(0, VERSION, Ne2k, Ne2k_Install, NULL, NULL); @@ -152,7 +152,7 @@ int Ne2k_Install(char **Options) gpNe2k_Cards[ k ].NextRXPage = RX_FIRST; // Install IRQ Handler - IRQ_AddHandler(gpNe2k_Cards[ k ].IRQ, Ne2k_IRQHandler); + IRQ_AddHandler(gpNe2k_Cards[ k ].IRQ, Ne2k_IRQHandler, &gpNe2k_Cards[k]); // Reset Card outb( base + 0x1F, inb(base + 0x1F) ); @@ -506,41 +506,35 @@ Uint8 Ne2k_int_GetWritePage(tCard *Card, Uint16 Length) /** * \fn void Ne2k_IRQHandler(int IntNum) */ -void Ne2k_IRQHandler(int IntNum) +void Ne2k_IRQHandler(int IntNum, void *Ptr) { - int i; Uint8 byte; - for( i = 0; i < giNe2k_CardCount; i++ ) - { - if(gpNe2k_Cards[i].IRQ == IntNum) - { - byte = inb( gpNe2k_Cards[i].IOBase + ISR ); - - LOG("byte = 0x%02x", byte); - + tCard *card = Ptr; + + if(card->IRQ != IntNum) return; + + byte = inb( card->IOBase + ISR ); + + LOG("byte = 0x%02x", byte); - // Reset All (save for RDMA), that's polled - outb( gpNe2k_Cards[i].IOBase + ISR, 0xFF&(~0x40) ); - // 0: Packet recieved (no error) - if( byte & 1 ) - { - //if( gpNe2k_Cards[i].NumWaitingPackets > MAX_PACKET_QUEUE ) - // gpNe2k_Cards[i].NumWaitingPackets = MAX_PACKET_QUEUE; - if( Semaphore_Signal( &gpNe2k_Cards[i].Semaphore, 1 ) != 1 ) { - // Oops? - } - } - // 1: Packet sent (no error) - // 2: Recieved with error - // 3: Transmission Halted (Excessive Collisions) - // 4: Recieve Buffer Exhausted - // 5: - // 6: Remote DMA Complete - // 7: Reset + // Reset All (save for RDMA), that's polled + outb( card->IOBase + ISR, 0xFF&(~0x40) ); - return ; + // 0: Packet recieved (no error) + if( byte & 1 ) + { + //if( card->NumWaitingPackets > MAX_PACKET_QUEUE ) + // card->NumWaitingPackets = MAX_PACKET_QUEUE; + if( Semaphore_Signal( &card->Semaphore, 1 ) != 1 ) { + // Oops? } } - Log_Warning("Ne2k", "Recieved Unknown IRQ %i", IntNum); + // 1: Packet sent (no error) + // 2: Recieved with error + // 3: Transmission Halted (Excessive Collisions) + // 4: Recieve Buffer Exhausted + // 5: + // 6: Remote DMA Complete + // 7: Reset } diff --git a/Modules/Network/RTL8139/rtl8139.c b/Modules/Network/RTL8139/rtl8139.c index bb479554..a34aeb4a 100644 --- a/Modules/Network/RTL8139/rtl8139.c +++ b/Modules/Network/RTL8139/rtl8139.c @@ -97,7 +97,7 @@ tVFS_Node *RTL8139_FindDir(tVFS_Node *Node, const char *Filename); Uint64 RTL8139_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); Uint64 RTL8139_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); int RTL8139_IOCtl(tVFS_Node *Node, int ID, void *Arg); -void RTL8139_IRQHandler(int Num); +void RTL8139_IRQHandler(int Num, void *Ptr); // === GLOBALS === MODULE_DEFINE(0, VERSION, RTL8139, RTL8139_Install, NULL, NULL); @@ -149,7 +149,7 @@ int RTL8139_Install(char **Options) card->IRQ = PCI_GetIRQ( id ); // Install IRQ Handler - IRQ_AddHandler(card->IRQ, RTL8139_IRQHandler); + IRQ_AddHandler(card->IRQ, RTL8139_IRQHandler, card); // Power on outb( base + CONFIG1, 0x00 ); @@ -372,94 +372,90 @@ int RTL8139_IOCtl(tVFS_Node *Node, int ID, void *Data) return 0; } -void RTL8139_IRQHandler(int Num) +void RTL8139_IRQHandler(int Num, void *Ptr) { - int i, j; - tCard *card; + int j; + tCard *card = Ptr; Uint16 status; LOG("Num = %i", Num); - for( i = 0; i < giRTL8139_CardCount; i ++ ) - { - card = &gaRTL8139_Cards[i]; - if( Num != card->IRQ ) break; + if( Num != card->IRQ ) return; - status = inw(card->IOBase + ISR); - LOG("status = 0x%02x", status); + status = inw(card->IOBase + ISR); + LOG("status = 0x%02x", status); - // Transmit OK, a transmit descriptor is now free - if( status & FLAG_ISR_TOK ) + // Transmit OK, a transmit descriptor is now free + if( status & FLAG_ISR_TOK ) + { + for( j = 0; j < 4; j ++ ) { - for( j = 0; j < 4; j ++ ) - { - if( ind(card->IOBase + TSD0 + j*4) & 0x8000 ) { // TSD TOK - Mutex_Release( &card->TransmitInUse[j] ); - // TODO: Update semaphore once implemented - } + if( ind(card->IOBase + TSD0 + j*4) & 0x8000 ) { // TSD TOK + Mutex_Release( &card->TransmitInUse[j] ); + // TODO: Update semaphore once implemented } - outw(card->IOBase + ISR, FLAG_ISR_TOK); } + outw(card->IOBase + ISR, FLAG_ISR_TOK); + } + + // Recieve OK, inform read + if( status & FLAG_ISR_ROK ) + { + int read_ofs, end_ofs; + int packet_count = 0; + int len; - // Recieve OK, inform read - if( status & FLAG_ISR_ROK ) + // Scan recieve buffer for packets + end_ofs = inw(card->IOBase + CBA); + read_ofs = card->SeenOfs; + LOG("read_ofs = %i, end_ofs = %i", read_ofs, end_ofs); + if( read_ofs > end_ofs ) { - int read_ofs, end_ofs; - int packet_count = 0; - int len; - - // Scan recieve buffer for packets - end_ofs = inw(card->IOBase + CBA); - read_ofs = card->SeenOfs; - LOG("read_ofs = %i, end_ofs = %i", read_ofs, end_ofs); - if( read_ofs > end_ofs ) - { - while( read_ofs < card->ReceiveBufferLength ) - { - packet_count ++; - len = *(Uint16*)&card->ReceiveBuffer[read_ofs+2]; - LOG("%i 0x%x Pkt Hdr: 0x%04x, len: 0x%04x", - packet_count, read_ofs, - *(Uint16*)&card->ReceiveBuffer[read_ofs], - len - ); - if(len > 2000) { - Log_Warning("RTL8139", "IRQ: Packet in buffer exceeds sanity (%i>2000)", len); - } - read_ofs += len + 4; - read_ofs = (read_ofs + 3) & ~3; // Align - } - read_ofs -= card->ReceiveBufferLength; - LOG("wrapped read_ofs"); - } - while( read_ofs < end_ofs ) + while( read_ofs < card->ReceiveBufferLength ) { packet_count ++; + len = *(Uint16*)&card->ReceiveBuffer[read_ofs+2]; LOG("%i 0x%x Pkt Hdr: 0x%04x, len: 0x%04x", packet_count, read_ofs, *(Uint16*)&card->ReceiveBuffer[read_ofs], - *(Uint16*)&card->ReceiveBuffer[read_ofs+2] + len ); - read_ofs += *(Uint16*)&card->ReceiveBuffer[read_ofs+2] + 4; + if(len > 2000) { + Log_Warning("RTL8139", "IRQ: Packet in buffer exceeds sanity (%i>2000)", len); + } + read_ofs += len + 4; read_ofs = (read_ofs + 3) & ~3; // Align } - if( read_ofs != end_ofs ) { - Log_Warning("RTL8139", "IRQ: read_ofs (%i) != end_ofs(%i)", read_ofs, end_ofs); - read_ofs = end_ofs; - } - card->SeenOfs = read_ofs; - - LOG("packet_count = %i, read_ofs = 0x%x", packet_count, read_ofs); - - if( packet_count ) - { - if( Semaphore_Signal( &card->ReadSemaphore, packet_count ) != packet_count ) { - // Oops? - } - VFS_MarkAvaliable( &card->Node, 1 ); + read_ofs -= card->ReceiveBufferLength; + LOG("wrapped read_ofs"); + } + while( read_ofs < end_ofs ) + { + packet_count ++; + LOG("%i 0x%x Pkt Hdr: 0x%04x, len: 0x%04x", + packet_count, read_ofs, + *(Uint16*)&card->ReceiveBuffer[read_ofs], + *(Uint16*)&card->ReceiveBuffer[read_ofs+2] + ); + read_ofs += *(Uint16*)&card->ReceiveBuffer[read_ofs+2] + 4; + read_ofs = (read_ofs + 3) & ~3; // Align + } + if( read_ofs != end_ofs ) { + Log_Warning("RTL8139", "IRQ: read_ofs (%i) != end_ofs(%i)", read_ofs, end_ofs); + read_ofs = end_ofs; + } + card->SeenOfs = read_ofs; + + LOG("packet_count = %i, read_ofs = 0x%x", packet_count, read_ofs); + + if( packet_count ) + { + if( Semaphore_Signal( &card->ReadSemaphore, packet_count ) != packet_count ) { + // Oops? } - - outw(card->IOBase + ISR, FLAG_ISR_ROK); + VFS_MarkAvaliable( &card->Node, 1 ); } - } + + outw(card->IOBase + ISR, FLAG_ISR_ROK); + } } diff --git a/Modules/Storage/ATA/io.c b/Modules/Storage/ATA/io.c index 26fe6c05..128fdca0 100644 --- a/Modules/Storage/ATA/io.c +++ b/Modules/Storage/ATA/io.c @@ -79,8 +79,8 @@ Uint16 ATA_GetBasePort(int Disk); int ATA_ReadDMA(Uint8 Disk, Uint64 Address, Uint Count, void *Buffer); int ATA_WriteDMA(Uint8 Disk, Uint64 Address, Uint Count, const void *Buffer); // IRQs -void ATA_IRQHandlerPri(int UNUSED(IRQ)); -void ATA_IRQHandlerSec(int UNUSED(IRQ)); +void ATA_IRQHandlerPri(int UNUSED(IRQ), void *UNUSED(Ptr)); +void ATA_IRQHandlerSec(int UNUSED(IRQ), void *UNUSED(Ptr)); // Controller IO Uint8 ATA_int_BusMasterReadByte(int Ofs); Uint32 ATA_int_BusMasterReadDWord(int Ofs); @@ -145,8 +145,8 @@ int ATA_SetupIO(void) } // Register IRQs and get Buffers - IRQ_AddHandler( gATA_IRQPri, ATA_IRQHandlerPri ); - IRQ_AddHandler( gATA_IRQSec, ATA_IRQHandlerSec ); + IRQ_AddHandler( gATA_IRQPri, ATA_IRQHandlerPri, NULL ); + IRQ_AddHandler( gATA_IRQSec, ATA_IRQHandlerSec, NULL ); gATA_PRDTs[0].PBufAddr = MM_GetPhysAddr( (tVAddr)&gATA_Buffers[0] ); gATA_PRDTs[1].PBufAddr = MM_GetPhysAddr( (tVAddr)&gATA_Buffers[1] ); @@ -503,7 +503,7 @@ int ATA_WriteDMA(Uint8 Disk, Uint64 Address, Uint Count, const void *Buffer) /** * \brief Primary ATA Channel IRQ handler */ -void ATA_IRQHandlerPri(int UNUSED(IRQ)) +void ATA_IRQHandlerPri(int UNUSED(IRQ), void *UNUSED(Ptr)) { Uint8 val; @@ -521,7 +521,7 @@ void ATA_IRQHandlerPri(int UNUSED(IRQ)) /** * \brief Second ATA Channel IRQ handler */ -void ATA_IRQHandlerSec(int UNUSED(IRQ)) +void ATA_IRQHandlerSec(int UNUSED(IRQ), void *UNUSED(Ptr)) { Uint8 val; // IRQ bit set for Secondary Controller diff --git a/Modules/Storage/FDD/fdd.c b/Modules/Storage/FDD/fdd.c index 2de321da..5c2848ff 100644 --- a/Modules/Storage/FDD/fdd.c +++ b/Modules/Storage/FDD/fdd.c @@ -107,7 +107,7 @@ Uint FDD_ReadSectors(Uint64 SectorAddr, Uint Count, void *Buffer, Uint Disk); int FDD_ReadSector(Uint32 disk, Uint64 lba, void *Buffer); int FDD_WriteSector(Uint32 Disk, Uint64 LBA, void *Buffer); // --- Helpers -void FDD_IRQHandler(int Num); +void FDD_IRQHandler(int Num, void *Ptr); inline void FDD_WaitIRQ(); void FDD_SensInt(int base, Uint8 *sr0, Uint8 *cyl); int FDD_int_SendByte(int base, Uint8 Byte); @@ -172,7 +172,7 @@ int FDD_Install(char **Arguments) } // Install IRQ6 Handler - IRQ_AddHandler(6, FDD_IRQHandler); + IRQ_AddHandler(6, FDD_IRQHandler, NULL); // Ensure the FDD version is 0x90 { @@ -676,7 +676,7 @@ int FDD_int_GetDims(int type, int lba, int *c, int *h, int *s, int *spt) * \fn void FDD_IRQHandler(int Num) * \brief Handles IRQ6 */ -void FDD_IRQHandler(int Num) +void FDD_IRQHandler(int Num, void *Ptr) { gbFDD_IrqFired = 1; } diff --git a/Modules/USB/Core/uhci.c b/Modules/USB/Core/uhci.c index 157bf724..5a71d656 100644 --- a/Modules/USB/Core/uhci.c +++ b/Modules/USB/Core/uhci.c @@ -23,7 +23,7 @@ void UHCI_int_AppendTD(tUHCI_Controller *Cont, tUHCI_TD *TD); int UHCI_DataOUT(void *Ptr, int Fcn, int Endpt, int DataTgl, void *Data, size_t Length); int UHCI_SendSetup(void *Ptr, int Fcn, int Endpt, int DataTgl, void *Data, size_t Length); int UHCI_Int_InitHost(tUHCI_Controller *Host); -void UHCI_InterruptHandler(int IRQ); +void UHCI_InterruptHandler(int IRQ, void *Ptr); // === GLOBALS === tUHCI_TD gaUHCI_TDPool[NUM_TDs]; @@ -64,7 +64,7 @@ int UHCI_Initialise(const char **Arguments) Log_Debug("UHCI", "Controller PCI #%i: IO Base = 0x%x, IRQ %i", id, cinfo->IOBase, cinfo->IRQNum); - IRQ_AddHandler(cinfo->IRQNum, UHCI_InterruptHandler); + IRQ_AddHandler(cinfo->IRQNum, UHCI_InterruptHandler, cinfo); // Initialise Host ret = UHCI_Int_InitHost(&gUHCI_Controllers[i]); @@ -204,8 +204,13 @@ int UHCI_Int_InitHost(tUHCI_Controller *Host) outw( Host->IOBase + FRNUM, 0 ); // Enable Interrupts - //PCI_WriteWord( Host->PciId, 0xC0, 0x2000 ); +// PCI_WriteWord( Host->PciId, 0xC0, 0x2000 ); LEAVE('i', 0); return 0; } + +void UHCI_InterruptHandler(int IRQ, void *Ptr) +{ + +} -- 2.20.1