git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Modules/USB - Documention/Debugging, and fixed an API use
[tpg/acess2.git]
/
KernelLand
/
Modules
/
USB
/
Core
/
usb_lowlevel.c
diff --git
a/KernelLand/Modules/USB/Core/usb_lowlevel.c
b/KernelLand/Modules/USB/Core/usb_lowlevel.c
index
d8e1485
..
2382297
100644
(file)
--- a/
KernelLand/Modules/USB/Core/usb_lowlevel.c
+++ b/
KernelLand/Modules/USB/Core/usb_lowlevel.c
@@
-25,13
+25,19
@@
void *USB_int_Request(tUSBHost *Host, int Addr, int EndPt, int Type, int Req, in
void *hdl;
// TODO: Sanity check (and check that Type is valid)
struct sDeviceRequest req;
void *hdl;
// TODO: Sanity check (and check that Type is valid)
struct sDeviceRequest req;
+ int dest = Addr * 16 + EndPt; // TODO: Validate
+
+ ENTER("pHost xdest iType iReq iVal iIndx iLen pData",
+ Host, dest, Type, Req, Val, Indx, Len, Data);
+
req.ReqType = Type;
req.Request = Req;
req.Value = LittleEndian16( Val );
req.Index = LittleEndian16( Indx );
req.Length = LittleEndian16( Len );
req.ReqType = Type;
req.Request = Req;
req.Value = LittleEndian16( Val );
req.Index = LittleEndian16( Indx );
req.Length = LittleEndian16( Len );
-
- hdl = Host->HostDef->SendSETUP(Host->Ptr, Addr, EndPt, 0, NULL, NULL, &req, sizeof(req));
+
+ LOG("SETUP");
+ hdl = Host->HostDef->SendSETUP(Host->Ptr, dest, 0, NULL, NULL, &req, sizeof(req));
// TODO: Data toggle?
// TODO: Multi-packet transfers
// TODO: Data toggle?
// TODO: Multi-packet transfers
@@
-39,9
+45,12
@@
void *USB_int_Request(tUSBHost *Host, int Addr, int EndPt, int Type, int Req, in
{
void *hdl2;
{
void *hdl2;
- hdl = Host->HostDef->SendIN(Host->Ptr, Addr, EndPt, 0, NULL, NULL, Data, Len);
+ LOG("IN");
+ hdl = Host->HostDef->SendIN(Host->Ptr, dest, 0, NULL, NULL, Data, Len);
- hdl2 = Host->HostDef->SendOUT(Host->Ptr, Addr, EndPt, 0, NULL, NULL, NULL, 0);
+ LOG("OUT (Done)");
+ hdl2 = Host->HostDef->SendOUT(Host->Ptr, dest, 0, INVLPTR, NULL, NULL, 0);
+ LOG("Wait...");
while( Host->HostDef->IsOpComplete(Host->Ptr, hdl2) == 0 )
Time_Delay(1);
}
while( Host->HostDef->IsOpComplete(Host->Ptr, hdl2) == 0 )
Time_Delay(1);
}
@@
-49,16
+58,20
@@
void *USB_int_Request(tUSBHost *Host, int Addr, int EndPt, int Type, int Req, in
{
void *hdl2;
{
void *hdl2;
+ LOG("OUT");
if( Len > 0 )
if( Len > 0 )
- hdl = Host->HostDef->SendOUT(Host->Ptr,
Addr, EndP
t, 0, NULL, NULL, Data, Len);
+ hdl = Host->HostDef->SendOUT(Host->Ptr,
des
t, 0, NULL, NULL, Data, Len);
else
hdl = NULL;
else
hdl = NULL;
+ LOG("IN (Status)");
// Status phase (DataToggle=1)
// Status phase (DataToggle=1)
- hdl2 = Host->HostDef->SendIN(Host->Ptr, Addr, EndPt, 1, NULL, NULL, NULL, 0);
+ hdl2 = Host->HostDef->SendIN(Host->Ptr, dest, 1, INVLPTR, NULL, NULL, 0);
+ LOG("Wait...");
while( Host->HostDef->IsOpComplete(Host->Ptr, hdl2) == 0 )
Time_Delay(1);
}
while( Host->HostDef->IsOpComplete(Host->Ptr, hdl2) == 0 )
Time_Delay(1);
}
+ LEAVE('p', hdl);
return hdl;
}
return hdl;
}
@@
-74,22
+87,23
@@
int USB_int_ReadDescriptor(tUSBDevice *Dev, int Endpoint, int Type, int Index, i
struct sDeviceRequest req;
int bToggle = 0;
void *final;
struct sDeviceRequest req;
int bToggle = 0;
void *final;
+ int dest = Dev->Address*16 + Endpoint;
+
+ ENTER("pDev xdest iType iIndex iLength pDest",
+ Dev, dest, Type, Index, Length, Dest);
req.ReqType = 0x80;
req.ReqType = 0x80;
- switch( Type & 0xF00 )
- {
- case 0x000: req.ReqType |= (0 << 5); break; // Standard
- case 0x100: req.ReqType |= (1 << 5); break; // Class
- case 0x200: req.ReqType |= (2 << 5); break; // Vendor
- }
+ req.ReqType |= ((Type >> 8) & 0x3) << 5; // Bits 5/6
+ req.ReqType |= (Type >> 12) & 3; // Destination (Device, Interface, Endpoint, Other);
req.Request = 6; // GET_DESCRIPTOR
req.Value = LittleEndian16( ((Type & 0xFF) << 8) | (Index & 0xFF) );
req.Request = 6; // GET_DESCRIPTOR
req.Value = LittleEndian16( ((Type & 0xFF) << 8) | (Index & 0xFF) );
- req.Index = LittleEndian16( 0 ); // TODO: Language ID
+ req.Index = LittleEndian16( 0 ); // TODO: Language ID
/ Interface
req.Length = LittleEndian16( Length );
req.Length = LittleEndian16( Length );
-
+
+ LOG("SETUP");
Dev->Host->HostDef->SendSETUP(
Dev->Host->HostDef->SendSETUP(
- Dev->Host->Ptr,
Dev->Address, Endpoin
t,
+ Dev->Host->Ptr,
des
t,
0, NULL, NULL,
&req, sizeof(req)
);
0, NULL, NULL,
&req, sizeof(req)
);
@@
-97,8
+111,9
@@
int USB_int_ReadDescriptor(tUSBDevice *Dev, int Endpoint, int Type, int Index, i
bToggle = 1;
while( Length > ciMaxPacketSize )
{
bToggle = 1;
while( Length > ciMaxPacketSize )
{
+ LOG("IN (%i rem)", Length - ciMaxPacketSize);
Dev->Host->HostDef->SendIN(
Dev->Host->HostDef->SendIN(
- Dev->Host->Ptr,
Dev->Address, Endpoin
t,
+ Dev->Host->Ptr,
des
t,
bToggle, NULL, NULL,
Dest, ciMaxPacketSize
);
bToggle, NULL, NULL,
Dest, ciMaxPacketSize
);
@@
-106,15
+121,18
@@
int USB_int_ReadDescriptor(tUSBDevice *Dev, int Endpoint, int Type, int Index, i
Length -= ciMaxPacketSize;
}
Length -= ciMaxPacketSize;
}
+ LOG("IN (final)");
final = Dev->Host->HostDef->SendIN(
final = Dev->Host->HostDef->SendIN(
- Dev->Host->Ptr,
Dev->Address, Endpoin
t,
+ Dev->Host->Ptr,
des
t,
bToggle, INVLPTR, NULL,
Dest, Length
);
bToggle, INVLPTR, NULL,
Dest, Length
);
+ LOG("Waiting");
while( Dev->Host->HostDef->IsOpComplete(Dev->Host->Ptr, final) == 0 )
while( Dev->Host->HostDef->IsOpComplete(Dev->Host->Ptr, final) == 0 )
- Threads_Yield();
+ Threads_Yield();
// BAD BAD BAD
+ LEAVE('i', 0);
return 0;
}
return 0;
}
UCC
git Repository :: git.ucc.asn.au