OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [calmrisc32/] [arch/] [v2_0/] [include/] [calm32-stub.h] - Blame information for rev 584

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_HAL_MIPS_STUB_H
2
#define CYGONCE_HAL_MIPS_STUB_H
3
//========================================================================
4
//
5
//      mips-stub.h
6
//
7
//      CalmRISC32-specific definitions for generic stub
8
//
9
//========================================================================
10
//####ECOSGPLCOPYRIGHTBEGIN####
11
// -------------------------------------------
12
// This file is part of eCos, the Embedded Configurable Operating System.
13
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14
//
15
// eCos is free software; you can redistribute it and/or modify it under
16
// the terms of the GNU General Public License as published by the Free
17
// Software Foundation; either version 2 or (at your option) any later version.
18
//
19
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22
// for more details.
23
//
24
// You should have received a copy of the GNU General Public License along
25
// with eCos; if not, write to the Free Software Foundation, Inc.,
26
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27
//
28
// As a special exception, if other files instantiate templates or use macros
29
// or inline functions from this file, or you compile this file and link it
30
// with other works to produce a work based on this file, this file does not
31
// by itself cause the resulting work to be covered by the GNU General Public
32
// License. However the source code for this file must still be made available
33
// in accordance with section (3) of the GNU General Public License.
34
//
35
// This exception does not invalidate any other reasons why a work based on
36
// this file might be covered by the GNU General Public License.
37
//
38
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39
// at http://sources.redhat.com/ecos/ecos-license/
40
// -------------------------------------------
41
//####ECOSGPLCOPYRIGHTEND####
42
//========================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):     Red Hat, msalter
46
// Contributors:  Red Hat, msalter
47
// Date:          2001-02-12
48
// Purpose:       
49
// Description:   CalmRISC32-specific definitions for generic stub
50
// Usage:         
51
//
52
//####DESCRIPTIONEND####
53
//
54
//========================================================================
55
 
56
 
57
#include <pkgconf/system.h>
58
 
59
#include <cyg/hal/hal_io.h>
60
 
61
#ifdef __cplusplus
62
extern "C" {
63
#endif
64
 
65
#define TARGET_HAS_HARVARD_MEMORY 1
66
typedef unsigned long long target_addr_t;
67
#define TARGET_ADDR_IS_PROGMEM(x) (((unsigned long long)(x)) >= 0x100000000ULL)
68
#define TARGET_ADDR_TO_PTR(x)     ((char *) (((unsigned)(x)) & 0xffffffff))
69
 
70
#define NUMREGS    43
71
 
72
#define REGSIZE(X) 4
73
typedef unsigned long target_register_t;
74
 
75
enum regnames {
76
    REG_B0R0,   REG_B0R1,  REG_B0R2,   REG_B0R3,   REG_B0R4,   REG_B0R5,   REG_B0R6,   REG_B0R7,
77
    REG_B0R8,   REG_B0R9,  REG_B0R10,  REG_B0R11,  REG_B0R12,  REG_B0R13,  REG_B0R14,  REG_B0R15,
78
    REG_B1R0,   REG_B1R1,  REG_B1R2,   REG_B1R3,   REG_B1R4,   REG_B1R5,   REG_B1R6,   REG_B1R7,
79
    REG_B1R8,   REG_B1R9,  REG_B1R10,  REG_B1R11,  REG_B1R12,  REG_B1R13,  REG_B1R14,  REG_B1R15,
80
    REG_PC, REG_VBR, REG_SR,
81
    REG_SSR_FIQ, REG_SPC_FIQ, REG_SSR_IRQ, REG_SPC_IRQ,
82
    REG_SSR_SWI, REG_SPC_SWI, REG_SSR_EXPT, REG_SPC_EXPT
83
};
84
 
85
typedef enum regnames regnames_t;
86
 
87
#define PC REG_PC
88
#define SP __sp_regnum()
89
extern int __sp_regnum(void);
90
 
91
#define HAL_STUB_ADD_T_REG(__ptr__,__reg__,__val__)                      \
92
    *__ptr__++ = __tohex (__reg__ >> 4);                                 \
93
    *__ptr__++ = __tohex (__reg__);                                      \
94
    *__ptr__++ = ':';                                                    \
95
    __val__ = get_register (__reg__);                                    \
96
    __ptr__ = __mem2hex((char *)&__val__, __ptr__, sizeof(__val__), 0);  \
97
    *ptr++ = ';'
98
 
99
#define HAL_STUB_ARCH_T_PACKET_EXTRAS(__ptr__)                           \
100
{                                                                        \
101
    target_register_t __val__;                                           \
102
                                                                         \
103
    HAL_STUB_ADD_T_REG(__ptr__,REG_SR,__val__);                          \
104
    if ((__val__ & CYGARC_SR_PM) == 0 || (__val__ & CYGARC_SR_BS) == 0){ \
105
        HAL_STUB_ADD_T_REG(__ptr__,REG_B0R13,__val__);                   \
106
    } else {                                                             \
107
        HAL_STUB_ADD_T_REG(__ptr__,REG_B1R13,__val__);                   \
108
    }                                                                    \
109
}
110
 
111
/* Given a trap value TRAP, return the corresponding signal. */
112
extern int __computeSignal (unsigned int trap_number);
113
 
114
/* Return the SPARC trap number corresponding to the last-taken trap. */
115
extern int __get_trap_number (void);
116
 
117
/* Return the currently-saved value corresponding to register REG. */
118
extern target_register_t get_register (regnames_t reg);
119
 
120
/* Store VALUE in the register corresponding to WHICH. */
121
extern void put_register (regnames_t which, target_register_t value);
122
 
123
/* Set the currently-saved pc register value to PC. */
124
#if !defined(SET_PC_PROTOTYPE_EXISTS) && !defined(set_pc)
125
#define SET_PC_PROTOTYPE_EXISTS
126
extern void set_pc (target_register_t pc);
127
#endif
128
 
129
/* Set things up so that the next user resume will execute one instruction.
130
   This may be done by setting breakpoints or setting a single step flag
131
   in the saved user registers, for example. */
132
#ifndef __single_step
133
void __single_step (void);
134
#endif
135
 
136
/* Clear the single-step state. */
137
void __clear_single_step (void);
138
 
139
extern int __is_bsp_syscall(void);
140
 
141
extern int hal_syscall_handler(void);
142
 
143
/* If the breakpoint we hit is in the breakpoint() instruction, return a
144
   non-zero value. */
145
#ifndef __is_breakpoint_function
146
extern int __is_breakpoint_function (void);
147
#endif
148
 
149
/* Skip the current instruction. */
150
extern void __skipinst (void);
151
 
152
extern void __install_breakpoints (void);
153
 
154
extern void __clear_breakpoints (void);
155
 
156
extern void __install_breakpoint_list (void);
157
 
158
extern void __clear_breakpoint_list (void);
159
 
160
extern unsigned char  __read_prog_uint8(void *addr);
161
extern unsigned short __read_prog_uint16(void *addr);
162
extern unsigned int   __read_prog_uint32(void *addr);
163
 
164
extern void __write_prog_uint8(void *addr, unsigned char val);
165
extern void __write_prog_uint16(void *addr, unsigned short val);
166
extern void __write_prog_uint32(void *addr, unsigned int val);
167
 
168
#ifdef __cplusplus
169
}      /* extern "C" */
170
#endif
171
 
172
#endif // ifndef CYGONCE_HAL_MIPS_STUB_H

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.