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

Go to the source code of this file.

Data Structures

struct  alarm_struct_
 

Macros

#define PTR_TO_ALARM_ID(ptr_, cid_)   ((s32)((((uiptr)(ptr_)) << 4) | ((cid_) & 0xFE) | 1))
 
#define ALARM_ID_TO_PTR(id_)   ((alarm_struct_t *)((((uiptr)(id_)) >> 8) << 4))
 
#define ALARM_ID_IS_VALID(id_)   ((ALARM_ID_TO_PTR(id_) != NULL) && ((siptr)(id_) >= 0) && ((((((uiptr)id_) & 0xFF) == (((ALARM_ID_TO_PTR(id_))->timer_counter_id) & 0xFF)))))
 
#define ALARM_COUNT   64
 

Functions

struct alarm_struct_ __attribute__ ((aligned(16)))
 
static alarm_struct_t * ForTimer_AllocAlarm (void)
 
static void ForTimer_FreeAlarm (alarm_struct_t *alarm_current)
 

Variables

struct alarm_struct_alarm_next
 
vs32 timer_counter_id
 
timer_alarm_handler_t callback_handler
 
void * callback_handler_arg
 
alarm_struct_t * g_pFreeAlarm
 

Detailed Description

Some routines to do some timer alarm work

Definition in file timer_alarm.c.


Data Structure Documentation

◆ alarm_struct_

struct alarm_struct_

Definition at line 20 of file timer_alarm.c.

+ Collaboration diagram for alarm_struct_:
Data Fields
struct alarm_struct_ * alarm_next
vs32 timer_counter_id
timer_alarm_handler_t callback_handler
void * callback_handler_arg

Macro Definition Documentation

◆ PTR_TO_ALARM_ID

#define PTR_TO_ALARM_ID (   ptr_,
  cid_ 
)    ((s32)((((uiptr)(ptr_)) << 4) | ((cid_) & 0xFE) | 1))

Definition at line 28 of file timer_alarm.c.

◆ ALARM_ID_TO_PTR

#define ALARM_ID_TO_PTR (   id_)    ((alarm_struct_t *)((((uiptr)(id_)) >> 8) << 4))

Definition at line 29 of file timer_alarm.c.

◆ ALARM_ID_IS_VALID

#define ALARM_ID_IS_VALID (   id_)    ((ALARM_ID_TO_PTR(id_) != NULL) && ((siptr)(id_) >= 0) && ((((((uiptr)id_) & 0xFF) == (((ALARM_ID_TO_PTR(id_))->timer_counter_id) & 0xFF)))))

Definition at line 30 of file timer_alarm.c.

◆ ALARM_COUNT

#define ALARM_COUNT   64

Definition at line 32 of file timer_alarm.c.

Function Documentation

◆ ForTimer_AllocAlarm()

static alarm_struct_t * ForTimer_AllocAlarm ( void  )
inlinestatic

Definition at line 54 of file timer_alarm.c.

◆ ForTimer_FreeAlarm()

static void ForTimer_FreeAlarm ( alarm_struct_t *  alarm_current)
inlinestatic

Definition at line 65 of file timer_alarm.c.

Variable Documentation

◆ alarm_next

struct alarm_struct_* alarm_next

Definition at line 0 of file timer_alarm.c.

◆ timer_counter_id

vs32 timer_counter_id

Definition at line 1 of file timer_alarm.c.

◆ callback_handler

timer_alarm_handler_t callback_handler

Definition at line 2 of file timer_alarm.c.

◆ callback_handler_arg

void* callback_handler_arg

Definition at line 3 of file timer_alarm.c.