5a133630f5bbd5938a908d6b6b484eccb4cbf665
[tpg/acess2.git] / 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
15 typedef struct sUSBHost tUSBHost;
16 typedef struct sUSBDevice       tUSBDevice;
17 typedef struct sUSBEndpoint     tUSBEndpoint;
18
19 // === STRUCTURES ===
20 /**
21  * \brief USB Hub data
22  */
23 struct sUSBHub
24 {
25         tUSBInterface   *Interface;
26         
27          int    nPorts;
28         tUSBDevice      *Devices[];
29 };
30
31 struct sUSBEndpoint
32 {
33         tUSBEndpoint    *Next;  // (usb_poll.c) Clock list
34         tUSBInterface   *Interface;
35          int    EndpointIdx;    // Interface endpoint index
36          int    EndpointNum;    // Device endpoint num
37         
38          int    PollingPeriod;  // In 1ms intervals
39          int    MaxPacketSize;  // In bytes
40         Uint8   Type;   // Same as sUSBDriver.Endpoints.Type
41         
42          int    PollingAtoms;   // (usb_poll.c) Period in clock list
43         void    *InputData;
44 };
45
46 /**
47  * \brief Structure for a device's interface
48  */
49 struct sUSBInterface
50 {
51 //      tUSBInterface   *Next;
52         tUSBDevice      *Dev;
53
54         tUSBDriver      *Driver;
55         void    *Data;
56         
57          int    nEndpoints;
58         tUSBEndpoint    Endpoints[];
59 };
60
61 /**
62  * \brief Defines a single device on the USB Bus
63  */
64 struct sUSBDevice
65 {
66         tUSBHub *ParentHub;
67
68         /**
69          * \brief Host controller used
70          */
71         tUSBHost        *Host;
72          int    Address;
73
74          int    nInterfaces;
75         tUSBInterface   *Interfaces[];
76 };
77
78 struct sUSBHost
79 {
80         struct sUSBHost *Next;
81         
82         tUSBHostDef     *HostDef;
83         void    *Ptr;
84         
85         Uint8   AddressBitmap[128/8];
86         
87         tUSBDevice      RootHubDev;
88         tUSBInterface   RootHubIf;
89         tUSBHub RootHub;
90 };
91
92 extern tUSBDriver       *USB_int_FindDriverByClass(Uint32 ClassCode);
93
94 #endif

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