summaryrefslogtreecommitdiff
path: root/include/rvl/OS/OSAlarm.h
blob: 5ec841b8e7d6a1227bcbe2e5c4041924d54d56f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef RVL_SDK_OS_ALARM_H
#define RVL_SDK_OS_ALARM_H
#include "common.h"
#ifdef __cplusplus
extern "C" {
#endif

// Forward declarations
typedef struct OSAlarm;
typedef struct OSContext;

typedef void (*OSAlarmHandler)(struct OSAlarm *alarm, struct OSContext *ctx);

typedef struct OSAlarm {
    OSAlarmHandler handler; // at 0x0
    u32 tag;                // at 0x4
    s64 end;
    struct OSAlarm *prev; // at 0x10
    struct OSAlarm *next; // at 0x14
    s64 period;           // at 0x18
    s64 start;            // at 0x20
    void *userData;       // at 0x28
} OSAlarm;

typedef struct OSAlarmQueue {
    OSAlarm *head; // at 0x0
    OSAlarm *tail; // at 0x4
} OSAlarmQueue;

void __OSInitAlarm(void);
void OSCreateAlarm(OSAlarm *alarm);
void OSSetAlarm(OSAlarm *alarm, s64 tick, OSAlarmHandler handler);
void OSSetPeriodicAlarm(OSAlarm *alarm, s64 tick, s64 period, OSAlarmHandler handler);
void OSCancelAlarm(OSAlarm *alarm);
void OSSetAlarmTag(OSAlarm *alarm, u32 tag);
void OSSetAlarmUserData(OSAlarm *alarm, void *userData);
void *OSGetAlarmUserData(const OSAlarm *alarm);

#ifdef __cplusplus
}
#endif
#endif