diff --git a/src/userland/usb/include/usb.h b/src/userland/usb/include/usb.h index 7fad442..1bfbd4d 100644 --- a/src/userland/usb/include/usb.h +++ b/src/userland/usb/include/usb.h @@ -64,7 +64,7 @@ typedef struct { uint32_t pciClass; void *(*initialize)(uint32_t, uint32_t, uint32_t); - void (*getDeviceDescriptor)(void *, uint32_t, uint32_t, void *); + void (*getDescriptor)(void *, uint32_t, uint32_t, void *); void (*setupEndpointsStart)(void *, uint32_t); void (*setupEndpointsEnd)(void *, uint32_t); void (*setupHID)(void *, uint32_t, void *); diff --git a/src/userland/usb/include/usb.h b/src/userland/usb/include/usb.h index 7fad442..1bfbd4d 100644 --- a/src/userland/usb/include/usb.h +++ b/src/userland/usb/include/usb.h @@ -64,7 +64,7 @@ typedef struct { uint32_t pciClass; void *(*initialize)(uint32_t, uint32_t, uint32_t); - void (*getDeviceDescriptor)(void *, uint32_t, uint32_t, void *); + void (*getDescriptor)(void *, uint32_t, uint32_t, void *); void (*setupEndpointsStart)(void *, uint32_t); void (*setupEndpointsEnd)(void *, uint32_t); void (*setupHID)(void *, uint32_t, void *); diff --git a/src/userland/usb/main.c b/src/userland/usb/main.c index e768c66..cdc9411 100644 --- a/src/userland/usb/main.c +++ b/src/userland/usb/main.c @@ -12,9 +12,7 @@ char *usbReadString(UsbSlot *slot, uint32_t language, uint32_t stringDescriptor, void *buffer) { - void (*usbGetDeviceDescriptor)(void *, uint32_t, uint32_t, void *) = - slot->interface->getDeviceDescriptor; - usbGetDeviceDescriptor(slot->data, 3 << 8 | stringDescriptor, language, + slot->interface->getDescriptor(slot->data, 3 << 8 | stringDescriptor, language, buffer); uint32_t length = ((*(uint8_t *)buffer) - 2) / 2; char *string = malloc(length); @@ -79,12 +77,12 @@ printf("--------\n"); void *buffer = requestMemory(1, 0, 0); UsbDeviceDescriptor *descriptor = malloc(sizeof(UsbDeviceDescriptor)); - slot->interface->getDeviceDescriptor(slot->data, 1 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 1 << 8, 0, buffer); memcpy(buffer, (void *)descriptor, sizeof(UsbDeviceDescriptor)); printf("port %i: usb version %x.%x, %i supported configuration(s)\n", slot->portIndex, descriptor->usbVersion >> 8, descriptor->usbVersion & 0xFF, descriptor->configurationCount); - slot->interface->getDeviceDescriptor(slot->data, 3 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 3 << 8, 0, buffer); uint32_t language = *((uint16_t *)(buffer + 2)); char *manufacturer = usbReadString( slot, language, descriptor->manufacturerStringDescriptor, buffer); @@ -95,7 +93,7 @@ printf("port %i: manufacturer:%s, device:%s, serial:%s\n", slot->portIndex, manufacturer, device, serial); - slot->interface->getDeviceDescriptor(slot->data, 2 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 2 << 8, 0, buffer); UsbConfigurationDescriptor *configuration = malloc(((uint16_t *)buffer)[1]); memcpy(buffer, configuration, ((uint16_t *)buffer)[1]); char *configurationString = usbReadString( @@ -115,8 +113,6 @@ &xhci, }; -extern void *init(uint32_t deviceId, uint32_t bar0, uint32_t interrupt); - void checkDevice(uint32_t pciDevice, uint32_t deviceClass) { for (uint32_t i = 0; i < sizeof(interfaces) / sizeof(interfaces[0]); i++) { UsbHostControllerInterface *interface = interfaces[i]; diff --git a/src/userland/usb/include/usb.h b/src/userland/usb/include/usb.h index 7fad442..1bfbd4d 100644 --- a/src/userland/usb/include/usb.h +++ b/src/userland/usb/include/usb.h @@ -64,7 +64,7 @@ typedef struct { uint32_t pciClass; void *(*initialize)(uint32_t, uint32_t, uint32_t); - void (*getDeviceDescriptor)(void *, uint32_t, uint32_t, void *); + void (*getDescriptor)(void *, uint32_t, uint32_t, void *); void (*setupEndpointsStart)(void *, uint32_t); void (*setupEndpointsEnd)(void *, uint32_t); void (*setupHID)(void *, uint32_t, void *); diff --git a/src/userland/usb/main.c b/src/userland/usb/main.c index e768c66..cdc9411 100644 --- a/src/userland/usb/main.c +++ b/src/userland/usb/main.c @@ -12,9 +12,7 @@ char *usbReadString(UsbSlot *slot, uint32_t language, uint32_t stringDescriptor, void *buffer) { - void (*usbGetDeviceDescriptor)(void *, uint32_t, uint32_t, void *) = - slot->interface->getDeviceDescriptor; - usbGetDeviceDescriptor(slot->data, 3 << 8 | stringDescriptor, language, + slot->interface->getDescriptor(slot->data, 3 << 8 | stringDescriptor, language, buffer); uint32_t length = ((*(uint8_t *)buffer) - 2) / 2; char *string = malloc(length); @@ -79,12 +77,12 @@ printf("--------\n"); void *buffer = requestMemory(1, 0, 0); UsbDeviceDescriptor *descriptor = malloc(sizeof(UsbDeviceDescriptor)); - slot->interface->getDeviceDescriptor(slot->data, 1 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 1 << 8, 0, buffer); memcpy(buffer, (void *)descriptor, sizeof(UsbDeviceDescriptor)); printf("port %i: usb version %x.%x, %i supported configuration(s)\n", slot->portIndex, descriptor->usbVersion >> 8, descriptor->usbVersion & 0xFF, descriptor->configurationCount); - slot->interface->getDeviceDescriptor(slot->data, 3 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 3 << 8, 0, buffer); uint32_t language = *((uint16_t *)(buffer + 2)); char *manufacturer = usbReadString( slot, language, descriptor->manufacturerStringDescriptor, buffer); @@ -95,7 +93,7 @@ printf("port %i: manufacturer:%s, device:%s, serial:%s\n", slot->portIndex, manufacturer, device, serial); - slot->interface->getDeviceDescriptor(slot->data, 2 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 2 << 8, 0, buffer); UsbConfigurationDescriptor *configuration = malloc(((uint16_t *)buffer)[1]); memcpy(buffer, configuration, ((uint16_t *)buffer)[1]); char *configurationString = usbReadString( @@ -115,8 +113,6 @@ &xhci, }; -extern void *init(uint32_t deviceId, uint32_t bar0, uint32_t interrupt); - void checkDevice(uint32_t pciDevice, uint32_t deviceClass) { for (uint32_t i = 0; i < sizeof(interfaces) / sizeof(interfaces[0]); i++) { UsbHostControllerInterface *interface = interfaces[i]; diff --git a/src/userland/usb/xhci/commands.c b/src/userland/usb/xhci/commands.c index 895b73d..6669a67 100644 --- a/src/userland/usb/xhci/commands.c +++ b/src/userland/usb/xhci/commands.c @@ -43,7 +43,7 @@ return xhciCommand(controller, 0, 0, 0, COMMAND_TYPE(9))->slotId; } -void *usbGetDeviceDescriptor(SlotXHCI *slot, uint32_t value, uint32_t index, +void *xhciGetDescriptor(SlotXHCI *slot, uint32_t value, uint32_t index, void *buffer) { XHCISetupStageTRB setup = {0}; setup.requestType = 0x80; diff --git a/src/userland/usb/include/usb.h b/src/userland/usb/include/usb.h index 7fad442..1bfbd4d 100644 --- a/src/userland/usb/include/usb.h +++ b/src/userland/usb/include/usb.h @@ -64,7 +64,7 @@ typedef struct { uint32_t pciClass; void *(*initialize)(uint32_t, uint32_t, uint32_t); - void (*getDeviceDescriptor)(void *, uint32_t, uint32_t, void *); + void (*getDescriptor)(void *, uint32_t, uint32_t, void *); void (*setupEndpointsStart)(void *, uint32_t); void (*setupEndpointsEnd)(void *, uint32_t); void (*setupHID)(void *, uint32_t, void *); diff --git a/src/userland/usb/main.c b/src/userland/usb/main.c index e768c66..cdc9411 100644 --- a/src/userland/usb/main.c +++ b/src/userland/usb/main.c @@ -12,9 +12,7 @@ char *usbReadString(UsbSlot *slot, uint32_t language, uint32_t stringDescriptor, void *buffer) { - void (*usbGetDeviceDescriptor)(void *, uint32_t, uint32_t, void *) = - slot->interface->getDeviceDescriptor; - usbGetDeviceDescriptor(slot->data, 3 << 8 | stringDescriptor, language, + slot->interface->getDescriptor(slot->data, 3 << 8 | stringDescriptor, language, buffer); uint32_t length = ((*(uint8_t *)buffer) - 2) / 2; char *string = malloc(length); @@ -79,12 +77,12 @@ printf("--------\n"); void *buffer = requestMemory(1, 0, 0); UsbDeviceDescriptor *descriptor = malloc(sizeof(UsbDeviceDescriptor)); - slot->interface->getDeviceDescriptor(slot->data, 1 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 1 << 8, 0, buffer); memcpy(buffer, (void *)descriptor, sizeof(UsbDeviceDescriptor)); printf("port %i: usb version %x.%x, %i supported configuration(s)\n", slot->portIndex, descriptor->usbVersion >> 8, descriptor->usbVersion & 0xFF, descriptor->configurationCount); - slot->interface->getDeviceDescriptor(slot->data, 3 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 3 << 8, 0, buffer); uint32_t language = *((uint16_t *)(buffer + 2)); char *manufacturer = usbReadString( slot, language, descriptor->manufacturerStringDescriptor, buffer); @@ -95,7 +93,7 @@ printf("port %i: manufacturer:%s, device:%s, serial:%s\n", slot->portIndex, manufacturer, device, serial); - slot->interface->getDeviceDescriptor(slot->data, 2 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 2 << 8, 0, buffer); UsbConfigurationDescriptor *configuration = malloc(((uint16_t *)buffer)[1]); memcpy(buffer, configuration, ((uint16_t *)buffer)[1]); char *configurationString = usbReadString( @@ -115,8 +113,6 @@ &xhci, }; -extern void *init(uint32_t deviceId, uint32_t bar0, uint32_t interrupt); - void checkDevice(uint32_t pciDevice, uint32_t deviceClass) { for (uint32_t i = 0; i < sizeof(interfaces) / sizeof(interfaces[0]); i++) { UsbHostControllerInterface *interface = interfaces[i]; diff --git a/src/userland/usb/xhci/commands.c b/src/userland/usb/xhci/commands.c index 895b73d..6669a67 100644 --- a/src/userland/usb/xhci/commands.c +++ b/src/userland/usb/xhci/commands.c @@ -43,7 +43,7 @@ return xhciCommand(controller, 0, 0, 0, COMMAND_TYPE(9))->slotId; } -void *usbGetDeviceDescriptor(SlotXHCI *slot, uint32_t value, uint32_t index, +void *xhciGetDescriptor(SlotXHCI *slot, uint32_t value, uint32_t index, void *buffer) { XHCISetupStageTRB setup = {0}; setup.requestType = 0x80; diff --git a/src/userland/usb/xhci/commands.h b/src/userland/usb/xhci/commands.h index e5fb82e..8065075 100644 --- a/src/userland/usb/xhci/commands.h +++ b/src/userland/usb/xhci/commands.h @@ -15,7 +15,7 @@ extern uint32_t requestSlotIndex(XHCIController *controller); -extern void *usbGetDeviceDescriptor(SlotXHCI *slot, uint32_t value, +extern void *xhciGetDescriptor(SlotXHCI *slot, uint32_t value, uint32_t index, void *buffer); extern TrbRing *createSlotTRB(SlotXHCI *slot); diff --git a/src/userland/usb/include/usb.h b/src/userland/usb/include/usb.h index 7fad442..1bfbd4d 100644 --- a/src/userland/usb/include/usb.h +++ b/src/userland/usb/include/usb.h @@ -64,7 +64,7 @@ typedef struct { uint32_t pciClass; void *(*initialize)(uint32_t, uint32_t, uint32_t); - void (*getDeviceDescriptor)(void *, uint32_t, uint32_t, void *); + void (*getDescriptor)(void *, uint32_t, uint32_t, void *); void (*setupEndpointsStart)(void *, uint32_t); void (*setupEndpointsEnd)(void *, uint32_t); void (*setupHID)(void *, uint32_t, void *); diff --git a/src/userland/usb/main.c b/src/userland/usb/main.c index e768c66..cdc9411 100644 --- a/src/userland/usb/main.c +++ b/src/userland/usb/main.c @@ -12,9 +12,7 @@ char *usbReadString(UsbSlot *slot, uint32_t language, uint32_t stringDescriptor, void *buffer) { - void (*usbGetDeviceDescriptor)(void *, uint32_t, uint32_t, void *) = - slot->interface->getDeviceDescriptor; - usbGetDeviceDescriptor(slot->data, 3 << 8 | stringDescriptor, language, + slot->interface->getDescriptor(slot->data, 3 << 8 | stringDescriptor, language, buffer); uint32_t length = ((*(uint8_t *)buffer) - 2) / 2; char *string = malloc(length); @@ -79,12 +77,12 @@ printf("--------\n"); void *buffer = requestMemory(1, 0, 0); UsbDeviceDescriptor *descriptor = malloc(sizeof(UsbDeviceDescriptor)); - slot->interface->getDeviceDescriptor(slot->data, 1 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 1 << 8, 0, buffer); memcpy(buffer, (void *)descriptor, sizeof(UsbDeviceDescriptor)); printf("port %i: usb version %x.%x, %i supported configuration(s)\n", slot->portIndex, descriptor->usbVersion >> 8, descriptor->usbVersion & 0xFF, descriptor->configurationCount); - slot->interface->getDeviceDescriptor(slot->data, 3 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 3 << 8, 0, buffer); uint32_t language = *((uint16_t *)(buffer + 2)); char *manufacturer = usbReadString( slot, language, descriptor->manufacturerStringDescriptor, buffer); @@ -95,7 +93,7 @@ printf("port %i: manufacturer:%s, device:%s, serial:%s\n", slot->portIndex, manufacturer, device, serial); - slot->interface->getDeviceDescriptor(slot->data, 2 << 8, 0, buffer); + slot->interface->getDescriptor(slot->data, 2 << 8, 0, buffer); UsbConfigurationDescriptor *configuration = malloc(((uint16_t *)buffer)[1]); memcpy(buffer, configuration, ((uint16_t *)buffer)[1]); char *configurationString = usbReadString( @@ -115,8 +113,6 @@ &xhci, }; -extern void *init(uint32_t deviceId, uint32_t bar0, uint32_t interrupt); - void checkDevice(uint32_t pciDevice, uint32_t deviceClass) { for (uint32_t i = 0; i < sizeof(interfaces) / sizeof(interfaces[0]); i++) { UsbHostControllerInterface *interface = interfaces[i]; diff --git a/src/userland/usb/xhci/commands.c b/src/userland/usb/xhci/commands.c index 895b73d..6669a67 100644 --- a/src/userland/usb/xhci/commands.c +++ b/src/userland/usb/xhci/commands.c @@ -43,7 +43,7 @@ return xhciCommand(controller, 0, 0, 0, COMMAND_TYPE(9))->slotId; } -void *usbGetDeviceDescriptor(SlotXHCI *slot, uint32_t value, uint32_t index, +void *xhciGetDescriptor(SlotXHCI *slot, uint32_t value, uint32_t index, void *buffer) { XHCISetupStageTRB setup = {0}; setup.requestType = 0x80; diff --git a/src/userland/usb/xhci/commands.h b/src/userland/usb/xhci/commands.h index e5fb82e..8065075 100644 --- a/src/userland/usb/xhci/commands.h +++ b/src/userland/usb/xhci/commands.h @@ -15,7 +15,7 @@ extern uint32_t requestSlotIndex(XHCIController *controller); -extern void *usbGetDeviceDescriptor(SlotXHCI *slot, uint32_t value, +extern void *xhciGetDescriptor(SlotXHCI *slot, uint32_t value, uint32_t index, void *buffer); extern TrbRing *createSlotTRB(SlotXHCI *slot); diff --git a/src/userland/usb/xhci/xhci.c b/src/userland/usb/xhci/xhci.c index c8dd23a..1a4f005 100644 --- a/src/userland/usb/xhci/xhci.c +++ b/src/userland/usb/xhci/xhci.c @@ -159,7 +159,7 @@ UsbHostControllerInterface xhci = { .initialize = init, - .getDeviceDescriptor = (void *)usbGetDeviceDescriptor, + .getDescriptor = (void *)xhciGetDescriptor, .setupEndpointsStart = (void *)xhciSetupEndpointsStart, .setupEndpointsEnd = (void *)xhciSetupEndpointsEnd, .configureEndpoint = (void *)xhciConfigureEndpoint,