Kernel - Added 'Flags' param to VFS Read/Write/FindDir
[tpg/acess2.git] / KernelLand / 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 void     USB_PollThread(void *unused);
15 extern void     USB_AsyncThread(void *Unused);
16 extern void     USB_PortCtl_Init(void);
17
18 // === PROTOTYPES ===
19  int    USB_Install(char **Arguments);
20 void    USB_Cleanup(void);
21  int    USB_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]);
22 tVFS_Node       *USB_FindDir(tVFS_Node *Node, const char *Name, Uint Flags);
23  int    USB_IOCtl(tVFS_Node *Node, int Id, void *Data);
24
25 // === GLOBALS ===
26 MODULE_DEFINE(0, VERSION, USB_Core, USB_Install, NULL, NULL);
27 tVFS_NodeType   gUSB_RootNodeType = {
28         .ReadDir = USB_ReadDir,
29         .FindDir = USB_FindDir,
30         .IOCtl = USB_IOCtl
31 };
32 tDevFS_Driver   gUSB_DrvInfo = {
33         NULL, "usb", {
34                 .NumACLs = 1,
35                 .ACLs = &gVFS_ACL_EveryoneRX,
36                 .Flags = VFS_FFLAG_DIRECTORY,
37                 .Type = &gUSB_RootNodeType
38         }
39 };
40
41 // === CODE ===
42 /**
43  * \brief Called once module is loaded
44  */
45 int USB_Install(char **Arguments)
46 {
47         USB_PortCtl_Init();
48         Proc_SpawnWorker(USB_PollThread, NULL);
49         Proc_SpawnWorker(USB_AsyncThread, NULL);
50         
51         return MODULE_ERR_OK;
52 }
53
54 /**
55  * \brief Called just before module is unloaded
56  */
57 void USB_Cleanup()
58 {
59 }
60
61 /**
62  * \fn char *USB_ReadDir(tVFS_Node *Node, int Pos)
63  * \brief Read from the USB root
64  */
65 int USB_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX])
66 {
67         return -ENOTIMPL;
68 }
69
70 /**
71  * \fn tVFS_Node *USB_FindDir(tVFS_Node *Node, const char *Name)
72  * \brief Locate an entry in the USB root
73  */
74 tVFS_Node *USB_FindDir(tVFS_Node *Node, const char *Name, Uint Flags)
75 {
76         return NULL;
77 }
78
79 /**
80  * \brief Handles IOCtl Calls to the USB driver
81  */
82 int USB_IOCtl(tVFS_Node *Node, int Id, void *Data)
83 {
84         return 0;
85 }

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