Fix KUSB.ZC pointer star formatting.

This commit is contained in:
TomAwezome 2022-12-21 04:00:33 -05:00 committed by GitHub
parent 645f383a9f
commit f23a32d331
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,7 +19,7 @@ class CUSB //Not implemented
U8 num, //USB dev num U8 num, //USB dev num
bus, dev, fun; bus, dev, fun;
U16 ports, pad; U16 ports, pad;
U32 * frame_lst; U32 *frame_lst;
}; };
//USB Pkt ID's //USB Pkt ID's
@ -54,20 +54,19 @@ class CUSB //Not implemented
I64 sys_num_usb = 0; I64 sys_num_usb = 0;
CUSB sys_usb_devs[USB_NUM]; CUSB sys_usb_devs[USB_NUM];
MemSet(sys_usb_devs, 0, USB_NUM* sizeof(CUSB)); MemSet(sys_usb_devs, 0, USB_NUM * sizeof(CUSB));
U0 USBInitOne(I64 b, I64 d, I64 f) U0 USBInitOne(I64 b, I64 d, I64 f)
{ {
CUSB * u; CUSB *u;
if (sys_num_usb < USB_NUM && if (sys_num_usb < USB_NUM && PCIReadU16(b, d, f, 0) == 0x8086)
PCIReadU16(b, d, f, 0) == 0x8086)
{ {
u = &sys_usb_devs[sys_num_usb++]; u = &sys_usb_devs[sys_num_usb++];
u->num = sys_num_usb; u->num = sys_num_usb;
u->bus = b; u->bus = b;
u->dev = d; u->dev = d;
u->fun = f; u->fun = f;
u->ports = PCIReadU32(b, d, f, 0x20) &~0x1F; u->ports = PCIReadU32(b, d, f, 0x20) & ~0x1F;
} }
} }
@ -89,7 +88,7 @@ U0 USBInitAll() //This is only valid for my ICH10 dev
USBInitOne(0, 26, 2); USBInitOne(0, 26, 2);
} }
CUSBTD* USBAllocTD() CUSBTD *USBAllocTD()
{ {
return MAllocAligned(sizeof(CUSBTD), 0x10, dev.uncached_heap); return MAllocAligned(sizeof(CUSBTD), 0x10, dev.uncached_heap);
} }
@ -102,12 +101,12 @@ U0 USBFreeTD(CUSBTD *tmptd)
U32* USBAllocFrameLst(I64 usb_num, I64 size) U32* USBAllocFrameLst(I64 usb_num, I64 size)
{ {
//aligned to 0x1000 //aligned to 0x1000
CUSB * u; CUSB *u;
if (0 <= usb_num < sys_num_usb) if (0 <= usb_num < sys_num_usb)
{ {
u = &sys_usb_devs[usb_num]; u = &sys_usb_devs[usb_num];
Free(u->frame_lst); Free(u->frame_lst);
u->frame_lst = MAllocAligned(size* sizeof(U32), 0x1000, dev.uncached_heap); u->frame_lst = MAllocAligned(size * sizeof(U32), 0x1000, dev.uncached_heap);
OutU16(u->ports + USBP_CMD, 0); //Stop OutU16(u->ports + USBP_CMD, 0); //Stop
OutU16(u->ports + USBP_FRNUM, 0); OutU16(u->ports + USBP_FRNUM, 0);
OutU32(u->ports + USBP_FRBASEADD, u->frame_lst); OutU32(u->ports + USBP_FRBASEADD, u->frame_lst);
@ -115,4 +114,4 @@ U32* USBAllocFrameLst(I64 usb_num, I64 size)
} }
return NULL; return NULL;
} }