mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 09:48:37 +12:00
sys_gpio Cleanup
This commit is contained in:
parent
c2278fb879
commit
36de3d4f4c
2 changed files with 11 additions and 8 deletions
|
@ -1,20 +1,21 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "sys_gpio.h"
|
#include "sys_gpio.h"
|
||||||
|
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
#include "Emu/IdManager.h"
|
|
||||||
|
|
||||||
#include "Emu/Cell/ErrorCodes.h"
|
#include "Emu/Cell/ErrorCodes.h"
|
||||||
|
|
||||||
|
LOG_CHANNEL(sys_gpio);
|
||||||
|
|
||||||
error_code sys_gpio_get(u64 device_id, vm::ptr<u64> value)
|
error_code sys_gpio_get(u64 device_id, vm::ptr<u64> value)
|
||||||
{
|
{
|
||||||
|
sys_gpio.trace("sys_gpio_get(device_id=0x%llx, value=*0x%x)", device_id, value);
|
||||||
|
|
||||||
if (device_id != SYS_GPIO_LED_DEVICE_ID && device_id != SYS_GPIO_DIP_SWITCH_DEVICE_ID)
|
if (device_id != SYS_GPIO_LED_DEVICE_ID && device_id != SYS_GPIO_DIP_SWITCH_DEVICE_ID)
|
||||||
{
|
{
|
||||||
return CELL_ESRCH;
|
return CELL_ESRCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vm::check_addr(value.addr(), sizeof(u64), vm::page_writable))
|
if (!vm::check_addr(value.addr(), value.size(), vm::page_writable))
|
||||||
{
|
{
|
||||||
return CELL_EFAULT;
|
return CELL_EFAULT;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +28,8 @@ error_code sys_gpio_get(u64 device_id, vm::ptr<u64> value)
|
||||||
|
|
||||||
error_code sys_gpio_set(u64 device_id, u64 mask, u64 value)
|
error_code sys_gpio_set(u64 device_id, u64 mask, u64 value)
|
||||||
{
|
{
|
||||||
|
sys_gpio.trace("sys_gpio_set(device_id=0x%llx, mask=0x%llx, value=0x%llx)", device_id, mask, value);
|
||||||
|
|
||||||
// Retail consoles dont have LEDs or DIPs switches, hence the syscall can't modify devices's value
|
// Retail consoles dont have LEDs or DIPs switches, hence the syscall can't modify devices's value
|
||||||
switch (device_id)
|
switch (device_id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Emu/Memory/vm_ptr.h"
|
#include "Emu/Memory/vm_ptr.h"
|
||||||
|
|
||||||
enum : u64
|
enum : u64
|
||||||
{
|
{
|
||||||
SYS_GPIO_UNKNOWN_DEVICE_ID,
|
SYS_GPIO_UNKNOWN_DEVICE_ID = 0x0,
|
||||||
SYS_GPIO_LED_DEVICE_ID,
|
SYS_GPIO_LED_DEVICE_ID = 0x1,
|
||||||
SYS_GPIO_DIP_SWITCH_DEVICE_ID,
|
SYS_GPIO_DIP_SWITCH_DEVICE_ID = 0x2,
|
||||||
};
|
};
|
||||||
|
|
||||||
error_code sys_gpio_get(u64 device_id, vm::ptr<u64> value);
|
error_code sys_gpio_get(u64 device_id, vm::ptr<u64> value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue