TODO
[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         
39          int    PollingPeriod;  // In 1ms intervals
40          int    MaxPacketSize;  // In bytes
41         Uint8   Type;   // Same as sUSBDriver.Endpoints.Type
42         
43          int    PollingAtoms;   // (usb_poll.c) Period in clock list
44         void    *InputData;
45 };
46
47 /**
48  * \brief Structure for a device's interface
49  */
50 struct sUSBInterface
51 {
52 //      tUSBInterface   *Next;
53         tUSBDevice      *Dev;
54
55         tUSBDriver      *Driver;
56         void    *Data;
57
58         struct sDescriptor_Interface    IfaceDesc;
59         
60          int    nEndpoints;
61         tUSBEndpoint    Endpoints[];
62 };
63
64 /**
65  * \brief Defines a single device on the USB Bus
66  */
67 struct sUSBDevice
68 {
69         tUSBHub *ParentHub;
70
71         /**
72          * \brief Host controller used
73          */
74         tUSBHost        *Host;
75          int    Address;
76
77         struct sDescriptor_Device       DevDesc;
78
79          int    nInterfaces;
80         tUSBInterface   *Interfaces[];
81 };
82
83 struct sUSBHost
84 {
85         struct sUSBHost *Next;
86         
87         tUSBHostDef     *HostDef;
88         void    *Ptr;
89         
90         Uint8   AddressBitmap[128/8];
91         
92         tUSBDevice      RootHubDev;
93         tUSBInterface   RootHubIf;
94         tUSBHub RootHub;
95 };
96
97 extern tUSBDriver       *USB_int_FindDriverByClass(Uint32 ClassCode);
98
99 #endif

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