qertarm.blogg.se

Bochs android usb device
Bochs android usb device







bochs android usb device

The USBIF gives a set time you are to wait for this action. In real hardware, writing a 1 to the Enable bit will usually wait 10us to 100ms before it actually becomes set. In an emulator, when you write a 1 to the Enable bit, it is (usually instantly) set. One common mistake I have found is an implementation, after setting the port's enable bit, won't wait for that enable bit to become set before trying to execute TDs. You must wait for the controller to be ready where as an emulator usually is always ready. make sure that all associated physical memory and all pointers to this memory are valid and are written in the correct order (Buffers before TDs before Queue Heads before Frame Pointers).Īlso, timing is an issue with real hardware. Make sure that all TDs are in memory before you write a Queue Head to memory that might point to any of these TDs. For example, make sure that all data that is pointed to by a TD has already been written to memory before you write the TD to memory. With real hardware, you need to make sure you write your packets to physical memory in the correct order, as well as flushing to physical memory.

Bochs android usb device code#

If you happen to know any other VM that also emulates it please let me know as it would be interesting to know how my code behaves there Since my OS wasn't designed with BOCHS in mind I was only able to test this thing on QEMU, being the only VM I know that emulates UHCI. It's gonna take a while so for the time being I'm posting just this and I'll add in a subsequent post the dumps. Here and here the parts of my repo that contains a less simplified version of the code showed above.Īt the moment I'm trying to retrieve various dumps of the data that gets sent in real HW but it's a bit of a slow process not having copy-paste and a really small screen. Yes, the code still sucks and is pretty much equal to my last topic about USB stuff, but believe me a lot of structural rewriting happened somewhere else that doesn't impact the general behavior of this specific portion of code. While(!(inportw(controller->io + IO_USBSTS) & USBSTS_INT)) Volatile alignas(0x20) transfer_descriptor_t tds įor(size_t i = 0 i frame_list = FRAMELIST_TERMINATE Ĭontroller->frame_list = (uint32_t)(uint64_t)&qh | FRAMELIST_QH

bochs android usb device

Usb_transfer_status_t transfer_packets(void* data, uint64_t addr, uint64_t endpoint, const usb_packet_t* packets, size_t num_packets) Return uhci_transfer_packets(bus->hci.data, addr, endpoint, packets, 2) Memset(packets, 0, sizeof(usb_packet_t) * 2) Usb_transfer_status_t usb_transfer_control_out(const usb_bus_t* bus, uint64_t addr, uint64_t endpoint, void* setup) Return usb_transfer_control_out(bus, 0, 0, &setup) Setup.type = USB_REQUEST_DIR_HOST_TO_DEVICE | USB_REQUEST_TYPE_STANDARD Usb_transfer_status_t usb_set_address(const usb_bus_t* bus, uint64_t addr) If(usb_set_address(bus, addr) != USB_TRANSFER_STATUS_OK)

bochs android usb device

TODO: real hw hangs inside this function this functions expects a just resetted port to be present at address 0









Bochs android usb device