PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
timer.c File Reference
#include <kernel.h>
#include <timer.h>
#include <string.h>
+ Include dependency graph for timer.c:

Go to the source code of this file.

Data Structures

struct  counter_struct_
 
struct  timer_ee_global_struct_
 

Macros

#define TIMER_MODE_START   0x00000001
 
#define TIMER_MODE_HANDLER   0x00000002
 
#define PTR_TO_TIMER_ID(ptr_)   ((s32)((((uiptr)(ptr_)) << 4) | ((ptr_)->timer_key)))
 
#define TIMER_ID_TO_PTR(id_)   ((counter_struct_t *)((((uiptr)(id_)) >> 10) << 6))
 
#define TIMER_ID_IS_VALID(id_)   ((TIMER_ID_TO_PTR(id_) != NULL) && ((siptr)(id_) >= 0) && (((uiptr)(id_) & 0x3FF) == ((TIMER_ID_TO_PTR(id_))->timer_key)))
 
#define COUNTER_COUNT   128
 

Typedefs

typedef struct timer_ee_global_struct_ timer_ee_global_struct
 

Functions

struct counter_struct_ __attribute__ ((aligned(64)))
 
void ForTimer_InitAlarm (void)
 
void SetT2 (volatile void *ptr, u32 val)
 
void SetT2_COUNT (u32 val)
 
void SetT2_MODE (u32 val)
 
void SetT2_COMP (u32 val)
 
void InsertAlarm_ForTimer (counter_struct_t *timer_link)
 
counter_struct_t * UnlinkAlarm_ForTimer (counter_struct_t *timer_unlink)
 
s32 TimerHandler_callback (s32 cause, void *arg, void *addr)
 

Variables

struct counter_struct_timer_next
 
struct counter_struct_timer_previous
 
vu32 timer_key
 
u32 timer_mode
 
u64 timer_base_time
 
u64 timer_base_count
 
u64 timer_schedule
 
timer_alarm_handler_t callback_handler
 
void * gp_value
 
void * callback_handler_arg
 
u32 padding [3]
 
timer_ee_global_struct g_Timer
 

Detailed Description

Some routines to do some timer work

Definition in file timer.c.


Data Structure Documentation

◆ counter_struct_

struct counter_struct_

Definition at line 23 of file timer.c.

+ Collaboration diagram for counter_struct_:
Data Fields
struct counter_struct_ * timer_next
struct counter_struct_ * timer_previous
vu32 timer_key
u32 timer_mode
u64 timer_base_time
u64 timer_base_count
u64 timer_schedule
timer_alarm_handler_t callback_handler
void * gp_value
void * callback_handler_arg
u32 padding[3]

◆ timer_ee_global_struct_

struct timer_ee_global_struct_

Definition at line 38 of file timer.c.

Data Fields
vu64 timer_handled_count
s32 intc_handler
vu32 timer_counter_total
vu32 timer_counter_used
counter_struct_t * timer_counter_buf_free
counter_struct_t * timer_counter_buf_alarm
vs32 current_handling_timer_id

Macro Definition Documentation

◆ TIMER_MODE_START

#define TIMER_MODE_START   0x00000001

Definition at line 20 of file timer.c.

◆ TIMER_MODE_HANDLER

#define TIMER_MODE_HANDLER   0x00000002

Definition at line 21 of file timer.c.

◆ PTR_TO_TIMER_ID

#define PTR_TO_TIMER_ID (   ptr_)    ((s32)((((uiptr)(ptr_)) << 4) | ((ptr_)->timer_key)))

Definition at line 49 of file timer.c.

◆ TIMER_ID_TO_PTR

#define TIMER_ID_TO_PTR (   id_)    ((counter_struct_t *)((((uiptr)(id_)) >> 10) << 6))

Definition at line 50 of file timer.c.

◆ TIMER_ID_IS_VALID

#define TIMER_ID_IS_VALID (   id_)    ((TIMER_ID_TO_PTR(id_) != NULL) && ((siptr)(id_) >= 0) && (((uiptr)(id_) & 0x3FF) == ((TIMER_ID_TO_PTR(id_))->timer_key)))

Definition at line 51 of file timer.c.

◆ COUNTER_COUNT

#define COUNTER_COUNT   128

Definition at line 64 of file timer.c.

Variable Documentation

◆ timer_next

struct counter_struct_* timer_next

Definition at line 0 of file timer.c.

◆ timer_previous

struct counter_struct_* timer_previous

Definition at line 1 of file timer.c.

◆ timer_key

vu32 timer_key

Definition at line 2 of file timer.c.

◆ timer_mode

u32 timer_mode

Definition at line 3 of file timer.c.

◆ timer_base_time

u64 timer_base_time

Definition at line 4 of file timer.c.

◆ timer_base_count

u64 timer_base_count

Definition at line 5 of file timer.c.

◆ timer_schedule

u64 timer_schedule

Definition at line 6 of file timer.c.

◆ callback_handler

timer_alarm_handler_t callback_handler

Definition at line 7 of file timer.c.

◆ gp_value

void* gp_value

Definition at line 8 of file timer.c.

◆ callback_handler_arg

void* callback_handler_arg

Definition at line 9 of file timer.c.

◆ padding

u32 padding[3]

Definition at line 10 of file timer.c.