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

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