From: John Hodge Date: Thu, 9 Feb 2012 10:54:40 +0000 (+0800) Subject: Nodules/USB - Working on OHCI X-Git-Tag: rel0.15~786 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=809b3533650e35f3d1bc076382705e205d711100;p=tpg%2Facess2.git Nodules/USB - Working on OHCI --- diff --git a/KernelLand/Modules/USB/OHCI/ohci.c b/KernelLand/Modules/USB/OHCI/ohci.c new file mode 100644 index 00000000..8b61c48b --- /dev/null +++ b/KernelLand/Modules/USB/OHCI/ohci.c @@ -0,0 +1,66 @@ +/* + * Acess2 USB Stack - OHCI Driver + * - By John Hodge (thePowersGang) + * + * ohci.c + * - Open Host Controller Interface driver + */ +#define DEBUG 0 +#define VERSION VER2(0,1) +#include +#include "ohci.h" + +// === CONSTANTS === +#define MAX_CONTROLLERS 4 + +// === PROTOTYPES === + int OHCI_Initialise(char **Arguments); +void OHCI_Cleanup(void); + +void *OHCI_DataIN(void *Ptr, int Dest, int DataTgl, tUSBHostCb Cb, void *CbData, void *Buf, size_t Length); +void *OHCI_DataOUT(void *Ptr, int Dest, int DataTgl, tUSBHostCb Cb, void *CbData, void *Buf, size_t Length); +void *OHCI_SendSetup(void *Ptr, int Dest, int DataTgl, tUSBHostCb Cb, void *CbData, void *Buf, size_t Length); + +// === GLOBALS === +MODULE_DEFINE(0, VERSION, USB_OHCI, OHCI_Initialise, OHCI_Cleanup, "USB_Core", NULL); +tUSBHostDef gOHCI_HostDef = { + .SendIN = OHCI_DataIN, + .SendOUT = OHCI_DataOUT, + .SendSETUP = OHCI_DataSETUP, + }; + +// === CODE === +int OHCI_Initialise(char **Arguments) +{ + int id; + int card_num = 0; + + while( (id = PCI_GetDeviceByClass(0x0C0310, 0xFFFFFF)) != -1 && card_num < MAX_CONTROLLERS ) + { + Uint32 base_addr; + + base_addr = PCI_GetBAR(id, 0); // Offset 0x10 + } + + + // TODO: Initialise + return 0; +} + +void OHCI_Cleanup(void) +{ + // TODO: Cleanup for unload +} + +void *OHCI_DataIN(void *Ptr, int Dest, int DataTgl, tUSBHostCb Cb, void *CbData, void *Buf, size_t Length) +{ + return NULL; +} +void *OHCI_DataOUT(void *Ptr, int Dest, int DataTgl, tUSBHostCb Cb, void *CbData, void *Buf, size_t Length); +{ + return NULL; +} +void *OHCI_SendSetup(void *Ptr, int Dest, int DataTgl, tUSBHostCb Cb, void *CbData, void *Buf, size_t Length); +{ + return NULL; +}