Merge branch 'master' of git://localhost/acess2
[tpg/acess2.git] / KernelLand / Modules / USB / Core / usb.h
1 /*
2  * Acess2 USB Stack
3  * - By John Hodge (thePowersGang)
4  * 
5  * usb.h
6  * - USB Internal definitions
7  */
8 #ifndef _USB_H_
9 #define _USB_H_
10
11 #include <usb_core.h>
12 #include <usb_hub.h>
13 #include <usb_host.h>
14 #include "usb_proto.h"
15
16 typedef struct sUSBHost tUSBHost;
17 typedef struct sUSBDevice       tUSBDevice;
18 typedef struct sUSBEndpoint     tUSBEndpoint;
19
20 // === STRUCTURES ===
21 /**
22  * \brief USB Hub data
23  */
24 struct sUSBHub
25 {
26         tUSBInterface   *Interface;
27         
28          int    nPorts;
29         tUSBDevice      *Devices[];
30 };
31
32 struct sUSBEndpoint
33 {
34         tUSBEndpoint    *Next;  // (usb_poll.c) Clock list
35         tUSBInterface   *Interface;
36          int    EndpointIdx;    // Interface endpoint index
37          int    EndpointNum;    // Device endpoint num
38         void    *EndpointHandle;
39         
40          int    PollingPeriod;  // In 1ms intervals
41          int    MaxPacketSize;  // In bytes
42         Uint8   Type;   // Same as sUSBDriver.Endpoints.Type
43         
44          int    PollingAtoms;   // (usb_poll.c) Period in clock list
45         void    *InputData;
46 };
47
48 /**
49  * \brief Structure for a device's interface
50  */
51 struct sUSBInterface
52 {
53 //      tUSBInterface   *Next;
54         tUSBDevice      *Dev;
55
56         tUSBDriver      *Driver;
57         void    *Data;
58
59         struct sDescriptor_Interface    IfaceDesc;
60         
61          int    nEndpoints;
62         tUSBEndpoint    Endpoints[];
63 };
64
65 /**
66  * \brief Defines a single device on the USB Bus
67  */
68 struct sUSBDevice
69 {
70         tUSBHub *ParentHub;
71
72         /**
73          * \brief Host controller used
74          */
75         tUSBHost        *Host;
76          int    Address;
77
78         void    *EndpointHandles[16];
79
80         struct sDescriptor_Device       DevDesc;
81
82          int    nInterfaces;
83         tUSBInterface   *Interfaces[];
84 };
85
86 struct sUSBHost
87 {
88         struct sUSBHost *Next;
89         
90         tUSBHostDef     *HostDef;
91         void    *Ptr;
92         
93         Uint8   AddressBitmap[128/8];
94         
95         tUSBDevice      RootHubDev;
96         tUSBInterface   RootHubIf;
97         tUSBHub RootHub;
98 };
99
100 extern tUSBDriver       *USB_int_FindDriverByClass(Uint32 ClassCode);
101
102 #endif

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