comparison packages/cygmon/current/misc/mn10300/mn10300-mon.c @ 115:6ed91473a1cd ecos-sw-2000-08-21

Merge from eCos master repository on 2000-08-21-22:40:54-BST
author jlarmour
date Fri, 25 Aug 2000 17:32:38 +0000
parents
children e0c0827131d1
comparison
equal deleted inserted replaced
114:5ad2b71d525e 115:6ed91473a1cd
1 //==========================================================================
2 //
3 // mn10300-mon.c
4 //
5 // Support code to extend the generic monitor code to support
6 // MN10300 processors.
7 //
8 //==========================================================================
9 //####COPYRIGHTBEGIN####
10 //
11 // -------------------------------------------
12 // The contents of this file are subject to the Red Hat eCos Public License
13 // Version 1.1 (the "License"); you may not use this file except in
14 // compliance with the License. You may obtain a copy of the License at
15 // http://www.redhat.com/
16 //
17 // Software distributed under the License is distributed on an "AS IS"
18 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
19 // License for the specific language governing rights and limitations under
20 // the License.
21 //
22 // The Original Code is eCos - Embedded Configurable Operating System,
23 // released September 30, 1998.
24 //
25 // The Initial Developer of the Original Code is Red Hat.
26 // Portions created by Red Hat are
27 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
28 // All Rights Reserved.
29 // -------------------------------------------
30 //
31 //####COPYRIGHTEND####
32 //==========================================================================
33 //#####DESCRIPTIONBEGIN####
34 //
35 // Author(s): dmoseley
36 // Contributors: dmoseley
37 // Date: 2000-08-11
38 // Purpose: Support code to extend the generic monitor code to support
39 // MN10300 processors.
40 // Description: Further board specific support is in other files.
41 // This file contains:
42 // register names lookup table
43 //
44 // Empty Stubs:
45 // Interval timer - This should really belong to the application
46 // operating system.
47 //
48 // Should not contain:
49 // low level uart getchar and putchar functions
50 // delay function to support uart
51 //
52 //####DESCRIPTIONEND####
53 //
54 //=========================================================================
55
56 #include "monitor.h"
57
58 struct regstruct regtab[] =
59 {
60 {"d0", D0, 1},
61 {"d1", D1, 1},
62 {"d2", D2, 1},
63 {"d3", D3, 1},
64 {"a0", A0, 1},
65 {"a1", A1, 1},
66 {"a2", A2, 1},
67 {"a3", A3, 1},
68 {"sp", SP, 1},
69 {"pc", PC, 1},
70 {"mdr", MDR, 1},
71 {"psw", PSW, 1},
72 {"lir", LIR, 1},
73 {"lar", LAR, 1},
74 #ifdef CYGPKG_HAL_MN10300_AM33
75 {"r0", R0, 1},
76 {"r1", R1, 1},
77 {"r2", R2, 1},
78 {"r3", R3, 1},
79 {"r4", R4, 1},
80 {"r5", R5, 1},
81 {"r6", R6, 1},
82 {"r7", R7, 1},
83 {"ssp", SSP, 1},
84 {"msp", MSP, 1},
85 {"usp", USP, 1},
86 {"mcrh", MCRH, 1},
87 {"mcrl", MCRL, 1},
88 {"mcvf", MCVF, 1},
89 {"mdrq", MDRQ, 1},
90 #endif
91 { 0, 0, 1}, /* Terminating element must be last */
92 } ;
93
94 void
95 initialize_mon(void)
96 {
97 } /* initialize_mon */
98
99
100 #ifdef CYGPKG_HAL_MN10300_AM33
101 extern int msp_read;
102 #endif
103
104 void
105 initialize_mon_each_time(void)
106 {
107 int i;
108
109 #ifdef CYGPKG_HAL_MN10300_AM33
110 // Make sure the regtab[] indicates the valid status of the MSP
111 for (i = 0; regtab[i].registername != NULL; i++)
112 {
113 if (regtab[i].registernumber == MSP)
114 regtab[i].registervalid = msp_read;
115 }
116 #endif
117 } /* initialize_mon_each_time */
118
119
120 #include <cyg/hal/hal_arch.h>
121 #include <bsp/common/bsp_if.h>
122 int
123 machine_syscall(HAL_SavedRegisters *regs)
124 {
125 int res, err;
126 target_register_t d0, d1, d2, d3;
127
128 d0 = get_register(D0);
129 d1 = get_register(D1);
130 d2 = get_register(D2);
131 d3 = get_register(D3);
132
133 err = _bsp_do_syscall(d0, // Function
134 d1, d2, d3, 0, // arguments,
135 &res);
136 if (err)
137 {
138 // This was a syscall. It has now been handled, so update the registers appropriately
139 put_register(D0, res);
140 bsp_skip_instruction(regs);
141 }
142
143 return err;
144 }
145
146
147 // Utility function for printing breakpoints
148 void bp_print(target_register_t bp_val)
149 {
150 bsp_printf("0x%08lx\n", (unsigned long)bp_val);
151 }