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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//=============================================================================
2
//
3
//      plf_stub.c
4
//
5
//      Platform specific code for GDB stub support.
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):   dmoseley (based on the old mn10300 hal_stub.c)
44
// Contributors:dmoseley
45
// Date:        2000-08-11
46
// Purpose:     Platform specific code for GDB stub support.
47
//              
48
//####DESCRIPTIONEND####
49
//
50
//=============================================================================
51
 
52
#include <pkgconf/hal.h>
53
 
54
#include <cyg/hal/hal_io.h>             // HAL IO macros
55
 
56
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
57
 
58
#include <cyg/hal/hal_stub.h>
59
 
60
#include <cyg/hal/hal_intr.h>           // HAL interrupt macros
61
 
62
//---------------------------------------------------------------------------
63
 
64
#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
65
 
66
#define ASB2303_SER0_BASE      0xD4002000
67
#define _SERIAL_RXR      0x09
68
#define SERIAL0_RXR      ((volatile cyg_uint8 *) (ASB2303_SER0_BASE + _SERIAL_RXR))
69
 
70
// This ISR is called from the interrupt handler. This should only
71
// happen when there is no serial driver, so the code shouldn't mess
72
// anything up.
73
int cyg_hal_gdb_isr(cyg_uint32 vector, target_register_t pc)
74
{
75
    if ( CYGNUM_HAL_INTERRUPT_SERIAL_0_RX == vector ) {
76
        cyg_uint8 c;
77
 
78
        HAL_READ_UINT8 (SERIAL0_RXR, c);
79
        HAL_INTERRUPT_ACKNOWLEDGE (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX);
80
 
81
        if( 3 == c )
82
        {
83
            // Ctrl-C: set a breakpoint at PC so GDB will display the
84
            // correct program context when stopping rather than the
85
            // interrupt handler.
86
            cyg_hal_gdb_interrupt (pc);
87
 
88
            // Interrupt handled. Don't call ISR proper. At return
89
            // from the VSR, execution will stop at the breakpoint
90
            // just set.
91
            return 0;
92
        }
93
    }
94
 
95
    // Not caused by GDB. Call ISR proper.
96
    return 1;
97
}
98
 
99
#ifndef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT
100
int hal_asb_interruptible(int state)
101
{
102
    if (state) {
103
        HAL_WRITE_UINT8 (SERIAL0_ICR, 0);
104
        HAL_INTERRUPT_ACKNOWLEDGE (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX)
105
        HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX)
106
    } else {
107
        HAL_INTERRUPT_MASK (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX)
108
    }
109
    return 0;
110
}
111
 
112
void hal_asb_init_break_irq( void )
113
{
114
    // Enable serial receive interrupts.
115
    HAL_WRITE_UINT8 (SERIAL0_ICR, 0);
116
    HAL_INTERRUPT_ACKNOWLEDGE (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX)
117
    HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SERIAL_0_RX)
118
    HAL_ENABLE_INTERRUPTS();
119
}
120
#endif
121
#endif
122
 
123
//-----------------------------------------------------------------------------
124
 
125
void hal_asb_platform_init(void)
126
{
127
    extern CYG_ADDRESS hal_virtual_vector_table[64];
128
    extern void init_thread_syscall( void *);
129
    extern void install_async_breakpoint(void *epc);
130
//    void (*oldvsr)(void);
131
    extern void _default_trap_vsr(void);
132
 
133
    // Ensure that the breakpoint VSR points to the default VSR. This will pass
134
    // it on to the stubs.
135
//    HAL_VSR_SET( CYGNUM_HAL_VECTOR_BREAKPOINT, _default_trap_vsr, &oldvsr );
136
 
137
    // Install async breakpoint handler into vector table.
138
    hal_virtual_vector_table[35] = (CYG_ADDRESS)install_async_breakpoint;
139
 
140
#if !defined(CYGPKG_KERNEL) && defined(CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT)
141
    // Only include this code if we do not have a kernel. Otherwise
142
    // the kernel supplies the functionality for the app we are linked
143
    // with.
144
 
145
    // Prepare for application installation of thread info function in
146
    // vector table.
147
    hal_virtual_vector_table[15] = 0;
148
    init_thread_syscall( (void *)&hal_virtual_vector_table[15] );
149
 
150
#endif
151
}
152
#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
153
 
154
/*------------------------------------------------------------------------*/
155
/* Reset support                                                          */
156
 
157
#define RSTCTR        0xc0001004
158
#define CHIPRST       0x01
159
void hal_asb_reset(void)
160
{
161
    // Unfortunately this only resets the MN103E010
162
    // A full board reset is not done.  ie If the boot block select switched,
163
    // and a Cygmon reset called the switch change will not occur.  AFAICT
164
    // the only way to notice that change is to use the Reset switch on the
165
    // board.
166
    HAL_WRITE_UINT8(RSTCTR, 0x00);
167
    HAL_WRITE_UINT8(RSTCTR, CHIPRST);
168
 
169
    // Just in case.
170
    while (1) ;
171
}
172
 
173
 
174
//-----------------------------------------------------------------------------
175
// End of plf_stub.c

powered by: WebSVN 2.1.0

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