summaryrefslogtreecommitdiff
path: root/src/os/osSetTimer.c
blob: 264e5c7db1043558edc1bd69d6208d585b5ca3cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "libultra_internal.h"

extern OSTimer* __osTimerList;
extern u64 __osInsertTimer(OSTimer*);

u32 osSetTimer(OSTimer* a0, OSTime a1, u64 a2, OSMesgQueue* a3, OSMesg a4) {
    u64 sp18;
    a0->next = NULL;
    a0->prev = NULL;
    a0->interval = a2;
    if (a1 != 0) {
        a0->remaining = a1;
    } else {
        a0->remaining = a2;
    }
    a0->mq = a3;
    a0->msg = a4;
    sp18 = __osInsertTimer(a0);
    if (__osTimerList->next == a0) {
        __osSetTimerIntr(sp18);
    }
    return 0;
}