Modules/USB - Working on driver support, little headache
[tpg/acess2.git] / Modules / USB / Core / usb.h
1 /*
2  * AcessOS Version 1
3  * USB Stack
4  */
5 #ifndef _USB_H_
6 #define _USB_H_
7
8 #include <usb_core.h>
9 #include <usb_hub.h>
10 #include <usb_host.h>
11
12 typedef struct sUSBHost tUSBHost;
13 typedef struct sUSBDevice       tUSBDevice;
14 typedef struct sUSBEndpoint     tUSBEndpoint;
15
16 // === STRUCTURES ===
17 /**
18  * \brief USB Hub data
19  */
20 struct sUSBHub
21 {
22         tUSBDevice      *Device;
23         
24         tUSB_HubPoll    CheckPorts;
25         
26          int    nPorts;
27         tUSBDevice      *Devices[];
28 };
29
30 struct sUSBEndpoint
31 {
32         tUSBInterface   *Interface;
33         tUSBEndpoint    *Next;  // In the poll list
34          int    PollingPeriod;  // In 1ms intervals
35          int    MaxPacketSize;  // In bytes
36
37         char    Direction;      // 1 Polled Input, 0 Output
38         
39         Uint8   Type;   // Same as sDescriptor_Endpoint.Type
40 };
41
42 /**
43  * \brief Structure for a device's interface
44  */
45 struct sUSBInterface
46 {
47         tUSBInterface   *Next;
48         tUSBDevice      *Dev;
49
50         tUSBDriver      *Driver;
51         void    *Data;
52         
53          int    nEndpoints;
54         tUSBEndpoint    Endpoints[];
55 };
56
57 /**
58  * \brief Defines a single device on the USB Bus
59  */
60 struct sUSBDevice
61 {
62         tUSBHub *ParentHub;
63
64         /**
65          * \brief Host controller used
66          */
67         tUSBHost        *Host;
68          int    Address;
69
70          int    nInterfaces;
71         tUSBInterface   *Interfaces[];
72 };
73
74 struct sUSBHost
75 {
76         struct sUSBHost *Next;
77         
78         tUSBHostDef     *HostDef;
79         void    *Ptr;
80         
81         Uint8   AddressBitmap[128/8];
82         
83         tUSBDevice      RootHubDev;
84         tUSBHub RootHub;
85 };
86
87 extern void     USB_NewDevice(tUSBHub *Hub);
88
89 #endif

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