From Vita Development Wiki
Jump to navigation Jump to search

Manages the system timers. This module wraps the Hardware Timers and add some functionalities, along with providing a consistent interface.


Version World Privilege
0.931-3.65 Non-secure Kernel


Known NIDs

Version Name World Visibility NID
0.931-3.65 SceSystimerForDriver Non-secure Kernel 0xA47EB09A


#define SYSTIMER_TYPE_LONG 1      //<! 64-bit timer
#define SYSTIMER_TYPE_WORD 2      //<! 32-bit timer
typedef SceInt32 SceSystimerType;

#define SYSTIMER_CLKSRC_SYS   0   //<! The clock controlled by scePowerSetSysClockFrequency
#define SYSTIMER_CLKSRC_48MHZ 3   //<! A clock running at a fixed frequency of 48MHz
typedef SceUInt32 SceSystimerClkSrc;

typedef SceInt32 SceSystimerId;

typedef void (*SceSystimerCallback)(SceSystimerId timer, void* pUserData);



Version NID
0.990-3.60 0xE2B9D8E9
SceSystimerId sceKernelSysTimerAllocForDriver(SceSystimerType type);


Version NID
3.65 0x0450933B

Set the timer's frequency. Timer must not be counting.

// Timer frequency = (clock source frequency) / (prescaleFactor + 1)
// if (a2 < 0x10), written to bits 0x00F00000
// else (a2 & 0x7) written to bits 0x00000700 and 0x2 written to bits 0x00F00000
// a3 written to bits 0xFF000000
SceInt32 SceSystimerForDriver_0450933B(SceSystimerId timer, SceSystimerClkSrc src, SceUInt32 prescaleFactor);


Version NID
3.65 0x1B14DFD6

Sets the timer's counter value and increments the accumulating counter by counter.

SceInt32 SceSystimerForDriver_1B14DFD6(SceSystimerId timer, SceKernelSysClock counter);


Version NID
3.65 0x59EBD22D

Starts the timer.

SceInt32 SceSystimerForDriver_59EBD22D(SceSystimerId timer);


Version NID
3.65 0x7DEBA6A5

Resets the timer. Sets current and accumulated counter to 0.

SceInt32 SceSystimerForDriver_7DEBA6A5(SceSystimerId timer);


Version NID
3.65 0x8358611F

Stops the timer if active, and frees the timer. (sceKernelSysTimerFree)

SceInt32 SceSystimerForDriver_8358611F(SceSystimerId timer);


Version NID
3.65 0x85AAE0DD

Obtains the timer's accumulated count (i.e. *a2 = timer->currentCounter + (sum of counter of each time interrupt was triggered))

SceInt32 SceSystimerForDriver_85AAE0DD(SceSystimerId timer, SceKernelSysClock* a2);


Version NID
3.65 0x904DF737

Edits some bits (mask 0x000F0080) of the timer's config register. Timer must not be counting.

// a2 written to bits 0x000F0000
// a3 written to bit  0x00000080
// additionaly, config register is also |= 0x40
SceInt32 SceSystimerForDriver_904DF737(SceSystimerId timer, SceUInt32 a2, SceBool a3);


Version NID
3.65 0x963F7C0D

Obtains the current value of the timer's counter (i.e. *a2 = timer->currentCount).

SceInt32 SceSystimerForDriver_963F7C0D(SceSystimerId timer, SceKernelSysClock* a2);


Version NID
3.65 0xA73351C1

Sets the timer's threshold. Timer must not be counting.

SceInt32 SceSystimerForDriver_A73351C1(SceSystimerId timer, SceKernelSysClock a2);


Version NID
3.65 0xBF8D42B0

Stops the timer.

SceInt32 SceSystimerForDriver_BF8D42B0(SceSystimerId timer);


Version NID
3.65 0xC34D7940

Edits some bits (mask 0x0000F000) of the timer's config register. Timer must not be counting.

// a2 written to bits 0x0000F000
// additionaly, config register is also |= 0x20
SceInt32 SceSystimerForDriver_C34D7940(SceSystimerId timer, SceUInt32 a2);


Version NID
3.65 0xCCCD1EE3

(Un)registers an interrupt handler for the timer.

 * cb will be invoked whenever the timer generates an interrupt (that is, when the counter reaches the threshold set via SceSystimerForDriver_A73351C1())
 * timer and pUserData arguments will be the same as provided to this function
 * cb will only be called if SceSystimerForDriver_A73351C1() has been called with non-zero argument (e.g. timer has a threshold)
 * cb can be NULL, in which case targetCPU will not be set
 * targetCPU follows the same rules as sceKernelSetIntrTarget() - see SceKernelIntrMgr for more info
SceInt32 SceSystimerForDriver_CCCD1EE3(SceSystimerId timer, SceSystimerCallback cb, SceUInt32 targetCPU, void* pUserData);


Version NID
3.65 0xFD5F1742

Reads some ?counter? from the timer.

SceInt32 SceSystimerForDriver_FD5F1742(SceSystimerId timer, SceKernelSysClock* a2);