rmonsio.c
1.63 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "osint.h"
#include "piint.h"
#include "rmonint.h"
#include "ramrom.h"
#include "rcp.h"
#include "rdb.h"
#include "rmon.h"
#ifndef _FINALROM
static OSMesgQueue IOmq;
static OSMesg IOmsgs;
u8 *__osRdb_DbgRead_Buf;
u8 rmonRdbReadBuf[RMON_DBG_BUF_SIZE];
void __rmonSendFault( OSThread * thread )
{
volatile float f;
u8 *tPtr;
u32 sent = 0;
/*
* Touch a floating point register to become the owner of the floating
* point unit (and force the previous owner to save its registers).
*/
f = 0.0F;
tPtr = (u8*)thread;
while(sent < sizeof(OSThread))
{
sent += __osRdbSend(&tPtr[sent],sizeof(OSThread)-sent,RDB_TYPE_GtoH_FAULT);
}
}
void __rmonIOflush( void )
{
int sent = 0;
unsigned char tstr[4];
while(sent < 1)
sent += __osRdbSend(&tstr[0],1,RDB_TYPE_GtoH_DEBUG_DONE);
}
void __rmonIOputw( u32 word )
{
int sent = 0;
unsigned char *cPtr;
cPtr = (unsigned char*)&word;
while(sent < 4)
sent += __osRdbSend(&cPtr[sent],4-sent,RDB_TYPE_GtoH_DEBUG);
}
void __rmonIOhandler(void)
{
int sent;
unsigned char tstr[4]; /* junk, but needed for osRdbSend */
osCreateMesgQueue(&IOmq, &IOmsgs, 1);
osSetEventMesg(OS_EVENT_RDB_DBG_DONE, &IOmq, 0);
__osRdb_DbgRead_Buf = rmonRdbReadBuf;
while(1)
{
osRecvMesg(&IOmq, NULL, OS_MESG_BLOCK);
__rmonExecute( (KKHeader *) rmonRdbReadBuf );
__osRdb_DbgRead_Buf = rmonRdbReadBuf; /* reset the buffer pointer */
sent = 0;
while(sent < 1)
sent += __osRdbSend(&tstr[0],1,RDB_TYPE_GtoH_DEBUG_READY);
}
}
#endif /* #ifndef _FINALROM */