Modules/USB - Working on driver support, little headache
[tpg/acess2.git] / Modules / USB / Core / main.c
1 /*
2  * Acess2
3  * USB Stack
4  */
5 #define VERSION ( (0<<8)| 5 )
6 #define DEBUG   1
7 #include <acess.h>
8 #include <vfs.h>
9 #include <fs_devfs.h>
10 #include <modules.h>
11 #include "usb.h"
12
13 // === PROTOTYPES ===
14  int    USB_Install(char **Arguments);
15 void    USB_Cleanup(void);
16 char    *USB_ReadDir(tVFS_Node *Node, int Pos);
17 tVFS_Node       *USB_FindDir(tVFS_Node *Node, const char *Name);
18  int    USB_IOCtl(tVFS_Node *Node, int Id, void *Data);
19
20 // === GLOBALS ===
21 MODULE_DEFINE(0, VERSION, USB_Core, USB_Install, NULL, NULL);
22 tDevFS_Driver   gUSB_DrvInfo = {
23         NULL, "usb", {
24                 .NumACLs = 1,
25                 .ACLs = &gVFS_ACL_EveryoneRX,
26                 .Flags = VFS_FFLAG_DIRECTORY,
27                 .ReadDir = USB_ReadDir,
28                 .FindDir = USB_FindDir,
29                 .IOCtl = USB_IOCtl
30         }
31 };
32 tUSBHost        *gUSB_Hosts = NULL;
33 tUSBInterface   *gUSB_InterruptDevs = NULL;
34 tUSBInterface   *gUSB_InterruptLast = NULL;
35
36 // === CODE ===
37 /**
38  * \brief Called once module is loaded
39  */
40 int USB_Install(char **Arguments)
41 {
42         Log_Warning("USB", "Not Complete - Devel Only");
43         return MODULE_ERR_OK;
44 }
45
46 /**
47  * \brief USB polling thread
48  */
49 int USB_PollThread(void *unused)
50 {
51         for(;;)
52         {
53                 for( tUSBInterface *dev = gUSB_InterruptDevs; dev; dev = dev->Next )
54                 {
55 //                      hub->CheckPorts(hub, hub->Device);
56                 }
57                 // TODO: Fine tune
58                 Time_Delay(250);
59         }
60 }
61
62 /**
63  * \brief Called just before module is unloaded
64  */
65 void USB_Cleanup()
66 {
67 }
68
69 /**
70  * \fn char *USB_ReadDir(tVFS_Node *Node, int Pos)
71  * \brief Read from the USB root
72  */
73 char *USB_ReadDir(tVFS_Node *Node, int Pos)
74 {
75         return NULL;
76 }
77
78 /**
79  * \fn tVFS_Node *USB_FindDir(tVFS_Node *Node, const char *Name)
80  * \brief Locate an entry in the USB root
81  */
82 tVFS_Node *USB_FindDir(tVFS_Node *Node, const char *Name)
83 {
84         return NULL;
85 }
86
87 /**
88  * \brief Handles IOCtl Calls to the USB driver
89  */
90 int USB_IOCtl(tVFS_Node *Node, int Id, void *Data)
91 {
92         return 0;
93 }

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