| 334 | } |
| 335 | |
| 336 | error_code sys_timer_connect_event_queue(ppu_thread &ppu, u32 timer_id, |
| 337 | u32 queue_id, u64 name, u64 data1, |
| 338 | u64 data2) { |
| 339 | ppu.state += cpu_flag::wait; |
| 340 | |
| 341 | sys_timer.warning("sys_timer_connect_event_queue(timer_id=0x%x, " |
| 342 | "queue_id=0x%x, name=0x%llx, data1=0x%llx, data2=0x%llx)", |
| 343 | timer_id, queue_id, name, data1, data2); |
| 344 | |
| 345 | const auto timer = idm::check<lv2_obj, lv2_timer>( |
| 346 | timer_id, [&](lv2_timer &timer) -> CellError { |
| 347 | auto found = idm::get_unlocked<lv2_obj, lv2_event_queue>(queue_id); |
| 348 | |
| 349 | if (!found) { |
| 350 | return CELL_ESRCH; |
| 351 | } |
| 352 | |
| 353 | std::lock_guard lock(timer.mutex); |
| 354 | |
| 355 | if (lv2_obj::check(timer.port)) { |
| 356 | return CELL_EISCONN; |
| 357 | } |
| 358 | |
| 359 | // Connect event queue |
| 360 | timer.port = found; |
| 361 | timer.source = |
| 362 | name ? name : (u64{process_getpid() + 0u} << 32) | u64{timer_id}; |
| 363 | timer.data1 = data1; |
| 364 | timer.data2 = data2; |
| 365 | return {}; |
| 366 | }); |
| 367 | |
| 368 | if (!timer) { |
| 369 | return CELL_ESRCH; |
| 370 | } |
| 371 | |
| 372 | if (timer.ret) { |
| 373 | return timer.ret; |
| 374 | } |
| 375 | |
| 376 | return CELL_OK; |
| 377 | } |
| 378 | |
| 379 | error_code sys_timer_disconnect_event_queue(ppu_thread &ppu, u32 timer_id) { |
| 380 | ppu.state += cpu_flag::wait; |
nothing calls this directly
no test coverage detected