|
typedef s32(* | SceSTimerCb) (s32 timerId, u32 count, void *common, u32) |
|
Hardware timer management.
◆ SceSTimerCb
typedef s32(* SceSTimerCb) (s32 timerId, u32 count, void *common, u32) |
The time-up handler used by sceSTimerSetHandler().
When the hardware timer counter register matches the comparison value that was set by sceSTimerSetHandler(), the time-up handler is called.
When the value returned by the time-up handler is not equal to -1, timer
counting is stopped and the timer is set to "not in use".
The following arguments don't need to be used in the time-up routine.
- Parameters
-
timerID | The ID of the timer this time-up handler belongs to. |
count | Counter value. |
common | Pass the common argument specified in sceSTimerSetHandler(). |
unk | Unknown. |
Typically returns -1.
◆ sceSTimerAlloc()
s32 sceSTimerAlloc |
( |
void |
| ) |
|
Obtain a hardware timer. Cannot be called from an interrupt handler.
- Returns
- The timer id (greater than or equal to 0) on success.
◆ sceSTimerFree()
s32 sceSTimerFree |
( |
s32 |
timerId | ) |
|
Return the hardware timer that was obtained by sceSTimerAlloc().
Cannot be called from an interrupt handler.
- Parameters
-
timerId | The ID of the timer to return. |
- Returns
- SCE_ERROR_OK on success.
◆ sceSTimerStartCount()
s32 sceSTimerStartCount |
( |
s32 |
timerId | ) |
|
Start hardware timer counting. The timer is set to "in use" state.
- Parameters
-
timerId | The ID of the timer to start counting. |
- Returns
- SCE_ERROR_OK on success.
◆ sceSTimerGetCount()
s32 sceSTimerGetCount |
( |
s32 |
timerId, |
|
|
s32 * |
count |
|
) |
| |
Read the current value of hardware timer's counter register.
- Parameters
-
timerId | The ID of the timer to obtain the timer counter value from. |
count | A pointer where the obtained counter value will be stored into. |
- Returns
- SCE_ERROR_OK on success.
◆ sceSTimerResetCount()
s32 sceSTimerResetCount |
( |
s32 |
timerId | ) |
|
Reset the hardware timer's counter register to 0.
- Parameters
-
timerId | The ID of the timer to reset its counter. |
- Returns
- SCE_ERROR_OK on success.
◆ sceSTimerStopCount()
s32 sceSTimerStopCount |
( |
s32 |
timerId | ) |
|
Stop the hardware timer counting and set the timer's state to "not in use".
- Parameters
-
timerId | The ID of the timer to stop its counting. |
- Returns
- SCE_ERROR_OK on success.
◆ sceSTimerSetPrscl()
s32 sceSTimerSetPrscl |
( |
s32 |
timerId, |
|
|
s32 |
numerator, |
|
|
s32 |
denominator |
|
) |
| |
Set the prescale of a hardware timer. It can be only set on timers which are in the "not in use" state.
The input signal is divided into the resulting ratio. The ratio has to be less than 1/11.
- Parameters
-
timerId | The ID of the timer to set the prescale. |
numerator | The numerator of the prescale. Must not be 0. |
denominator | The denominator of the prescale. Must not be 0. |
- Returns
- SCE_ERROR_OK on success.
◆ sceSTimerSetHandler()
s32 sceSTimerSetHandler |
( |
s32 |
timerId, |
|
|
s32 |
compareValue, |
|
|
SceSTimerCb |
timeUpHandler, |
|
|
void * |
common |
|
) |
| |
Set the comparison value and the time-up handler of the hardware timer counter register.
The hardware timer counter register begins counting up from zero. If the counter register matches
the comparison value, an interrupt occurs, the counter register is returned to zero, and counting
continues. The time-up handler is called via this interrupt.
- Parameters
-
timerId | The ID of the timer to set the compare value and time-up handler. |
compareValue | The count comparison value. Should not be greater 4194303 (~1/10 seconds) and less than 0. |
timeUpHandler | Specify the time-up handler that is called when count matches the comparison value.
Pass null to delete a registered time-up handler. This will also stop the hardware timer
counting. |
common | Pointer to memory common between time-up handler and general routines. |
- Returns
- SCE_ERROR_OK on success.
◆ sceSTimerSetTMCY()
s32 sceSTimerSetTMCY |
( |
s32 |
timerId, |
|
|
s32 |
arg1 |
|
) |
| |
Unknown purpose.
- Parameters
-
timerId | The ID of the timer. |
arg1 | Unknown. Should not be less than 0 and greater 4194304. |
- Returns
- SCE_ERROR_OK on success.