rmonmisc.c
4.84 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* ==========================================================================
* Copyright (c) 1994, Silicon Graphics, Inc. All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied
* or duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc. handleSelectExceptions
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished
* rights reserved under the Copyright Laws of the United States.
* ==========================================================================
*/
/************************************************************************
Program: rmon (reality monitor) in-circuit target monitor
File: regs.c
Author: Kenneth F. Greenberg
Purpose: The access functions that don't fit anywhere else
Revision history:
94.10.31 Original (Happy Halloween)
************************************************************************/
#ifndef _FINALROM
#include "dbgdefs.h" /* definitions needed by the following file */
#include "dbgproto.h" /* standard protocol definitions */
#include "rmonint.h" /* needs info in above files */
#include <em.h>
#include <rcp.h>
/************************************************************************
Function: __rmonSetFault
Args: KKHeader * req - address of the standard protocol structure for
setting faults, whatever the heck that means.
Type: int - returns 0 if successful, otherwise error type
Purpose: This function responds to the set fault request with useless
information - just like the one in the settop box.
************************************************************************/
int __rmonSetFault( KKHeader * req )
{
KKFaultRequest * request = (KKFaultRequest *) req;
KKObjectEvent reply;
Debug( "SetFault\n" );
reply.header.code = request->header.code;
reply.header.error = TV_ERROR_NO_ERROR;
reply.object = request->tid;
__rmonSendReply( (KKHeader * const) &reply, sizeof( KKObjectEvent ), _KK_REPLY );
return 0;
}
OSMesgQueue __rmonMQ; /* public - shared by main and IO */
static OSThread rmonIOThread;
static OSMesg rmonMsgs[8];
static double rmonIOStack[0x800];
static OSMesg rmonPiMsgs[8];
static OSMesgQueue rmonPiMQ;
/************************************************************************
Function: rmonInit
Args: none
Type: void
Purpose: This function should always contain all init code for rmon.
************************************************************************/
void __rmonInit(void)
{
osCreateMesgQueue( &__rmonMQ, rmonMsgs, 8 );
osSetEventMesg( OS_EVENT_CPU_BREAK, &__rmonMQ, (OSMesg) MSG_BREAKPOINT );
osSetEventMesg( OS_EVENT_SP_BREAK, &__rmonMQ, (OSMesg) MSG_SPBREAKPOINT );
osSetEventMesg( OS_EVENT_FAULT, &__rmonMQ, (OSMesg) MSG_CPUFAULT );
osSetEventMesg( OS_EVENT_THREADSTATUS, &__rmonMQ, (OSMesg) 0 );
osCreateThread( &rmonIOThread, 0, (VFUNPTR) __rmonIOhandler, 0,
&rmonIOStack[0x800], (OSPri) 255 );
/*
Note that Pi manager must start before IO manager, since the
latter requests the former's command queue address at startup.
It should be legal to start one, even if one is already
running (will just fail).
*/
osCreatePiManager( (OSPri) 150, &rmonPiMQ, rmonPiMsgs, 8 );
osStartThread( &rmonIOThread );
}
/************************************************************************
Function: __rmonPanic
Args: none
Type: void
Purpose: This function implements a panic stop for rmon; essentially, it
stops doing anything when a fatal error occurs, although interrupts
continue to be processed. By looking at the stack (how?) it may
be possible to figure out how we got here.
************************************************************************/
void __rmonPanic(void)
{
Debug( "PANIC!!\n" );
for ( ;; )
;
}
/************************************************************************
Function: __rmonSetComm
Args: KKHeader * req - address of the standard protocol structure for
setting comm, whatever the heck that means.
Type: int - returns 0 if successful, otherwise error type
Purpose: This function responds to the set comm request with useless
information - just like the one in the settop box.
************************************************************************/
int __rmonSetComm( KKHeader * req )
{
KKObjectEvent reply;
Debug( "SetComm\n" );
reply.header.code = req->code;
reply.object = KK_TTY;
reply.header.error = TV_ERROR_NO_ERROR;
__rmonSendReply( (KKHeader * const) &reply, sizeof( KKObjectEvent ), _KK_REPLY );
return 0;
}
#endif /* #ifndef _FINALROM */