Battery function prototypes
Battery function prototypes
Does anyone have a header file with the prototypes for sceSysconBatteryReadNVM and sceSysconBatteryWriteNVM?
-
- Posts: 110
- Joined: Tue Feb 27, 2007 9:43 pm
- Contact:
Code: Select all
// Addresses valid from 0x00-0x7F
// returns < 0 on error
int sceSysconBatteryReadNVM(u32 addr);
int sceSysconBatteryWriteNVM(u32 addr, u16 data);
Here's a compatible replacement to use on 3.80+ cfw:
Code: Select all
int pspSysconBatteryReadNVM(u32 addr)
{
u32 k1 = pspSdkSetK1(0);
if (addr > 0x7F)
return(0x80000102);
u8 param[0x60];
param[0x0C] = 0x74; // read battery eeprom command
param[0x0D] = 3; // tx packet length
// tx data
param[0x0E] = addr;
int res = sceSysconCmdExec(param, 0);
if (res < 0)
return(res);
// rx data
u16 data = (param[0x21]<<8) | param[0x20];
pspSdkSetK1(k1);
return(data);
}
int pspSysconBatteryWriteNVM(u32 addr, u16 data)
{
u32 k1 = pspSdkSetK1(0);
if (addr > 0x7F)
return(0x80000102);
u8 param[0x60];
param[0x0C] = 0x73; // write battery eeprom command
param[0x0D] = 5; // tx packet length
// tx data
param[0x0E] = addr;
param[0x0F] = data;
param[0x10] = data>>8;
int res = sceSysconCmdExec(param, 0);
if (res < 0)
return(res);
pspSdkSetK1(k1);
return 0;
}