Modules/USB - Cleanup and sorting, added hub code to build
[tpg/acess2.git] / Modules / USB / Core / usb_io.c
1 /*
2  * Acess2 USB Stack
3  * - By John Hodge (thePowersGang)
4  *
5  * usb_io.c
6  * - High-level IO
7  */
8 #define DEBUG   1
9
10 #include <usb_core.h>
11 #include "usb.h"
12 #include "usb_lowlevel.h"
13
14 // === PROTOTYPES ===
15 void    USB_ReadDescriptor(tUSBInterface *Iface, int Type, int Index, int Length, void *Data);
16 void    USB_Request(tUSBInterface *Iface, int Endpoint, int Type, int Req, int Value, int Index, int Len, void *Data);
17
18 // === GLOBALS ===
19
20 // === CODE ===
21 void USB_ReadDescriptor(tUSBInterface *Iface, int Type, int Index, int Length, void *Data)
22 {
23         USB_int_ReadDescriptor(Iface->Dev, 0, Type, Index, Length, Data);
24 }
25
26 void USB_Request(tUSBInterface *Iface, int Endpoint, int Type, int Req, int Value, int Index, int Len, void *Data)
27 {
28          int    endpt;
29
30         // Sanity check
31         if(Endpoint < 0 || Endpoint >= Iface->nEndpoints)
32                 return ;        
33
34         // Get endpoint number
35         if(Endpoint)
36                 endpt = Iface->Endpoints[Endpoint-1].EndpointNum;
37         else
38                 endpt = 0;
39         
40         USB_int_Request(Iface->Dev->Host, Iface->Dev->Address, endpt, Type, Req, Value, Index, Len, Data);
41 }
42

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