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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [language/] [c/] [libc/] [startup/] [current/] [src/] [cstartup.cxx] - Blame information for rev 865

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

Line No. Rev Author Line
1 786 skrzyp
//=======================================================================
2
//
3
//      cstartup.cxx
4
//
5
//      Support for startup of ISO C environment
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):     jlarmour
43
// Contributors:  
44
// Date:          2000-04-30
45
// Purpose:     
46
// Description: 
47
// Usage:       
48
//
49
//####DESCRIPTIONEND####
50
//
51
//========================================================================
52
 
53
// CONFIGURATION
54
 
55
#include <pkgconf/system.h>         // CYGPKG_KERNEL
56
#include <pkgconf/libc_startup.h>   // Configuration header
57
 
58
// INCLUDES
59
 
60
#include <cyg/infra/cyg_type.h>     // Common type definitions and support
61
#include <cyg/infra/cyg_trac.h>     // Common tracing support
62
 
63
#ifdef CYGPKG_KERNEL
64
# include <pkgconf/kernel.h>        // eCos kernel configuration
65
# include <cyg/kernel/thread.hxx>   // eCos thread support
66
# include <cyg/kernel/thread.inl>
67
#endif
68
 
69
 
70
// FUNCTION PROTOTYPES
71
 
72
externC void
73
cyg_libc_invoke_main( CYG_ADDRWORD );
74
 
75
// EXTERNS
76
 
77
#ifdef CYGSEM_LIBC_STARTUP_MAIN_THREAD
78
extern Cyg_Thread cyg_libc_main_thread;
79
 
80
// FUNCTIONS
81
 
82
externC void
83
cyg_iso_c_start( void )
84
{
85
    static int initialized=0;
86
 
87
    CYG_REPORT_FUNCNAME( "cyg_iso_c_start" );
88
    CYG_REPORT_FUNCARGVOID();
89
 
90
    if (initialized++ == 0) {
91
        CYG_TRACE0( true, "Resuming cyg_libc_main_thread" );
92
        cyg_libc_main_thread.resume();
93
    }
94
    CYG_REPORT_RETURN();
95
 
96
} // cyg_iso_c_start()
97
 
98
// define an object that will automatically call cyg_iso_c_start()
99
 
100
class cyg_libc_startup_dummy_constructor_class {
101
public:
102
    cyg_libc_startup_dummy_constructor_class() { cyg_iso_c_start(); }
103
};
104
 
105
static cyg_libc_startup_dummy_constructor_class cyg_libc_startup_obj
106
                                  CYGBLD_ATTRIB_INIT_AFTER(CYG_INIT_LIBC);
107
 
108
#elif defined( CYGSEM_LIBC_STARTUP_MAIN_INITCONTEXT )
109
 
110
// otherwise replace the default cyg_user_start(), but of course keep
111
// it a weak symbol in case the user wants to override
112
 
113
externC void
114
cyg_user_start(void) CYGBLD_ATTRIB_WEAK;
115
 
116
externC void
117
cyg_user_start(void)
118
{
119
    cyg_libc_invoke_main(0);
120
}
121
 
122
externC void
123
cyg_iso_c_start( void )
124
{
125
    static int initialized=0;
126
 
127
    CYG_REPORT_FUNCNAME( "cyg_iso_c_start" );
128
    CYG_REPORT_FUNCARGVOID();
129
 
130
    // In case they want to explicitly invoke the C library from
131
    // cyg_user_start() themselves
132
    if (initialized++ == 0) {
133
        cyg_libc_invoke_main(0);
134
    }
135
    CYG_REPORT_RETURN();
136
}
137
#else
138
 
139
externC void
140
cyg_iso_c_start( void ) {}
141
 
142
#endif
143
 
144
// EOF cstartup.cxx

powered by: WebSVN 2.1.0

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