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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [cygmon/] [current/] [misc/] [bsp/] [common/] [bsp_if.c] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      bsp_if.c
4
//
5
//      Miscellaneous BSP Interfaces.
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 Free Software Foundation, 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      
16
// version.                                                                 
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT      
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
21
// for more details.                                                        
22
//
23
// You should have received a copy of the GNU General Public License        
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
26
//
27
// As a special exception, if other files instantiate templates or use      
28
// macros or inline functions from this file, or you compile this file      
29
// and link it with other works to produce a work based on this file,       
30
// this file does not by itself cause the resulting work to be covered by   
31
// the GNU General Public License. However the source code for this file    
32
// must still be made available in accordance with section (3) of the GNU   
33
// General Public License v2.                                               
34
//
35
// This exception does not invalidate any other reasons why a work based    
36
// on this file might be covered by the GNU General Public License.         
37
// -------------------------------------------                              
38
// ####ECOSGPLCOPYRIGHTEND####                                              
39
//==========================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// Author(s):    
43
// Contributors: gthomas
44
// Date:         1999-10-20
45
// Purpose:      Miscellaneous BSP Interfaces.
46
// Description:  
47
//               
48
//
49
//####DESCRIPTIONEND####
50
//
51
//=========================================================================
52
 
53
 
54
#include <bsp/bsp.h>
55
#include "bsp_if.h"
56
 
57
/*
58
 * Install a debug handler.
59
 * Returns old handler being replaced.
60
 */
61
bsp_handler_t
62
bsp_install_dbg_handler(bsp_handler_t new_handler)
63
{
64
    bsp_handler_t old_handler;
65
 
66
    old_handler = *bsp_shared_data->__dbg_vector;
67
    *bsp_shared_data->__dbg_vector = new_handler;
68
 
69
    return old_handler;
70
}
71
 
72
/*
73
 * Sometimes it is desireable to call the debug handler directly. This routine
74
 * accomplishes that. It is the responsibility of the caller to insure that
75
 * interrupts are disabled before calling this routine.
76
 */
77
void
78
bsp_invoke_dbg_handler(int exc_nr, void *regs)
79
{
80
    (*bsp_shared_data->__dbg_vector)(exc_nr, regs);
81
}
82
 
83
/*
84
 * Install a 'kill' handler.
85
 * Returns old handler being replaced.
86
 */
87
bsp_handler_t
88
bsp_install_kill_handler(bsp_handler_t new_handler)
89
{
90
    bsp_handler_t old_handler;
91
 
92
    old_handler = bsp_shared_data->__kill_vector;
93
    bsp_shared_data->__kill_vector = new_handler;
94
 
95
    return old_handler;
96
}
97
 
98
 
99
void *
100
bsp_cpu_data(void)
101
{
102
  return bsp_shared_data->__cpu_data;
103
}
104
 
105
 
106
void *
107
bsp_board_data(void)
108
{
109
    return bsp_shared_data->__board_data;
110
}
111
 
112
 
113
int
114
bsp_sysinfo(enum bsp_info_id id, ...)
115
{
116
    int     retval;
117
    va_list ap;
118
 
119
    va_start (ap, id);
120
    retval = bsp_shared_data->__sysinfo(id, ap);
121
    va_end(ap);
122
    return retval;
123
}
124
 
125
int
126
bsp_set_debug_comm(int id)
127
{
128
    return bsp_shared_data->__set_debug_comm(id);
129
}
130
 
131
int
132
bsp_set_console_comm(int id)
133
{
134
    return bsp_shared_data->__set_console_comm(id);
135
}
136
 
137
int
138
bsp_set_serial_baud(int id, int baud)
139
{
140
    return bsp_shared_data->__set_serial_baud(id, baud);
141
}
142
 
143
 
144
#if !defined(NDEBUG)
145
 
146
void _bsp_assert(const char *file, const int line, const char *condition)
147
{
148
    bsp_printf("Assertion \"%s\" failed\n", condition);
149
    bsp_printf("File \"%s\"\n", file);
150
    bsp_printf("Line %d\n", line);
151
#if defined(PORT_TOGGLE_DEBUG)
152
    PORT_TOGGLE_DEBUG();
153
#else
154
    while(1) ;
155
#endif /* defined(PORT_TOGGLE_DEBUG) */
156
}
157
 
158
#endif /* !defined(NDEBUG) */
159
 

powered by: WebSVN 2.1.0

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