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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [mn10300/] [stdeval1/] [v2_0/] [src/] [plf_misc.c] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      plf_misc.c
4
//
5
//      HAL platform miscellaneous functions
6
//
7
//==========================================================================
8
//####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later version.
16
//
17
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
// for more details.
21
//
22
// You should have received a copy of the GNU General Public License along
23
// with eCos; if not, write to the Free Software Foundation, Inc.,
24
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
//
26
// As a special exception, if other files instantiate templates or use macros
27
// or inline functions from this file, or you compile this file and link it
28
// with other works to produce a work based on this file, this file does not
29
// by itself cause the resulting work to be covered by the GNU General Public
30
// License. However the source code for this file must still be made available
31
// in accordance with section (3) of the GNU General Public License.
32
//
33
// This exception does not invalidate any other reasons why a work based on
34
// this file might be covered by the GNU General Public License.
35
//
36
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
// at http://sources.redhat.com/ecos/ecos-license/
38
// -------------------------------------------
39
//####ECOSGPLCOPYRIGHTEND####
40
//==========================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):    nickg
44
// Contributors: nickg, jlarmour
45
// Date:         1999-01-21
46
// Purpose:      HAL miscellaneous functions
47
// Description:  This file contains miscellaneous functions provided by the
48
//               HAL.
49
//
50
//####DESCRIPTIONEND####
51
//
52
//========================================================================*/
53
 
54
#include <pkgconf/hal.h>
55
 
56
#include <cyg/infra/cyg_type.h>         // Base types
57
#include <cyg/infra/cyg_trac.h>         // tracing macros
58
#include <cyg/infra/cyg_ass.h>          // assertion macros
59
 
60
#include <cyg/hal/hal_arch.h>           // architectural definitions
61
 
62
#include <cyg/hal/hal_intr.h>           // Interrupt handling
63
 
64
#include <cyg/hal/hal_cache.h>          // Cache handling
65
 
66
/*------------------------------------------------------------------------*/
67
 
68
void hal_platform_init(void)
69
{
70
    // Note that the hardware seems to come up with the
71
    // caches containing random data. Hence they must be
72
    // invalidated before being enabled.
73
 
74
    HAL_ICACHE_INVALIDATE_ALL();
75
    HAL_ICACHE_ENABLE();
76
    HAL_DCACHE_INVALIDATE_ALL();
77
    HAL_DCACHE_ENABLE();
78
 
79
#if defined(CYGPKG_KERNEL)                      && \
80
    defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT)   && \
81
    defined(CYGSEM_HAL_USE_ROM_MONITOR_CygMon)
82
    {
83
        extern CYG_ADDRESS hal_virtual_vector_table[32];
84
        extern void patch_dbg_syscalls(void * vector);
85
        patch_dbg_syscalls( (void *)(&hal_virtual_vector_table[0]) );
86
    }
87
#endif    
88
}
89
 
90
/*------------------------------------------------------------------------*/
91
/* Functions to support the detection and execution of a user provoked    */
92
/* program break. These are usually called from interrupt routines.       */
93
 
94
cyg_bool cyg_hal_is_break(char *buf, int size)
95
{
96
    while( size )
97
        if( buf[--size] == 0x03 ) return true;
98
 
99
    return false;
100
}
101
 
102
void cyg_hal_user_break( CYG_ADDRWORD *regs )
103
{
104
 
105
#if defined(CYGSEM_HAL_USE_ROM_MONITOR_GDB_stubs)
106
 
107
        {
108
            extern CYG_ADDRESS hal_virtual_vector_table[64];
109
            typedef void install_bpt_fn(void *pc);
110
            CYG_WORD32 retpc = ((CYG_WORD32 *)(&regs))[-1];
111
            CYG_WORD32 pc;
112
            HAL_SavedRegisters *sreg = (HAL_SavedRegisters *)regs;
113
            install_bpt_fn *ibp = (install_bpt_fn *)hal_virtual_vector_table[35];
114
 
115
            if( regs == NULL ) pc = retpc;
116
            else pc = sreg->pc;
117
 
118
            if( ibp != NULL ) ibp((void *)pc);
119
        }
120
 
121
#elif defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS)
122
 
123
    {
124
        extern void breakpoint(void);
125
        breakpoint();
126
    }
127
 
128
#else
129
 
130
    HAL_BREAKPOINT(breakinst);
131
 
132
#endif
133
}
134
 
135
/*------------------------------------------------------------------------*/
136
/* Control C ISR support                                                  */
137
 
138
#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT)
139
 
140
struct Hal_SavedRegisters *hal_saved_interrupt_state;
141
 
142
static void hal_ctrlc_isr_init(void)
143
{
144
}
145
 
146
cyg_uint32 hal_ctrlc_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data)
147
{
148
 
149
//    char c;
150
 
151
    HAL_INTERRUPT_ACKNOWLEDGE( CYGHWR_HAL_GDB_PORT_VECTOR );
152
 
153
    return 2;
154
}
155
 
156
#endif
157
 
158
/*------------------------------------------------------------------------*/
159
/* End of plf_misc.c                                                      */

powered by: WebSVN 2.1.0

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