mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-14 10:48:36 +12:00
Implement sys_usbd_event_port_send
This commit is contained in:
parent
c62a667fb1
commit
4de301a961
2 changed files with 28 additions and 12 deletions
|
@ -73,6 +73,7 @@ public:
|
||||||
|
|
||||||
// Events related functions
|
// Events related functions
|
||||||
bool get_event(vm::ptr<u64>& arg1, vm::ptr<u64>& arg2, vm::ptr<u64>& arg3);
|
bool get_event(vm::ptr<u64>& arg1, vm::ptr<u64>& arg2, vm::ptr<u64>& arg3);
|
||||||
|
void add_event(u64 arg1, u64 arg2, u64 arg3);
|
||||||
void add_to_receive_queue(ppu_thread* ppu);
|
void add_to_receive_queue(ppu_thread* ppu);
|
||||||
|
|
||||||
// Transfers related functions
|
// Transfers related functions
|
||||||
|
@ -114,7 +115,7 @@ private:
|
||||||
// List of devices "connected" to the ps3
|
// List of devices "connected" to the ps3
|
||||||
std::vector<std::shared_ptr<usb_device>> usb_devices;
|
std::vector<std::shared_ptr<usb_device>> usb_devices;
|
||||||
|
|
||||||
libusb_context* ctx = nullptr;
|
libusb_context* ctx = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
void LIBUSB_CALL callback_transfer(struct libusb_transfer* transfer)
|
void LIBUSB_CALL callback_transfer(struct libusb_transfer* transfer)
|
||||||
|
@ -269,12 +270,7 @@ void usb_handler_thread::send_message(u32 message, u32 tr_id)
|
||||||
{
|
{
|
||||||
sys_usbd.trace("Sending event: arg1=0x%x arg2=0x%x arg3=0x00", message, tr_id);
|
sys_usbd.trace("Sending event: arg1=0x%x arg2=0x%x arg3=0x00", message, tr_id);
|
||||||
|
|
||||||
usbd_events.push({message, tr_id, 0x00});
|
add_event(message, tr_id, 0x00);
|
||||||
if (receive_threads.size())
|
|
||||||
{
|
|
||||||
lv2_obj::awake(receive_threads.front());
|
|
||||||
receive_threads.pop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void usb_handler_thread::transfer_complete(struct libusb_transfer* transfer)
|
void usb_handler_thread::transfer_complete(struct libusb_transfer* transfer)
|
||||||
|
@ -403,6 +399,16 @@ bool usb_handler_thread::get_event(vm::ptr<u64>& arg1, vm::ptr<u64>& arg2, vm::p
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void usb_handler_thread::add_event(u64 arg1, u64 arg2, u64 arg3)
|
||||||
|
{
|
||||||
|
usbd_events.push({arg1, arg2, arg3});
|
||||||
|
if (receive_threads.size())
|
||||||
|
{
|
||||||
|
lv2_obj::awake(receive_threads.front());
|
||||||
|
receive_threads.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void usb_handler_thread::add_to_receive_queue(ppu_thread* ppu)
|
void usb_handler_thread::add_to_receive_queue(ppu_thread* ppu)
|
||||||
{
|
{
|
||||||
lv2_obj::sleep(*ppu);
|
lv2_obj::sleep(*ppu);
|
||||||
|
@ -436,7 +442,7 @@ s32 sys_usbd_initialize(vm::ptr<u32> handle)
|
||||||
std::lock_guard lock(usbh->mutex);
|
std::lock_guard lock(usbh->mutex);
|
||||||
|
|
||||||
usbh->is_init = true;
|
usbh->is_init = true;
|
||||||
*handle = 0x115B;
|
*handle = 0x115B;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
@ -768,7 +774,7 @@ s32 sys_usbd_get_transfer_status(u32 handle, u32 id_transfer, u32 unk1, vm::ptr<
|
||||||
|
|
||||||
s32 sys_usbd_get_isochronous_transfer_status(u32 handle, u32 id_transfer, u32 unk1, vm::ptr<UsbDeviceIsoRequest> request, vm::ptr<u32> result)
|
s32 sys_usbd_get_isochronous_transfer_status(u32 handle, u32 id_transfer, u32 unk1, vm::ptr<UsbDeviceIsoRequest> request, vm::ptr<u32> result)
|
||||||
{
|
{
|
||||||
sys_usbd.todo("sys_usbd_get_isochronous_transfer_status()");
|
sys_usbd.todo("sys_usbd_get_isochronous_transfer_status(handle=0x%x, id_transfer=0x%x, unk1=0x%x, request=*0x%x, result=*0x%x)", handle, id_transfer, unk1, request, result);
|
||||||
|
|
||||||
const auto usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
const auto usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||||
|
|
||||||
|
@ -797,9 +803,19 @@ s32 sys_usbd_send_event()
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 sys_usbd_event_port_send()
|
s32 sys_usbd_event_port_send(u32 handle, u64 arg1, u64 arg2, u64 arg3)
|
||||||
{
|
{
|
||||||
sys_usbd.todo("sys_usbd_event_port_send()");
|
sys_usbd.warning("sys_usbd_event_port_send(handle=0x%x, arg1=0x%x, arg2=0x%x, arg3=0x%x)", handle, arg1, arg2, arg3);
|
||||||
|
|
||||||
|
const auto usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||||
|
|
||||||
|
std::lock_guard lock(usbh->mutex);
|
||||||
|
|
||||||
|
if (!usbh->is_init)
|
||||||
|
return CELL_EINVAL;
|
||||||
|
|
||||||
|
usbh->add_event(arg1, arg2, arg3);
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ s32 sys_usbd_get_transfer_status(u32 handle, u32 id_transfer, u32 unk1, vm::ptr<
|
||||||
s32 sys_usbd_get_isochronous_transfer_status(u32 handle, u32 id_transfer, u32 unk1, vm::ptr<UsbDeviceIsoRequest> request, vm::ptr<u32> result);
|
s32 sys_usbd_get_isochronous_transfer_status(u32 handle, u32 id_transfer, u32 unk1, vm::ptr<UsbDeviceIsoRequest> request, vm::ptr<u32> result);
|
||||||
s32 sys_usbd_get_device_location();
|
s32 sys_usbd_get_device_location();
|
||||||
s32 sys_usbd_send_event();
|
s32 sys_usbd_send_event();
|
||||||
s32 sys_usbd_event_port_send();
|
s32 sys_usbd_event_port_send(u32 handle, u64 arg1, u64 arg2, u64 arg3);
|
||||||
s32 sys_usbd_allocate_memory();
|
s32 sys_usbd_allocate_memory();
|
||||||
s32 sys_usbd_free_memory();
|
s32 sys_usbd_free_memory();
|
||||||
s32 sys_usbd_get_device_speed();
|
s32 sys_usbd_get_device_speed();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue