Modules/USB - Fiddling with USB
[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 // === IMPORTS ===
14 extern int      UHCI_Initialise(void);
15
16 // === PROTOTYPES ===
17  int    USB_Install(char **Arguments);
18 void    USB_Cleanup(void);
19 char    *USB_ReadDir(tVFS_Node *Node, int Pos);
20 tVFS_Node       *USB_FindDir(tVFS_Node *Node, const char *Name);
21  int    USB_IOCtl(tVFS_Node *Node, int Id, void *Data);
22
23 // === GLOBALS ===
24 MODULE_DEFINE(0, VERSION, USB_Core, USB_Install, NULL, NULL);
25 tDevFS_Driver   gUSB_DrvInfo = {
26         NULL, "usb", {
27                 .NumACLs = 1,
28                 .ACLs = &gVFS_ACL_EveryoneRX,
29                 .Flags = VFS_FFLAG_DIRECTORY,
30                 .ReadDir = USB_ReadDir,
31                 .FindDir = USB_FindDir,
32                 .IOCtl = USB_IOCtl
33         }
34 };
35 tUSBDevice      *gUSB_RootHubs = NULL;
36 tUSBHost        *gUSB_Hosts = NULL;
37
38 // === CODE ===
39 /**
40  * \brief Called once module is loaded
41  */
42 int USB_Install(char **Arguments)
43 {
44         UHCI_Initialise();
45         Log_Warning("USB", "Not Complete - Devel Only");
46         return MODULE_ERR_OK;
47 }
48
49 /**
50  * \brief USB polling thread
51  */
52 int USB_PollThread(void *unused)
53 {
54         for(;;)
55         {
56                 for( tUSBHost *host = gUSB_Hosts; host; host = host->Next )
57                 {
58                         // host->CheckPorts(host);
59                 }
60
61                 for( tUSBDevice *dev = gUSB_RootHubs; dev; dev = dev->Next )
62                 {
63                         
64                 }
65         }
66 }
67
68 /**
69  * \brief Called just before module is unloaded
70  */
71 void USB_Cleanup()
72 {
73 }
74
75 /**
76  * \fn char *USB_ReadDir(tVFS_Node *Node, int Pos)
77  * \brief Read from the USB root
78  */
79 char *USB_ReadDir(tVFS_Node *Node, int Pos)
80 {
81         return NULL;
82 }
83
84 /**
85  * \fn tVFS_Node *USB_FindDir(tVFS_Node *Node, const char *Name)
86  * \brief Locate an entry in the USB root
87  */
88 tVFS_Node *USB_FindDir(tVFS_Node *Node, const char *Name)
89 {
90         return NULL;
91 }
92
93 /**
94  * \brief Handles IOCtl Calls to the USB driver
95  */
96 int USB_IOCtl(tVFS_Node *Node, int Id, void *Data)
97 {
98         return 0;
99 }

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