Modules/USB - Cleanup and sorting, added hub code to build
[tpg/acess2.git] / Modules / USB / Core / include / usb_core.h
1 /*
2  * Acess2 USB Stack
3  * - By John Hodge (thePowersGang)
4  *
5  * usb_core.h
6  * - Core USB IO Header 
7  */
8 #ifndef _USB_CORE_H_
9 #define _USB_CORE_H_
10
11 #include <acess.h>
12
13 typedef struct sUSBInterface    tUSBInterface;
14 typedef struct sUSBDriver       tUSBDriver;
15
16 /**
17  */
18 struct sUSBDriver
19 {
20         tUSBDriver      *Next;
21         
22         const char      *Name;
23
24          int    MatchType;      // 0: Interface, 1: Device, 2: Vendor
25         union { 
26                 struct {
27                         // 23:16 - Interface Class
28                         // 15:8  - Interface Sub Class
29                         // 7:0   - Interface Protocol
30                         Uint32  ClassMask;
31                         Uint32  ClassCode;
32                 } Class;
33                 struct {
34                         Uint16  VendorID;
35                         Uint16  DeviceID;
36                 } VendorDev;
37         } Match;
38
39         void    (*Connected)(tUSBInterface *Dev);
40         void    (*Disconnected)(tUSBInterface *Dev);
41
42          int    MaxEndpoints;   
43         struct {
44                 // USB Attrbute byte
45                 // NOTE: Top bit indicates the direction (1=Input)
46                 Uint8   Attributes;
47                 // Data availiable Callback
48                 void    (*DataAvail)(tUSBInterface *Dev, int Length, void *Data);
49         } Endpoints[];
50 };
51
52 extern void     *USB_GetDeviceDataPtr(tUSBInterface *Dev);
53 extern void     USB_SetDeviceDataPtr(tUSBInterface *Dev, void *Ptr);
54
55 extern void     USB_StartPollingEndpoint(tUSBInterface *Dev, int Endpoint);
56 extern void     USB_ReadDescriptor(tUSBInterface *Dev, int Type, int Index, int Length, void *Data);
57 extern void     USB_Request(tUSBInterface *Dev, int Endpoint, int Type, int Req, int Value, int Index, int Len, void *Data);
58 // TODO: Async
59 extern void     USB_SendData(tUSBInterface *Dev, int Endpoint, int Length, void *Data);
60 extern void     USB_RecvData(tUSBInterface *Dev, int Endpoint, int Length, void *Data);
61
62 #endif
63

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