Merge branch 'master' of git://localhost/acess2
[tpg/acess2.git] / KernelLand / Modules / USB / Core / include / usb_host.h
1 /*
2  * Acess2 USB Stack
3  * - By John Hodge (thePowersGang)
4  *
5  * usb_host.h
6  * - USB Host Controller Interface
7  */
8 #ifndef _USB_HOST_H_
9 #define _USB_HOST_H_
10
11 #include "usb_core.h"
12 #include "usb_hub.h"
13
14 typedef struct sUSBHostDef      tUSBHostDef;
15
16 typedef void    (*tUSBHostCb)(void *DataPtr, void *Data, size_t Length);
17
18 typedef void    *(*tUSBInitInt)(void *Ptr, int Endpt, int bOutbound, int Period, tUSBHostCb Cb, void *CbData, void *Buf, size_t Len);
19 typedef void    *(*tUSBInit)(void *Ptr, int Endpt, size_t MaxPacketSize);
20 typedef void    *(*tUSBDataOp)(void *Dest, tUSBHostCb Cb, void *CbData, void *Data, size_t Length);
21
22 typedef void    *(*tUSBControlOp)(void *Ptr, void *Endpt, tUSBHostCb Cb, void *CbData,
23         int bOutbound,  // (1) SETUP, OUT, IN vs (0) SETUP, IN, OUT
24         const void *SetupData, size_t SetupLength,
25         const void *OutData, size_t OutLength,
26         void *InData, size_t InLength
27         );
28 typedef void    *(*tUSBBulkOp)(void *Ptr, void *Endpt, tUSBHostCb Cb, void *CbData,
29         int bOutbound, void *Data, size_t Length
30         );
31 typedef void    *(*tUSBIsochOp)(void *Ptr, void *Endpt, tUSBHostCb Cb, void *CbData,
32         int bOutbound, void *Data, size_t Length, int When
33         );
34
35 /**
36  * \brief Defines a USB Host Controller type
37  */
38 struct sUSBHostDef
39 {
40         tUSBInitInt     InitInterrupt;
41         tUSBInit        InitIsoch;
42         tUSBInit        InitControl;
43         tUSBInit        InitBulk;
44         void    (*RemEndpoint)(void *Ptr, void *Handle);
45         
46         // NOTE: If \a Cb is ERRPTR, the handle returned must be free'd by the calling code
47         //       otherwise the controller will free it once done
48         tUSBIsochOp     SendIsoch;
49         tUSBControlOp   SendControl;
50         tUSBBulkOp      SendBulk;
51         void    (*FreeOp)(void *Ptr, void *Handle);
52
53         void    (*CheckPorts)(void *Ptr);
54 };
55
56 extern tUSBHub  *USB_RegisterHost(tUSBHostDef *HostDef, void *ControllerPtr, int nPorts);
57
58 #endif
59

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