Kernel - Slight reworks to timer code
[tpg/acess2.git] / Modules / USB / Core / main.c
index d99ef3a..df7f174 100644 (file)
 #include <modules.h>
 #include "usb.h"
 
+// === IMPORTS ===
+extern void    USB_PollThread(void *unused);
+extern void    USB_AsyncThread(void *Unused);
+
 // === PROTOTYPES ===
  int   USB_Install(char **Arguments);
 void   USB_Cleanup(void);
@@ -19,19 +23,20 @@ tVFS_Node   *USB_FindDir(tVFS_Node *Node, const char *Name);
 
 // === GLOBALS ===
 MODULE_DEFINE(0, VERSION, USB_Core, USB_Install, NULL, NULL);
+tVFS_NodeType  gUSB_RootNodeType = {
+       .ReadDir = USB_ReadDir,
+       .FindDir = USB_FindDir,
+       .IOCtl = USB_IOCtl
+};
 tDevFS_Driver  gUSB_DrvInfo = {
        NULL, "usb", {
                .NumACLs = 1,
                .ACLs = &gVFS_ACL_EveryoneRX,
                .Flags = VFS_FFLAG_DIRECTORY,
-               .ReadDir = USB_ReadDir,
-               .FindDir = USB_FindDir,
-               .IOCtl = USB_IOCtl
+               .Type = &gUSB_RootNodeType
        }
 };
 tUSBHost       *gUSB_Hosts = NULL;
-tUSBDevice     *gUSB_InterruptDevs = NULL;
-tUSBDevice     *gUSB_InterruptLast = NULL;
 
 // === CODE ===
 /**
@@ -40,25 +45,13 @@ tUSBDevice  *gUSB_InterruptLast = NULL;
 int USB_Install(char **Arguments)
 {
        Log_Warning("USB", "Not Complete - Devel Only");
+       
+       Proc_SpawnWorker(USB_PollThread, NULL);
+       Proc_SpawnWorker(USB_AsyncThread, NULL);
+       
        return MODULE_ERR_OK;
 }
 
-/**
- * \brief USB polling thread
- */
-int USB_PollThread(void *unused)
-{
-       for(;;)
-       {
-               for( tUSBDevice *dev = gUSB_InterruptDevs; dev; dev = dev->Next )
-               {
-//                     hub->CheckPorts(hub, hub->Device);
-               }
-               // TODO: Fine tune
-               Time_Delay(250);
-       }
-}
-
 /**
  * \brief Called just before module is unloaded
  */

UCC git Repository :: git.ucc.asn.au