mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
Fix USB.ZC spacing formatting.
This commit is contained in:
parent
f23a32d331
commit
d4317cb582
1 changed files with 45 additions and 45 deletions
|
@ -14,11 +14,11 @@ different mice.PS2 is more compatible.
|
||||||
#help_index "USB"
|
#help_index "USB"
|
||||||
extern I64 sys_num_usb;
|
extern I64 sys_num_usb;
|
||||||
extern CUSB sys_usb_devs[USB_NUM];
|
extern CUSB sys_usb_devs[USB_NUM];
|
||||||
extern CUSBTD* USBAllocTD();
|
extern CUSBTD *USBAllocTD();
|
||||||
extern U0 USBFreeTD(CUSBTD *tmptd);
|
extern U0 USBFreeTD(CUSBTD *tmptd);
|
||||||
extern U0 USBEndAll();
|
extern U0 USBEndAll();
|
||||||
extern U0 USBInitAll();
|
extern U0 USBInitAll();
|
||||||
extern U32* USBAllocFrameLst(I64 usb_num, I64 size);
|
extern U32 *USBAllocFrameLst(I64 usb_num, I64 size);
|
||||||
|
|
||||||
U8* StatCB(CDoc *, CDocEntry *doc_e, CTask *mem_task)
|
U8* StatCB(CDoc *, CDocEntry *doc_e, CTask *mem_task)
|
||||||
{
|
{
|
||||||
|
@ -40,8 +40,8 @@ U8* StatCB(CDoc *, CDocEntry *doc_e, CTask *mem_task)
|
||||||
U0 PutStat()
|
U0 PutStat()
|
||||||
{
|
{
|
||||||
I64 i;
|
I64 i;
|
||||||
CDocEntry * doc_e;
|
CDocEntry *doc_e;
|
||||||
CUSB * u;
|
CUSB *u;
|
||||||
WinMax;
|
WinMax;
|
||||||
|
|
||||||
"$$FG,GREEN$$Dev Stat Bits\n$$FG$$"
|
"$$FG,GREEN$$Dev Stat Bits\n$$FG$$"
|
||||||
|
@ -79,9 +79,9 @@ U0 PutStat()
|
||||||
|
|
||||||
extern U0 PutQH(U32 h);
|
extern U0 PutQH(U32 h);
|
||||||
|
|
||||||
U32* P(U32 d)
|
U32 *P(U32 d)
|
||||||
{
|
{
|
||||||
return d &~3;
|
return d & ~3;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 PutTD(U32 t)
|
U0 PutTD(U32 t)
|
||||||
|
@ -91,10 +91,10 @@ U0 PutTD(U32 t)
|
||||||
DocDm(t + 4, 8);
|
DocDm(t + 4, 8);
|
||||||
if (*P(t + 12))
|
if (*P(t + 12))
|
||||||
DocDm(*P(t + 12), 16);
|
DocDm(*P(t + 12), 16);
|
||||||
// DocDm(*P(t+12),*P(t+4)>>21&0x7FF);
|
// DocDm(*P(t+12), *P(t+4) >> 21 & 0x7FF);
|
||||||
if (!(*P(t) &1))
|
if (!(*P(t) & 1))
|
||||||
{
|
{
|
||||||
if (*P(t) &2)
|
if (*P(t) & 2)
|
||||||
PutQH(*P(t));
|
PutQH(*P(t));
|
||||||
else
|
else
|
||||||
PutTD(*P(t));
|
PutTD(*P(t));
|
||||||
|
@ -107,17 +107,17 @@ U0 PutQH(U32 h)
|
||||||
"%08X\n", *P(h);
|
"%08X\n", *P(h);
|
||||||
"%08X\n", *P(h + 4);
|
"%08X\n", *P(h + 4);
|
||||||
|
|
||||||
if (!(*P(h) &1))
|
if (!(*P(h) & 1))
|
||||||
{
|
{
|
||||||
if (*P(h) &2)
|
if (*P(h) & 2)
|
||||||
PutQH(*P(h));
|
PutQH(*P(h));
|
||||||
else
|
else
|
||||||
PutTD(*P(h));
|
PutTD(*P(h));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*P(h + 4) &1))
|
if (!(*P(h + 4) & 1))
|
||||||
{
|
{
|
||||||
if (*P(h + 4) &2)
|
if (*P(h + 4) & 2)
|
||||||
PutQH(*P(h + 4));
|
PutQH(*P(h + 4));
|
||||||
else
|
else
|
||||||
PutTD(*P(h + 4));
|
PutTD(*P(h + 4));
|
||||||
|
@ -132,14 +132,14 @@ U0 PutFrame(U32 f)
|
||||||
U0 PutFrames()
|
U0 PutFrames()
|
||||||
{
|
{
|
||||||
I64 i, d, f, w1, w2;
|
I64 i, d, f, w1, w2;
|
||||||
CUSB * u;
|
CUSB *u;
|
||||||
for (i = 0; i < sys_num_usb; i++)
|
for (i = 0; i < sys_num_usb; i++)
|
||||||
{
|
{
|
||||||
u = &sys_usb_devs[i];
|
u = &sys_usb_devs[i];
|
||||||
d = u->ports;
|
d = u->ports;
|
||||||
w1 = InU16(d + USBP_PORTSC0);
|
w1 = InU16(d + USBP_PORTSC0);
|
||||||
w2 = InU16(d + USBP_PORTSC1);
|
w2 = InU16(d + USBP_PORTSC1);
|
||||||
if (w1 &1 || w2 &1)
|
if (w1 & 1 || w2 & 1)
|
||||||
{
|
{
|
||||||
f = InU32(d + USBP_FRBASEADD);
|
f = InU32(d + USBP_FRBASEADD);
|
||||||
PutFrame(f);
|
PutFrame(f);
|
||||||
|
@ -169,46 +169,46 @@ Main;
|
||||||
|
|
||||||
U0 SetUpTD()
|
U0 SetUpTD()
|
||||||
{
|
{
|
||||||
CUSB *u =&sys_usb_devs[PORT];
|
CUSB *u = &sys_usb_devs[PORT];
|
||||||
I64 i,d=u->ports;
|
I64 i, d = u->ports;
|
||||||
U32 *frm =CAllocAligned(0x1000,0x1000,Fs->code_heap),
|
U32 *frm = CAllocAligned(0x1000, 0x1000, Fs->code_heap),
|
||||||
*tds=CAllocAligned(256,16,Fs->code_heap),
|
*tds = CAllocAligned(256, 16, Fs->code_heap),
|
||||||
*buf=CAlloc(128,Fs->code_heap);
|
*buf = CAlloc(128, Fs->code_heap);
|
||||||
DocD(buf,128);
|
DocD(buf, 128);
|
||||||
|
|
||||||
"<0>\n"; Sleep(100);
|
"<0>\n"; Sleep(100);
|
||||||
OutU16(d+USBP_CMD,2); //Reset
|
OutU16(d + USBP_CMD, 2); //Reset
|
||||||
"<1>\n"; Sleep(100);
|
"<1>\n"; Sleep(100);
|
||||||
OutU16(d+USBP_CMD,0);
|
OutU16(d + USBP_CMD, 0);
|
||||||
"<2>\n"; Sleep(100);
|
"<2>\n"; Sleep(100);
|
||||||
OutU16(d+USBP_PORTSC0,4); //Enable
|
OutU16(d + USBP_PORTSC0, 4); //Enable
|
||||||
OutU16(d+USBP_PORTSC1,4);
|
OutU16(d + USBP_PORTSC1, 4);
|
||||||
"<3>\n"; Sleep(100);
|
"<3>\n"; Sleep(100);
|
||||||
|
|
||||||
tds[0]=&tds[4](U8*);
|
tds[0] = &tds[4](U8*);
|
||||||
tds[1]=0;
|
tds[1] = 0;
|
||||||
tds[2]=PID_SETUP+DEV_ADD_INIT<<8+END_PT0<<15+LEN_MAX<<21;
|
tds[2] = PID_SETUP + DEV_ADD_INIT << 8 + END_PT0 << 15 + LEN_MAX << 21;
|
||||||
tds[3]=buf;
|
tds[3] = buf;
|
||||||
buf[0]=0+RQ_SET_ADDR<<8+DEV_ADD<<16;
|
buf[0] = 0 + RQ_SET_ADDR << 8 + DEV_ADD << 16;
|
||||||
buf[1]=0+0<<16;
|
buf[1] = 0 + 0 << 16;
|
||||||
|
|
||||||
tds[4]=TERMINATE;
|
tds[4] = TERMINATE;
|
||||||
tds[5]=0;
|
tds[5] = 0;
|
||||||
tds[6]=PID_SETUP+DEV_ADD_INIT<<8+END_PT0<<15+LEN_MAX<<21;
|
tds[6] = PID_SETUP + DEV_ADD_INIT << 8 + END_PT0 << 15 + LEN_MAX << 21;
|
||||||
tds[7]=buf(U8*)+8;
|
tds[7] = buf(U8*) + 8;
|
||||||
buf[2]=0+RQ_SET_ADDR<<8+DEV_ADD<<16;
|
buf[2] = 0 + RQ_SET_ADDR << 8 + DEV_ADD << 16;
|
||||||
buf[3]=0+0<<16;
|
buf[3] = 0 + 0 << 16;
|
||||||
|
|
||||||
frm[0]=&tds[0](U8*);
|
frm[0] = &tds[0](U8*);
|
||||||
for (i=1;i<0x1000/4;i++)
|
for (i = 1; i < 0x1000 / 4; i++)
|
||||||
frm[i]=TERMINATE;
|
frm[i] = TERMINATE;
|
||||||
|
|
||||||
OutU16(d+USBP_FRNUM,frm);
|
OutU16(d + USBP_FRNUM, frm);
|
||||||
OutU32(d+USBP_FRBASEADD,frm);
|
OutU32(d + USBP_FRBASEADD, frm);
|
||||||
"<4>\n"; Sleep(200);
|
"<4>\n"; Sleep(200);
|
||||||
OutU16(d+USBP_CMD,1);
|
OutU16(d + USBP_CMD,1);
|
||||||
"<5>\n"; Sleep(1000);
|
"<5>\n"; Sleep(1000);
|
||||||
OutU16(d+USBP_CMD,0);
|
OutU16(d + USBP_CMD,0);
|
||||||
"<6>\n"; Sleep(200);
|
"<6>\n"; Sleep(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue