-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathnotify.c
More file actions
48 lines (41 loc) · 973 Bytes
/
notify.c
File metadata and controls
48 lines (41 loc) · 973 Bytes
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
43
44
45
46
47
48
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
inline DSError TRKWaitForACK(TRKBuffer* msg, MessageCommandID cmd)
{
if (msg->position >= 0x880)
{
return DS_MessageBufferOverflow;
}
msg->data[msg->position++] = cmd;
msg->length += 1;
return DS_NoError;
}
DSError TRKDoNotifyStopped(u8 cmd)
{
DSError err;
int reqIdx;
int bufIdx;
TRKBuffer* msg;
err = TRKGetFreeBuffer(&bufIdx, &msg);
if (err == DS_NoError)
{
err = TRKWaitForACK(msg, cmd);
if (err == DS_NoError)
{
if (cmd == DSMSG_NotifyStopped)
{
TRKTargetAddStopInfo(msg);
}
else
{
TRKTargetAddExceptionInfo(msg);
}
}
err = TRKRequestSend(msg, &reqIdx, 2, 3, 1);
if (err == DS_NoError)
{
TRKReleaseBuffer(reqIdx);
}
TRKReleaseBuffer(bufIdx);
}
return err;
}