Sorting source tree a bit
[tpg/acess2.git] / KernelLand / 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 typedef void    (*tUSB_DataCallback)(tUSBInterface *Dev, int EndPt, int Length, void *Data);
17
18 /**
19  */
20 struct sUSBDriver
21 {
22         tUSBDriver      *Next;
23         
24         const char      *Name;
25
26          int    MatchType;      // 0: Interface, 1: Device, 2: Vendor
27         union { 
28                 struct {
29                         // 23:16 - Interface Class
30                         // 15:8  - Interface Sub Class
31                         // 7:0   - Interface Protocol
32                         Uint32  ClassCode;
33                         Uint32  ClassMask;
34                 } Class;
35                 struct {
36                         Uint16  VendorID;
37                         Uint16  DeviceID;
38                 } VendorDev;
39         } Match;
40
41         void    (*Connected)(tUSBInterface *Dev);
42         void    (*Disconnected)(tUSBInterface *Dev);
43
44          int    MaxEndpoints;   
45         struct {
46                 // USB Attrbute byte
47                 // NOTE: Top bit indicates the direction (1=Input)
48                 Uint8   Attributes;
49                 // Data availiable Callback
50                 tUSB_DataCallback       DataAvail;
51         } Endpoints[];
52 };
53
54 extern void     *USB_GetDeviceDataPtr(tUSBInterface *Dev);
55 extern void     USB_SetDeviceDataPtr(tUSBInterface *Dev, void *Ptr);
56
57 extern void     USB_StartPollingEndpoint(tUSBInterface *Dev, int Endpoint);
58 extern void     USB_ReadDescriptor(tUSBInterface *Dev, int Type, int Index, int Length, void *Data);
59 extern void     USB_Request(tUSBInterface *Dev, int Endpoint, int Type, int Req, int Value, int Index, int Len, void *Data);
60 // TODO: Async
61 extern void     USB_SendData(tUSBInterface *Dev, int Endpoint, int Length, void *Data);
62 extern void     USB_RecvData(tUSBInterface *Dev, int Endpoint, int Length, void *Data);
63 extern void     USB_RecvDataA(tUSBInterface *Dev, int Endpoint, int Length, void *DataBuf, tUSB_DataCallback Callback);
64
65 #endif
66

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