URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/rtos/ecos-2.0/packages/infra/v2_0
- from Rev 27 to Rev 174
- ↔ Reverse comparison
Rev 27 → Rev 174
/cdl/infra.cdl
0,0 → 1,312
# ==================================================================== |
# |
# infra.cdl |
# |
# Infrastructure configuration data |
# |
# ==================================================================== |
#####ECOSGPLCOPYRIGHTBEGIN#### |
## ------------------------------------------- |
## This file is part of eCos, the Embedded Configurable Operating System. |
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
## |
## eCos is free software; you can redistribute it and/or modify it under |
## the terms of the GNU General Public License as published by the Free |
## Software Foundation; either version 2 or (at your option) any later version. |
## |
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
## WARRANTY; without even the implied warranty of MERCHANTABILITY or |
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
## for more details. |
## |
## You should have received a copy of the GNU General Public License along |
## with eCos; if not, write to the Free Software Foundation, Inc., |
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
## |
## As a special exception, if other files instantiate templates or use macros |
## or inline functions from this file, or you compile this file and link it |
## with other works to produce a work based on this file, this file does not |
## by itself cause the resulting work to be covered by the GNU General Public |
## License. However the source code for this file must still be made available |
## in accordance with section (3) of the GNU General Public License. |
## |
## This exception does not invalidate any other reasons why a work based on |
## this file might be covered by the GNU General Public License. |
## |
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
## at http://sources.redhat.com/ecos/ecos-license/ |
## ------------------------------------------- |
#####ECOSGPLCOPYRIGHTEND#### |
# ==================================================================== |
######DESCRIPTIONBEGIN#### |
# |
# Author(s): bartv |
# Original data: bartv,hmt |
# Contributors: |
# Date: 1999-06-13 |
# |
#####DESCRIPTIONEND#### |
# |
# ==================================================================== |
|
cdl_package CYGPKG_INFRA { |
display "Infrastructure" |
include_dir cyg/infra |
description " |
Common types and useful macros. |
Tracing and assertion facilities. |
Package startup options." |
|
compile startup.cxx prestart.cxx pkgstart.cxx userstart.cxx \ |
dummyxxmain.cxx null.cxx simple.cxx fancy.cxx buffer.cxx \ |
diag.cxx tcdiag.cxx memcpy.c memset.c delete.cxx eprintf.c \ |
pure.cxx |
|
|
# ==================================================================== |
# cdl_component CYGPKG_INFRA_TYPES { |
# display "Common Types" |
# flavor none |
# active_if 0 ;# Not yet configurable. |
# description " |
# These types are used throughout the eCos source code. |
# Currently there are no configuration options associated |
# with the Common Types component; they are automatically |
# set up according to the selected HAL." |
# } |
|
# ==================================================================== |
cdl_component CYGPKG_INFRA_DEBUG { |
display "Asserts & Tracing" |
default_value 0 |
description " |
The eCos source code contains a significant amount of |
internal debugging support, in the form of assertions and |
tracing. |
Assertions check at runtime that various conditions are as |
expected; if not, execution is halted. |
Tracing takes the form of text messages that are output |
whenever certain events occur, or whenever functions are |
called or return. |
The most important property of these checks and messages is |
that they are not required for the program to run. |
It is prudent to develop software with assertions enabled, |
but disable them when making a product release, thus |
removing the overhead of that checking. |
It is possible to enable assertions and tracing |
independently. |
There are also options controlling the exact behaviour of |
the assertion and tracing facilities, thus giving users |
finer control over the code and data size requirements." |
|
script debug.cdl |
} |
|
# ==================================================================== |
cdl_component CYGPKG_INFRA_STARTUP { |
display "Startup options" |
flavor none |
description " |
Some packages require a startup routine to be called. |
This can be carried out by application code, by supplying |
a routine called cyg_package_start() which calls the |
appropriate package startup routine(s). |
Alternatively, this routine can be constructed automatically |
and configured to call the startup routines of your choice." |
|
script startup.cdl |
} |
|
# ======================================================================== |
# memcpy()/memset() configuration |
cdl_option CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMCPY { |
display "Smaller slower memcpy()" |
default_value 0 |
description " |
Enabling this option causes the implementation of |
the standard memcpy() routine to reduce code |
size at the expense of execution speed. This |
option is automatically enabled with the use of |
the -Os option to the compiler. Also note that |
the compiler will try to use its own builtin |
version of memcpy() if possible, ignoring the |
implementation in this package, unless given |
the -fno-builtin compiler option." |
} |
|
cdl_option CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMSET { |
display "Smaller slower memset()" |
default_value 0 |
description " |
Enabling this option causes the implementation of |
the standard memset() routine to reduce code |
size at the expense of execution speed. This |
option is automatically enabled with the use of |
the -Os option to the compiler. Also note that |
the compiler will try to use its own builtin |
version of memset() if possible, ignoring the |
implementation in this package, unless given |
the -fno-builtin compiler option." |
} |
|
# ======================================================================== |
|
cdl_option CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS { |
display "Provide empty C++ delete functions" |
default_value 1 |
description " |
To deal with virtual destructors, where the correct delete() |
function must be called for the derived class in question, the |
underlying delete is called when needed, from destructors. This |
is regardless of whether the destructor is called by delete itself. |
So there is a reference to delete() from all destructors. The |
default builtin delete() attempts to call free() if there is |
one defined. So, if you have destructors, and you have free(), |
as in malloc() and free(), any destructor counts as a reference |
to free(). So the dynamic memory allocation code is linked |
in regardless of whether it gets explicitly called. This |
increases code and data size needlessly. |
|
To defeat this undesirable behaviour, we define empty versions |
of delete and delete[]. But doing this prevents proper use |
of dynamic memory in C++ programs via C++'s new and delete |
operators. |
|
Therefore, this option is provided |
for explicitly disabling the provision of these empty functions, |
so that new and delete can be used, if that is what is required." |
} |
|
# ======================================================================== |
|
cdl_option CYGFUN_INFRA_DUMMY_ABORT { |
display "Provide dummy abort() function" |
requires !CYGINT_ISO_EXIT |
default_value { CYGINT_ISO_EXIT == 0 } |
compile abort.cxx |
description " |
This option controls the inclusion of a dummy abort() function. |
Parts of the C and C++ compiler runtime systems contain references |
to abort(), particulary in the C++ exception handling code. It is |
not possible to eliminate these references, so this dummy function |
in included to satisfy them. It is not expected that this function |
will ever be called, so its current behaviour is to simply loop." |
} |
|
# ======================================================================== |
|
cdl_option CYGFUN_INFRA_DUMMY_STRLEN { |
display "Provide dummy strlen() function" |
requires !CYGINT_ISO_STRING_STRFUNCS |
default_value { CYGINT_ISO_STRING_STRFUNCS == 0 } |
compile strlen.cxx |
description " |
This option controls the inclusion of a dummy strlen() function. |
Parts of the C and C++ compiler runtime systems contain references |
to strlen(), particulary in the C++ exception handling code. It is |
not possible to eliminate these references, so this dummy function |
in included to satisfy them. While it is not expected that this function |
will ever be called, it is functional but uses the simplest, smallest |
algorithm. There is a faster version of strlen() in the C library." |
} |
|
# ======================================================================== |
# Debugging-related miscellania. |
|
define_proc { |
puts $::cdl_header "/***** proc output start *****/" |
puts $::cdl_header "#include <pkgconf/system.h>" |
puts $::cdl_header "/***** proc output end *****/" |
} |
|
|
# ======================================================================== |
# Global compiler option controls |
|
cdl_option CYGBLD_INFRA_CFLAGS_WARNINGS_AS_ERRORS { |
display "Make all compiler warnings show as errors" |
requires { is_substr(CYGBLD_GLOBAL_CFLAGS, " -Werror") } |
default_value 0 |
description " |
Enabling this option will cause all compiler warnings to show |
as errors and bring the library build to a halt. This is used |
to ensure that the code base is warning free, and thus ensure |
that newly introduced warnings stand out and get fixed before |
they show up as weird run-time behavior." |
} |
|
cdl_option CYGBLD_INFRA_CFLAGS_PIPE { |
display "Make compiler and assembler communicate by pipe" |
requires { is_substr(CYGBLD_GLOBAL_CFLAGS, " -pipe") } |
default_value 0 |
description " |
Enabling this option will cause the compiler to feed the |
assembly output the the assembler via a pipe instead of |
via a temporary file. This normally reduces the build |
time." |
} |
|
# ======================================================================== |
# Package compiler options |
|
cdl_component CYGPKG_INFRA_OPTIONS { |
display "Infra build options" |
flavor none |
description " |
Package specific build options including control over |
compiler flags used only in building this package." |
|
|
cdl_option CYGPKG_INFRA_CFLAGS_ADD { |
display "Additional compiler flags" |
flavor data |
no_define |
default_value { "" } |
description " |
This option modifies the set of compiler flags for |
building the eCos infra package. These flags are used |
in addition to the set of global flags." |
} |
|
cdl_option CYGPKG_INFRA_CFLAGS_REMOVE { |
display "Suppressed compiler flags" |
flavor data |
no_define |
default_value { "" } |
description " |
This option modifies the set of compiler flags for |
building the eCos infra package. These flags are removed from |
the set of global flags if present." |
} |
|
cdl_option CYGPKG_INFRA_LDFLAGS_REMOVE { |
display "Suppressed linker flags" |
flavor data |
no_define |
default_value { "-Wl,--gc-sections" } |
description " |
This option modifies the set of linker flags for |
building the eCos infra package tests. These flags are removed from |
the set of global flags if present." |
} |
|
cdl_option CYGPKG_INFRA_LDFLAGS_ADD { |
display "Additional linker flags" |
flavor data |
no_define |
default_value { "-Wl,--fatal-warnings" } |
description " |
This option modifies the set of linker flags for |
building the eCos infra package tests. These flags are added to |
the set of global flags if present." |
} |
|
cdl_option CYGPKG_INFRA_TESTS { |
display "Infra package tests" |
flavor data |
no_define |
calculated { "" } |
} |
|
} |
} |
/cdl/assert.cdl
0,0 → 1,120
# ==================================================================== |
# |
# assert.cdl |
# |
# Infrastructure debugging/assertion configuration data |
# |
# ==================================================================== |
#####ECOSGPLCOPYRIGHTBEGIN#### |
## ------------------------------------------- |
## This file is part of eCos, the Embedded Configurable Operating System. |
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
## |
## eCos is free software; you can redistribute it and/or modify it under |
## the terms of the GNU General Public License as published by the Free |
## Software Foundation; either version 2 or (at your option) any later version. |
## |
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
## WARRANTY; without even the implied warranty of MERCHANTABILITY or |
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
## for more details. |
## |
## You should have received a copy of the GNU General Public License along |
## with eCos; if not, write to the Free Software Foundation, Inc., |
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
## |
## As a special exception, if other files instantiate templates or use macros |
## or inline functions from this file, or you compile this file and link it |
## with other works to produce a work based on this file, this file does not |
## by itself cause the resulting work to be covered by the GNU General Public |
## License. However the source code for this file must still be made available |
## in accordance with section (3) of the GNU General Public License. |
## |
## This exception does not invalidate any other reasons why a work based on |
## this file might be covered by the GNU General Public License. |
## |
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
## at http://sources.redhat.com/ecos/ecos-license/ |
## ------------------------------------------- |
#####ECOSGPLCOPYRIGHTEND#### |
# ==================================================================== |
######DESCRIPTIONBEGIN#### |
# |
# Author(s): jskov |
# Original data: bartv,hmt |
# Contributors: |
# Date: 1999-07-02 |
# |
#####DESCRIPTIONEND#### |
# |
# ==================================================================== |
|
# The eCos system uses a number of more specialised assertions in |
# addition to a conventional ASSERT() macro. By default these are all |
# enabled when general assertions are enabled, but it is possible to |
# suppress some of them and thus reduce the size of the generated code. |
# |
# Preconditions check that a condition holds true at the beginning of |
# a piece of code, typically at the start of a function. For example a |
# kernel function might have a precondition that it is only invoked |
# when the scheduler is locked. |
# |
# Postconditions check that a condition holds at the end of a piece of |
# code, typically at the point where a function returns. For example |
# at the end of scheduler initialisation there could be a |
# postcondition that there is at least one runnable thread, the idle |
# thread. |
# |
# Loop invariants check that a condition holds on every iteration of |
# a loop. For example the deferred service support code in the kernel |
# could have a loop invariant that interrupts are enabled whenever |
# there are still DSR's pending. |
|
cdl_option CYGDBG_INFRA_DEBUG_PRECONDITIONS { |
display "Preconditions" |
default_value 1 |
description " |
This option allows individual control of preconditions. |
A precondition is one type of assert, which it is |
useful to control separately from more general asserts. |
The function is CYG_PRECONDITION(condition,msg)." |
} |
cdl_option CYGDBG_INFRA_DEBUG_POSTCONDITIONS { |
display "Postconditions" |
default_value 1 |
description " |
This option allows individual control of postconditions. |
A postcondition is one type of assert, which it is |
useful to control separately from more general asserts. |
The function is CYG_POSTCONDITION(condition,msg)." |
} |
cdl_option CYGDBG_INFRA_DEBUG_LOOP_INVARIANTS { |
display "Loop invariants" |
default_value 1 |
description " |
This option allows individual control of loop invariants. |
A loop invariant is one type of assert, which it is |
useful to control separately from more general asserts, |
particularly since a loop invariant is typically evaluated |
a great many times when used correctly. |
The function is CYG_LOOP_INVARIANT(condition,msg)." |
} |
|
cdl_option CYGDBG_INFRA_DEBUG_ASSERT_MESSAGE { |
display "Use assert text" |
default_value 1 |
description " |
All assertions within eCos contain a text message |
which should give some information about the condition |
being tested. |
These text messages will end up being embedded in the |
application image and hence there is a significant penalty |
in terms of image size. |
It is possible to suppress the use of these messages by |
disabling this option. |
This results in smaller code size, but there is less |
human-readable information if an assertion actually gets |
triggered." |
} |
|
# EOF assert.cdl |
/cdl/startup.cdl
0,0 → 1,82
# ==================================================================== |
# |
# startup.cdl |
# |
# Infrastructure startup configuration data |
# |
# ==================================================================== |
#####ECOSGPLCOPYRIGHTBEGIN#### |
## ------------------------------------------- |
## This file is part of eCos, the Embedded Configurable Operating System. |
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
## |
## eCos is free software; you can redistribute it and/or modify it under |
## the terms of the GNU General Public License as published by the Free |
## Software Foundation; either version 2 or (at your option) any later version. |
## |
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
## WARRANTY; without even the implied warranty of MERCHANTABILITY or |
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
## for more details. |
## |
## You should have received a copy of the GNU General Public License along |
## with eCos; if not, write to the Free Software Foundation, Inc., |
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
## |
## As a special exception, if other files instantiate templates or use macros |
## or inline functions from this file, or you compile this file and link it |
## with other works to produce a work based on this file, this file does not |
## by itself cause the resulting work to be covered by the GNU General Public |
## License. However the source code for this file must still be made available |
## in accordance with section (3) of the GNU General Public License. |
## |
## This exception does not invalidate any other reasons why a work based on |
## this file might be covered by the GNU General Public License. |
## |
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
## at http://sources.redhat.com/ecos/ecos-license/ |
## ------------------------------------------- |
#####ECOSGPLCOPYRIGHTEND#### |
# ==================================================================== |
######DESCRIPTIONBEGIN#### |
# |
# Author(s): bartv |
# Original data: bartv,hmt |
# Contributors: |
# Date: 1999-06-13 |
# |
#####DESCRIPTIONEND#### |
# |
# ==================================================================== |
|
# ================================================================= |
# The following options allow particular compatibility modes to be |
# enabled, when they require specialised support from the startup |
# process. These can affect the environment in which the program |
# runs. |
# |
# CYGSEM_START_UITRON_COMPATIBILITY enables compatibility with uItron. |
# You must configure uItron with the correct tasks, and then enabling this |
# option starts the uItron subsystem. It does this by invoking the function |
# cyg_uitron_start(). |
# |
# Both these can also be done by the user overriding cyg_user_start(), |
# cyg_package_start(), or cyg_prestart(). Refer to the documentation on |
# how and when to do this. |
|
cdl_option CYGSEM_START_UITRON_COMPATIBILITY { |
display "Start uITRON subsystem" |
default_value 0 |
requires CYGPKG_UITRON |
active_if CYGPKG_UITRON |
description " |
Generate a call to initialize the |
uITRON compatibility subsystem |
within the system version of cyg_package_start(). |
This enables compatibility with uITRON. |
You must configure uITRON with the correct tasks before |
starting the uItron subsystem. |
If this is disabled, and you want to use uITRON, |
you must call cyg_uitron_start() from your own |
cyg_package_start() or cyg_userstart()." |
} |
/cdl/debug.cdl
0,0 → 1,235
# ==================================================================== |
# |
# debug.cdl |
# |
# Infrastructure debugging configuration data |
# |
# ==================================================================== |
#####ECOSGPLCOPYRIGHTBEGIN#### |
## ------------------------------------------- |
## This file is part of eCos, the Embedded Configurable Operating System. |
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
## |
## eCos is free software; you can redistribute it and/or modify it under |
## the terms of the GNU General Public License as published by the Free |
## Software Foundation; either version 2 or (at your option) any later version. |
## |
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
## WARRANTY; without even the implied warranty of MERCHANTABILITY or |
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
## for more details. |
## |
## You should have received a copy of the GNU General Public License along |
## with eCos; if not, write to the Free Software Foundation, Inc., |
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
## |
## As a special exception, if other files instantiate templates or use macros |
## or inline functions from this file, or you compile this file and link it |
## with other works to produce a work based on this file, this file does not |
## by itself cause the resulting work to be covered by the GNU General Public |
## License. However the source code for this file must still be made available |
## in accordance with section (3) of the GNU General Public License. |
## |
## This exception does not invalidate any other reasons why a work based on |
## this file might be covered by the GNU General Public License. |
## |
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
## at http://sources.redhat.com/ecos/ecos-license/ |
## ------------------------------------------- |
#####ECOSGPLCOPYRIGHTEND#### |
# ==================================================================== |
######DESCRIPTIONBEGIN#### |
# |
# Author(s): jskov |
# Original data: bartv,hmt |
# Contributors: |
# Date: 1999-07-02 |
# |
#####DESCRIPTIONEND#### |
# |
# ==================================================================== |
|
# If global debugging is enabled then by default all assertions |
# are enabled. Tracing is not enabled by default because it |
# involves excessive overheads, for example on some targets |
# it requires sending a string down a serial line for every |
# function call. Both assertions and tracing are controlled |
# by the following lines. |
|
cdl_component CYGDBG_USE_ASSERTS { |
display "Use asserts" |
default_value 1 |
requires { 1 == CYGINT_INFRA_DEBUG_TRACE_IMPL } |
description " |
If this option is defined, asserts in the code are tested. |
Assert functions (CYG_ASSERT()) are defined in |
'include/cyg/infra/cyg_ass.h' within the 'install' tree. |
If it is not defined, these result in no additional |
object code and no checking of the asserted conditions." |
|
script assert.cdl |
} |
|
cdl_component CYGDBG_USE_TRACING { |
display "Use tracing" |
default_value 0 |
requires { 1 == CYGINT_INFRA_DEBUG_TRACE_IMPL } |
description " |
If this option is defined, tracing operations |
result in output or logging, depending on other options. |
This may have adverse effects on performance, if the time |
taken to output message overwhelms the available CPU |
power or output bandwidth. |
Trace functions (CYG_TRACE()) are defined in |
'include/cyg/infra/cyg_trac.h' within the 'install' tree. |
If it is not defined, these result in no additional |
object code and no trace information." |
|
|
# The eCos system uses two types of tracing mechanisms. The most common |
# type traces events, for example an event could be logged whenever |
# an interrupt occurs or whenever a context switch takes place. The |
# second type of tracing mechanism records every function entry and |
# exit. It is possible to disable this second type of tracing while |
# leaving the main tracing facility enabled. |
cdl_option CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS { |
display "Trace function reports" |
default_value 1 |
description " |
This option allows individual control of |
function entry/exit tracing, independent of |
more general tracing output. |
This may be useful to remove clutter from a |
trace log." |
} |
|
cdl_option CYGDBG_INFRA_DEBUG_TRACE_MESSAGE { |
display "Use trace text" |
default_value 1 |
description " |
All trace calls within eCos contain a text message |
which should give some information about the circumstances. |
These text messages will end up being embedded in the |
application image and hence there is a significant penalty |
in terms of image size. |
It is possible to suppress the use of these messages by |
disabling this option. |
This results in smaller code size, but there is less |
human-readable information available in the trace output, |
possibly only filenames and line numbers." |
} |
} |
|
cdl_interface CYGINT_INFRA_DEBUG_TRACE_IMPL { |
display "Trace output implementations" |
} |
|
cdl_option CYGDBG_INFRA_DEBUG_TRACE_ASSERT_NULL { |
display "Null output" |
default_value 0 |
implements CYGINT_INFRA_DEBUG_TRACE_IMPL |
description " |
A null output module which is useful when |
debugging interactively; the output routines |
can be breakpointed rather than have them actually |
'print' something." |
} |
cdl_option CYGDBG_INFRA_DEBUG_TRACE_ASSERT_SIMPLE { |
display "Simple output" |
default_value 0 |
implements CYGINT_INFRA_DEBUG_TRACE_IMPL |
description " |
An output module which produces simple output |
from tracing and assertion events." |
} |
cdl_option CYGDBG_INFRA_DEBUG_TRACE_ASSERT_FANCY { |
display "Fancy output" |
default_value 0 |
implements CYGINT_INFRA_DEBUG_TRACE_IMPL |
description " |
An output module which produces fancy output |
from tracing and assertion events." |
} |
cdl_component CYGDBG_INFRA_DEBUG_TRACE_ASSERT_BUFFER { |
display "Buffered tracing" |
default_value 1 |
implements CYGINT_INFRA_DEBUG_TRACE_IMPL |
description " |
An output module which buffers output |
from tracing and assertion events. The stored |
messages are output when an assert fires, or |
CYG_TRACE_PRINT() (defined in <cyg/infra/cyg_trac.h>) |
is called. |
Of course, there will only be stored messages |
if tracing per se (CYGDBG_USE_TRACING) |
is enabled above." |
|
cdl_option CYGDBG_INFRA_DEBUG_TRACE_BUFFER_SIZE { |
display "Trace buffer size" |
flavor data |
active_if CYGDBG_USE_TRACING |
default_value 32 |
legal_values 5 to 65535 |
description " |
The size of the trace buffer. This counts the number |
of trace records stored. When the buffer fills it |
either wraps, stops recording, or generates output." |
} |
# FIXME: The below options should be mutually exclusive. |
cdl_option CYGDBG_INFRA_DEBUG_TRACE_BUFFER_WRAP { |
display "Wrap trace buffer when full" |
active_if CYGDBG_USE_TRACING |
default_value 1 |
# type radio |
description " |
When the trace buffer has filled with records it |
starts again at the beginning. Hence only the last |
CYGDBG_INFRA_DEBUG_TRACE_BUFFER_SIZE messages will |
be recorded." |
} |
cdl_option CYGDBG_INFRA_DEBUG_TRACE_BUFFER_HALT { |
display "Halt trace buffer when full" |
active_if CYGDBG_USE_TRACING |
default_value 0 |
# type radio |
description " |
When the trace buffer has filled with records it |
stops recording. Hence only the first |
CYGDBG_INFRA_DEBUG_TRACE_BUFFER_SIZE messages will |
be recorded." |
} |
cdl_option CYGDBG_INFRA_DEBUG_TRACE_BUFFER_PRINT { |
display "Print trace buffer when full" |
active_if CYGDBG_USE_TRACING |
default_value 0 |
# type radio |
description " |
When the trace buffer has filled with records it |
prints the contents of the buffer. The buffer is then |
emptied and the system continues." |
} |
cdl_option CYGDBG_INFRA_DEBUG_TRACE_BUFFER_PRINT_ON_ASSERT { |
display "Print trace buffer on assert fail" |
active_if CYGDBG_USE_TRACING |
default_value 1 |
description " |
When an assertion fails the trace buffer will be |
printed to the default diagnostic device." |
} |
} |
|
cdl_option CYGDBG_INFRA_DEBUG_FUNCTION_PSEUDOMACRO { |
display "Use function names" |
default_value 1 |
description " |
All trace and assert calls within eCos contain a |
reference to the builtin macro '__PRETTY_FUNCTION__', |
which evaluates to a string containing |
the name of the current function. |
This is useful when reading a trace log. |
It is possible to suppress the use of the function name |
by disabling this option. |
This results in smaller code size, but there is less |
human-readable information available in the trace output, |
possibly only filenames and line numbers." |
} |
/tests/cxxsupp.cxx
0,0 → 1,175
//========================================================================== |
// |
// cxxsupp.cxx |
// |
// C++ runtime support test |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 2003 Nick Garnett <nickg@calivar.com> |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting the copyright |
// holders. |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg |
// Contributors: nickg |
// Date: 2003-04-01 |
// Description: Simple test for C++ runtime support. |
// |
//####DESCRIPTIONEND#### |
//========================================================================== |
|
#include <pkgconf/hal.h> |
#include <pkgconf/isoinfra.h> |
|
#include <cyg/infra/testcase.h> |
#include <cyg/infra/diag.h> |
|
#include <new> |
|
//========================================================================== |
|
class Pure |
{ |
protected: |
int instance; |
public: |
Pure(int i); |
virtual void pure_fun1(void) = 0; |
virtual void pure_fun2(void) = 0; |
virtual void impure_fun1(void); |
inline void inline_fun1(void); |
}; |
|
Pure::Pure(int i) |
{ |
instance = i; |
diag_printf("%s(%d) called\n",__PRETTY_FUNCTION__,instance); |
} |
|
void Pure::impure_fun1() |
{ |
diag_printf("%s(%d) called\n",__PRETTY_FUNCTION__,instance); |
} |
|
//========================================================================== |
|
class Derived : public Pure |
{ |
public: |
Derived(int i); |
void pure_fun1(void); |
void pure_fun2(void); |
void impure_fun2(void); |
}; |
|
Derived::Derived(int i) |
: Pure(i) |
{ |
diag_printf("%s(%d) called\n",__PRETTY_FUNCTION__,instance); |
} |
|
void Derived::pure_fun1(void) |
{ |
diag_printf("%s(%d) called\n",__PRETTY_FUNCTION__,instance); |
} |
|
void Derived::pure_fun2(void) |
{ |
diag_printf("%s(%d) called\n",__PRETTY_FUNCTION__,instance); |
} |
|
|
void Derived::impure_fun2(void) |
{ |
diag_printf("%s(%d) called\n",__PRETTY_FUNCTION__,instance); |
} |
|
//========================================================================== |
|
__externC void |
cyg_start( void ) |
{ |
|
CYG_TEST_INIT(); |
|
Derived derived(1); |
Pure *pure = &derived; |
|
CYG_TEST_INFO("Calling derived members"); |
derived.pure_fun1(); |
derived.pure_fun2(); |
derived.impure_fun1(); |
derived.impure_fun2(); |
derived.inline_fun1(); |
|
CYG_TEST_INFO("Calling pure members"); |
pure->pure_fun1(); |
pure->pure_fun2(); |
pure->impure_fun1(); |
pure->inline_fun1(); |
|
#if CYGINT_ISO_MALLOC |
Derived *derived2 = new Derived(2); |
Pure *pure2 = derived2; |
|
CYG_TEST_INFO("Calling derived2 members"); |
derived2->pure_fun1(); |
derived2->pure_fun2(); |
derived2->impure_fun1(); |
derived2->impure_fun2(); |
derived2->inline_fun1(); |
|
CYG_TEST_INFO("Calling pure2 members"); |
pure2->pure_fun1(); |
pure2->pure_fun2(); |
pure2->impure_fun1(); |
pure2->inline_fun1(); |
|
delete derived2; |
|
#else |
CYG_TEST_INFO("No malloc support, new and delete not tested"); |
#endif |
|
CYG_TEST_PASS_FINISH("C++ Support OK"); |
} |
|
//========================================================================== |
|
void Pure::inline_fun1() |
{ |
diag_printf("%s(%d) called\n",__PRETTY_FUNCTION__,instance); |
} |
|
//========================================================================== |
// EOF cxxsupp.cxx |
/include/cyg_trac.h
0,0 → 1,1655
#ifndef CYGONCE_INFRA_CYG_TRAC_H |
#define CYGONCE_INFRA_CYG_TRAC_H |
|
//========================================================================== |
// |
// cyg_trac.h |
// |
// Macros and prototypes for the tracing system |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg from an original by hmt |
// Contributors: nickg |
// Date: 1998-04-23 |
// Purpose: Use traces to log procedure entry, and "print" stuff |
// Description: Runtime logging messages that compile to nothing in |
// release versions of the code, to allow |
// as-you-go tracing of alternate builds. |
// Usage: #include <cyg/infra/cyg_trac.h> |
// ... |
// CYG_TRACE2( PIPE_TRACE, "pipe %x, data %d", ppipe, oword ); |
// |
// which can result, for example, in a message of the form: |
// "TRACE: pipemgr.cxx:1340, write_pipe(): pipe 0x8004c, data 17" |
// |
//####DESCRIPTIONEND#### |
// |
|
/**************************************************************************** |
|
Explicit tracing |
================ |
|
CYG_TRACE0( bool, msg ); |
CYG_TRACE1( bool, msg, arg1 ); |
CYG_TRACE2( bool, msg, arg1, arg2 ); |
.... |
CYG_TRACE8( bool, msg, .... [with 8 args] ); |
|
In general, the bool controls whether or not the tracing occurs for a |
particular invocation of the macro. The msg is a printf-style string, |
though exactly which formats are supported depends on the underlying |
implementation. Typically, at least %d, %x, %08x, %c and %s will be |
supported. Of course a most compact implementation might print |
|
TRACE:z1dbuff.c[92]get_nextdata(): data pointer %x offset %d: 42BD8 1C |
|
or some such, leaving you to work it out for yourself. |
|
It is expected that the boolean would rarely actually be a complex |
expression; it is more likely that it would either be "1", tracing being |
controlled for the whole compilation unit or subsystem by means of the |
CYGDBG_USE_TRACING symbol, or a local symbol for tracing over the whole |
file, defined to 0 or to 1. For runtime control of tracing in a debugging |
session, it is typical to use symbols defined to expressions such as: |
|
static int xxx_trace = 0; |
#define TL1 (0 < xxx_trace) |
#define TL2 (1 < xxx_trace) |
|
so you set xxx_trace to 1 to enable those messages conditioned by TL1 |
(trace level 1) and so on. |
|
CYG_TRACE1( TL1, "Major argument is %d", zz ); |
CYG_TRACE4( TL2, "...minor details %d %d %d %d", m1, m2, m3 ,m4 ); |
|
To assist with the case where the same symbol or expression is used |
throughout a compilation unit, the programmer can define the symbol |
CYG_TRACE_USER_BOOL as they choose and then use convenience macros with the |
suffix 'B' in the obvious manner: |
|
#define CYG_TRACE_USER_BOOL (xxx_trace > 0) |
CYG_TRACE2B( "Counters are %d, %d", countlo, counthi ); |
|
For the case where you just want to print a load of numbers in hex, or |
decimal, convenience suffices X, D and Y are provided. X uses %08x, D %d |
and Y an unadorned %x for each argument. |
|
CYG_TRACE3D( TL2, m1, m2, d ); |
|
If you want to do something similar but with a little more comment, the |
names (strictly spellings) of the variables you are printing can be used by |
appending a V to the X, D or Y. |
|
CYG_TRACE3DV( TL2, m1, m2, d ); |
|
might output: |
|
TRACE:z1dbuff.c[92]get_nextdata(): m1=23 m2=-4 d=55 |
|
These conveniences can be combined, and they apply equally to tracing with |
up to 8 variables; the B for Bool goes last: |
|
CYG_TRACE4DVB( i, i*i, i*i*i, i*i*i*i ); |
|
might output: |
|
TRACE:table.c[12]main(): i=3 i*i=9 i*i*i=27 i*i*i*i=81 |
|
|
Function Tracing |
================ |
|
There are also facities for easily reporting function entry and exit, |
printing the function arguments, and detecting returns without logging (or |
without a value!). |
|
The basic facility is |
|
CYG_REPORT_FUNCTION(); |
|
In C, place this between the local variable declarations and the first |
statement or errors will ensue. C++ is more flexible; place the macro as |
the first line of all functions you wish to trace. The following |
variations are also provided: |
|
CYG_REPORT_FUNCTYPE( exitmsg ) provide a printf string for the type |
of the returned value |
CYG_REPORT_FUNCNAME( name ) supply a function name explicitly, for |
if __FUNCTION__ is not supported |
CYG_REPORT_FUNCNAMETYPE( name, exitmsg ) both of the above extensions |
|
These are unconditional; the assumption is that if function reporting is |
used at all it will be used for all functions within a compilation unit. |
However, it is useful to be able to control function reporting at finer |
grain without editing the source files concerned, at compile time or at |
runtime. To support this, conditioned versions (with suffix 'C') are |
provided for the above four macros, which only procduce trace output if the |
macro CYG_REPORT_USER_BOOL evaluates true. |
|
CYG_REPORT_FUNCTIONC() |
CYG_REPORT_FUNCNAMEC( name ) |
CYG_REPORT_FUNCTYPEC( exitmsg ) |
CYG_REPORT_FUNCNAMETYPEC( name, exitmsg ) |
|
You can define CYG_REPORT_USER_BOOL to anything you like before invoking |
these macros; using a simple -DCYG_REPORT_USER_BOOL=0 or ...=1 on the |
compiler command line would do the trick, but there is more flexibility to |
be gained by something like: |
|
#define CYG_REPORT_USER_BOOL (reporting_bool_FOO) |
#ifdef TRACE_FOO |
int reporting_bool_FOO = 1; |
#else |
int reporting_bool_FOO = 0; |
#endif |
|
where FOO relates to the module name. Thus an external symbol sets the |
default, but it can be overridden in a debugging session by setting the |
variable reporting_bool_FOO. |
|
Note that the condition applied to the initial CYG_REPORT_FUNC...() macro |
controls all function-related reporting (not tracing) from that function; |
the underlying mechanisms still operate even if no output is created. Thus |
no conditioned variants of CYG_REPORT_FUNCARG[s] nor of CYG_REPORT_RETURN |
are needed. |
|
Examples: |
int myfunction() |
{ |
CYG_REPORT_FUNCTYPE( "recode is %d" ); |
|
A function return is traced using |
|
CYG_REPORT_RETURN() a void return |
CYG_REPORT_RETVAL( value ) returning a value |
|
With the CYG_REPORT_FUNCTYPE example, the latter might produce a message |
like: |
|
TRACE:myprog.c[40]fact(): enter |
TRACE:myprog.c[53]fact(): retcode is 24 |
|
It is also useful to trace the values of the arguments to a function: |
CYG_REPORT_FUNCARGVOID confirms that the function is void |
CYG_REPORT_FUNCARG1( format, arg ) printf-style |
to |
CYG_REPORT_FUNCARG8( format, arg1...arg8 ) printf-style |
|
The CYG_REPORT_FUNCARG[1-8] macros are also offered with the convenience |
extensions: D, X, or Y, and V like the explicit tracing macros. For |
example: |
|
int fact( int number ) |
{ |
CYG_REPORT_FUNCTYPE( "recode is %d" ); |
CYG_REPORT_FUNCARG1DV( number ); |
int result = number; |
while ( --number > 1 ) result *= number |
CYG_REPORT_RETVAL( result ); |
return result; |
} |
|
might produce: |
|
TRACE:myprog.c[40]fact(): enter |
TRACE:myprog.c[40]fact(): number=4 |
TRACE:myprog.c[53]fact(): retcode is 24 |
|
If no exit message is provided, a default of %08x is used. |
|
|
General Configury |
================= |
|
If CYGDBG_INFRA_DEBUG_FUNCTION_PSEUDOMACRO is *not* defined, it is assumed |
that __PRETTY_FUNCTION__ or equivalents do not exist, so no function name |
tracing is possible; only file and line number. |
|
If CYGDBG_INFRA_DEBUG_TRACE_MESSAGE is *not* defined, the message and |
arguments to all tracing macros are not used; only "execution was here" |
type information, by file, function and line number, is available. This |
can greatly reduce the size of an image with tracing disabled, which may be |
crucial in debugging on actual shipped hardware with limited memory. |
|
If configured for buffered tracing then CYG_TRACE_PRINT() can be used to |
output the contents of the trace buffer on demand. |
|
CYG_TRACE_DUMP() outputs a form of "core dump" containing info on the |
scheduler and threads at the time. This information will be invalid if |
the kernel is not running. |
|
C/C++: in C++ the function reporting is implemented using a class object |
with a destructor; this allows reporting of a return which has not been |
explicitly reported, and detection of accidental multiple return reports. |
This helps you write the function reporting correctly. In C it is not |
possible to be so sophisticated, so the implementation is not so helpful in |
detecting errors in the use of the tracing system. |
|
Note that for all of the above variations, the internal API to the |
functions which are called in consequence of tracing remains the same, so |
these variations can be mixed in the same executable, by configuring the |
tracing macros differently in different compilation units or subsystems. |
|
|
Summary |
======= |
|
Explicit tracing |
---------------- |
|
CYG_TRACE0( bool, msg ) if bool, print msg |
CYG_TRACE1( bool, msg, arg ) if bool, printf-style |
to |
CYG_TRACE8( bool, msg, arg1...arg8 ) if bool, printf-style |
|
CYG_TRACE0B( msg, args... ) to CYG_TRACE8B() use CYG_TRACE_USER_BOOL |
|
CYG_TRACE1X( bool, args... ) to CYG_TRACE8X() print args using %08x |
CYG_TRACE1Y( bool, args... ) to CYG_TRACE8Y() print args using %x |
CYG_TRACE1D( bool, args... ) to CYG_TRACE8D() print args using %d |
|
CYG_TRACE1XV( bool, args... ) to CYG_TRACE8XV() print args using "arg=%08x" |
CYG_TRACE1YV( bool, args... ) to CYG_TRACE8YV() print args using "arg=%x" |
CYG_TRACE1DV( bool, args... ) to CYG_TRACE8DV() print args using "arg=%d" |
|
CYG_TRACE1XB( args... ) to CYG_TRACE8XB() print using %08x, no bool |
CYG_TRACE1YB( args... ) to CYG_TRACE8YB() print using %x, no bool |
CYG_TRACE1DB( args... ) to CYG_TRACE8DB() print using %d, no bool |
|
CYG_TRACE1XVB( args... ) to CYG_TRACE8XVB() use "arg=%08x", no bool |
CYG_TRACE1YVB( args... ) to CYG_TRACE8YVB() use "arg=%x", no bool |
CYG_TRACE1DVB( args... ) to CYG_TRACE8DVB() use "arg=%d", no bool |
|
Function tracing |
---------------- |
|
CYG_REPORT_FUNCTION() default function entry |
CYG_REPORT_FUNCNAME( name ) name the function |
CYG_REPORT_FUNCTYPE( exitmsg ) printf for retval |
CYG_REPORT_FUNCNAMETYPE( name, exitmsg ) both |
|
CYG_REPORT_FUNCTIONC() as above, but conditional |
CYG_REPORT_FUNCNAMEC( name ) on CYG_REPORT_USER_BOOL |
CYG_REPORT_FUNCTYPEC( exitmsg ) however it is defined |
CYG_REPORT_FUNCNAMETYPEC( name, exitmsg ) ... |
|
CYG_REPORT_RETURN() void function exit |
CYG_REPORT_RETVAL( value ) returning value |
|
CYG_REPORT_FUNCARGVOID() void function entry |
CYG_REPORT_FUNCARG1( format, arg ) printf-style |
to |
CYG_REPORT_FUNCARG8( format, arg1...arg8 ) printf-style |
|
CYG_REPORT_FUNCARG1X( arg ) |
to |
CYG_REPORT_FUNCARG8X( arg1...arg8 ) use %08x |
CYG_REPORT_FUNCARG1Y... use %x |
CYG_REPORT_FUNCARG1D... use %d |
|
CYG_REPORT_FUNCARG1XV... use "arg=%08x" |
CYG_REPORT_FUNCARG1YV... use "arg=%x" |
CYG_REPORT_FUNCARG1DV... use "arg=%d" |
|
Other |
----- |
|
CYG_TRACE_DUMP() dumps kernel state |
CYG_TRACE_PRINT() prints buffered tracing |
|
|
--------------------------------------------------------------------------- |
|
Internal Documentation |
====================== |
|
The required functions which are used by the tracing macros are |
|
externC void |
cyg_tracenomsg( const char *psz_func, const char *psz_file, |
cyg_uint32 linenum ); |
|
externC void |
cyg_tracemsg( cyg_uint32 what, const char *psz_func, const char *psz_file, |
cyg_uint32 linenum, const char *psz_msg ); |
|
externC void |
cyg_tracemsg2( cyg_uint32 what, |
const char *psz_func, const char *psz_file, |
cyg_uint32 linenum, const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 ); |
// extended in the obvious way for 4,6,8 arguments |
|
These functions should expect psz_func and psz_file to possibly be NULL in |
case those facilities are not available in the compilation environment, and |
do something safe in such cases. A NULL message should really be dealt |
with safely also, just logging "execution here" info like cyg_tracenomsg(). |
|
Discussion of possible underlying implementations |
------------------------------------------------- |
|
It is intended that the functions that get called can simply print the info |
they are given in as fancy a format as you like, or they could do the |
printf-type formatting and log the resulting text in a buffer. They get |
told the type of event (function-entry, function-arguments, function-exit |
or plain tracing info) and so can perform fancy indenting, for example, to |
make call stack inspection more obvious to humans. It is also intended |
that a more compact logging arrangement be possible, for example one which |
records, in 32-bit words (CYG_ADDRWORDs), the addresses of the file, |
function and msg strings, the line number and the arguments. This has the |
implication that the msg string should not be constructed dynamically but |
be static ie. a plain quoted C string. The number of arguments also must |
be recorded, and if it is chosen to save string arguments in the buffer |
rather than just their addresses (which could be invalid by the time the |
logged information is processed) some flagging of which arguments are |
strings must be provided. The system could also be extended to deal with |
floats of whichever size fir in a CYG_ADDRWORD; these would probably |
require special treatment also. With these considerations in mind, the |
maximum number of parameters in a single trace message has been set to 8, |
so that a byte bitset could be used to indicate which arguments are |
strings, another for those which are floats, and the count of arguments |
also fits in a byte as number or a bitset. |
|
|
****************************************************************************/ |
|
#include <pkgconf/infra.h> |
|
#include <cyg/infra/cyg_ass.h> |
|
// ------------------------------------------------------------------------- |
// CYGDBG_INFRA_DEBUG_FUNCTION_PSEUDOMACRO is dealt with in cyg_ass.h. |
// ------------------------------------------------------------------------- |
|
#ifdef CYGDBG_USE_TRACING |
|
// ------------------------------------------------------------------------- |
// We define macros and appropriate prototypes for the trace/fail |
// system. These are: |
// CYG_TRACE0..8 - trace if boolean |
// CYG_TRACEPROC - default no comment proc entry |
// CYG_TRACEPROCOUT - default no comment proc exit |
// CYG_TRACE_DUMP - outputs a form of "core dump", including the state |
// of the kernel scheduler, threads, etc. |
// CYG_TRACE_PRINT - Forces manual output of any trace info that has |
// been buffered up. |
|
// these are executed to deal with tracing - breakpoint? |
|
externC void |
cyg_tracenomsg( const char *psz_func, const char *psz_file, cyg_uint32 linenum ); |
|
externC void |
cyg_trace_dump(void); |
|
#define CYG_TRACE_DUMP() cyg_trace_dump() |
|
#ifdef CYGDBG_INFRA_DEBUG_TRACE_ASSERT_BUFFER |
|
externC void |
cyg_trace_print(void); |
|
#define CYG_TRACE_PRINT() cyg_trace_print() |
|
#else |
#define CYG_TRACE_PRINT() CYG_EMPTY_STATEMENT |
#endif |
|
// provide every other one of these as a space/caller bloat compromise. |
|
# ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
enum cyg_trace_what{ |
cyg_trace_trace = 0, |
cyg_trace_enter, |
cyg_trace_args, |
cyg_trace_return, |
// cyg_trace_, |
// cyg_trace_, |
}; |
|
externC void |
cyg_tracemsg( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg ); |
|
externC void |
cyg_tracemsg2( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 ); |
externC void |
cyg_tracemsg4( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 ); |
externC void |
cyg_tracemsg6( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5 ); |
externC void |
cyg_tracemsg8( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5, |
CYG_ADDRWORD arg6, CYG_ADDRWORD arg7 ); |
|
#endif // CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
// ------------------------------------------------------------------------- |
|
# ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
# define CYG_TRACE_docall0( _msg_ ) \ |
cyg_tracemsg( cyg_trace_trace, \ |
__PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_ ); |
|
# define CYG_TRACE_docall2( _msg_, _arg0_, _arg1_ ) \ |
cyg_tracemsg2( cyg_trace_trace, \ |
__PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_, \ |
(CYG_ADDRWORD)_arg0_, (CYG_ADDRWORD)_arg1_ ); |
|
# define CYG_TRACE_docall4( _msg_, _arg0_, _arg1_ , _arg2_, _arg3_ ) \ |
cyg_tracemsg4( cyg_trace_trace, \ |
__PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_, \ |
(CYG_ADDRWORD)_arg0_, (CYG_ADDRWORD)_arg1_, \ |
(CYG_ADDRWORD)_arg2_, (CYG_ADDRWORD)_arg3_ ); |
|
# define CYG_TRACE_docall6( _msg_, _arg0_, _arg1_ , _arg2_, _arg3_, \ |
_arg4_, _arg5_ ) \ |
cyg_tracemsg6( cyg_trace_trace, \ |
__PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_, \ |
(CYG_ADDRWORD)_arg0_, (CYG_ADDRWORD)_arg1_, \ |
(CYG_ADDRWORD)_arg2_, (CYG_ADDRWORD)_arg3_, \ |
(CYG_ADDRWORD)_arg4_, (CYG_ADDRWORD)_arg5_ ); |
|
# define CYG_TRACE_docall8( _msg_, _arg0_, _arg1_ , _arg2_, _arg3_, \ |
_arg4_, _arg5_, _arg6_, _arg7_ ) \ |
cyg_tracemsg8( cyg_trace_trace, \ |
__PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_, \ |
(CYG_ADDRWORD)_arg0_, (CYG_ADDRWORD)_arg1_, \ |
(CYG_ADDRWORD)_arg2_, (CYG_ADDRWORD)_arg3_, \ |
(CYG_ADDRWORD)_arg4_, (CYG_ADDRWORD)_arg5_, \ |
(CYG_ADDRWORD)_arg6_, (CYG_ADDRWORD)_arg7_ ); |
|
# else // do not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
# define CYG_TRACE_docall0( _msg_ ) \ |
cyg_tracenomsg( __PRETTY_FUNCTION__, __FILE__, __LINE__ ); |
|
# define CYG_TRACE_docall2( _msg_, _arg0_, _arg1_ ) \ |
cyg_tracenomsg( __PRETTY_FUNCTION__, __FILE__, __LINE__ ); |
|
# define CYG_TRACE_docall4( _msg_, _arg0_, _arg1_ , _arg2_, _arg3_ ) \ |
cyg_tracenomsg( __PRETTY_FUNCTION__, __FILE__, __LINE__ ); |
|
# define CYG_TRACE_docall6( _msg_, _arg0_, _arg1_ , _arg2_, _arg3_, \ |
_arg4_, _arg5_ ) \ |
cyg_tracenomsg( __PRETTY_FUNCTION__, __FILE__, __LINE__ ); |
|
# define CYG_TRACE_docall8( _msg_, _arg0_, _arg1_, _arg2_, _arg3_, \ |
_arg4_, _arg5_, _arg6_, _arg7_ ) \ |
cyg_tracenomsg( __PRETTY_FUNCTION__, __FILE__, __LINE__ ); |
|
#endif |
|
// ------------------------------------------------------------------------- |
// Conditioned trace; if the condition is false, fail. |
|
#define CYG_TRACE0( _bool_, _msg_ ) \ |
CYG_MACRO_START \ |
if ( ( _bool_ ) ) \ |
CYG_TRACE_docall0( _msg_ ); \ |
CYG_MACRO_END |
|
#define CYG_TRACE1( _bool_, _msg_, a ) \ |
CYG_MACRO_START \ |
if ( ( _bool_ ) ) \ |
CYG_TRACE_docall2( _msg_, a, 0 ); \ |
CYG_MACRO_END |
|
#define CYG_TRACE2( _bool_, _msg_, a, b ) \ |
CYG_MACRO_START \ |
if ( ( _bool_ ) ) \ |
CYG_TRACE_docall2( _msg_, a, b ); \ |
CYG_MACRO_END |
|
#define CYG_TRACE3( _bool_, _msg_, a, b, c ) \ |
CYG_MACRO_START \ |
if ( ( _bool_ ) ) \ |
CYG_TRACE_docall4( _msg_, a, b, c, 0 ); \ |
CYG_MACRO_END |
|
#define CYG_TRACE4( _bool_, _msg_, a, b, c, d ) \ |
CYG_MACRO_START \ |
if ( ( _bool_ ) ) \ |
CYG_TRACE_docall4( _msg_, a, b, c, d ); \ |
CYG_MACRO_END |
|
#define CYG_TRACE5( _bool_, _msg_, a, b, c, d, e ) \ |
CYG_MACRO_START \ |
if ( ( _bool_ ) ) \ |
CYG_TRACE_docall6( _msg_, a, b, c, d, e, 0 ); \ |
CYG_MACRO_END |
|
#define CYG_TRACE6( _bool_, _msg_, a, b, c, d, e, f ) \ |
CYG_MACRO_START \ |
if ( ( _bool_ ) ) \ |
CYG_TRACE_docall6( _msg_, a, b, c, d, e, f ); \ |
CYG_MACRO_END |
|
#define CYG_TRACE7( _bool_, _msg_, a, b, c, d, e, f, g ) \ |
CYG_MACRO_START \ |
if ( ( _bool_ ) ) \ |
CYG_TRACE_docall8( _msg_, a, b, c, d, e, f, g, 0 ); \ |
CYG_MACRO_END |
|
#define CYG_TRACE8( _bool_, _msg_, a, b, c, d, e, f, g, h ) \ |
CYG_MACRO_START \ |
if ( ( _bool_ ) ) \ |
CYG_TRACE_docall8( _msg_, a, b, c, d, e, f, g, h ); \ |
CYG_MACRO_END |
|
// ------------------------------------------------------------------------- |
// Report function entry and exit. |
// In C++ the macro CYG_REPORT_FUNCTION should appear as the first line of |
// any function. It will generate a message whenever the function is entered |
// and when it is exited. |
// In C the macro should appear as the first statement after any local variable |
// definitions. No exit message will be generated unless CYG_REPORT_RETURN is |
// placed just before each return. |
// Where a piece of code is to be compiled with both C and C++, the above |
// rules for C should be followed. |
|
#ifdef CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS |
|
#ifdef __cplusplus |
|
class Cyg_TraceFunction_Report_ |
{ |
public: |
int cond; |
const char *func; |
const char *file; |
cyg_uint32 lnum; |
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
char *exitmsg; |
CYG_ADDRWORD exitvalue; |
enum { UNSET = 0, SET, VOID } exitset; |
#endif |
|
Cyg_TraceFunction_Report_( |
int condition, const char *psz_func, const char *psz_file, |
cyg_uint32 linenum) |
{ |
cond = condition; |
func = psz_func; |
file = psz_file; |
lnum = linenum; |
|
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
exitmsg = NULL; |
exitset = UNSET; |
if ( cond ) |
cyg_tracemsg( cyg_trace_enter, func, file, lnum, "enter"); |
#else |
if ( cond ) |
cyg_tracenomsg( func, file, lnum ); |
#endif |
}; |
|
Cyg_TraceFunction_Report_( |
int condition, const char *psz_func, const char *psz_file, |
cyg_uint32 linenum, char *psz_exitmsg ) |
{ |
cond = condition; |
func = psz_func; |
file = psz_file; |
lnum = linenum; |
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
exitmsg = psz_exitmsg; |
exitset = UNSET; |
if ( cond ) |
cyg_tracemsg( cyg_trace_enter, func, file, lnum, "enter"); |
#else |
CYG_UNUSED_PARAM( char *, psz_exitmsg ); |
if ( cond ) |
cyg_tracenomsg( func, file, lnum ); |
#endif |
}; |
|
inline void set_exitvoid( cyg_uint32 linenum ) |
{ |
lnum = linenum; |
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
CYG_ASSERT( NULL == exitmsg, "exitvoid used in typed function" ); |
CYG_ASSERT( UNSET == exitset, "exitvoid used when arg already set" ); |
exitset = VOID; |
#endif |
} |
|
inline void set_exitvalue( cyg_uint32 linenum, CYG_ADDRWORD retcode ) |
{ |
lnum = linenum; |
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
CYG_ASSERT( UNSET == exitset, "exitvalue used when arg already set" ); |
exitvalue = retcode; |
exitset = SET; |
#else |
CYG_UNUSED_PARAM( CYG_ADDRWORD, retcode ); |
#endif |
} |
|
~Cyg_TraceFunction_Report_() |
{ |
if ( cond ) { |
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
if ( VOID == exitset ) |
cyg_tracemsg( cyg_trace_return, func, file, lnum, |
"return void"); |
else if ( UNSET == exitset ) |
cyg_tracemsg( cyg_trace_return, func, file, lnum, |
"RETURNING UNSET!"); |
else if ( NULL == exitmsg ) |
cyg_tracemsg2( cyg_trace_return, func, file, lnum, |
"return %08x", exitvalue, 0 ); |
else |
cyg_tracemsg2( cyg_trace_return, func, file, lnum, |
exitmsg, exitvalue, 0 ); |
#else |
cyg_tracenomsg( func, file, lnum ); |
#endif |
} |
} |
}; |
|
// These have no CYG_MACRO_START,END around because it is required |
// that the scope of the object be the whole function body. Get it? |
|
// These are the unconditional versions: |
#define CYG_REPORT_FUNCTION() \ |
Cyg_TraceFunction_Report_ cyg_tracefunction_report_( \ |
1, __PRETTY_FUNCTION__, \ |
__FILE__, __LINE__ ) |
|
#define CYG_REPORT_FUNCTYPE( _exitmsg_ ) \ |
Cyg_TraceFunction_Report_ cyg_tracefunction_report_( \ |
1, __PRETTY_FUNCTION__, \ |
__FILE__, __LINE__, _exitmsg_ ) |
|
#define CYG_REPORT_FUNCNAME( _name_ ) \ |
Cyg_TraceFunction_Report_ cyg_tracefunction_report_( \ |
1, _name_, \ |
__FILE__, __LINE__ ) |
|
#define CYG_REPORT_FUNCNAMETYPE( _name_, _exitmsg_ ) \ |
Cyg_TraceFunction_Report_ cyg_tracefunction_report_( \ |
1, _name_, \ |
__FILE__, __LINE__, _exitmsg_ ) |
|
// These are conditioned on macro CYG_REPORT_USER_BOOL |
// (which you better have defined) |
#define CYG_REPORT_FUNCTIONC() \ |
Cyg_TraceFunction_Report_ cyg_tracefunction_report_( \ |
CYG_REPORT_USER_BOOL, __PRETTY_FUNCTION__, \ |
__FILE__, __LINE__ ) |
|
#define CYG_REPORT_FUNCTYPEC( _exitmsg_ ) \ |
Cyg_TraceFunction_Report_ cyg_tracefunction_report_( \ |
CYG_REPORT_USER_BOOL, __PRETTY_FUNCTION__, \ |
__FILE__, __LINE__, _exitmsg_ ) |
|
#define CYG_REPORT_FUNCNAMEC( _name_ ) \ |
Cyg_TraceFunction_Report_ cyg_tracefunction_report_( \ |
CYG_REPORT_USER_BOOL, _name_, \ |
__FILE__, __LINE__ ) |
|
#define CYG_REPORT_FUNCNAMETYPEC( _name_, _exitmsg_ ) \ |
Cyg_TraceFunction_Report_ cyg_tracefunction_report_( \ |
CYG_REPORT_USER_BOOL, _name_, \ |
__FILE__, __LINE__, _exitmsg_ ) |
|
|
#define CYG_REPORT_RETURN() CYG_MACRO_START \ |
cyg_tracefunction_report_.set_exitvoid( __LINE__ ); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_RETVAL( _value_) CYG_MACRO_START \ |
cyg_tracefunction_report_.set_exitvalue( \ |
__LINE__, (CYG_ADDRWORD)(_value_) ); \ |
CYG_MACRO_END |
|
|
#else // not __cplusplus |
|
|
struct Cyg_TraceFunction_Report_ |
{ |
int cond; |
char *func; |
char *file; /* not strictly needed in plain 'C' */ |
cyg_uint32 lnum; /* nor this */ |
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
char *exitmsg; |
CYG_ADDRWORD exitvalue; |
int exitset; |
#endif |
|
}; |
|
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
#define CYG_REPORT_FUNCTION_ENTER_INTERNAL() CYG_MACRO_START \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg( cyg_trace_enter, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
"enter" ); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_FUNCTION_CONSTRUCT( _c_, _fn_,_fl_,_l_,_xm_,_xv_,_xs_ ) \ |
{ _c_, _fn_, _fl_, _l_, _xm_, _xv_, _xs_ } |
|
#else // do not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
#define CYG_REPORT_FUNCTION_ENTER_INTERNAL() CYG_MACRO_START \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracenomsg( cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum ); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_FUNCTION_CONSTRUCT( _c_, _fn_,_fl_,_l_,_xm_,_xv_,_xs_ ) \ |
{ _c_, _fn_, _fl_, _l_ } |
|
#endif // not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
// These have no CYG_MACRO_START,END around because it is required |
// that the scope of the object be the whole function body. Get it? |
|
// These are the unconditional versions: |
#define CYG_REPORT_FUNCTION() \ |
struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ = \ |
CYG_REPORT_FUNCTION_CONSTRUCT( \ |
1, __PRETTY_FUNCTION__, __FILE__, __LINE__, NULL, 0, 0 ); \ |
CYG_REPORT_FUNCTION_ENTER_INTERNAL() |
|
#define CYG_REPORT_FUNCTYPE( _exitmsg_ ) \ |
struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ = \ |
CYG_REPORT_FUNCTION_CONSTRUCT( \ |
1, __PRETTY_FUNCTION__, __FILE__, __LINE__, _exitmsg_, 0, 0 ); \ |
CYG_REPORT_FUNCTION_ENTER_INTERNAL() |
|
#define CYG_REPORT_FUNCNAME( _name_ ) \ |
struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ = \ |
CYG_REPORT_FUNCTION_CONSTRUCT( \ |
1, _name_, __FILE__, __LINE__, NULL, 0, 0 ); \ |
CYG_REPORT_FUNCTION_ENTER_INTERNAL() |
|
#define CYG_REPORT_FUNCNAMETYPE( _name_, _exitmsg_ ) \ |
struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ = \ |
CYG_REPORT_FUNCTION_CONSTRUCT( \ |
1, _name_, __FILE__, __LINE__, _exitmsg_, 0, 0 ); \ |
CYG_REPORT_FUNCTION_ENTER_INTERNAL() |
|
// These are conditioned on macro CYG_REPORT_USER_BOOL |
// (which you better have defined) |
#define CYG_REPORT_FUNCTIONC() \ |
struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ = \ |
CYG_REPORT_FUNCTION_CONSTRUCT( \ |
CYG_REPORT_USER_BOOL, \ |
__PRETTY_FUNCTION__, __FILE__, __LINE__, NULL, 0, 0 ); \ |
CYG_REPORT_FUNCTION_ENTER_INTERNAL() |
|
#define CYG_REPORT_FUNCTYPEC( _exitmsg_ ) \ |
struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ = \ |
CYG_REPORT_FUNCTION_CONSTRUCT( \ |
CYG_REPORT_USER_BOOL, \ |
__PRETTY_FUNCTION__, __FILE__, __LINE__, _exitmsg_, 0, 0 ); \ |
CYG_REPORT_FUNCTION_ENTER_INTERNAL() |
|
#define CYG_REPORT_FUNCNAMEC( _name_ ) \ |
struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ = \ |
CYG_REPORT_FUNCTION_CONSTRUCT( \ |
CYG_REPORT_USER_BOOL, \ |
_name_, __FILE__, __LINE__, NULL, 0, 0 ); \ |
CYG_REPORT_FUNCTION_ENTER_INTERNAL() |
|
#define CYG_REPORT_FUNCNAMETYPEC( _name_, _exitmsg_ ) \ |
struct Cyg_TraceFunction_Report_ cyg_tracefunction_report_ = \ |
CYG_REPORT_FUNCTION_CONSTRUCT( \ |
CYG_REPORT_USER_BOOL, \ |
_name_, __FILE__, __LINE__, _exitmsg_, 0, 0 ); \ |
CYG_REPORT_FUNCTION_ENTER_INTERNAL() |
|
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
#define CYG_REPORT_RETURN() CYG_MACRO_START \ |
CYG_ASSERT( NULL == cyg_tracefunction_report_.exitmsg, \ |
"exitvoid used in typed function" ); \ |
CYG_ASSERT( 0 == cyg_tracefunction_report_.exitset, \ |
"exitvoid used when arg already set" ); \ |
cyg_tracefunction_report_.lnum = __LINE__; \ |
cyg_tracefunction_report_.exitset = 2; \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg( cyg_trace_return, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
"return void" ); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_RETVAL( _value_ ) CYG_MACRO_START \ |
CYG_ASSERT( 0 == cyg_tracefunction_report_.exitset, \ |
"exitvalue used when arg already set" ); \ |
cyg_tracefunction_report_.lnum = __LINE__; \ |
cyg_tracefunction_report_.exitvalue = (CYG_ADDRWORD)(_value_); \ |
cyg_tracefunction_report_.exitset = 1; \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg2( cyg_trace_return, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
cyg_tracefunction_report_.exitmsg ? \ |
cyg_tracefunction_report_.exitmsg : \ |
"return %08x", \ |
cyg_tracefunction_report_.exitvalue, 0 ); \ |
CYG_MACRO_END |
|
#else // do not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
#define CYG_REPORT_RETURN() CYG_MACRO_START \ |
cyg_tracefunction_report_.lnum = __LINE__; \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracenomsg( cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum ); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_RETVAL( _value_ ) CYG_MACRO_START \ |
CYG_REPORT_RETURN(); \ |
CYG_MACRO_END |
|
#endif // not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
#endif // not __cplusplus |
|
#ifdef CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
#define CYG_REPORT_FUNCARGVOID() CYG_MACRO_START \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg( cyg_trace_args, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
"(void)" \ |
); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_FUNCARG1( _format_, a ) CYG_MACRO_START \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg2( cyg_trace_args, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
(_format_), \ |
(CYG_ADDRWORD)a , 0 \ |
); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_FUNCARG2( _format_, a,b ) CYG_MACRO_START \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg2( cyg_trace_args, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
(_format_), \ |
(CYG_ADDRWORD)a, (CYG_ADDRWORD)b \ |
); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_FUNCARG3( _format_, a,b,c ) CYG_MACRO_START \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg4( cyg_trace_args, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
(_format_), \ |
(CYG_ADDRWORD)a, (CYG_ADDRWORD)b, \ |
(CYG_ADDRWORD)c , 0 \ |
); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_FUNCARG4( _format_, a,b,c,d ) CYG_MACRO_START \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg4( cyg_trace_args, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
(_format_), \ |
(CYG_ADDRWORD)a, (CYG_ADDRWORD)b, \ |
(CYG_ADDRWORD)c, (CYG_ADDRWORD)d \ |
); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_FUNCARG5( _format_, a,b,c,d,e ) CYG_MACRO_START \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg6( cyg_trace_args, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
(_format_), \ |
(CYG_ADDRWORD)a, (CYG_ADDRWORD)b, \ |
(CYG_ADDRWORD)c, (CYG_ADDRWORD)d, \ |
(CYG_ADDRWORD)e , 0 \ |
); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_FUNCARG6( _format_, a,b,c,d,e,f ) CYG_MACRO_START \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg6( cyg_trace_args, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
(_format_), \ |
(CYG_ADDRWORD)a, (CYG_ADDRWORD)b, \ |
(CYG_ADDRWORD)c, (CYG_ADDRWORD)d, \ |
(CYG_ADDRWORD)e, (CYG_ADDRWORD)f \ |
); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_FUNCARG7( _format_, a,b,c,d,e,f,g ) CYG_MACRO_START \ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg8( cyg_trace_args, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
(_format_), \ |
(CYG_ADDRWORD)a, (CYG_ADDRWORD)b, \ |
(CYG_ADDRWORD)c, (CYG_ADDRWORD)d, \ |
(CYG_ADDRWORD)e, (CYG_ADDRWORD)f, \ |
(CYG_ADDRWORD)g , 0 \ |
); \ |
CYG_MACRO_END |
|
#define CYG_REPORT_FUNCARG8( _format_, a,b,c,d,e,f,g,h ) CYG_MACRO_START\ |
if ( cyg_tracefunction_report_.cond ) \ |
cyg_tracemsg8( cyg_trace_args, \ |
cyg_tracefunction_report_.func, \ |
cyg_tracefunction_report_.file, \ |
cyg_tracefunction_report_.lnum, \ |
(_format_), \ |
(CYG_ADDRWORD)a, (CYG_ADDRWORD)b, \ |
(CYG_ADDRWORD)c, (CYG_ADDRWORD)d, \ |
(CYG_ADDRWORD)e, (CYG_ADDRWORD)f, \ |
(CYG_ADDRWORD)g, (CYG_ADDRWORD)h \ |
); \ |
CYG_MACRO_END |
|
|
#else // do not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
#define CYG_REPORT_FUNCARGVOID() CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG1( _format_, a ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG2( _format_, a,b ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG3( _format_, a,b,c ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG4( _format_, a,b,c,d ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG5( _format_, a,b,c,d,e ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG6( _format_, a,b,c,d,e,f ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG7( _format_, a,b,c,d,e,f,g ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG8( _format_, a,b,c,d,e,f,g,h ) CYG_EMPTY_STATEMENT |
|
#endif // not CYGDBG_INFRA_DEBUG_TRACE_MESSAGE |
|
#else // no CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS |
|
#define CYG_REPORT_FUNCTION() CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCTYPE( _exitmsg_ ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCNAME( _name_ ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCNAMETYPE( _name_, _exitmsg_ ) CYG_EMPTY_STATEMENT |
|
#define CYG_REPORT_FUNCTIONC() CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCTYPEC( _exitmsg_ ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCNAMEC( _name_ ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCNAMETYPEC( _name_, _exitmsg_ ) CYG_EMPTY_STATEMENT |
|
#define CYG_REPORT_FUNCARGVOID() CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG1( _format_, a ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG2( _format_, a,b ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG3( _format_, a,b,c ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG4( _format_, a,b,c,d ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG5( _format_, a,b,c,d,e ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG6( _format_, a,b,c,d,e,f ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG7( _format_, a,b,c,d,e,f,g ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG8( _format_, a,b,c,d,e,f,g,h ) CYG_EMPTY_STATEMENT |
|
#define CYG_REPORT_RETURN() CYG_EMPTY_STATEMENT |
#define CYG_REPORT_RETVAL( _value_ ) CYG_EMPTY_STATEMENT |
|
#endif // CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS |
|
#else // ! CYGDBG_USE_TRACING |
|
// ------------------------------------------------------------------------- |
// No traces: we define empty statements for trace macros. |
|
#define CYG_TRACE0( _bool_, _msg_ ) CYG_EMPTY_STATEMENT |
#define CYG_TRACE1( _bool_, _msg_, a ) CYG_EMPTY_STATEMENT |
#define CYG_TRACE2( _bool_, _msg_, a,b ) CYG_EMPTY_STATEMENT |
#define CYG_TRACE3( _bool_, _msg_, a,b,c ) CYG_EMPTY_STATEMENT |
#define CYG_TRACE4( _bool_, _msg_, a,b,c,d ) CYG_EMPTY_STATEMENT |
#define CYG_TRACE5( _bool_, _msg_, a,b,c,d,e ) CYG_EMPTY_STATEMENT |
#define CYG_TRACE6( _bool_, _msg_, a,b,c,d,e,f ) CYG_EMPTY_STATEMENT |
#define CYG_TRACE7( _bool_, _msg_, a,b,c,d,e,f,g ) CYG_EMPTY_STATEMENT |
#define CYG_TRACE8( _bool_, _msg_, a,b,c,d,e,f,g,h ) CYG_EMPTY_STATEMENT |
|
#define CYG_REPORT_FUNCTION() CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCTYPE( _exitmsg_ ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCNAME( _name_ ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCNAMETYPE( _name_, _exitmsg_ ) CYG_EMPTY_STATEMENT |
|
#define CYG_REPORT_FUNCTIONC() CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCTYPEC( _exitmsg_ ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCNAMEC( _name_ ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCNAMETYPEC( _name_, _exitmsg_ ) CYG_EMPTY_STATEMENT |
|
#define CYG_REPORT_FUNCARGVOID() CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG1( _format_, a ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG2( _format_, a,b ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG3( _format_, a,b,c ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG4( _format_, a,b,c,d ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG5( _format_, a,b,c,d,e ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG6( _format_, a,b,c,d,e,f ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG7( _format_, a,b,c,d,e,f,g ) CYG_EMPTY_STATEMENT |
#define CYG_REPORT_FUNCARG8( _format_, a,b,c,d,e,f,g,h ) CYG_EMPTY_STATEMENT |
|
#define CYG_REPORT_RETURN() CYG_EMPTY_STATEMENT |
#define CYG_REPORT_RETVAL( _value_ ) CYG_EMPTY_STATEMENT |
|
#define CYG_TRACE_PRINT() CYG_EMPTY_STATEMENT |
#define CYG_TRACE_DUMP() CYG_EMPTY_STATEMENT |
|
#endif // ! CYGDBG_USE_TRACING |
|
// ------------------------------------------------------------------------- |
// |
// CYG_TRACEn{[XDY]{V}}{B} |
// |
// Convenience macros: these fall into a few dimensions, with suffix letters: |
// First option: |
// X: user need not supply a format string, %08x is used |
// D: ditto but signed decimal, %d |
// Y: ditto but just plain %x |
// Second option, only meaningful with one of XDY: |
// V: "<var> = %..." is used, by stringifying the argument |
// Third option: |
// B: user need not supply a bool; the symbol CYG_TRACE_USER_BOOL is |
// used (which we do not define, user must do this) |
|
#define CYG_TRACE0B( _msg_ ) \ |
CYG_TRACE0( CYG_TRACE_USER_BOOL, _msg_ ) |
#define CYG_TRACE1B( _msg_, a ) \ |
CYG_TRACE1( CYG_TRACE_USER_BOOL, _msg_, a ) |
#define CYG_TRACE2B( _msg_, a,b ) \ |
CYG_TRACE2( CYG_TRACE_USER_BOOL, _msg_, a,b ) |
#define CYG_TRACE3B( _msg_, a,b,c ) \ |
CYG_TRACE3( CYG_TRACE_USER_BOOL, _msg_, a,b,c ) |
#define CYG_TRACE4B( _msg_, a,b,c,d ) \ |
CYG_TRACE4( CYG_TRACE_USER_BOOL, _msg_, a,b,c,d ) |
#define CYG_TRACE5B( _msg_, a,b,c,d,e ) \ |
CYG_TRACE5( CYG_TRACE_USER_BOOL, _msg_, a,b,c,d,e ) |
#define CYG_TRACE6B( _msg_, a,b,c,d,e,f ) \ |
CYG_TRACE6( CYG_TRACE_USER_BOOL, _msg_, a,b,c,d,e,f ) |
#define CYG_TRACE7B( _msg_, a,b,c,d,e,f,g ) \ |
CYG_TRACE7( CYG_TRACE_USER_BOOL, _msg_, a,b,c,d,e,f,g ) |
#define CYG_TRACE8B( _msg_, a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( CYG_TRACE_USER_BOOL, _msg_, a,b,c,d,e,f,g,h ) |
|
// long hex versions |
|
#define CYG_TRACE1X( _bool_, a ) \ |
CYG_TRACE1( _bool_, "%08x", a ) |
#define CYG_TRACE2X( _bool_, a,b ) \ |
CYG_TRACE2( _bool_, "%08x %08x", a,b ) |
#define CYG_TRACE3X( _bool_, a,b,c ) \ |
CYG_TRACE3( _bool_, "%08x %08x %08x", a,b,c ) |
#define CYG_TRACE4X( _bool_, a,b,c,d ) \ |
CYG_TRACE4( _bool_, "%08x %08x %08x %08x", a,b,c,d ) |
#define CYG_TRACE5X( _bool_, a,b,c,d,e ) \ |
CYG_TRACE5( _bool_, "%08x %08x %08x %08x %08x", a,b,c,d,e ) |
#define CYG_TRACE6X( _bool_, a,b,c,d,e,f ) \ |
CYG_TRACE6( _bool_, "%08x %08x %08x %08x %08x %08x", \ |
a,b,c,d,e,f ) |
#define CYG_TRACE7X( _bool_, a,b,c,d,e,f,g ) \ |
CYG_TRACE7( _bool_, "%08x %08x %08x %08x %08x %08x %08x", \ |
a,b,c,d,e,f,g ) |
#define CYG_TRACE8X( _bool_, a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( _bool_, "%08x %08x %08x %08x %08x %08x %08x %08x", \ |
a,b,c,d,e,f,g,h ) |
|
#define CYG_TRACE1XV( _bool_, a ) \ |
CYG_TRACE1( _bool_, # a "=%08x ", a ) |
#define CYG_TRACE2XV( _bool_, a,b ) \ |
CYG_TRACE2( _bool_, \ |
# a "=%08x " # b "=%08x " , a,b ) |
#define CYG_TRACE3XV( _bool_, a,b,c ) \ |
CYG_TRACE3( _bool_, \ |
# a "=%08x " # b "=%08x " # c "=%08x " , a,b,c ) |
#define CYG_TRACE4XV( _bool_, a,b,c,d ) \ |
CYG_TRACE4( _bool_, \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
, a,b,c,d ) |
#define CYG_TRACE5XV( _bool_, a,b,c,d,e ) \ |
CYG_TRACE5( _bool_, \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " \ |
, a,b,c,d,e ) |
#define CYG_TRACE6XV( _bool_, a,b,c,d,e,f ) \ |
CYG_TRACE6( _bool_, \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " # f "=%08x " \ |
, a,b,c,d,e,f ) |
#define CYG_TRACE7XV( _bool_, a,b,c,d,e,f,g ) \ |
CYG_TRACE7( _bool_, \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " # f "=%08x " # g "=%08x " \ |
, a,b,c,d,e,f,g ) |
#define CYG_TRACE8XV( _bool_, a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( _bool_, \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " # f "=%08x " # g "=%08x " # h "=%08x " \ |
, a,b,c,d,e,f,g,h ) |
|
#define CYG_TRACE1XB( a ) \ |
CYG_TRACE1( CYG_TRACE_USER_BOOL, "%08x", a ) |
#define CYG_TRACE2XB( a,b ) \ |
CYG_TRACE2( CYG_TRACE_USER_BOOL, "%08x %08x", a,b ) |
#define CYG_TRACE3XB( a,b,c ) \ |
CYG_TRACE3( CYG_TRACE_USER_BOOL, "%08x %08x %08x", a,b,c ) |
#define CYG_TRACE4XB( a,b,c,d ) \ |
CYG_TRACE4( CYG_TRACE_USER_BOOL, "%08x %08x %08x %08x", a,b,c,d ) |
#define CYG_TRACE5XB( a,b,c,d,e ) \ |
CYG_TRACE5( CYG_TRACE_USER_BOOL, "%08x %08x %08x %08x %08x", a,b,c,d,e ) |
#define CYG_TRACE6XB( a,b,c,d,e,f ) \ |
CYG_TRACE6( CYG_TRACE_USER_BOOL, "%08x %08x %08x %08x %08x %08x", \ |
a,b,c,d,e,f ) |
#define CYG_TRACE7XB( a,b,c,d,e,f,g ) \ |
CYG_TRACE7( CYG_TRACE_USER_BOOL, "%08x %08x %08x %08x %08x %08x %08x", \ |
a,b,c,d,e,f,g ) |
#define CYG_TRACE8XB( a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( CYG_TRACE_USER_BOOL, "%08x %08x %08x %08x %08x %08x %08x %08x", \ |
a,b,c,d,e,f,g,h ) |
|
#define CYG_TRACE1XVB( a ) \ |
CYG_TRACE1( CYG_TRACE_USER_BOOL, # a "=%08x ", a ) |
#define CYG_TRACE2XVB( a,b ) \ |
CYG_TRACE2( CYG_TRACE_USER_BOOL, \ |
# a "=%08x " # b "=%08x " , a,b ) |
#define CYG_TRACE3XVB( a,b,c ) \ |
CYG_TRACE3( CYG_TRACE_USER_BOOL, \ |
# a "=%08x " # b "=%08x " # c "=%08x " , a,b,c ) |
#define CYG_TRACE4XVB( a,b,c,d ) \ |
CYG_TRACE4( CYG_TRACE_USER_BOOL, \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
, a,b,c,d ) |
#define CYG_TRACE5XVB( a,b,c,d,e ) \ |
CYG_TRACE5( CYG_TRACE_USER_BOOL, \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " \ |
, a,b,c,d,e ) |
#define CYG_TRACE6XVB( a,b,c,d,e,f ) \ |
CYG_TRACE6( CYG_TRACE_USER_BOOL, \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " # f "=%08x " \ |
, a,b,c,d,e,f ) |
#define CYG_TRACE7XVB( a,b,c,d,e,f,g ) \ |
CYG_TRACE7( CYG_TRACE_USER_BOOL, \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " # f "=%08x " # g "=%08x " \ |
, a,b,c,d,e,f,g ) |
#define CYG_TRACE8XVB( a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( CYG_TRACE_USER_BOOL, \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " # f "=%08x " # g "=%08x " # h "=%08x " \ |
, a,b,c,d,e,f,g,h ) |
|
// decimal versions |
|
#define CYG_TRACE1D( _bool_, a ) \ |
CYG_TRACE1( _bool_, "%d", a ) |
#define CYG_TRACE2D( _bool_, a,b ) \ |
CYG_TRACE2( _bool_, "%d %d", a,b ) |
#define CYG_TRACE3D( _bool_, a,b,c ) \ |
CYG_TRACE3( _bool_, "%d %d %d", a,b,c ) |
#define CYG_TRACE4D( _bool_, a,b,c,d ) \ |
CYG_TRACE4( _bool_, "%d %d %d %d", a,b,c,d ) |
#define CYG_TRACE5D( _bool_, a,b,c,d,e ) \ |
CYG_TRACE5( _bool_, "%d %d %d %d %d", a,b,c,d,e ) |
#define CYG_TRACE6D( _bool_, a,b,c,d,e,f ) \ |
CYG_TRACE6( _bool_, "%d %d %d %d %d %d", \ |
a,b,c,d,e,f ) |
#define CYG_TRACE7D( _bool_, a,b,c,d,e,f,g ) \ |
CYG_TRACE7( _bool_, "%d %d %d %d %d %d %d", \ |
a,b,c,d,e,f,g ) |
#define CYG_TRACE8D( _bool_, a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( _bool_, "%d %d %d %d %d %d %d %d", \ |
a,b,c,d,e,f,g,h ) |
|
#define CYG_TRACE1DV( _bool_, a ) \ |
CYG_TRACE1( _bool_, # a "=%d ", a ) |
#define CYG_TRACE2DV( _bool_, a,b ) \ |
CYG_TRACE2( _bool_, \ |
# a "=%d " # b "=%d " , a,b ) |
#define CYG_TRACE3DV( _bool_, a,b,c ) \ |
CYG_TRACE3( _bool_, \ |
# a "=%d " # b "=%d " # c "=%d " , a,b,c ) |
#define CYG_TRACE4DV( _bool_, a,b,c,d ) \ |
CYG_TRACE4( _bool_, \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
, a,b,c,d ) |
#define CYG_TRACE5DV( _bool_, a,b,c,d,e ) \ |
CYG_TRACE5( _bool_, \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " \ |
, a,b,c,d,e ) |
#define CYG_TRACE6DV( _bool_, a,b,c,d,e,f ) \ |
CYG_TRACE6( _bool_, \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " # f "=%d " \ |
, a,b,c,d,e,f ) |
#define CYG_TRACE7DV( _bool_, a,b,c,d,e,f,g ) \ |
CYG_TRACE7( _bool_, \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " # f "=%d " # g "=%d " \ |
, a,b,c,d,e,f,g ) |
#define CYG_TRACE8DV( _bool_, a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( _bool_, \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " # f "=%d " # g "=%d " # h "=%d " \ |
, a,b,c,d,e,f,g,h ) |
|
#define CYG_TRACE1DB( a ) \ |
CYG_TRACE1( CYG_TRACE_USER_BOOL, "%d", a ) |
#define CYG_TRACE2DB( a,b ) \ |
CYG_TRACE2( CYG_TRACE_USER_BOOL, "%d %d", a,b ) |
#define CYG_TRACE3DB( a,b,c ) \ |
CYG_TRACE3( CYG_TRACE_USER_BOOL, "%d %d %d", a,b,c ) |
#define CYG_TRACE4DB( a,b,c,d ) \ |
CYG_TRACE4( CYG_TRACE_USER_BOOL, "%d %d %d %d", a,b,c,d ) |
#define CYG_TRACE5DB( a,b,c,d,e ) \ |
CYG_TRACE5( CYG_TRACE_USER_BOOL, "%d %d %d %d %d", a,b,c,d,e ) |
#define CYG_TRACE6DB( a,b,c,d,e,f ) \ |
CYG_TRACE6( CYG_TRACE_USER_BOOL, "%d %d %d %d %d %d", \ |
a,b,c,d,e,f ) |
#define CYG_TRACE7DB( a,b,c,d,e,f,g ) \ |
CYG_TRACE7( CYG_TRACE_USER_BOOL, "%d %d %d %d %d %d %d", \ |
a,b,c,d,e,f,g ) |
#define CYG_TRACE8DB( a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( CYG_TRACE_USER_BOOL, "%d %d %d %d %d %d %d %d", \ |
a,b,c,d,e,f,g,h ) |
|
#define CYG_TRACE1DVB( a ) \ |
CYG_TRACE1( CYG_TRACE_USER_BOOL, # a "=%d ", a ) |
#define CYG_TRACE2DVB( a,b ) \ |
CYG_TRACE2( CYG_TRACE_USER_BOOL, \ |
# a "=%d " # b "=%d " , a,b ) |
#define CYG_TRACE3DVB( a,b,c ) \ |
CYG_TRACE3( CYG_TRACE_USER_BOOL, \ |
# a "=%d " # b "=%d " # c "=%d " , a,b,c ) |
#define CYG_TRACE4DVB( a,b,c,d ) \ |
CYG_TRACE4( CYG_TRACE_USER_BOOL, \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
, a,b,c,d ) |
#define CYG_TRACE5DVB( a,b,c,d,e ) \ |
CYG_TRACE5( CYG_TRACE_USER_BOOL, \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " \ |
, a,b,c,d,e ) |
#define CYG_TRACE6DVB( a,b,c,d,e,f ) \ |
CYG_TRACE6( CYG_TRACE_USER_BOOL, \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " # f "=%d " \ |
, a,b,c,d,e,f ) |
#define CYG_TRACE7DVB( a,b,c,d,e,f,g ) \ |
CYG_TRACE7( CYG_TRACE_USER_BOOL, \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " # f "=%d " # g "=%d " \ |
, a,b,c,d,e,f,g ) |
#define CYG_TRACE8DVB( a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( CYG_TRACE_USER_BOOL, \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " # f "=%d " # g "=%d " # h "=%d " \ |
, a,b,c,d,e,f,g,h ) |
|
// short hex versions |
|
#define CYG_TRACE1Y( _bool_, a ) \ |
CYG_TRACE1( _bool_, "%x", a ) |
#define CYG_TRACE2Y( _bool_, a,b ) \ |
CYG_TRACE2( _bool_, "%x %x", a,b ) |
#define CYG_TRACE3Y( _bool_, a,b,c ) \ |
CYG_TRACE3( _bool_, "%x %x %x", a,b,c ) |
#define CYG_TRACE4Y( _bool_, a,b,c,d ) \ |
CYG_TRACE4( _bool_, "%x %x %x %x", a,b,c,d ) |
#define CYG_TRACE5Y( _bool_, a,b,c,d,e ) \ |
CYG_TRACE5( _bool_, "%x %x %x %x %x", a,b,c,d,e ) |
#define CYG_TRACE6Y( _bool_, a,b,c,d,e,f ) \ |
CYG_TRACE6( _bool_, "%x %x %x %x %x %x", \ |
a,b,c,d,e,f ) |
#define CYG_TRACE7Y( _bool_, a,b,c,d,e,f,g ) \ |
CYG_TRACE7( _bool_, "%x %x %x %x %x %x %x", \ |
a,b,c,d,e,f,g ) |
#define CYG_TRACE8Y( _bool_, a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( _bool_, "%x %x %x %x %x %x %x %x", \ |
a,b,c,d,e,f,g,h ) |
|
#define CYG_TRACE1YV( _bool_, a ) \ |
CYG_TRACE1( _bool_, # a "=%x ", a ) |
#define CYG_TRACE2YV( _bool_, a,b ) \ |
CYG_TRACE2( _bool_, \ |
# a "=%x " # b "=%x " , a,b ) |
#define CYG_TRACE3YV( _bool_, a,b,c ) \ |
CYG_TRACE3( _bool_, \ |
# a "=%x " # b "=%x " # c "=%x " , a,b,c ) |
#define CYG_TRACE4YV( _bool_, a,b,c,d ) \ |
CYG_TRACE4( _bool_, \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
, a,b,c,d ) |
#define CYG_TRACE5YV( _bool_, a,b,c,d,e ) \ |
CYG_TRACE5( _bool_, \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " \ |
, a,b,c,d,e ) |
#define CYG_TRACE6YV( _bool_, a,b,c,d,e,f ) \ |
CYG_TRACE6( _bool_, \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " # f "=%x " \ |
, a,b,c,d,e,f ) |
#define CYG_TRACE7YV( _bool_, a,b,c,d,e,f,g ) \ |
CYG_TRACE7( _bool_, \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " # f "=%x " # g "=%x " \ |
, a,b,c,d,e,f,g ) |
#define CYG_TRACE8YV( _bool_, a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( _bool_, \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " # f "=%x " # g "=%x " # h "=%x " \ |
, a,b,c,d,e,f,g,h ) |
|
#define CYG_TRACE1YB( a ) \ |
CYG_TRACE1( CYG_TRACE_USER_BOOL, "%x", a ) |
#define CYG_TRACE2YB( a,b ) \ |
CYG_TRACE2( CYG_TRACE_USER_BOOL, "%x %x", a,b ) |
#define CYG_TRACE3YB( a,b,c ) \ |
CYG_TRACE3( CYG_TRACE_USER_BOOL, "%x %x %x", a,b,c ) |
#define CYG_TRACE4YB( a,b,c,d ) \ |
CYG_TRACE4( CYG_TRACE_USER_BOOL, "%x %x %x %x", a,b,c,d ) |
#define CYG_TRACE5YB( a,b,c,d,e ) \ |
CYG_TRACE5( CYG_TRACE_USER_BOOL, "%x %x %x %x %x", a,b,c,d,e ) |
#define CYG_TRACE6YB( a,b,c,d,e,f ) \ |
CYG_TRACE6( CYG_TRACE_USER_BOOL, "%x %x %x %x %x %x", \ |
a,b,c,d,e,f ) |
#define CYG_TRACE7YB( a,b,c,d,e,f,g ) \ |
CYG_TRACE7( CYG_TRACE_USER_BOOL, "%x %x %x %x %x %x %x", \ |
a,b,c,d,e,f,g ) |
#define CYG_TRACE8YB( a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( CYG_TRACE_USER_BOOL, "%x %x %x %x %x %x %x %x", \ |
a,b,c,d,e,f,g,h ) |
|
#define CYG_TRACE1YVB( a ) \ |
CYG_TRACE1( CYG_TRACE_USER_BOOL, # a "=%x ", a ) |
#define CYG_TRACE2YVB( a,b ) \ |
CYG_TRACE2( CYG_TRACE_USER_BOOL, \ |
# a "=%x " # b "=%x " , a,b ) |
#define CYG_TRACE3YVB( a,b,c ) \ |
CYG_TRACE3( CYG_TRACE_USER_BOOL, \ |
# a "=%x " # b "=%x " # c "=%x " , a,b,c ) |
#define CYG_TRACE4YVB( a,b,c,d ) \ |
CYG_TRACE4( CYG_TRACE_USER_BOOL, \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
, a,b,c,d ) |
#define CYG_TRACE5YVB( a,b,c,d,e ) \ |
CYG_TRACE5( CYG_TRACE_USER_BOOL, \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " \ |
, a,b,c,d,e ) |
#define CYG_TRACE6YVB( a,b,c,d,e,f ) \ |
CYG_TRACE6( CYG_TRACE_USER_BOOL, \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " # f "=%x " \ |
, a,b,c,d,e,f ) |
#define CYG_TRACE7YVB( a,b,c,d,e,f,g ) \ |
CYG_TRACE7( CYG_TRACE_USER_BOOL, \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " # f "=%x " # g "=%x " \ |
, a,b,c,d,e,f,g ) |
#define CYG_TRACE8YVB( a,b,c,d,e,f,g,h ) \ |
CYG_TRACE8( CYG_TRACE_USER_BOOL, \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " # f "=%x " # g "=%x " # h "=%x " \ |
, a,b,c,d,e,f,g,h ) |
|
// ------------------------------------------------------------------------- |
// |
// CYG_REPORT_FUNCARGn{[XDY]{V}} |
// |
// Convenience macros two: these fall into a few dimensions, with suffix letters: |
// First option: |
// X: user need not supply a format string, %08x is used |
// D: ditto but signed decimal, %d |
// Y: ditto but just plain %x |
// Second option, only meaningful with one of XDY: |
// V: "<var> = %..." is used, by stringifying the argument |
|
// long hex versions |
|
#define CYG_REPORT_FUNCARG1X( a ) \ |
CYG_REPORT_FUNCARG1( "%08x", a ) |
#define CYG_REPORT_FUNCARG2X( a,b ) \ |
CYG_REPORT_FUNCARG2( "%08x %08x", a,b ) |
#define CYG_REPORT_FUNCARG3X( a,b,c ) \ |
CYG_REPORT_FUNCARG3( "%08x %08x %08x", a,b,c ) |
#define CYG_REPORT_FUNCARG4X( a,b,c,d ) \ |
CYG_REPORT_FUNCARG4( "%08x %08x %08x %08x", a,b,c,d ) |
#define CYG_REPORT_FUNCARG5X( a,b,c,d,e ) \ |
CYG_REPORT_FUNCARG5( "%08x %08x %08x %08x %08x", a,b,c,d,e ) |
#define CYG_REPORT_FUNCARG6X( a,b,c,d,e,f ) \ |
CYG_REPORT_FUNCARG6( "%08x %08x %08x %08x %08x %08x", \ |
a,b,c,d,e,f ) |
#define CYG_REPORT_FUNCARG7X( a,b,c,d,e,f,g ) \ |
CYG_REPORT_FUNCARG7( "%08x %08x %08x %08x %08x %08x %08x", \ |
a,b,c,d,e,f,g ) |
#define CYG_REPORT_FUNCARG8X( a,b,c,d,e,f,g,h ) \ |
CYG_REPORT_FUNCARG8( "%08x %08x %08x %08x %08x %08x %08x %08x", \ |
a,b,c,d,e,f,g,h ) |
|
#define CYG_REPORT_FUNCARG1XV( a ) \ |
CYG_REPORT_FUNCARG1( # a "=%08x ", a ) |
#define CYG_REPORT_FUNCARG2XV( a,b ) \ |
CYG_REPORT_FUNCARG2( \ |
# a "=%08x " # b "=%08x " , a,b ) |
#define CYG_REPORT_FUNCARG3XV( a,b,c ) \ |
CYG_REPORT_FUNCARG3( \ |
# a "=%08x " # b "=%08x " # c "=%08x " , a,b,c ) |
#define CYG_REPORT_FUNCARG4XV( a,b,c,d ) \ |
CYG_REPORT_FUNCARG4( \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
, a,b,c,d ) |
#define CYG_REPORT_FUNCARG5XV( a,b,c,d,e ) \ |
CYG_REPORT_FUNCARG5( \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " \ |
, a,b,c,d,e ) |
#define CYG_REPORT_FUNCARG6XV( a,b,c,d,e,f ) \ |
CYG_REPORT_FUNCARG6( \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " # f "=%08x " \ |
, a,b,c,d,e,f ) |
#define CYG_REPORT_FUNCARG7XV( a,b,c,d,e,f,g ) \ |
CYG_REPORT_FUNCARG7( \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " # f "=%08x " # g "=%08x " \ |
, a,b,c,d,e,f,g ) |
#define CYG_REPORT_FUNCARG8XV( a,b,c,d,e,f,g,h ) \ |
CYG_REPORT_FUNCARG8( \ |
# a "=%08x " # b "=%08x " # c "=%08x " # d "=%08x " \ |
# e "=%08x " # f "=%08x " # g "=%08x " # h "=%08x " \ |
, a,b,c,d,e,f,g,h ) |
|
// decimal versions |
|
|
#define CYG_REPORT_FUNCARG1D( a ) \ |
CYG_REPORT_FUNCARG1( "%d", a ) |
#define CYG_REPORT_FUNCARG2D( a,b ) \ |
CYG_REPORT_FUNCARG2( "%d %d", a,b ) |
#define CYG_REPORT_FUNCARG3D( a,b,c ) \ |
CYG_REPORT_FUNCARG3( "%d %d %d", a,b,c ) |
#define CYG_REPORT_FUNCARG4D( a,b,c,d ) \ |
CYG_REPORT_FUNCARG4( "%d %d %d %d", a,b,c,d ) |
#define CYG_REPORT_FUNCARG5D( a,b,c,d,e ) \ |
CYG_REPORT_FUNCARG5( "%d %d %d %d %d", a,b,c,d,e ) |
#define CYG_REPORT_FUNCARG6D( a,b,c,d,e,f ) \ |
CYG_REPORT_FUNCARG6( "%d %d %d %d %d %d", \ |
a,b,c,d,e,f ) |
#define CYG_REPORT_FUNCARG7D( a,b,c,d,e,f,g ) \ |
CYG_REPORT_FUNCARG7( "%d %d %d %d %d %d %d", \ |
a,b,c,d,e,f,g ) |
#define CYG_REPORT_FUNCARG8D( a,b,c,d,e,f,g,h ) \ |
CYG_REPORT_FUNCARG8( "%d %d %d %d %d %d %d %d", \ |
a,b,c,d,e,f,g,h ) |
|
#define CYG_REPORT_FUNCARG1DV( a ) \ |
CYG_REPORT_FUNCARG1( # a "=%d ", a ) |
#define CYG_REPORT_FUNCARG2DV( a,b ) \ |
CYG_REPORT_FUNCARG2( \ |
# a "=%d " # b "=%d " , a,b ) |
#define CYG_REPORT_FUNCARG3DV( a,b,c ) \ |
CYG_REPORT_FUNCARG3( \ |
# a "=%d " # b "=%d " # c "=%d " , a,b,c ) |
#define CYG_REPORT_FUNCARG4DV( a,b,c,d ) \ |
CYG_REPORT_FUNCARG4( \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
, a,b,c,d ) |
#define CYG_REPORT_FUNCARG5DV( a,b,c,d,e ) \ |
CYG_REPORT_FUNCARG5( \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " \ |
, a,b,c,d,e ) |
#define CYG_REPORT_FUNCARG6DV( a,b,c,d,e,f ) \ |
CYG_REPORT_FUNCARG6( \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " # f "=%d " \ |
, a,b,c,d,e,f ) |
#define CYG_REPORT_FUNCARG7DV( a,b,c,d,e,f,g ) \ |
CYG_REPORT_FUNCARG7( \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " # f "=%d " # g "=%d " \ |
, a,b,c,d,e,f,g ) |
#define CYG_REPORT_FUNCARG8DV( a,b,c,d,e,f,g,h ) \ |
CYG_REPORT_FUNCARG8( \ |
# a "=%d " # b "=%d " # c "=%d " # d "=%d " \ |
# e "=%d " # f "=%d " # g "=%d " # h "=%d " \ |
, a,b,c,d,e,f,g,h ) |
|
// short hex versions |
|
#define CYG_REPORT_FUNCARG1Y( a ) \ |
CYG_REPORT_FUNCARG1( "%x", a ) |
#define CYG_REPORT_FUNCARG2Y( a,b ) \ |
CYG_REPORT_FUNCARG2( "%x %x", a,b ) |
#define CYG_REPORT_FUNCARG3Y( a,b,c ) \ |
CYG_REPORT_FUNCARG3( "%x %x %x", a,b,c ) |
#define CYG_REPORT_FUNCARG4Y( a,b,c,d ) \ |
CYG_REPORT_FUNCARG4( "%x %x %x %x", a,b,c,d ) |
#define CYG_REPORT_FUNCARG5Y( a,b,c,d,e ) \ |
CYG_REPORT_FUNCARG5( "%x %x %x %x %x", a,b,c,d,e ) |
#define CYG_REPORT_FUNCARG6Y( a,b,c,d,e,f ) \ |
CYG_REPORT_FUNCARG6( "%x %x %x %x %x %x", \ |
a,b,c,d,e,f ) |
#define CYG_REPORT_FUNCARG7Y( a,b,c,d,e,f,g ) \ |
CYG_REPORT_FUNCARG7( "%x %x %x %x %x %x %x", \ |
a,b,c,d,e,f,g ) |
#define CYG_REPORT_FUNCARG8Y( a,b,c,d,e,f,g,h ) \ |
CYG_REPORT_FUNCARG8( "%x %x %x %x %x %x %x %x", \ |
a,b,c,d,e,f,g,h ) |
|
#define CYG_REPORT_FUNCARG1YV( a ) \ |
CYG_REPORT_FUNCARG1( # a "=%x ", a ) |
#define CYG_REPORT_FUNCARG2YV( a,b ) \ |
CYG_REPORT_FUNCARG2( \ |
# a "=%x " # b "=%x " , a,b ) |
#define CYG_REPORT_FUNCARG3YV( a,b,c ) \ |
CYG_REPORT_FUNCARG3( \ |
# a "=%x " # b "=%x " # c "=%x " , a,b,c ) |
#define CYG_REPORT_FUNCARG4YV( a,b,c,d ) \ |
CYG_REPORT_FUNCARG4( \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
, a,b,c,d ) |
#define CYG_REPORT_FUNCARG5YV( a,b,c,d,e ) \ |
CYG_REPORT_FUNCARG5( \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " \ |
, a,b,c,d,e ) |
#define CYG_REPORT_FUNCARG6YV( a,b,c,d,e,f ) \ |
CYG_REPORT_FUNCARG6( \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " # f "=%x " \ |
, a,b,c,d,e,f ) |
#define CYG_REPORT_FUNCARG7YV( a,b,c,d,e,f,g ) \ |
CYG_REPORT_FUNCARG7( \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " # f "=%x " # g "=%x " \ |
, a,b,c,d,e,f,g ) |
#define CYG_REPORT_FUNCARG8YV( a,b,c,d,e,f,g,h ) \ |
CYG_REPORT_FUNCARG8( \ |
# a "=%x " # b "=%x " # c "=%x " # d "=%x " \ |
# e "=%x " # f "=%x " # g "=%x " # h "=%x " \ |
, a,b,c,d,e,f,g,h ) |
|
|
#endif // CYGONCE_INFRA_CYG_TRAC_H multiple inclusion protection |
// EOF cyg_trac.h |
/include/testcase.h
0,0 → 1,199
#ifndef CYGONCE_INFRA_TESTCASE_H |
#define CYGONCE_INFRA_TESTCASE_H |
//========================================================================== |
// |
// testcase.h |
// |
// Target side interface for tests |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): ctarpy |
// Contributors: ctarpy, jlarmour |
// Date: 1999-02-16 |
// |
// |
//####DESCRIPTIONEND#### |
|
#include <cyg/infra/cyg_type.h> // Common type definitions and support |
|
|
// CONSTANTS |
|
// Status codes |
|
typedef enum { |
CYGNUM_TEST_FAIL, |
CYGNUM_TEST_PASS, |
CYGNUM_TEST_EXIT, |
CYGNUM_TEST_INFO, |
CYGNUM_TEST_GDBCMD, |
CYGNUM_TEST_NA |
} Cyg_test_code; |
|
// FUNCTION PROTOTYPES |
|
externC void |
cyg_test_output(Cyg_test_code _status_, const char* _msg_, int _line_number_, |
const char* _file_); |
|
// This should be called at the start of each test file |
externC void |
cyg_test_init(void); |
|
// This causes the test to exit |
externC void |
cyg_test_exit(void) CYGBLD_ATTRIB_NORET; |
|
// GLOBALS |
|
externC int cyg_test_is_simulator; // infrastructure changes as necessary |
|
// MACROS |
|
// ----------- Info ----------- |
// |
// Any macro with EXIT in it should only be used in a panic situation. It |
// is synonymous with assert. If the test behaves as expected, it |
// should call one of the FINISH macros. |
// |
// - Compound testcases |
// If a testcase is capable of being part of a compound, then the following |
// rules apply: |
// - The testcase must only ever call one of the EXIT macros if it decides |
// the state of the system is such that further testing is meaningless; |
// such a call would prevent subsequent tests in the compound from being |
// run. |
// - In order to terminate the test, the testcase should call one of the |
// FINISH macros. This must be done from within main(). |
|
|
|
|
// The following is the testcase API to be used by testcases. |
|
#define CYG_TEST_INIT() cyg_test_init() |
|
#define CYG_TEST_INFO( _msg_ ) \ |
cyg_test_output(CYGNUM_TEST_INFO, _msg_, __LINE__, __FILE__) |
|
#define CYG_TEST_PASS( _msg_ ) \ |
cyg_test_output(CYGNUM_TEST_PASS, _msg_, __LINE__, __FILE__) |
|
#define CYG_TEST_FAIL( _msg_ ) \ |
cyg_test_output(CYGNUM_TEST_FAIL, _msg_, __LINE__, __FILE__) |
|
#define CYG_TEST_EXIT( _msg_ ) \ |
(cyg_test_output(CYGNUM_TEST_EXIT, _msg_, __LINE__, __FILE__), \ |
cyg_test_exit()) |
|
// Use the following macro to instruct GDB to run a command when using |
// the automatic testing infrastructure. This must be used *before* |
// CYG_TEST_INIT() is called |
|
#define CYG_TEST_GDBCMD( _command_ ) \ |
CYG_MACRO_START \ |
cyg_test_output(CYGNUM_TEST_GDBCMD, _command_, __LINE__, __FILE__); \ |
CYG_MACRO_END |
|
// Use the following macro to declare that a test is not applicable for |
// some reason - perhaps not appropriate due to chosen hardware, |
// configuration options governing the presence of a tested feature, or |
// even configuration options governing the presence of a feature the |
// test relies on _in_order_ to test the feature (despite being |
// unrelated!) |
|
#define CYG_TEST_NA( _msg_ ) \ |
CYG_MACRO_START \ |
cyg_test_output(CYGNUM_TEST_NA, _msg_, __LINE__, __FILE__); \ |
cyg_test_exit(); \ |
CYG_MACRO_END |
|
#ifdef CYG_COMPOUND_TEST |
# define CYG_TEST_FINISH( _msg_ ) \ |
CYG_MACRO_START \ |
cyg_test_output(CYGNUM_TEST_EXIT, _msg_, __LINE__, __FILE__); \ |
return 0; \ |
CYG_MACRO_END |
#else |
# define CYG_TEST_FINISH( _msg_ ) CYG_TEST_EXIT( _msg_ ) |
#endif |
|
#define CYG_TEST_STILL_ALIVE( _ctr_ , _msg_ ) CYG_TEST_INFO( _msg_ ) |
|
|
// ----- The following are convenience functions |
|
#define CYG_TEST_PASS_FINISH( _msg_ ) \ |
CYG_MACRO_START \ |
CYG_TEST_PASS( _msg_ ); \ |
CYG_TEST_FINISH("done"); \ |
CYG_MACRO_END |
|
#define CYG_TEST_FAIL_FINISH( _msg_ ) \ |
CYG_MACRO_START \ |
CYG_TEST_FAIL( _msg_ ); \ |
CYG_TEST_FINISH("done"); \ |
CYG_MACRO_END |
|
|
#define CYG_TEST_CHECK( _chk_ , _msg_) \ |
CYG_MACRO_START \ |
(void)(( _chk_ ) || ( CYG_TEST_FAIL( _msg_ ) , cyg_test_exit(), 1)); \ |
CYG_MACRO_END |
|
#define CYG_TEST_PASS_FAIL( _cdn_, _msg_ ) \ |
CYG_MACRO_START \ |
if ( _cdn_ ) CYG_TEST_PASS( _msg_ ); else CYG_TEST_FAIL( _msg_ ); \ |
CYG_MACRO_END |
|
|
// CYG_TEST_PASS_EXIT and CYG_TEST_FAIL_EXIT are now obscelete, |
// but are here for now |
// to avoid breaking testcases which still use them. They will |
// soon go away. |
#define CYG_TEST_PASS_EXIT( _msg_ ) \ |
(cyg_test_output(CYGNUM_TEST_PASS, _msg_, __LINE__, __FILE__), \ |
CYG_TEST_EXIT("done")) |
|
#define CYG_TEST_FAIL_EXIT( _msg_ ) \ |
(cyg_test_output(CYGNUM_TEST_FAIL, _msg_, __LINE__, __FILE__), \ |
CYG_TEST_EXIT("done")) |
|
|
#endif // CYGONCE_INFRA_TESTCASE_H |
// EOF testcase.h |
/include/clist.hxx
0,0 → 1,365
#ifndef CYGONCE_INFRA_CLIST_HXX |
#define CYGONCE_INFRA_CLIST_HXX |
|
//========================================================================== |
// |
// clist.hxx |
// |
// Standard types, and some useful coding macros. |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg |
// Contributors: nickg |
// Date: 2000-11-08 |
// Purpose: Simple circular list implementation |
// Description: A simple implementation of circular lists. |
// Usage: #include "cyg/infra/clist.hxx" |
// ... |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#include <cyg/infra/cyg_type.h> |
|
// ------------------------------------------------------------------------- |
// Class and structure conversion macros. |
// CYG_CLASSFROMFIELD translates a pointer to a field of a struct or |
// class into a pointer to the class. |
// CYG_OFFSETOFBASE yields the offset of a base class of a derived |
// class. |
// CYG_CLASSFROMBASE translates a pointer to a base class into a pointer |
// to a selected derived class. The base class object _must_ be part of |
// the specified derived class. This is essentially a poor mans version |
// of the RTTI dynamic_cast operator. |
// Caveat: These macros do not work for virtual base classes. |
|
// Note: These definitions are exact duplicates of definitions in |
// ktypes.h. If either definition is changed, the other should be too |
// to avoid compiler messages. |
|
#define CYG_CLASSFROMFIELD(_type_,_member_,_ptr_)\ |
((_type_ *)((char *)(_ptr_)-((char *)&(((_type_ *)0)->_member_)))) |
|
#define CYG_OFFSETOFBASE(_type_,_base_)\ |
((char *)((_base_ *)((_type_ *)4)) - (char *)4) |
|
# define CYG_CLASSFROMBASE(_class_,_base_,_ptr_)\ |
((_class_ *)((char *)(_ptr_) - CYG_OFFSETOFBASE(_class_,_base_))) |
|
|
// ------------------------------------------------------------------------- |
// Cyg_DNode class. |
// This simply represents a double linked node that is intended to |
// be a base member of the class that is being managed. |
|
class Cyg_DNode |
{ |
friend class Cyg_CList; |
|
Cyg_DNode *next; |
Cyg_DNode *prev; |
|
public: |
|
Cyg_DNode() |
{ |
// Initialize pointers to point here |
next = prev = this; |
}; |
|
// Accessor and test functions |
Cyg_DNode *get_next() { return next; }; |
Cyg_DNode *get_prev() { return prev; }; |
cyg_bool in_list() { return next != this; }; |
|
// Insert a node into the list before this one, |
// so that it becomes this nodes predecessor in |
// the list. |
void insert( Cyg_DNode *node ) |
{ |
node->next = this; |
node->prev = prev; |
prev->next = node; |
prev = node; |
}; |
|
// Append a node after this one so that it become |
// this nodes sucessor in the list. |
void append( Cyg_DNode *node ) |
{ |
node->prev = this; |
node->next = next; |
next->prev = node; |
next = node; |
}; |
|
// Unlink this node from it's list. It is safe to apply this to an |
// already unlinked node. |
void unlink() |
{ |
next->prev = prev; |
prev->next = next; |
next = prev = this; |
}; |
|
~Cyg_DNode() |
{ |
// If this node is still linked, unlink it. |
if( next != this ) |
unlink(); |
}; |
|
}; |
|
// ------------------------------------------------------------------------- |
// Cyg_CList class. |
|
// This is a simple class that manages a circular list of DNodes. This |
// object points to the head of the list and provides functions to |
// manipulate the head and tail of the list. |
|
class Cyg_CList |
{ |
Cyg_DNode *head; // list head pointer |
|
public: |
|
Cyg_CList() |
{ |
head = NULL; |
}; |
|
// Accessor and test functions |
Cyg_DNode *get_head() { return head; }; |
Cyg_DNode *get_tail() { return head?head->prev:NULL; }; |
cyg_bool empty() { return head == NULL; }; |
|
// Add a node at the head of the list |
void add_head( Cyg_DNode *node ) |
{ |
if( head == NULL ) |
head = node; |
else |
{ |
head->insert( node ); |
head = node; |
} |
}; |
|
// Remove the node at the head of the list |
Cyg_DNode *rem_head() |
{ |
Cyg_DNode *node = head; |
if( node != NULL ) |
{ |
// There is a node available |
Cyg_DNode *next = node->next; |
if( next == node ) |
{ |
// Only node on list |
head = NULL; |
} |
else |
{ |
// remove head node and move head to next. |
node->unlink(); |
head = next; |
} |
} |
return node; |
}; |
|
|
// Add a node at the tail of the list |
void add_tail( Cyg_DNode *node ) |
{ |
if( head == NULL ) |
head = node; |
else |
head->insert( node ); |
}; |
|
// Remove the node at the tail of the list |
Cyg_DNode *rem_tail() |
{ |
if( head == NULL ) |
return NULL; |
|
Cyg_DNode *node = head->prev; |
|
if( node == head ) |
head = NULL; |
else node->unlink(); |
|
return node; |
}; |
|
// Merge the supplied list into this one, at the tail. |
void merge( Cyg_CList& list ) |
{ |
if( list.head == NULL ) |
return; // Nothing to do |
else if( head == NULL ) |
head = list.head; // this is empty, just move it |
else |
{ |
// We have a real merge to do. Adjust the pointers |
// on the two lists so that they become one. |
|
Cyg_DNode *lh = list.head; |
Cyg_DNode *lt = lh->prev; |
Cyg_DNode *tail = head->prev; |
|
head->prev = lt; |
lt->next = head; |
tail->next = lh; |
lh->prev = tail; |
} |
list.head = NULL; |
}; |
|
// General removal. Deals with what happend if this is only |
// object on list, or is the head. |
void remove( Cyg_DNode *node ) |
{ |
if( node == head ) |
rem_head(); |
else node->unlink(); |
}; |
|
// Rotation - move the head to the next node in the list. |
void rotate() |
{ |
if( head ) |
head = head->next; |
}; |
|
// Move a node to the head of the list. Assumes that the |
// node is in this list. |
void to_head( Cyg_DNode *node ) |
{ |
head = node; |
}; |
|
// Insert a node before one in this list, and deal with what |
// happens if the node happens to be at the head of the list. |
void insert( Cyg_DNode *list_node, Cyg_DNode *node ) |
{ |
if( list_node == head ) |
{ |
head->insert( node ); |
head = node; |
} |
else list_node->insert( node ); |
}; |
|
~Cyg_CList() |
{ |
while( head != NULL ) |
rem_head(); |
}; |
|
}; |
|
// ------------------------------------------------------------------------- |
// Cyg_CList_T |
// Template class that allows us to make use of the CList class in a |
// type-specific way. |
|
template <class T> class Cyg_CList_T |
: public Cyg_CList |
{ |
public: |
|
Cyg_CList_T() {}; |
~Cyg_CList_T() {}; |
|
T *get_head() |
{ |
Cyg_DNode *node = Cyg_CList::get_head(); |
if( node ) return CYG_CLASSFROMBASE( T, Cyg_DNode, node ); |
return NULL; |
}; |
T *get_tail() |
{ |
Cyg_DNode *node = Cyg_CList::get_tail(); |
if( node ) return CYG_CLASSFROMBASE( T, Cyg_DNode, node ); |
return NULL; |
}; |
|
T *rem_head() |
{ |
Cyg_DNode *node = Cyg_CList::rem_head(); |
if( node ) return CYG_CLASSFROMBASE( T, Cyg_DNode, node ); |
return NULL; |
}; |
|
T *rem_tail() |
{ |
Cyg_DNode *node = Cyg_CList::rem_tail(); |
if( node ) return CYG_CLASSFROMBASE( T, Cyg_DNode, node ); |
return NULL; |
}; |
|
// The rest just default to the Cyg_CList class operations. |
}; |
|
// ------------------------------------------------------------------------- |
// Cyg_DNode_T |
// Template class that allows us to make use of the DNode class in a |
// type-specific way. |
|
template <class T> class Cyg_DNode_T |
: public Cyg_DNode |
{ |
public: |
|
Cyg_DNode_T() {}; |
~Cyg_DNode_T() {}; |
|
T *get_next() { return CYG_CLASSFROMBASE( T, Cyg_DNode, Cyg_DNode::get_next() ); }; |
T *get_prev() { return CYG_CLASSFROMBASE( T, Cyg_DNode, Cyg_DNode::get_prev() ); }; |
|
// The rest just default to the Cyg_DNode class operations. |
}; |
|
// ------------------------------------------------------------------------- |
#endif // CYGONCE_INFRA_CLIST_HXX multiple inclusion protection |
// EOF clist.hxx |
|
/include/cyg_type.h
0,0 → 1,433
#ifndef CYGONCE_INFRA_CYG_TYPE_H |
#define CYGONCE_INFRA_CYG_TYPE_H |
|
//========================================================================== |
// |
// cyg_type.h |
// |
// Standard types, and some useful coding macros. |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg from an original by hmt |
// Contributors: nickg |
// Date: 1997-09-08 |
// Purpose: share unambiguously sized types. |
// Description: we typedef [cyg_][u]int8,16,32 &c for general use. |
// Usage: #include "cyg/infra/cyg_type.h" |
// ... |
// cyg_int32 my_32bit_integer; |
// |
//####DESCRIPTIONEND#### |
// |
|
#include <stddef.h> // Definition of NULL from the compiler |
|
// ------------------------------------------------------------------------- |
// Some useful macros. These are defined here by default. |
|
// __externC is used in mixed C/C++ headers to force C linkage on an external |
// definition. It avoids having to put all sorts of ifdefs in. |
|
#ifdef __cplusplus |
# define __externC extern "C" |
#else |
# define __externC extern |
#endif |
// Also define externC for now - but it is deprecated |
#define externC __externC |
|
// ------------------------------------------------------------------------- |
// The header <basetype.h> defines the base types used here. It is |
// supplied either by the target architecture HAL, or by the host |
// porting kit. They are all defined as macros, and only those that |
// make choices other than the defaults given below need be defined. |
|
#define CYG_LSBFIRST 1234 |
#define CYG_MSBFIRST 4321 |
|
#include <cyg/hal/basetype.h> |
|
#if (CYG_BYTEORDER != CYG_LSBFIRST) && (CYG_BYTEORDER != CYG_MSBFIRST) |
# error You must define CYG_BYTEORDER to equal CYG_LSBFIRST or CYG_MSBFIRST |
#endif |
|
#ifndef CYG_DOUBLE_BYTEORDER |
#define CYG_DOUBLE_BYTEORDER CYG_BYTEORDER |
#endif |
|
#ifndef cyg_halint8 |
# define cyg_halint8 char |
#endif |
#ifndef cyg_halint16 |
# define cyg_halint16 short |
#endif |
#ifndef cyg_halint32 |
# define cyg_halint32 int |
#endif |
#ifndef cyg_halint64 |
# define cyg_halint64 long long |
#endif |
|
#ifndef cyg_halcount8 |
# define cyg_halcount8 int |
#endif |
#ifndef cyg_halcount16 |
# define cyg_halcount16 int |
#endif |
#ifndef cyg_halcount32 |
# define cyg_halcount32 int |
#endif |
#ifndef cyg_halcount64 |
# define cyg_halcount64 long long |
#endif |
|
#ifndef cyg_haladdress |
# define cyg_haladdress cyg_uint32 |
#endif |
#ifndef cyg_haladdrword |
# define cyg_haladdrword cyg_uint32 |
#endif |
|
#ifndef cyg_halbool |
# define cyg_halbool int |
#endif |
|
#ifndef cyg_halatomic |
# define cyg_halatomic cyg_halint8 |
#endif |
|
// ------------------------------------------------------------------------- |
// Provide a default architecture alignment |
// This may be overridden in basetype.h if necessary. |
// These should be straightforward numbers to allow use in assembly. |
|
#ifndef CYGARC_ALIGNMENT |
# define CYGARC_ALIGNMENT 8 |
#endif |
// And corresponding power of two alignment |
#ifndef CYGARC_P2ALIGNMENT |
# define CYGARC_P2ALIGNMENT 3 |
#endif |
#if (CYGARC_ALIGNMENT) != (1 << CYGARC_P2ALIGNMENT) |
# error "Inconsistent CYGARC_ALIGNMENT and CYGARC_P2ALIGNMENT values" |
#endif |
|
// ------------------------------------------------------------------------- |
// The obvious few that compilers may define for you. |
// But in case they don't: |
|
#ifndef NULL |
# define NULL 0 |
#endif |
|
#ifndef __cplusplus |
|
typedef cyg_halbool bool; |
|
# ifndef false |
# define false 0 |
# endif |
|
# ifndef true |
# define true (!false) |
# endif |
|
#endif |
|
// ------------------------------------------------------------------------- |
// Allow creation of procedure-like macros that are a single statement, |
// and must be followed by a semi-colon |
|
#define CYG_MACRO_START do { |
#define CYG_MACRO_END } while (0) |
|
#define CYG_EMPTY_STATEMENT CYG_MACRO_START CYG_MACRO_END |
|
#define CYG_UNUSED_PARAM( _type_, _name_ ) CYG_MACRO_START \ |
_type_ __tmp1 = (_name_); \ |
_type_ __tmp2 = __tmp1; \ |
__tmp1 = __tmp2; \ |
CYG_MACRO_END |
|
|
// ------------------------------------------------------------------------- |
// Reference a symbol without explicitly making use of it. Ensures that |
// the object containing the symbol will be included when linking. |
|
#define CYG_REFERENCE_OBJECT(__object__) \ |
CYG_MACRO_START \ |
static void *__cygvar_discard_me__ __attribute__ ((unused)) = \ |
&(__object__); \ |
CYG_MACRO_END |
|
// ------------------------------------------------------------------------- |
// Define basic types for using integers in memory and structures; |
// depends on compiler defaults and CPU type. |
|
typedef unsigned cyg_halint8 cyg_uint8 ; |
typedef signed cyg_halint8 cyg_int8 ; |
|
typedef unsigned cyg_halint16 cyg_uint16 ; |
typedef signed cyg_halint16 cyg_int16 ; |
|
typedef unsigned cyg_halint32 cyg_uint32 ; |
typedef signed cyg_halint32 cyg_int32 ; |
|
typedef unsigned cyg_halint64 cyg_uint64 ; |
typedef signed cyg_halint64 cyg_int64 ; |
|
typedef cyg_halbool cyg_bool ; |
|
// ------------------------------------------------------------------------- |
// Define types for using integers in registers for looping and the like; |
// depends on CPU type, choose what it is most comfortable with, with at |
// least the range required. |
|
typedef unsigned cyg_halcount8 cyg_ucount8 ; |
typedef signed cyg_halcount8 cyg_count8 ; |
|
typedef unsigned cyg_halcount16 cyg_ucount16 ; |
typedef signed cyg_halcount16 cyg_count16 ; |
|
typedef unsigned cyg_halcount32 cyg_ucount32 ; |
typedef signed cyg_halcount32 cyg_count32 ; |
|
typedef unsigned cyg_halcount64 cyg_ucount64 ; |
typedef signed cyg_halcount64 cyg_count64 ; |
|
// ------------------------------------------------------------------------- |
// Define a type to be used for atomic accesses. This type is guaranteed |
// to be read or written in a single uninterruptible operation. This type |
// is at least a single byte. |
|
typedef volatile unsigned cyg_halatomic cyg_atomic; |
typedef volatile unsigned cyg_halatomic CYG_ATOMIC; |
|
// ------------------------------------------------------------------------- |
// Define types for access plain, on-the-metal memory or devices. |
|
typedef cyg_uint32 CYG_WORD; |
typedef cyg_uint8 CYG_BYTE; |
typedef cyg_uint16 CYG_WORD16; |
typedef cyg_uint32 CYG_WORD32; |
typedef cyg_uint64 CYG_WORD64; |
|
typedef cyg_haladdress CYG_ADDRESS; |
typedef cyg_haladdrword CYG_ADDRWORD; |
|
// ------------------------------------------------------------------------- |
// Constructor ordering macros. These are added as annotations to all |
// static objects to order the constuctors appropriately. |
|
#if defined(__cplusplus) && defined(__GNUC__) && \ |
!defined(CYGBLD_ATTRIB_INIT_PRI) |
# define CYGBLD_ATTRIB_INIT_PRI( _pri_ ) __attribute__((init_priority(_pri_))) |
#elif !defined(CYGBLD_ATTRIB_INIT_PRI) |
// FIXME: should maybe just bomb out if this is attempted anywhere else? |
// Not sure |
# define CYGBLD_ATTRIB_INIT_PRI( _pri_ ) |
#endif |
|
// The following will be removed eventually as it doesn't allow the use of |
// e.g. pri+5 format |
#define CYG_INIT_PRIORITY( _pri_ ) CYGBLD_ATTRIB_INIT_PRI( CYG_INIT_##_pri_ ) |
|
#define CYGBLD_ATTRIB_INIT_BEFORE( _pri_ ) CYGBLD_ATTRIB_INIT_PRI(_pri_-100) |
#define CYGBLD_ATTRIB_INIT_AFTER( _pri_ ) CYGBLD_ATTRIB_INIT_PRI(_pri_+100) |
|
#define CYG_INIT_HAL 10000 |
#define CYG_INIT_SCHEDULER 11000 |
#define CYG_INIT_INTERRUPTS 12000 |
#define CYG_INIT_DRIVERS 13000 |
#define CYG_INIT_CLOCK 14000 |
#define CYG_INIT_IDLE_THREAD 15000 |
#define CYG_INIT_THREADS 16000 |
#define CYG_INIT_KERNEL 40000 |
#define CYG_INIT_MEMALLOC 47000 |
#define CYG_INIT_IO 49000 |
#define CYG_INIT_IO_FS 50000 |
#define CYG_INIT_LIBC 52000 |
#define CYG_INIT_COMPAT 55000 |
#define CYG_INIT_APPLICATION 60000 |
#define CYG_INIT_PREDEFAULT 65534 |
#define CYG_INIT_DEFAULT 65535 |
|
// ------------------------------------------------------------------------- |
// Label name macros. Some toolsets generate labels with initial |
// underscores and others don't. CYG_LABEL_NAME should be used on |
// labels in C/C++ code that are defined in assembly code or linker |
// scripts. CYG_LABEL_DEFN is for use in assembly code and linker |
// scripts where we need to manufacture labels that can be used from |
// C/C++. |
// These are default implementations that should work for most targets. |
// They may be overridden in basetype.h if necessary. |
|
#ifndef CYG_LABEL_NAME |
|
#define CYG_LABEL_NAME(_name_) _name_ |
|
#endif |
|
#ifndef CYG_LABEL_DEFN |
|
#define CYG_LABEL_DEFN(_label) _label |
|
#endif |
|
// ------------------------------------------------------------------------- |
// COMPILER-SPECIFIC STUFF |
|
#ifdef __GNUC__ |
// Force a 'C' routine to be called like a 'C++' contructor |
# if !defined(CYGBLD_ATTRIB_CONSTRUCTOR) |
# define CYGBLD_ATTRIB_CONSTRUCTOR __attribute__((constructor)) |
# endif |
|
// Define a compiler-specific rune for saying a function doesn't return |
# if !defined(CYGBLD_ATTRIB_NORET) |
# define CYGBLD_ATTRIB_NORET __attribute__((noreturn)) |
# endif |
|
// How to define weak symbols - this is only relevant for ELF and a.out, |
// but that won't be a problem for eCos |
# if !defined(CYGBLD_ATTRIB_WEAK) |
# define CYGBLD_ATTRIB_WEAK __attribute__ ((weak)) |
# endif |
|
// How to define alias to symbols. Just pass in the symbol itself, not |
// the string name of the symbol |
# if !defined(CYGBLD_ATTRIB_ALIAS) |
# define CYGBLD_ATTRIB_ALIAS(__symbol__) \ |
__attribute__ ((alias (#__symbol__))) |
# endif |
|
// This effectively does the reverse of the previous macro. It defines |
// a name that the attributed variable or function will actually have |
// in assembler. |
# if !defined(CYGBLD_ATTRIB_ASM_ALIAS) |
# define __Str(x) #x |
# define __Xstr(x) __Str(x) |
# define CYGBLD_ATTRIB_ASM_ALIAS(__symbol__) \ |
__asm__ ( __Xstr( CYG_LABEL_DEFN( __symbol__ ) ) ) |
# endif |
|
// Shows that a function returns the same value when given the same args, but |
// note this can't be used if there are pointer args |
# if !defined(CYGBLD_ATTRIB_CONST) |
# define CYGBLD_ATTRIB_CONST __attribute__((const)) |
#endif |
|
// Assign a defined variable to a specific section |
# if !defined(CYGBLD_ATTRIB_SECTION) |
# define CYGBLD_ATTRIB_SECTION(__sect__) __attribute__((section (__sect__))) |
# endif |
|
// Give a type or object explicit minimum alignment |
# if !defined(CYGBLD_ATTRIB_ALIGN) |
# define CYGBLD_ATTRIB_ALIGN(__align__) __attribute__((aligned(__align__))) |
# endif |
|
// Teach compiler how to check format of printf-like functions |
# define CYGBLD_ATTRIB_PRINTF_FORMAT(__format__, __args__) \ |
__attribute__((format (printf, __format__, __args__))) |
|
#else // non-GNU |
|
# define CYGBLD_ATTRIB_CONSTRUCTOR |
|
# define CYGBLD_ATTRIB_NORET |
// This intentionally gives an error only if we actually try to |
// use it. #error would give an error if we simply can't. |
// FIXME: Had to disarm the bomb - the CYGBLD_ATTRIB_WEAK macro is now |
// (indirectly) used in host tools. |
# define CYGBLD_ATTRIB_WEAK /* !!!-- Attribute weak not defined --!!! */ |
|
# define CYGBLD_ATTRIB_ALIAS(__x__) !!!-- Attribute alias not defined --!!! |
|
# define CYGBLD_ATTRIB_ASM_ALIAS(__symbol__) !!!-- Asm alias not defined --!!! |
|
# define CYGBLD_ATTRIB_CONST |
|
# define CYGBLD_ATTRIB_ALIGN(__align__) !!!-- Alignment alias not defined --!!! |
|
# define CYGBLD_ATTRIB_PRINTF_FORMAT(__format__, __args__) |
|
#endif |
|
// How to define weak aliases. Currently this is simply a mixture of the |
// above |
|
# define CYGBLD_ATTRIB_WEAK_ALIAS(__symbol__) \ |
CYGBLD_ATTRIB_WEAK CYGBLD_ATTRIB_ALIAS(__symbol__) |
|
#ifdef __cplusplus |
# define __THROW throw() |
#else |
# define __THROW |
#endif |
|
// ------------------------------------------------------------------------- |
// Variable annotations |
// These annotations may be added to various static variables in the |
// HAL and kernel to indicate which component they belong to. These |
// are used by some targets to optimize memory placement of these |
// variables. |
|
#ifndef CYGBLD_ANNOTATE_VARIABLE_HAL |
#define CYGBLD_ANNOTATE_VARIABLE_HAL |
#endif |
#ifndef CYGBLD_ANNOTATE_VARIABLE_SCHED |
#define CYGBLD_ANNOTATE_VARIABLE_SCHED |
#endif |
#ifndef CYGBLD_ANNOTATE_VARIABLE_CLOCK |
#define CYGBLD_ANNOTATE_VARIABLE_CLOCK |
#endif |
#ifndef CYGBLD_ANNOTATE_VARIABLE_INTR |
#define CYGBLD_ANNOTATE_VARIABLE_INTR |
#endif |
|
// ------------------------------------------------------------------------- |
// Various "flavours" of memory regions that can be described by the |
// Memory Layout Tool (MLT). |
|
#define CYGMEM_REGION_ATTR_R 0x01 // Region can be read |
#define CYGMEM_REGION_ATTR_W 0x02 // Region can be written |
|
// ------------------------------------------------------------------------- |
#endif // CYGONCE_INFRA_CYG_TYPE_H multiple inclusion protection |
// EOF cyg_type.h |
/include/diag.h
0,0 → 1,112
#ifndef CYGONCE_INFRA_DIAG_H |
#define CYGONCE_INFRA_DIAG_H |
|
/*============================================================================= |
// |
// diag.h |
// |
// Diagnostic Routines for Infra Development |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// Copyright (C) 2002 Gary Thomas |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg |
// Contributors: nickg, gthomas |
// Date: 1998-03-02 |
// Purpose: Diagnostic Routines for Infra Development |
// Description: Diagnostic routines for use during infra development. |
// Usage: #include <cyg/infra/diag.h> |
// |
//####DESCRIPTIONEND#### |
// |
//==========================================================================*/ |
|
#include <pkgconf/infra.h> |
#include <cyg/infra/cyg_type.h> |
#include <stdarg.h> |
|
/*---------------------------------------------------------------------------*/ |
/* Diagnostic routines */ |
|
externC void diag_init(void); /* Initialize, call before any others*/ |
|
externC void diag_write_char(char c); /* Write single char to output */ |
|
externC void diag_write_string(const char *psz); /* Write zero terminated string */ |
|
externC void diag_write_dec( cyg_int32 n); /* Write decimal value */ |
|
externC void diag_write_hex( cyg_uint32 n); /* Write hexadecimal value */ |
|
externC void diag_dump_buf(void *buf, CYG_ADDRWORD len); |
externC void diag_dump_buf_32bit(void *buf, CYG_ADDRWORD len); |
externC void diag_dump_buf_16bit(void *buf, CYG_ADDRWORD len); |
typedef int __printf_fun(const char *fmt, ...); |
externC void diag_vdump_buf_with_offset(__printf_fun *pf, |
cyg_uint8 *p, |
CYG_ADDRWORD s, |
cyg_uint8 *base); |
externC void diag_dump_buf_with_offset(cyg_uint8 *p, |
CYG_ADDRWORD s, |
cyg_uint8 *base); |
|
externC void diag_dump_buf_with_offset_32bit(cyg_uint32 *p, |
CYG_ADDRWORD s, |
cyg_uint32 *base); |
|
externC void diag_dump_buf_with_offset_16bit(cyg_uint16 *p, |
CYG_ADDRWORD s, |
cyg_uint16 *base); |
|
externC int diag_printf( const char *fmt, ... ); /* Formatted print */ |
|
externC void diag_init_putc(void (*putc)(char c, void **param)); |
externC int diag_sprintf(char *buf, const char *fmt, ...); |
externC int diag_snprintf(char *buf, size_t len, const char *fmt, ...); |
externC int diag_vsprintf(char *buf, const char *fmt, va_list ap); |
externC int diag_vprintf(const char *fmt, va_list ap); |
|
|
/*---------------------------------------------------------------------------*/ |
/* Internal Diagnostic MACROS */ |
|
#define DIAG_DEVICE_START_SYNC() |
#define DIAG_DEVICE_END_SYNC() |
|
/*---------------------------------------------------------------------------*/ |
#endif /* CYGONCE_INFRA_DIAG_H */ |
/* EOF diag.h */ |
/include/cyg_type.inc
0,0 → 1,87
#ifndef CYGONCE_INFRA_CYG_TYPE_INC |
#define CYGONCE_INFRA_CYG_TYPE_INC |
|
//========================================================================== |
// |
// cyg_type.inc |
// |
// Standard types, and some useful coding macros. |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: |
// Date: 2000-07-25 |
// Purpose: Define symbols for use in linker scripts and "generic" asm |
// Description: This file should only use #defines - it should be safe |
// to include from both linker scripts and assembler files |
// Usage: #include <cyg/infra/cyg_type.inc> |
// |
// |
//####DESCRIPTIONEND#### |
|
#include <cyg/hal/basetype.h> |
|
// ------------------------------------------------------------------------- |
// Label name macros. Some toolsets generate labels with initial |
// underscores and others don't. CYG_LABEL_NAME should be used on |
// labels in C/C++ code that are defined in assembly code or linker |
// scripts. CYG_LABEL_DEFN is for use in assembly code and linker |
// scripts where we need to manufacture labels that can be used from |
// C/C++. |
// These are default implementations that should work for most targets. |
// They may be overridden in basetype.h if necessary. |
|
#ifndef CYG_LABEL_DEFN |
# define CYG_LABEL_DEFN(_label) _label |
#endif |
|
// ------------------------------------------------------------------------- |
// Provide a default architecture alignment. |
// This may be overridden in basetype.h if necessary. |
|
#ifndef CYGARC_ALIGNMENT |
# define CYGARC_ALIGNMENT 8 |
#endif |
// And corresponding power of two alignment |
#ifndef CYGARC_P2ALIGNMENT |
# define CYGARC_P2ALIGNMENT 3 |
#endif |
|
#endif /* CYGONCE_INFRA_CYG_TYPE_INC */ |
|
// EOF cyg_type.inc |
/include/cyg_ass.h
0,0 → 1,617
#ifndef CYGONCE_INFRA_CYG_ASS_H |
#define CYGONCE_INFRA_CYG_ASS_H |
|
//========================================================================== |
// |
// assert.h |
// |
// Macros and prototypes for the assert system |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg from an original by hmt |
// Contributors: nickg |
// Date: 1997-09-08 |
// Purpose: Use asserts to avoid writing duff code. |
// Description: Runtime tests that compile to nothing in |
// release versions of the code, to allow |
// as-you-go testing of alternate builds. |
// Usage: #include <cyg/infra/cyg_ass.h> |
// ... |
// CYG_ASSERT( pcount > 0, "Number of probes should be > 0!" ); |
// |
// which can result, for example, in a message of the form: |
// ASSERT FAILED: probemgr.cxx:1340, scan_probes() : |
// number of probes should be > 0! |
// if the boolean "pcount > 0" is false. |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#include <pkgconf/infra.h> |
|
#include <cyg/infra/cyg_type.h> // for CYGBLD_ATTRIB_NORET |
|
// ------------------------------------------------------------------------- |
// If we do not have a function name macro, define it ourselves |
|
#ifndef CYGDBG_INFRA_DEBUG_FUNCTION_PSEUDOMACRO |
// __PRETTY_FUNCTION__ does not work |
# ifndef __PRETTY_FUNCTION__ // And it is not already defined |
# define __PRETTY_FUNCTION__ NULL |
# endif |
#endif |
|
// ------------------------------------------------------------------------- |
// This is executed to deal with failure - breakpoint it first! |
// It is declared as a weak symbol to allow user code to override the |
// definition. |
|
externC void |
cyg_assert_fail( const char* /* psz_func */, const char* /* psz_file */, |
cyg_uint32 /* linenum */, const char* /* psz_msg */ ) __THROW |
CYGBLD_ATTRIB_NORET CYGBLD_ATTRIB_WEAK; |
|
externC void |
cyg_assert_msg( const char *psz_func, const char *psz_file, |
cyg_uint32 linenum, const char *psz_msg ) __THROW; |
|
// ------------------------------------------------------------------------- |
|
#ifdef CYGDBG_USE_ASSERTS |
|
// ------------------------------------------------------------------------- |
// We define macros and appropriate prototypes for the assert/fail |
// system. These are: |
// CYG_FAIL - unconditional panic |
// CYG_ASSERT - panic if boolean expression is false |
// CYG_ASSERTC - compact version of CYG_ASSERT |
|
# ifdef CYGDBG_INFRA_DEBUG_ASSERT_MESSAGE |
# define CYG_ASSERT_DOCALL( _msg_ ) \ |
CYG_MACRO_START \ |
/* Make sure we always get a pretty-printed message */ \ |
cyg_assert_msg( __PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_ ); \ |
cyg_assert_fail( __PRETTY_FUNCTION__, __FILE__, __LINE__, _msg_ );\ |
CYG_MACRO_END |
# else |
# define CYG_ASSERT_DOCALL( _msg_ ) \ |
CYG_MACRO_START \ |
const char* _tmp1_ = _msg_; \ |
_tmp1_ = _tmp1_; \ |
cyg_assert_fail( __PRETTY_FUNCTION__, __FILE__, __LINE__, NULL ); \ |
CYG_MACRO_END |
# endif |
|
// unconditional failure; use like panic(), coredump() &c. |
# define CYG_FAIL( _msg_ ) \ |
CYG_MACRO_START \ |
CYG_ASSERT_DOCALL( _msg_ ); \ |
CYG_MACRO_END |
|
// conditioned assert; if the condition is false, fail. |
# define CYG_ASSERT( _bool_, _msg_ ) \ |
CYG_MACRO_START \ |
if ( ! ( _bool_ ) ) \ |
CYG_ASSERT_DOCALL( _msg_ ); \ |
CYG_MACRO_END |
|
# define CYG_ASSERTC( _bool_ ) \ |
CYG_MACRO_START \ |
if ( ! ( _bool_ ) ) \ |
CYG_ASSERT_DOCALL( #_bool_ );\ |
CYG_MACRO_END |
|
#else // ! CYGDBG_USE_ASSERTS |
|
// ------------------------------------------------------------------------- |
// No asserts: we define empty statements for assert & fail. |
|
# define CYG_FAIL( _msg_ ) CYG_EMPTY_STATEMENT |
# define CYG_ASSERT( _bool_, _msg_ ) CYG_EMPTY_STATEMENT |
# define CYG_ASSERTC( _bool_ ) CYG_EMPTY_STATEMENT |
|
#endif // ! CYGDBG_USE_ASSERTS |
|
// ------------------------------------------------------------------------- |
// Pointer integrity checks. |
// These check not only for NULL pointer, but can also check for pointers |
// that are outside to defined memory areas of the platform or executable. |
// We differentiate between data and function pointers, so that we can cope |
// with different formats, and so we can check them against different memory |
// regions. |
|
externC cyg_bool cyg_check_data_ptr(const void *ptr); |
externC cyg_bool cyg_check_func_ptr(const void (*ptr)(void)); |
|
#ifdef CYGDBG_USE_ASSERTS |
|
# define CYG_CHECK_DATA_PTR( _ptr_, _msg_ ) \ |
CYG_MACRO_START \ |
if( !cyg_check_data_ptr((const void *)(_ptr_))) \ |
CYG_ASSERT_DOCALL( _msg_ ); \ |
CYG_MACRO_END |
|
# define CYG_CHECK_FUNC_PTR( _ptr_, _msg_ ) \ |
CYG_MACRO_START \ |
if( !cyg_check_func_ptr((const void (*)(void))(_ptr_))) \ |
CYG_ASSERT_DOCALL( _msg_ ); \ |
CYG_MACRO_END |
|
# define CYG_CHECK_DATA_PTRC( _ptr_ ) \ |
CYG_MACRO_START \ |
if ( !cyg_check_data_ptr((const void *)(_ptr_))) \ |
CYG_ASSERT_DOCALL("data pointer (" #_ptr_ ") is valid");\ |
CYG_MACRO_END |
|
# define CYG_CHECK_FUNC_PTRC( _ptr_ ) \ |
CYG_MACRO_START \ |
if ( !cyg_check_func_ptr((const void (*)(void))(_ptr_))) \ |
CYG_ASSERT_DOCALL("function pointer (" #_ptr_ ") is valid"); \ |
CYG_MACRO_END |
|
#else // CYGDBG_USE_ASSERTS |
|
# define CYG_CHECK_DATA_PTR( _ptr_, _msg_ ) CYG_EMPTY_STATEMENT |
# define CYG_CHECK_FUNC_PTR( _ptr_, _msg_ ) CYG_EMPTY_STATEMENT |
# define CYG_CHECK_DATA_PTRC( _ptr_ ) CYG_EMPTY_STATEMENT |
# define CYG_CHECK_FUNC_PTRC( _ptr_ ) CYG_EMPTY_STATEMENT |
|
#endif // CYGDBG_USE_ASSERTS |
|
// ------------------------------------------------------------------------- |
// Unconditional definitions: |
|
// Check an object for validity by calling its own checker. |
// Usage: |
// ClassThing *p = &classobject; |
// CYG_ASSERTCLASS( p, "Object at p is broken!" ); |
|
// this enum gives some options as to how keenly to test; avoids cluttering |
// the member function declaration if the implementor wants to do more |
// zealous tests themselves. |
|
enum cyg_assert_class_zeal { |
cyg_system_test = -1, |
cyg_none = 0, |
cyg_trivial, |
cyg_quick, |
cyg_thorough, |
cyg_extreme |
}; |
|
// ------------------------------------------------------------------------- |
// Define macros for checking classes: |
// |
// CYG_ASSERT_CLASS - do proforma check on a class pointer |
// CYG_ASSERT_CLASSO - do proforma check on a class object |
// CYG_ASSERT_ZERO_OR_CLASS- a class pointer is NULL or valid |
// CYG_ASSERT_THIS - "this" is valid |
// + 3 compact variants and two aliases for backwards compatibility. |
// |
// All of these end up going via CYG_ASSERT(), which will be an empty |
// statement if CYGDBG_USE_ASSERTS is disabled. There is no need to |
// test CYGDBG_USE_ASSERTS again here. |
// |
// The idiom required is that a class have a member function called |
// "bool check_this( cyg_assert_class_zeal ) const" that returns true |
// iff the object is OK. This need not be conditionally compiled against |
// CYGDBG_USE_ASSERTS but it can be if only this macro is used to |
// invoke it. Alternatively it can be invoked by hand with other |
// choices from the above enum. |
|
// Assert the checker function of an object by pointer, or in hand. |
|
#ifdef __cplusplus |
|
# ifndef CYG_ASSERT_CLASS_ZEAL |
# define CYG_ASSERT_CLASS_ZEAL (cyg_quick) // can be redefined locally |
# endif |
|
# define CYG_ASSERT_CLASS( _pobj_, _msg_ ) \ |
CYG_ASSERT( ((0 != (_pobj_)) && \ |
(_pobj_)->check_this( CYG_ASSERT_CLASS_ZEAL )), _msg_ ) |
|
# define CYG_ASSERTCLASS( _pobj_,_msg_) \ |
CYG_ASSERT_CLASS( (_pobj_), _msg_ ) |
|
# define CYG_ASSERT_CLASSO( _obj_, _msg_ ) \ |
CYG_ASSERT( (_obj_).check_this( CYG_ASSERT_CLASS_ZEAL ), _msg_ ) |
|
# define CYG_ASSERTCLASSO( _obj_, _msg_ ) \ |
CYG_ASSERT_CLASSO( (_obj_), _msg_ ) |
|
# define CYG_ASSERT_ZERO_OR_CLASS( _pobj_, _msg_ ) \ |
CYG_ASSERT( ((0 == (_pobj_)) || \ |
(_pobj_)->check_this( CYG_ASSERT_CLASS_ZEAL )), _msg_ ) |
|
# define CYG_ASSERT_THIS( _msg_ ) \ |
CYG_ASSERT( this->check_this( CYG_ASSERT_CLASS_ZEAL ), _msg_ ) |
|
# define CYG_ASSERT_CLASSC( _pobj_ ) \ |
CYG_ASSERT_CLASS( (_pobj_), "class pointer (" #_pobj_ ") is valid" ) |
|
# define CYG_ASSERT_CLASSOC( _obj_ ) \ |
CYG_ASSERT_CLASSO( (_obj_), "object (" #_obj_ ") is valid" ) |
|
# define CYG_ASSERT_ZERO_OR_CLASSC( _pobj_ ) \ |
CYG_ASSERT_ZERO_OR_CLASS((_pobj_), \ |
"class pointer (" #_pobj_ ") is zero or valid") |
|
# define CYG_ASSERT_THISC( ) \ |
CYG_ASSERT_THIS( "\"this\" pointer is valid" ) |
|
#define CYGDBG_DEFINE_CHECK_THIS \ |
cyg_bool check_this( cyg_assert_class_zeal zeal ) const; |
|
#endif // __cplusplus |
|
// ------------------------------------------------------------------------- |
// Some alternative names for basic assertions that we can disable |
// individually. |
// |
// CYG_PRECONDITION - argument checking etc |
// CYG_POSTCONDITION - results etc |
// CYG_LOOP_INVARIANT - for putting in loops |
// |
// C++ programmers have class-related variants of all of these. |
|
#ifdef CYGDBG_INFRA_DEBUG_PRECONDITIONS |
# define CYG_PRECONDITION( _bool_ , _msg_ ) CYG_ASSERT( _bool_, _msg_ ) |
# define CYG_PRECONDITIONC( _bool_ ) \ |
CYG_ASSERT( _bool_, "precondition " #_bool_) |
#else |
# define CYG_PRECONDITION( _bool_ , _msg_ ) CYG_EMPTY_STATEMENT |
# define CYG_PRECONDITIONC( _bool_ ) CYG_EMPTY_STATEMENT |
#endif |
|
#ifdef CYGDBG_INFRA_DEBUG_POSTCONDITIONS |
# define CYG_POSTCONDITION( _bool_ , _msg_ ) CYG_ASSERT( _bool_, _msg_ ) |
# define CYG_POSTCONDITIONC( _bool_ ) \ |
CYG_ASSERT( _bool_, "postcondition " #_bool_) |
#else |
# define CYG_POSTCONDITION( _bool_ , _msg_ ) CYG_EMPTY_STATEMENT |
# define CYG_POSTCONDITIONC( _bool_ ) CYG_EMPTY_STATEMENT |
#endif |
|
#ifdef CYGDBG_INFRA_DEBUG_LOOP_INVARIANTS |
# define CYG_LOOP_INVARIANT( _bool_ , _msg_ ) CYG_ASSERT( _bool_, _msg_ ) |
# define CYG_LOOP_INVARIANTC( _bool_ ) \ |
CYG_ASSERT( _bool_, "loop invariant " #_bool_ ) |
#else |
# define CYG_LOOP_INVARIANT( _bool_ , _msg_ ) CYG_EMPTY_STATEMENT |
# define CYG_LOOP_INVARIANTC( _bool_ ) CYG_EMPTY_STATEMENT |
#endif |
|
#ifdef __cplusplus |
|
// All variants of _CLASS |
# define CYG_PRECONDITION_CLASS( _pobj_, _msg_ ) \ |
CYG_PRECONDITION( ((0 != (_pobj_)) && \ |
(_pobj_)->check_this(CYG_ASSERT_CLASS_ZEAL)), _msg_) |
|
# define CYG_PRECONDITION_CLASSC( _pobj_ ) \ |
CYG_PRECONDITION_CLASS( (_pobj_), \ |
"precondition, class pointer (" #_pobj_ ") is valid" ) |
|
# define CYG_POSTCONDITION_CLASS( _pobj_, _msg_ ) \ |
CYG_POSTCONDITION( ((0 != (_pobj_)) && \ |
(_pobj_)->check_this(CYG_ASSERT_CLASS_ZEAL)), _msg_) |
|
# define CYG_POSTCONDITION_CLASSC( _pobj_ ) \ |
CYG_POSTCONDITION_CLASS( (_pobj_), \ |
"postcondition, class pointer (" #_pobj_ ") is valid" ) |
|
# define CYG_LOOP_INVARIANT_CLASS( _pobj_, _msg_) \ |
CYG_LOOP_INVARIANT( ((0 != (_pobj_)) && \ |
(_pobj_)->check_this(CYG_ASSERT_CLASS_ZEAL)), _msg_) |
|
# define CYG_LOOP_INVARIANT_CLASSC( _pobj_ ) \ |
CYG_LOOP_INVARIANT_CLASS( (_pobj_), \ |
"loop invariant, class pointer (" #_pobj_ ") is valid" ) |
|
// All variants of _CLASSO |
# define CYG_PRECONDITION_CLASSO( _obj_, _msg_ ) \ |
CYG_PRECONDITION( (_obj_).check_this(CYG_ASSERT_CLASS_ZEAL), _msg_) |
|
# define CYG_PRECONDITION_CLASSOC( _obj_ ) \ |
CYG_PRECONDITION_CLASSO( (_obj_), \ |
"precondition, object (" #_obj_ ") is valid" ) |
|
# define CYG_POSTCONDITION_CLASSO( _obj_, _msg_ ) \ |
CYG_POSTCONDITION( (_obj_).check_this(CYG_ASSERT_CLASS_ZEAL), _msg_) |
|
# define CYG_POSTCONDITION_CLASSOC( _obj_ ) \ |
CYG_POSTCONDITION_CLASSO( (_obj_), \ |
"postcondition, object (" #_obj_ ") is valid" ) |
|
# define CYG_LOOP_INVARIANT_CLASSO( _obj_, _msg_) \ |
CYG_LOOP_INVARIANT( (_obj_).check_this(CYG_ASSERT_CLASS_ZEAL), _msg_) |
|
# define CYG_LOOP_INVARIANT_CLASSOC( _obj_ ) \ |
CYG_LOOP_INVARIANT_CLASSO( (_obj_), \ |
"loop invariant, object (" #_obj_ ") is valid" ) |
|
// All variants of _ZERO_OR_CLASS |
# define CYG_PRECONDITION_ZERO_OR_CLASS( _pobj_, _msg_ ) \ |
CYG_PRECONDITION( ((0 == (_pobj_)) || \ |
(_pobj_)->check_this(CYG_ASSERT_CLASS_ZEAL)), _msg_) |
|
# define CYG_PRECONDITION_ZERO_OR_CLASSC( _pobj_ ) \ |
CYG_PRECONDITION_ZERO_OR_CLASS( (_pobj_), \ |
"precondition, class pointer (" #_pobj_ ") is zero or valid" ) |
|
# define CYG_POSTCONDITION_ZERO_OR_CLASS( _pobj_, _msg_ ) \ |
CYG_POSTCONDITION( ((0 == (_pobj_)) || \ |
(_pobj_)->check_this(CYG_ASSERT_CLASS_ZEAL)), _msg_) |
|
# define CYG_POSTCONDITION_ZERO_OR_CLASSC( _pobj_ ) \ |
CYG_POSTCONDITION_ZERO_OR_CLASS( (_pobj_), \ |
"postcondition, class pointer (" #_pobj_ ") is zero or valid" ) |
|
# define CYG_LOOP_INVARIANT_ZERO_OR_CLASS( _pobj_, _msg_) \ |
CYG_LOOP_INVARIANT( ((0 == (_pobj_)) || \ |
(_pobj_)->check_this(CYG_ASSERT_CLASS_ZEAL)), _msg_) |
|
# define CYG_LOOP_INVARIANT_ZERO_OR_CLASSC( _pobj_ ) \ |
CYG_LOOP_INVARIANT_ZERO_OR_CLASS( (_pobj_), \ |
"loop invariant, class pointer (" #_pobj_ ") is zero or valid" ) |
|
// All variants of _THIS |
# define CYG_PRECONDITION_THIS( _msg_ ) \ |
CYG_PRECONDITION( this->check_this(CYG_ASSERT_CLASS_ZEAL), _msg_) |
|
# define CYG_PRECONDITION_THISC() \ |
CYG_PRECONDITION_THIS( "precondition, \"this\" is valid" ) |
|
# define CYG_POSTCONDITION_THIS( _msg_ ) \ |
CYG_POSTCONDITION( this->check_this(CYG_ASSERT_CLASS_ZEAL), _msg_) |
|
# define CYG_POSTCONDITION_THISC() \ |
CYG_POSTCONDITION_THIS( "postcondition, \"this\" is valid" ) |
|
# define CYG_LOOP_INVARIANT_THIS( _msg_) \ |
CYG_LOOP_INVARIANT( this->check_this(CYG_ASSERT_CLASS_ZEAL), _msg_) |
|
# define CYG_LOOP_INVARIANT_THISC() \ |
CYG_LOOP_INVARIANT_THIS( "loop invariant, \"this\" is valid" ) |
|
#endif // __cplusplus |
|
// ------------------------------------------------------------------------- |
// Invariants. These are a bit more interesting. The ordinary invariants |
// take an arbitrary boolean expression, and C++ does not provide any way |
// of evaluating this expression automatically on entry and exit - any |
// attempt to use local objects leads to trying to evaluate the expression |
// when it is not in scope. This problem does not arise with objects. |
// |
// For C++ objects it is possible to do a bit better. A template can be |
// used to create a local object whose constructor will validate the |
// target object and whose destructor will validate the target object |
// again. Unfortunately it is necessary to pass the type as well as |
// the object: typeof() is a gcc extension, and RTTI's typeid facility |
// would provide the derived class and not what we actually want. |
|
#ifdef CYGDBG_INFRA_DEBUG_INVARIANTS |
|
# define CYG_INVARIANT( _bool_, _msg_ ) \ |
CYG_MACRO_START \ |
if ( ! ( _bool_ ) ) \ |
CYG_ASSERT_DOCALL( _msg_ ); \ |
CYG_MACRO_END |
|
# define CYG_INVARIANTC( _bool_ ) \ |
CYG_MACRO_START \ |
if ( ! ( _bool_ ) ) \ |
CYG_ASSERT_DOCALL( "invariant (" #_bool_ ")" ); \ |
CYG_MACRO_END |
|
# ifdef __cplusplus |
// NOTE: if the compiler does not manage to inline the appropriate |
// template functions then the impact on code size and performance becomes |
// rather large. But there are significant performance overheads anyway |
// simply because of the call to check_this()... |
// |
template<class X> class __CygInvariantObject { |
|
const X* rep; |
|
private: |
// Prevent access to the default constructors. |
__CygInvariantObject() { } |
__CygInvariantObject( const __CygInvariantObject& arg ) { } |
__CygInvariantObject & operator=( const __CygInvariantObject & arg) { return *this; } |
|
public: |
__CygInvariantObject( X* arg, const char* msg ) : rep(arg) { |
if ( !rep->check_this( CYG_ASSERT_CLASS_ZEAL ) ) |
CYG_ASSERT_DOCALL( msg ); |
} |
__CygInvariantObject( X& arg, const char* msg ) : rep(&arg) { |
if ( !rep->check_this( CYG_ASSERT_CLASS_ZEAL ) ) |
CYG_ASSERT_DOCALL( msg ); |
} |
__CygInvariantObject( const X* arg, const char* msg ) : rep(arg) { |
if ( !rep->check_this( CYG_ASSERT_CLASS_ZEAL ) ) |
CYG_ASSERT_DOCALL( msg ); |
} |
__CygInvariantObject( const X& arg, const char* msg ) : rep(&arg) { |
if ( !rep->check_this( CYG_ASSERT_CLASS_ZEAL ) ) |
CYG_ASSERT_DOCALL( msg ); |
} |
~__CygInvariantObject( ) { |
if ( !rep->check_this( CYG_ASSERT_CLASS_ZEAL ) ) |
CYG_ASSERT_DOCALL( "invariant, object valid on exit" ); |
rep = 0; |
}; |
}; |
|
// |
// These macros provide sensible concatenation facilities at |
// the C preprocessor level, getting around complications in the |
// macro expansion rules related to __LINE__ and __FILE__. |
|
# define __CYG_INVARIANT_CLASSNAME_AUX( a, b) a ## b |
# define __CYG_INVARIANT_CLASSNAME( a, b ) \ |
__CYG_INVARIANT_CLASSNAME_AUX( a, b ) |
|
|
// These macro definitions do not use CYG_MACRO_START because |
// I do not want the scope of the local objects to get confused. |
// |
// The first line of the macro expansion specifies the type of |
// the local object being created. The second line invents a |
// name for this object. The third line provides command-line |
// arguments. |
|
# define CYG_INVARIANT_CLASS( _type_, _pobj_, _msg_ ) \ |
__CygInvariantObject<_type_> \ |
__CYG_INVARIANT_CLASSNAME( __invariant_class_, __LINE__ ) \ |
( _pobj_, _msg_ ) |
|
# define CYG_INVARIANT_CLASSC( _type_, _pobj_ ) \ |
__CygInvariantObject<_type_> \ |
__CYG_INVARIANT_CLASSNAME( __invariant_class_, __LINE__ ) \ |
( _pobj_, "invariant, class pointer (" #_pobj_ ") is valid" ) |
|
# define CYG_INVARIANT_CLASSO( _type_, _obj_, _msg_ ) \ |
__CygInvariantObject<_type_> \ |
__CYG_INVARIANT_CLASSNAME( __invariant_class_, __LINE__ ) \ |
( _obj_, _msg_ ) |
|
# define CYG_INVARIANT_CLASSOC( _type_, _obj_ ) \ |
__CygInvariantObject<_type_> \ |
__CYG_INVARIANT_CLASSNAME( __invariant_class_, __LINE__ ) \ |
( _obj_, "invariant, object (" #_obj_ ") is valid" ) |
|
# define CYG_INVARIANT_THIS( _type_, _msg_ ) \ |
__CygInvariantObject<_type_> \ |
__CYG_INVARIANT_CLASSNAME( __invariant_class_, __LINE__ ) \ |
( this, _msg_ ) |
|
# define CYG_INVARIANT_THISC( _type_ ) \ |
__CygInvariantObject<_type_> \ |
__CYG_INVARIANT_CLASSNAME( __invariant_class_, __LINE__ ) \ |
( this, "invariant, \"this\" is valid" ) |
|
# endif // __cplusplus |
|
#else // !CYGDBG_INFRA_DEBUG_INVARIANTS |
|
# define CYG_INVARIANT( _bool_, _msg_ ) CYG_EMPTY_STATEMENT |
# define CYG_INVARIANTC( _bool_ ) CYG_EMPTY_STATEMENT |
|
# ifdef __cplusplus |
|
# define CYG_INVARIANT_CLASS( _type_, _pobj_, _msg_ ) |
# define CYG_INVARIANT_CLASSC( _type_, _pobj_ ) |
# define CYG_INVARIANT_CLASSO( _type_, _obj_, _msg_ ) |
# define CYG_INVARIANT_CLASSOC( _type_, _obj_ ) |
# define CYG_INVARIANT_THIS( _type_, _msg_ ) |
# define CYG_INVARIANT_THISC( _type_ ) |
|
# endif |
|
#endif // CYGDBG_INFRA_DEBUG_INVARIANTS |
|
// ------------------------------------------------------------------------- |
// Compile time failure; like #error but in a macro so we can use it in |
// other definitions. |
// |
// Usage: |
// #define new CYG_COMPILETIMEFAIL( "Do NOT use new!") |
|
#define CYG_COMPILETIMEFAIL( _msg_ ) !!!-- _msg_ --!!! |
|
|
// ------------------------------------------------------------------------- |
// The host-side implementation of the infrastructure provides a number |
// of additional functions that allow applications to provide their own |
// implementation of cyg_assert_fail(). This is not strictly necessary |
// since the presence of cyg_assert_fail() in the application would |
// override the one in the library anyway, but it is useful to make |
// certain functionality more readily available. |
// |
// These declarations are only available if the symbol |
// CYG_DECLARE_HOST_ASSERTION_SUPPORT is defined. |
#ifdef CYG_DECLARE_HOST_ASSERTION_SUPPORT |
|
// The default assertion handler writes its output to a file and |
// if possible a suitable message to stdout. It is possible to |
// install an alternative handler. If this alternative returns false |
// then the default handler will be invoked instead, otherwise the |
// application will exit. |
externC void cyg_assert_install_failure_handler( |
bool (*)(const char* /* psz_func */, |
const char* /* psz_file */, |
cyg_uint32 /* linenum */, |
const char* /* psz_msg */) ); |
|
// Register a callback that should get invoked as part of handling an |
// assertion failure and that will typically produce some additional |
// output. For example the trace code will install a callback to output |
// trace information. |
// |
// The first argument is a string identifying the callback. The second |
// argument is a function pointer for the callback itself, whose |
// argument is another function that can be invoked for output. |
externC void cyg_assert_install_failure_callback( |
const char* /* name */, |
void (*)( void (*)(const char*) )); |
|
// This function can be called by assert failure handlers to invoke |
// the installed callbacks. The three arguments are function pointers |
// that get invoked prior to callback invocation, by the callback itself, |
// and after each callback. In the first case the argument will be the |
// callback name. |
externC void cyg_assert_failure_invoke_callbacks( |
void (*)(const char* /* name */), |
void (*)(const char* /* callback data */ ), |
void (*)(void) ); |
|
// This function is intended to be called from inside gdb instead of |
// cyg_assert_fail(),, without the need to specify a filename or |
// anything else. |
externC void cyg_assert_quickfail(void); |
|
#endif // CYG_DECLARE_HOST_ASSERTION_SUPPORT |
|
// ------------------------------------------------------------------------- |
|
#endif // CYGONCE_INFRA_CYG_ASS_H multiple inclusion protection |
// EOF cyg_ass.h |
/ChangeLog
0,0 → 1,933
2003-04-25 Jonathan Larmour <jifl@eCosCentric.com> |
|
* tests/cxxsupp.cxx: don't include <pkgconf/kernel.h> as it's not |
needed. |
(cyg_start): CYGINT_ISO_MALLOC needs a #if test. |
|
2003-04-10 Nick Garnett <nickg@balti.calivar.com> |
|
* tests/cxxsupp.cxx: Added this test program to check that basic |
C++ support is present. It checks that pure virtual functions can |
be defined, that new and delete are present and functional, and |
that calls to as-yet undefined inline functions work. Most of |
these are linker and runtime system issues, so the actual run of |
the program is almost a non-event. |
|
* cdl/infra.cdl: |
Added CYGFUN_INFRA_DUMMY_ABORT and CYGFUN_INFRA_DUMMY_STRLEN |
options to control inclusion of dummy abort() and strlen() |
functions. These are needed to be present by the compiler's C++ |
runtime system, although they should never be called. |
Added CYGPKG_INFRA_TESTS to define test programs. |
Added CYGPKG_INFRA_LDFLAGS_REMOVE and CYGPKG_INFRA_LDFLAGS_ADD to |
modify the linkage options for the infra package |
tests. Specifically they remove the --gc-sections option and make |
all linker warning fatal. This is necessary if cxxsupp.cxx is to |
test what it needs correctly. |
|
* src/abort.cxx: Added this dummy implementation of abort() to |
satisfy references in the C++ runtime system. |
|
* src/strlen.cxx: Added this dummy implementation of strlen() to |
satisfy references in the C++ runtime system. |
|
2003-03-27 Bart Veer <bartv@ecoscentric.com> |
|
* src/pure.cxx, cdl/infra.cdl: new function __cxa_pure_virtual(), |
needed when building with g++ v3.x if the code uses pure |
virtual functions. |
|
2003-01-18 Jonathan Larmour <jifl@eCosCentric.com> |
|
* include/cyg_ass.h (CYG_CHECK_FUNC_PTRC): Define with const pointer |
arguments. |
(CYG_CHECK_DATA_PTRC): Ditto. |
(CYG_CHECK_FUNC_PTR): Ditto. |
(CYG_CHECK_DATA_PTR): Ditto. |
* src/null.cxx: Define cyg_check_data/func_ptr() with const args. |
* src/buffer.cxx: Ditto. |
* src/fancy.cxx: Ditto. |
* src/simple.cxx: Ditto. |
|
2002-07-18 Gary Thomas <gary@chez-thomas.org> |
|
* include/diag.h: |
* src/diag.cxx (diag_vdump_buf_with_offset): New function. |
|
2002-05-22 Jesper Skov <jskov@redhat.com> |
|
* cdl/infra.cdl: Added two options to control CFLAGS. |
|
2002-05-17 Martin Buck <martin.buck@ascom.ch> |
|
* include/cyg_type.h (CYGBLD_ATTRIB_PRINTF_FORMAT): Add. |
|
2002-05-23 Gary Thomas <gthomas@redhat.com> |
|
* src/diag.cxx (_vprintf): Mapping of '\n'=>'\r\n' must be done |
at the _putc() level. |
|
2002-04-17 Gary Thomas <gthomas@redhat.com> |
|
* src/diag.cxx (diag_dump_buf_with_offset): Fix pad for short lines. |
|
2002-04-16 Gary Thomas <gthomas@redhat.com> |
|
* src/diag.cxx: Return proper length result for sprintf() functions. |
|
2002-04-09 Jonathan Larmour <jlarmour@redhat.com> |
|
* include/cyg_type.h: Allow HALs to override certain attrib macros. |
|
2002-02-19 Gary Thomas <gthomas@redhat.com> |
|
* src/diag.cxx (diag_snprintf): |
* include/diag.h: Change function signature on diag_snprintf() |
to match snprintf() found in stdio. |
|
2002-02-13 Jonathan Larmour <jlarmour@redhat.com> |
|
* include/cyg_trac.h: Make message type of trace functions be |
const char * to help avoid warnings with callers. |
* src/null.cxx: Reflect that in actual functions. |
* src/fancy.cxx: Ditto. |
* src/simple.cxx: Ditto. |
* src/buffer.cxx: Ditto. |
|
2002-01-31 Hugo Tyson <hmt@redhat.com> |
|
* src/tcdiag.cxx (cyg_assert_msg): Enable this function |
universally; given the extra usefulness it now has (see below) |
it's worth always having around by default in asserted builds. |
It can be disabled with CYGDBG_INFRA_DEBUG_ASSERT_MESSAGE = 0. |
|
2002-01-30 Hugo Tyson <hmt@redhat.com> |
|
* src/tcdiag.cxx (cyg_assert_msg): Collect from RedBoot flash |
config, whether or not to dump to a specific console. |
|
2002-01-28 Gary Thomas <gthomas@redhat.com> |
|
* src/diag.cxx (diag_snprintf): |
* include/diag.h: New function diag_snprintf(). |
|
2002-01-23 Jonathan Larmour <jlarmour@redhat.com> |
|
* include/cyg_type.h: Define CYG_INIT_IO_FS used by filesystems |
so that they init *after* the devices they depend on. |
|
2002-01-21 Jonathan Larmour <jlarmour@redhat.com> |
|
* src/tcdiag.cxx (cyg_test_exit): Work around problem with recent |
SH tools that isn't likely to get fixed soon. |
|
2002-01-17 Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com> |
|
* src/diag.cxx (diag_check_string): enlarge valid string length to 2048 |
|
2001-12-06 Jesper Skov <jskov@redhat.com> |
|
* src/diag.cxx: Added functions to do memory dump in 16 and 32 bit |
units. Based on changes from Warren Jasper <warrenj@bops.com>. |
* include/diag.h: Function declarations. |
|
2001-09-12 Jonathan Larmour <jlarmour@redhat.com> |
|
* src/eprintf.c (__eprintf): Tolerate absence of standard ISO C |
functions better. |
|
2001-09-11 Jesper Skov <jskov@redhat.com> |
|
* src/diag.cxx (diag_check_string): Also accept \b. |
|
2001-08-25 Gary Thomas <gthomas@redhat.com> |
|
* src/diag.cxx (_vprintf): Fix confusion between signed and unsigned |
descriptors (only %d is signed). |
|
2001-08-24 Gary Thomas <gthomas@redhat.com> |
|
* include/diag.h: Export diag_dump_buf_with_offset. |
|
* src/diag.cxx (_vprintf): Fix problems with signed/unsigned prints. |
(diag_dump_buf_with_offset): Export. |
|
2001-08-23 Gary Thomas <gthomas@redhat.com> |
|
* src/diag.cxx (_vprintf): Restore functionality of %D,%U,%X,%B,%S,%C |
which were present in old code. |
|
2001-08-22 Gary Thomas <gthomas@redhat.com> |
|
* src/diag.cxx: |
* include/diag.h: |
* cdl/infra.cdl: Restructuring to support more flexible versions |
of diag_printf() and related functions. Remove old cruft which |
was workaround for possibly failing compilers [K&R support]. |
These versions of printf(), etc, were part of the RedBoot package |
and have been moved here (and renamed) to reduce code duplication. |
|
2001-08-22 Jonathan Larmour <jlarmour@redhat.com> |
|
* src/eprintf.c: New file to implement __eprintf called from libgcc. |
* cdl/infra.cdl: Build it. |
* include/cyg_type.h: Provide __THROW default empty throw specifier. |
* include/cyg_ass.h (cyg_assert_fail): Add __THROW. |
(cyg_assert_msg): Ditto. |
* src/buffer.cxx (cyg_assert_fail): Ditto. |
* src/fancy.cxx (cyg_assert_fail): Ditto. |
* src/null.cxx (cyg_assert_fail): Ditto (twice). |
* src/simple.cxx (cyg_assert_fail): Ditto. |
* src/tcdiag.cxx (cyg_assert_msg): Ditto. |
|
2001-08-03 Nick Garnett <nickg@cygnus.co.uk> |
|
Imported from a development branch: |
|
2001-06-27 Nick Garnett <nickg@cygnus.co.uk> |
|
* src/diag.cxx: |
* src/tcdiag.cxx: |
Added use of CYG_HAL_DIAG_LOCK() and CYG_HAL_DIAG_UNLOCK() to |
diag_printf(), cyg_assert_msg() and cyg_test_output() to prevent |
messages from different CPUs being mingled. |
|
2001-05-22 Nick Garnett <nickg@cygnus.co.uk> |
|
* include/cyg_type.h (CYGBLD_ANNOTATE_VARIABLE_*): |
Added better way of supplying default definitions for these. |
|
2001-04-27 Nick Garnett <nickg@cygnus.co.uk> |
|
* include/cyg_type.h: |
Added default variable annotation macros. |
|
2001-07-18 Jonathan Larmour <jlarmour@redhat.com> |
|
* include/cyg_type.h (CYG_INIT_MEMALLOC): Add. |
|
2001-07-13 Jonathan Larmour <jlarmour@redhat.com> |
|
* src/diag.cxx (diag_vprintf): Fix long longs (patch from |
Motoya Kurotsu <kurotsu [at] allied-telesis.co.jp> |
|
* cdl/debug.cdl: Make tracing styles be mutually exclusive properly |
using an interface. |
|
2001-06-14 Jonathan Larmour <jlarmour@redhat.com> |
|
* include/clist.hxx (Cyg_DNode_T): Don't qualify constructor or |
destructor with <T>. |
(Cyg_CList_T): Ditto. |
|
2001-02-23 Robin Farine <acnrf@dial.eunet.ch> |
|
* include/cyg_type.h: Do alignment consistency check. |
|
2001-01-05 Nick Garnett <nickg@cygnus.co.uk> |
|
* include/clist.hxx: Many changes to make these classes usable in |
the MLQ scheduler and alarm objects. |
|
2000-12-15 Nick Garnett <nickg@cygnus.co.uk> |
|
* include/clist.hxx: Added this implementation of simple circular |
list classes. This is not immediately useful, except to the |
dynamic loader, but it is intended to simplify the MLQ scheduler |
with these classes eventually. |
|
2000-12-13 Jesper Skov <jskov@redhat.com> |
|
* include/cyg_type.h (CYGBLD_ATTRIB_ASM_ALIAS): Mangle assembler |
symbols properly. |
|
2000-09-08 Jonathan Larmour <jlarmour@redhat.com> |
|
* include/cyg_type.h (CYGBLD_ATTRIB_SECTION): Don't stringify arg. |
|
2000-09-04 Jonathan Larmour <jlarmour@redhat.com> |
|
* include/cyg_type.h (CYGARC_ALIGNMENT): Add default of 8 |
(CYGARC_P2ALIGNMENT): Add corresponding default of 3 |
(CYGBLD_ATTRIB_ALIGN): Define to allow alignment |
* include/cyg_type.inc: As above for CYGARC_ALIGNMENT and |
CYGARC_P2ALIGNMENT |
|
2000-07-25 Jonathan Larmour <jlarmour@redhat.co.uk> |
|
* include/cyg_type.inc: Create. Used for the equivalent stuff of |
cyg_type.h in assembler and linker scripts |
|
2000-07-19 Jonathan Larmour <jlarmour@redhat.co.uk> |
|
* src/pkgstart.cxx (cyg_package_start): Remove POSIX startup option |
* cdl/startup.cdl: Likewise |
|
2000-07-18 Jonathan Larmour <jlarmour@redhat.co.uk> |
|
* src/buffer.cxx (increment_buffer_pos): Reset buffer pos *before* |
we try to print the buffer |
Thanks to Chris Morrow (cmorrow at YottaYotta.com ) for spotting |
the problem. |
|
2000-07-04 Jonathan Larmour <jlarmour@redhat.co.uk> |
|
* cdl/infra.cdl: Add CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS option |
to control presence of empty C++ delete functions |
|
* src/delete.cxx: Move comments into above option, and simplify |
the configuration now that it's more straightforward |
|
2000-06-21 Nick Garnett <nickg@cygnus.co.uk> |
|
* src/simple.cxx: |
* src/null.cxx: |
* src/fancy.cxx: |
* src/buffer.cxx: |
Removed use of CYG_LABEL_NAME() and added extra underscores to |
_stext and _etext. |
|
* include/cyg_type.h: Changed default for CYG_LABEL_DEFN() to |
define labels without an extra underscore. This reflects the |
practice of most of the targets we support. |
|
2000-06-19 Nick Garnett <nickg@cygnus.co.uk> |
|
* include/cyg_type.h: |
Added CYGBLD_ATTRIB_SECTION to assign variables to a named |
section. |
Added CYG_LABEL_DEFN() macro for defining labels in asm and linker |
scripts. This is particularly useful for generating labels in |
inline assembler fragments. |
|
2000-05-02 Jonathan Larmour <jlarmour@redhat.co.uk> |
|
* cdl/startup.cdl: |
* src/pkgstart.cxx: |
Remove CYGSEM_START_ISO_C_COMPATIBILITY: startup is now handled |
via extras.o |
* include/cyg_type.h: Define __externC alternative to externC |
|
2000-04-12 Jesper Skov <jskov@redhat.com> |
|
* cdl/infra.cdl: Allow build flags to be tweaked. |
|
2000-03-31 Nick Garnett <nickg@cygnus.co.uk> |
|
* cdl/startup.cdl: |
* src/pkgstart.cxx: |
Added POSIX startup option. |
|
2000-03-28 Jonathan Larmour <jlarmour@redhat.co.uk> |
|
* include/cyg_trac.h: Also update internal documentation for below |
const char * changes (2000-03-27) |
|
2000-03-28 John Dallaway <jld@cygnus.co.uk> |
|
* cdl/infra.cdl: |
|
Adjust documentation URLs. |
|
2000-03-27 Gary Thomas <gthomas@redhat.com> |
|
* src/tcdiag.cxx: HAL architecture ports may override default |
behavior for 'cyg_test_exit()'. |
|
* src/diag.cxx (diag_vprintf): Add support for %llX modifier, which |
allows for printing of (long long) operands. |
|
2000-03-27 Jonathan Larmour <jlarmour@redhat.co.uk> |
|
* include/cyg_trac.h: Use const qualifier on function and file name |
strings to be compatible with the C++ standard |
* src/buffer.cxx: likewise |
* src/fancy.cxx: likewise |
* src/null.cxx: likewise |
|
2000-03-27 Jesper Skov <jskov@redhat.com> |
|
* include/cyg_type.h: Make cyg_halbool the same for C and C++ |
code. |
|
* include/cyg_ass.h (CYGDBG_DEFINE_CHECK_THIS): Use cyg_bool |
instead of bool. |
|
2000-03-07 Jesper Skov <jskov@redhat.com> |
|
* src/buffer.cxx: Fix some compiler warnings. |
|
2000-03-03 Jesper Skov <jskov@redhat.com> |
|
* include/cyg_type.h (CYGBLD_ATTRIB_WEAK): disarm bomb for !GCC. |
|
2000-03-01 Jesper Skov <jskov@redhat.com> |
103290 |
* include/cyg_ass.h: Make cyg_assert_fail a weak symbol. |
|
2000-02-28 Gary Thomas <gthomas@cygnus.co.uk> |
|
* include/diag.h: |
* src/diag.cxx (diag_dump_buf): Add diagnostic "dump buffer" function. |
|
2000-02-21 Hugo Tyson <hmt@cygnus.co.uk> |
|
* src/tcdiag.cxx (cyg_test_is_simulator): set this true if ugly |
new cdl_option CYGHWR_TARGET_SIMULATOR_NO_GDB_WORKING is set. |
This means we cannot diddle the variable using GDB. |
|
2000-02-18 Hugo Tyson <hmt@cygnus.co.uk> |
|
* src/tcdiag.cxx (cyg_test_exit): Add the facility for a platform |
HAL to define an action to take at CYG_TEST_EXIT time; this is |
useful for some simulators that are not (yet) Gdb integrated. |
The action is CYGHWR_TEST_PROGRAM_EXIT() if defined. |
|
* src/simple.cxx (cyg_assert_fail): Add the facility for a |
platform HAL to define an action to take when an assertion failure |
occurs. Ditto. |
|
* src/fancy.cxx (cyg_assert_fail): Ditto. |
|
* src/buffer.cxx (cyg_assert_fail): Ditto. |
|
[no change to null.cxx because, well, it's null isn't it] |
|
2000-02-08 Jonathan Larmour <jlarmour@redhat.co.uk> |
|
* include/cyg_trac.h: Define and document CYG_TRACE_PRINT() and |
CYG_TRACE_DUMP() macros for outputting buffered trace output, and |
kernel state dump respectively |
|
* cdl/debug.cdl (CYGDBG_INFRA_DEBUG_TRACE_ASSERT_BUFFER): |
replace (incorrect) mention of cyg_trace_output() with CYG_TRACE_PRINT() |
macro. |
|
* src/fancy.cxx (cyg_trace_dump): Add (from buffer.cxx) |
* src/simple.cxx (cyg_trace_dump): Add (from buffer.cxx) |
* src/null.cxx (cyg_trace_dump): Add as empty function |
|
2000-01-31 Simon FitzMaurice <sdf@cygnus.co.uk> |
* cdl\infra.cdl: |
|
Adjust help URLs in line with new doc layout. |
|
2000-01-28 Simon FitzMaurice <sdf@cygnus.co.uk> |
* cdl\infra.cdl: |
|
Adjust help URLs in line with new doc layout. |
|
1999-11-26 Gary Thomas <gthomas@cygnus.co.uk> |
|
* include/cyg_type.h: Add MLT symbols CYGMEM_REGION_ATTR_R/W. |
|
1999-11-23 Hugo Tyson <hmt@cygnus.co.uk> |
|
* cdl/debug.cdl: Add "active_if CYGDBG_USE_TRACING" to all tracing |
only options in the buffered flavour of assert'n'trace. Otherwise |
enabling asserts but no tracing does not build; oldCDL dealt with |
this by a string of ifdefs in the header. Active_if is my friend. |
This also prevents the confusion of having active options that |
have no effect whatsoever. |
Aside: the default is buffered assert'n'trace so that the test |
farm can enable tracing and not get swamped by output. |
|
1999-05-14 Hugo Tyson <hmt@cygnus.co.uk> |
|
* include/cyg_type.h (CYG_INIT_COMPAT): add a new init priority |
level for compatibility layers (for uITRON that is, but |
potentially POSIX also perhaps, after libc anyway). |
|
1999-04-14 John Dallaway <jld@cygnus.co.uk> |
|
* include/pkgconf/infra.h: Add cdl_package doc attribute. |
|
1999-04-12 Jesper Skov <jskov@cygnus.co.uk> |
|
* include/cyg_type.h: Added new init priority for IO devices. |
|
* include/diag.h: |
* src/diag.cxx: |
Use device for diag if configured so. |
|
1999-03-19 Gary Thomas <gthomas@cygnus.co.uk> |
|
* src/diag.cxx (diag_vprintf): Support '%%' printf modifier. |
|
1999-03-05 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* include/cyg_type.h: |
Add CYGBLD_ATTRIB_CONST and tidy define indentation |
|
1999-03-04 Bart Veer <bartv@cygnus.co.uk> |
|
* include/diag.h: |
Added a #include for <pkgconf/infra.h> so that the header file |
can correctly check for CYGDBG_INFRA_DIAG_PRINTF_USE_VARARG |
|
1999-02-25 Nick Garnett <nickg@cygnus.co.uk> |
|
* include/cyg_type.h: |
Added CYGBLD_ATTRIB_ASM_ALIAS() macro to supply an alias for a |
variable while it is being defined. |
|
1999-02-24 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* include/cyg_type.h (CYG_INIT_APPLICATION): Add CYG_INIT_DRIVERS |
priority |
|
* src/tcdiag.cxx (cyg_test_output): Re-include angle brackets |
for CYG_TEST_GDBCMD command |
|
1999-02-23 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* include/testcase.h (CYG_TEST_NA): |
Add call to cyg_test_exit() |
|
1999-02-22 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* include/cyg_type.h: |
Add CYGBLD_ATTRIB_INIT_PRI/BEFORE/AFTER macros. |
Remove CYG_INIT_BEFORE/AFTER as they were unusable |
|
* include/testcase.h: |
* src/tcdiag.cxx: |
Add CYGNUM_TEST_NA() macro for not applicable state |
Don't need to call diag_init() any more from cyg_test_init() |
|
* src/diag.c: |
* src/diag.cxx: |
Rename diag.c to diag.cxx |
Add dummy constructor object to do initialization right after the |
HAL has started. Needed to get asserts working correctly at |
constructor time, and for CYGNUM_TEST_GDBCMD to work as intended |
(i.e. before calling CYG_TEST_INIT()) |
|
1999-02-17 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* src/tcdiag.cxx (cyg_test_output): Remove angle brackets round |
GDBCMD output |
|
1999-02-16 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* src/fancy.cxx (trim_func): |
* src/simple.cxx (trim_func): |
* src/buffer.cxx (trim_func): |
Don't delete bits before a space as it may not always be a |
type, if using CYG_FUNCNAME rather than relying on |
__PRETTY_FUNCTION__ |
|
* src/tcdiag.cxx (cyg_test_output): |
Add new GDBCMD output and do some tidying vis a vis coding standards |
etc. |
|
* include/testcase.h: |
Do some tidying vis a vis coding standards etc. |
|
1999-02-16 Gary Thomas <gthomas@cygnus.co.uk> |
|
* include/cyg_type.h (CYGBLD_ATTRIB_CONSTRUCTOR): |
New macro, used to define a 'C' routine to be run with 'C++' |
constructors. |
|
1999-01-26 Bart Veer <bartv@cygnus.co.uk> |
|
* include/cyg_type.h (CYGBLD_ATTRIB_NORET): |
Updated the non-GNUC version of the macro |
|
1999-01-21 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* include/cyg_type.h: |
Remove all traces of CYG_KERNEL_USE_INIT_PRIORITY option - now |
compulsory. Consequently can remove include of pkgconf/infra.h. |
Add CYG_INIT_PREDEFAULT priority for |
CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG implementation. |
Change CYGBLD_NORET to CYGBLD_ATTRIB_NORET |
Add CYGBLD_ATTRIB_ALIAS and CYGBLD_ATTRIB_WEAK_ALIAS macros |
|
* include/cyg_ass.h: |
* include/testcase.h |
Change CYGBLD_NORET to CYGBLD_ATTRIB_NORET |
|
* src/startup.cxx: |
Split up into smaller files to make GDB happier when debuggin |
|
* src/pkgstart.cxx: |
* src/prestart.cxx: |
* src/userstart.cxx: |
New files with contents originally from startup.cxx |
|
1999-01-19 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* include/cyg_type.h (CYG_REFERENCE_OBJECT): |
Make this work with no overhead, although it doesn't work with |
anything other than objects with constructors. I _believe_ this |
is the only relevant situation though. Bite me. |
Fix for PR 18782 |
|
1999-01-14 Jesper Skov <jskov@cygnus.co.uk> |
|
* include/cyg_type.h (CYG_REFERENCE_SYMBOL): Added. |
|
1999-01-13 Gary Thomas <gthomas@cygnus.co.uk> |
|
* include/cyg_type.h: Default handling of 'CYG_DOUBLE_BYTEORDER' |
|
1999-01-13 Jesper Skov <jskov@cygnus.co.uk> |
|
* include/cyg_type.h (CYG_UNUSED_PARAM): Don't assign to the |
unused parameter; it might be a macro constant. |
|
1999-01-11 Bart Veer <bartv@cygnus.co.uk> |
|
* src/tcdiag.cxx (cyg_test_output): |
* include/testcase.h: |
Use const where appropriate in cyg_test_output() |
|
1999-01-06 Bart Veer <bartv@cygnus.co.uk> |
|
* include/cyg_trac.h (CYG_REPORT_FUNCARG8): |
Removed spurious comma so that the macro actually compiles. |
|
1998-12-24 Bart Veer <bartv@cygnus.co.uk> |
|
* src/simple.cxx: |
* src/null.cxx: |
* src/fancy.cxx: |
* src/diag.c: |
* src/buffer.cxx: |
* include/diag.h: |
In the assertion support, use const where appropriate. |
|
1998-12-24 Bart Veer <bartv@cygnus.co.uk> |
|
* include/cyg_ass.h: |
The prototype for cyg_assert_fail() is now always present. |
const is used wherever appropriate. |
A number of additional assertion macros are now defined. |
Host-specific assertion support has been added. |
Some minor tweaks for greater consistency in macro usage. |
|
1998-12-21 Bart Veer <bartv@cygnus.co.uk> |
|
* include/cyg_type.h: |
Allow for platforms where pointers are not 32 bits wide. |
|
1998-12-16 Hugo Tyson <hmt@cygnus.co.uk> |
|
* include/testcase.h (cyg_test_is_simulator): |
* src/tcdiag.cxx (cyg_test_is_simulator): |
Change the type to int so that all gdb's understand it. |
(it was impossible to assign to from the prompt as a bool) |
|
1998-12-09 Bart Veer <bartv@cygnus.co.uk> |
|
* include/testcase.h: |
Hide a __noreturn__ attribute inside a macro so that the |
header file can be used for host-side code. |
|
1998-11-02 Jesper Skov <jskov@cygnus.co.uk> |
|
* src/memset.c (_memset): Use type casted pointer to avoid |
compiler warning. |
|
Mon Oct 26 21:20:13 1998 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* src/buffer.cxx: |
Make write_thread_id() conditional on CYGDBG_USE_ASSERTS as that's |
the only time it is used. This silences a compiler warning |
|
Mon Oct 26 19:40:48 1998 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* src/memset.c, src/memcpy.c: |
Conditionalise out all tracing for now |
Fix for PR 17996 |
|
Fri Oct 23 05:42:36 1998 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* include/cyg_ass.h (CYGASSERT_docall): |
Make a dummy reference to _msg_ argument when |
CYGDBG_INFRA_DEBUG_ASSERT_MESSAGE is disabled, otherwise we may get |
"unused variable" warnings |
Fix for PR 17889 |
|
1998-10-22 Hugo Tyson <hmt@cygnus.co.uk> |
|
* src/buffer.cxx (increment_buffer_pos): |
Use the correctly named print_trace_buffer() rather than some |
typo/globaleditto. |
(cyg_trace_dump): only refer to thread->get_saved_context() if |
CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT is defined. |
|
1998-10-22 Hugo Tyson <hmt@cygnus.co.uk> |
|
* src/buffer.cxx (write_thread_id): |
Make get_tid() be there when used. |
|
* include/pkgconf/infra.h: |
Only enable all the buffered tracing stuff if USE_TRACING is |
selected; otherwise link errors ensue if only USE_ASSERTS is |
enabled. |
|
1998-10-22 Jesper Skov <jskov@cygnus.co.uk> |
PR 17914 |
|
* src/simple.cxx (CYG_NO_THREADID): Set if there is no Kernel |
support. |
|
1998-10-20 Nick Garnett <nickg@cygnus.co.uk> |
|
* src/null.cxx: |
Removed fix for PR 17471 since the required macros have been moved |
to cyg_type.h. |
|
* include/diag.h (diag_printf): |
* src/diag.c (diag_printf): |
Made use of variadic arguments optional in this function. |
|
* include/pkgconf/infra.h: |
Added configury to support buffered tracing. |
|
* src/fancy.cxx (trim_func): |
Fixed fencepost bug. |
|
* src/PKGconf.mak: |
* src/buffer.cxx: |
Added buffer.cxx to implement buffered trace log. |
|
Thu Oct 15 21:27:23 1998 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* src/delete.cxx, src/memcpy.c, src/memset.c: |
Moved here from ecc/kernel/current/src/common, as they should |
be present even if the kernel is disabled |
|
* include/pkgconf/infra.h: |
Add new config options CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMCPY |
and CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMSET to support the |
functionality available in memcpy.c and memset.c |
|
* src/PKGconf.mak: |
build above new files |
|
Above changes are required for PR 17229 |
|
1998-10-14 Nick Garnett <nickg@cygnus.co.uk> |
|
* include/cyg_type.h: |
Moved CYG_LABEL_NAME() macro here from ktypes.h. |
|
Wed Oct 14 17:10:12 1998 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* src/diag.c: |
Change warning message from previous change to match compiler |
output exactly |
|
Tue Oct 13 17:23:37 1998 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* src/diag.c: |
Output another warning so that people know that diag.c produces |
a warning |
Reformat to 76 columns |
Change args of diag_printf to be ANSI-style, not K&R to |
silence warning |
|
1998-09-25 Bart Veer <bartv@cygnus.co.uk> |
|
* src/null.cxx: |
PR 17471: null.cxx relies on the macro CYG_LABEL_NAME(), which on |
the mn10300 is defined only if <cyg/kernel/ktypes.h> is included. |
As a temporary fix this header file is now always included. In the |
medium term there will have to be proper fixes to ktypes.h and to |
cyg_type.h |
|
Wed Sep 16 03:42:16 1998 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* src/startup.cxx, src/dummyxxmain.cxx: |
Move __main() to a separate dummyxxmain.cxx source file to resolve |
linking bogosities on some targets |
Fix for PR 17279 - kudos to Tim Goodwin really |
|
* src/PKGconf.mak: |
Build src/dummyxxmain.cxx |
|
Tue Sep 15 19:14:33 1998 David Moore <dsm@keema.cygnus.co.uk> |
|
* include/pkgconf/infra.h: Cleaned up comments. |
|
Tue Sep 15 14:34:34 1998 David Moore <dsm@cygnus.co.uk> |
|
* src/startup.cxx: |
* include/cyg_type.h: |
CYGBLD_ATTRIB_WEAK moved from src/startup.cxx to |
include/cyg_type.h |
|
Tue Sep 15 12:26:36 1998 Jonathan Larmour <jlarmour@peshwari.cygnus.co.uk> |
|
* src/null.cxx, src/simple.cxx, src/fancy.cxx: |
Change cyg_check_data_ptr() to not compare with _end symbol from |
linker scripts as this is a bogus thing to do when starting in |
ROM. Some better magic can be done later with the memory layout |
tool. |
|
* src/simple.cxx (cyg_assert_fail), |
src/fancy.cxx (cyg_assert_fail): |
If an assert is thrown, loop forever no matter what the platform |
rather than resetting the jmr board. |
|
Fri Sep 11 12:52:59 1998 Hugo Tyson <hmt@cygnus.co.uk> |
|
* src/tcdiag.cxx: |
* src/diag.c: |
Remove dependencies on the kernel: |
o types are available from here, infra. |
o Diag and its mates are here and the HAL. |
|
Thu Sep 10 21:59:09 1998 Hugo Tyson <hmt@cygnus.co.uk> |
|
* src/fancy.cxx: |
* src/simple.cxx: |
* src/null.cxx: |
Remove dependencies on the kernel: |
o interrupt stuff is available from the HAL. |
o types are available from here, infra. |
o Diag and its mates are here and the HAL. |
o Only consider printing thread information if there is a kernel. |
|
Thu Sep 10 21:29:55 1998 Hugo Tyson <hmt@cygnus.co.uk> |
|
* include/pkgconf/infra.h: |
Fix CDL descriptions (mainly) resulting from review of |
configury here. |
|
Thu Sep 10 17:38:00 1998 Hugo Tyson <hmt@cygnus.co.uk> |
|
* src/null.cxx: |
Add an empty cyg_assert_fail() if not CYGDBG_USE_ASSERTS, so that |
clib's assert() can use it, in common with but regardless of the |
internal assert setup. Of course if internal asserts are used, |
the same routine is used. |
|
Thu Sep 3 19:05:29 1998 Hugo Tyson <hmt@cygnus.co.uk> |
|
* src/startup.cxx (__main): |
...and its mates. Correct the bad usage of the tracing macros - a |
type was implied when the type was void, so an assert fires. |
|
* include/diag.h (diag_printf): |
Remove 'useful' prototype; this function deliberately has a K&R |
prototype to avoid having to use varargs, or pad arglists or |
anything grody like that. Comment to that effect added too. |
|
* src/fancy.cxx: |
Condition out routines which are only used by tracing system; |
prevent warnings. Also changed the default widths setup to |
something more suitable to our long function names; viewing on |
about a 200 column screen recommended - or use 'simple' instead. |
|
Tue Sep 1 19:09:39 1998 Hugo Tyson <hmt@masala.cygnus.co.uk> |
|
* include/pkgconf/infra.h: |
Fancy tracing by default, as I've been requested. |
Move definition (or not) of CYGDBG_INFRA_DIAG_USE_DEVICE from the |
kernel, correcting the symbol construction as we go. |
|
* include/cyg_type.h: |
Correct multiple-inclusion protection, remove |
<dollar>Version<Dollar> nonsense, correct Usage: field, put in |
definition of CYGBLD_NORET. |
|
* include/cyg_ass.h: |
Correct Usage: field, remove definition of CYGDBG_NORET, correct |
definition of cyg_assert_fail to use CYGBLD_NORET as intended. |
|
* include/cyg_trac.h: |
Tidy up comments. |
|
* src/PKGconf.mak (COMPILE): |
Added all the new units below. |
|
* src/fancy.cxx: |
* src/simple.cxx: |
* src/null.cxx: |
Moved here from the kernel; comments changed accordingly. |
|
* src/tcdiag.cxx: |
* include/diag.h: |
* src/diag.c: |
Moved here from the kernel; comments changed accordingly. |
Also use config symbol CYGDBG_INFRA_DIAG_USE_DEVICE rather than |
(badly named) CYG_DIAG_USE_DEVICE. |
|
Fri Aug 28 15:22:16 1998 Hugo Tyson <hmt@cygnus.co.uk> |
|
* include/pkgconf/infra.h: |
Add lots of lovely cdl comments and new, correct, names for the |
config options themselves. |
* include/cyg_trac.h: |
* include/cyg_ass.h: |
Use the newly named options. |
|
[KERNEL] see also changes to src/trace/{fancy,null,simple}.cxx |
which should soon move into this package instead. |
|
Fri Aug 28 09:57:21 1998 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* include/pkgconf/infra.h: |
Add CYGSEM_START_ISO_C_COMPATIBILITY and |
CYGSEM_START_UITRON_COMPATIBILITY options, along with some comment. |
|
* src/PKGconf.mak, src/startup.cxx: |
Add these two files for the new file startup.cxx that provides the |
generic startup mechanism, using new cyg_start() functions. This |
is to remove the dependency on main(), which is defined in ISO and |
POSIX as having certain properties we wouldn't be able to give it |
otherwise. |
|
Tue Aug 25 11:47:58 1998 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* src/startup.cxx: |
Add this to provide new startup method |
|
1998-08-20 Nick Garnett <nickg@cygnus.co.uk> |
|
* include/cyg_type.h: |
Moved constructor priority ordering stuff here from |
kernel/ktypes.h. |
|
//=========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//=========================================================================== |
|
|
|
/src/dummyxxmain.cxx
0,0 → 1,81
//======================================================================== |
// |
// dummyxxmain.cxx |
// |
// Dummy __main() function required for certain targets |
// |
//======================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//======================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 1998-08-25 |
// Purpose: Provide a default empty __main() function |
// Description: Dummy __main() function which certain targets use |
// to invoke constructors. But we invoke constructors |
// explicitly from the linker scripts in eCos |
// Usage: |
// |
//####DESCRIPTIONEND#### |
// |
//======================================================================== |
|
// CONFIGURATION |
|
#include <pkgconf/infra.h> // Configuration header |
|
// INCLUDES |
|
#include <cyg/infra/cyg_type.h> // Common type definitions and support |
#include <cyg/infra/cyg_trac.h> // Default tracing support |
|
|
// FUNCTIONS |
|
externC void |
__main( void ) |
{ |
CYG_REPORT_FUNCTION(); |
CYG_REPORT_FUNCARGVOID(); |
|
CYG_TRACE0( true, "This is the system default __main()" ); |
|
CYG_EMPTY_STATEMENT; // don't let it complain about doing nothing |
|
CYG_REPORT_RETURN(); |
} // __main() |
|
// EOF dummyxxmain.cxx |
/src/eprintf.c
0,0 → 1,100
//======================================================================== |
// |
// eprintf.c |
// |
// __eprintf() used by libgcc |
// |
//======================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//======================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: |
// Date: 2001-08-21 |
// Purpose: Provide __eprintf() as used by libgcc. |
// Description: libgcc calls __eprintf() to display errors and abort. |
// Usage: |
// |
//####DESCRIPTIONEND#### |
// |
//======================================================================== |
|
// CONFIGURATION |
|
#include <pkgconf/system.h> |
|
#ifdef CYGPKG_ISOINFRA |
# include <pkgconf/isoinfra.h> // Configuration header |
#endif |
|
// INCLUDES |
|
#include <cyg/infra/cyg_type.h> // Common type definitions and support |
#include <cyg/infra/cyg_ass.h> // Default assertion |
#include <cyg/infra/diag.h> |
|
#ifdef CYGPKG_ISOINFRA |
# if defined(CYGINT_ISO_STDIO_FORMATTED_IO) || \ |
defined(CYGINT_ISO_STDIO_FILEACCESS) |
# include <stdio.h> |
# endif |
# if CYGINT_ISO_EXIT |
# include <stdlib.h> |
# endif |
#endif |
|
// FUNCTIONS |
|
__externC void |
__eprintf (const char *string, const char *expression, |
unsigned int line, const char *filename) |
{ |
#ifdef CYGINT_ISO_STDIO_FORMATTED_IO |
fprintf(stderr, string, expression, line, filename); |
#else |
diag_printf(string, expression, line, filename); |
#endif |
#ifdef CYGINT_ISO_STDIO_FILEACCESS |
fflush (stderr); |
#endif |
#if CYGINT_ISO_EXIT |
abort(); |
#else |
CYG_FAIL( "Aborting" ); |
for (;;); |
#endif |
} // __eprintf() |
|
// EOF eprintf.c |
/src/simple.cxx
0,0 → 1,563
//========================================================================== |
// |
// simple.cxx |
// |
// Simple, non formatting trace and assert functions |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg |
// Contributors: nickg |
// Date: 1997-12-04 |
// Purpose: Simple Trace and assert functions |
// Description: The functions in this file are simple implementations |
// of the standard trace and assert functions. These do not |
// do any printf style formatting, simply printing the string |
// and arguments directly. |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#include <pkgconf/system.h> |
#include <pkgconf/infra.h> |
|
#ifdef CYGDBG_INFRA_DEBUG_TRACE_ASSERT_SIMPLE |
|
#include <cyg/infra/cyg_type.h> // base types |
#include <cyg/infra/cyg_trac.h> // tracing macros |
#include <cyg/infra/cyg_ass.h> // assertion macros |
|
#include <pkgconf/hal.h> // HAL configury |
#include <cyg/infra/diag.h> // HAL polled output |
#include <cyg/hal/hal_arch.h> // architectural stuff for... |
#include <cyg/hal/hal_intr.h> // interrupt control |
|
#ifdef CYGPKG_KERNEL |
#include <pkgconf/kernel.h> // kernel configury |
#include <cyg/kernel/thread.hxx> // thread id to print |
#include <cyg/kernel/sched.hxx> // ancillaries for above |
#include <cyg/kernel/thread.inl> // ancillaries for above |
#endif |
|
// ------------------------------------------------------------------------- |
// Local Configuration: hack me! |
|
#define CYG_NO_FILENAME 1 |
#define CYG_NO_THREADID 0 |
#define CYG_NO_LINENUM 0 |
#define CYG_NO_FUNCNAME 0 |
#define CYG_DIAG_PRINTF 1 |
|
#ifndef CYGPKG_KERNEL |
# undef CYG_NO_THREADID |
# define CYG_NO_THREADID 1 |
#endif |
// ------------------------------------------------------------------------- |
// Functions to trim file names and function names down to printable lengths |
// (these are shared between trace and assert functions) |
|
static const char *trim_file(const char *file) |
{ |
#if !CYG_NO_FILENAME |
if ( NULL == file ) |
file = "<nofile>"; |
|
const char *f = file; |
|
while( *f ) f++; |
|
while( *f != '/' && f != file ) f--; |
|
return f==file?f:(f+1); |
#else |
return ""; |
#endif |
} |
|
static const char *trim_func(const char *func) |
{ |
#if !CYG_NO_FUNCNAME |
|
static char fbuf[100]; |
int i; |
|
if ( NULL == func ) |
func = "<nofunc>"; |
|
for( i = 0; func[i] && func[i] != '(' ; i++ ) |
fbuf[i] = func[i]; |
|
fbuf[i++] = '('; |
fbuf[i++] = ')'; |
fbuf[i ] = 0; |
|
return &fbuf[0]; |
#else |
return ""; |
#endif |
} |
|
void write_lnum( cyg_uint32 lnum) |
{ |
#if !CYG_NO_LINENUM |
diag_write_char('['); |
diag_write_dec(lnum); |
diag_write_char(']'); |
#endif |
} |
|
void write_thread_id() |
{ |
#if !CYG_NO_THREADID |
Cyg_Thread *t = Cyg_Thread::self(); |
cyg_uint16 tid = 0xFFFF; |
|
if( t != NULL ) tid = t->get_unique_id(); |
|
diag_write_char('<'); |
diag_write_hex(tid); |
diag_write_char('>'); |
#endif |
} |
|
|
// ------------------------------------------------------------------------- |
// Trace functions: |
|
#ifdef CYGDBG_USE_TRACING |
|
externC void |
cyg_tracenomsg( const char *psz_func, const char *psz_file, cyg_uint32 linenum ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
diag_write_string("TRACE: "); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char('\n'); |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
|
}; |
|
// provide every other one of these as a space/caller bloat compromise. |
|
externC void |
cyg_tracemsg( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
if ( NULL == psz_msg ) |
psz_msg = "<nomsg>"; |
|
diag_write_string("TRACE: "); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
diag_write_string(psz_msg); |
diag_write_char('\n'); |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
|
}; |
|
externC void |
cyg_tracemsg2( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
if ( NULL == psz_msg ) |
psz_msg = "<nomsg>"; |
|
diag_write_string("TRACE: "); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
#if CYG_DIAG_PRINTF |
diag_printf( psz_msg, arg0, arg1 ); |
#else |
diag_write_string(psz_msg); |
diag_write_char(' '); |
diag_write_hex(arg0); |
diag_write_char(' '); |
diag_write_hex(arg1); |
#endif |
diag_write_char('\n'); |
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
externC void |
cyg_tracemsg4( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
if ( NULL == psz_msg ) |
psz_msg = "<nomsg>"; |
|
diag_write_string("TRACE: "); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
#if CYG_DIAG_PRINTF |
diag_printf( psz_msg, arg0, arg1, arg2, arg3 ); |
#else |
diag_write_string(psz_msg); |
diag_write_char(' '); |
diag_write_hex(arg0); |
diag_write_char(' '); |
diag_write_hex(arg1); |
diag_write_char(' '); |
diag_write_hex(arg2); |
diag_write_char(' '); |
diag_write_hex(arg3); |
#endif |
diag_write_char('\n'); |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
externC void |
cyg_tracemsg6( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5 ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
if ( NULL == psz_msg ) |
psz_msg = "<nomsg>"; |
|
diag_write_string("TRACE: "); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
#if CYG_DIAG_PRINTF |
diag_printf( psz_msg, arg0, arg1, arg2, arg3, arg4, arg5 ); |
#else |
diag_write_string(psz_msg); |
diag_write_char(' '); |
diag_write_hex(arg0); |
diag_write_char(' '); |
diag_write_hex(arg1); |
diag_write_char(' '); |
diag_write_hex(arg2); |
diag_write_char(' '); |
diag_write_hex(arg3); |
diag_write_char(' '); |
diag_write_hex(arg4); |
diag_write_char(' '); |
diag_write_hex(arg5); |
#endif |
diag_write_char('\n'); |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
externC void |
cyg_tracemsg8( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5, |
CYG_ADDRWORD arg6, CYG_ADDRWORD arg7 ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
if ( NULL == psz_msg ) |
psz_msg = "<nomsg>"; |
|
diag_write_string("TRACE: "); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
#if CYG_DIAG_PRINTF |
diag_printf( psz_msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 ); |
#else |
diag_write_string(psz_msg); |
diag_write_char(' '); |
diag_write_hex(arg0); |
diag_write_char(' '); |
diag_write_hex(arg1); |
diag_write_char(' '); |
diag_write_hex(arg2); |
diag_write_char(' '); |
diag_write_hex(arg3); |
diag_write_char(' '); |
diag_write_hex(arg4); |
diag_write_char(' '); |
diag_write_hex(arg5); |
diag_write_char(' '); |
diag_write_hex(arg6); |
diag_write_char(' '); |
diag_write_hex(arg7); |
#endif |
diag_write_char('\n'); |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
// ------------------------------------------------------------------------- |
|
externC void |
cyg_trace_dump(void) |
{ |
#if defined(CYGPKG_KERNEL) && defined(CYG_DIAG_PRINTF) |
|
{ |
diag_printf("\nScheduler:\n\n"); |
|
Cyg_Scheduler *sched = &Cyg_Scheduler::scheduler; |
|
diag_printf("Lock: %d\n",sched->get_sched_lock() ); |
|
# ifdef CYGVAR_KERNEL_THREADS_NAME |
|
diag_printf("Current Thread: %s\n",sched->get_current_thread()->get_name()); |
|
# else |
|
diag_printf("Current Thread: %d\n",sched->get_current_thread()->get_unique_id()); |
|
# endif |
|
} |
|
# ifdef CYGVAR_KERNEL_THREADS_LIST |
|
{ |
Cyg_Thread *t = Cyg_Thread::get_list_head(); |
|
diag_printf("\nThreads:\n\n"); |
|
while( NULL != t ) |
{ |
cyg_uint32 state = t->get_state(); |
char tstate[7]; |
char *tstate1 = "SCUKX"; |
static char *(reasons[8]) = |
{ |
"NONE", // No recorded reason |
"WAIT", // Wait with no timeout |
"DELAY", // Simple time delay |
"TIMEOUT", // Wait with timeout/timeout expired |
"BREAK", // forced break out of sleep |
"DESTRUCT", // wait object destroyed[note] |
"EXIT", // forced termination |
"DONE" // Wait/delay complete |
}; |
|
if( 0 != state ) |
{ |
// Knock out chars that do not correspond to set bits. |
for( int i = 0; i < 6 ; i++ ) |
if( 0 == (state & (1<<i)) ) |
tstate[i] = ' '; |
else tstate[i] = tstate1[i]; |
tstate[6] = 0; |
} |
else tstate[0] = 'R', tstate[1] = 0; |
|
# ifdef CYGVAR_KERNEL_THREADS_NAME |
|
diag_printf( "%20s pri = %3d state = %6s id = %3d\n", |
t->get_name(), |
t->get_priority(), |
tstate, |
t->get_unique_id() |
); |
# else |
|
diag_printf( "Thread %3d pri = %3d state = %6s\n", |
t->get_unique_id(), |
t->get_priority(), |
tstate |
); |
|
# endif |
diag_printf( "%20s stack base = %08x ptr = %08x size = %08x\n", |
"", |
t->get_stack_base(), |
#ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT |
t->get_saved_context(), |
#else |
0, |
#endif |
t->get_stack_size() |
); |
|
diag_printf( "%20s sleep reason %8s wake reason %8s\n", |
"", |
reasons[t->get_sleep_reason()], |
reasons[t->get_wake_reason()] |
); |
|
diag_printf( "%20s queue = %08x wait info = %08x\n", |
"", |
t->get_current_queue(), |
t->get_wait_info() |
); |
|
diag_printf("\n"); |
t = t->get_list_next(); |
} |
|
} |
# endif // CYGVAR_KERNEL_THREADS_LIST |
|
#endif // CYG_DIAG_PRINTF |
} |
|
#endif // CYGDBG_USE_TRACING |
|
// ------------------------------------------------------------------------- |
// Assert functions: |
|
#ifdef CYGDBG_USE_ASSERTS |
|
externC void |
cyg_assert_fail( const char *psz_func, const char *psz_file, |
cyg_uint32 linenum, const char *psz_msg ) __THROW |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
diag_write_string("ASSERT FAIL: "); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
diag_write_string(psz_msg); |
diag_write_char('\n'); |
|
#ifdef CYGHWR_TEST_PROGRAM_EXIT |
CYGHWR_TEST_PROGRAM_EXIT(); |
#endif |
for(;;); |
|
// DIAG_DEVICE_END_SYNC(); |
// HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
extern "C" |
{ |
extern unsigned long _stext; |
extern unsigned long _etext; |
|
unsigned long stext_addr = (unsigned long)&_stext; |
unsigned long etext_addr = (unsigned long)&_etext; |
}; |
|
externC cyg_bool cyg_check_data_ptr(const void *ptr) |
{ |
unsigned long p = (unsigned long)ptr; |
|
if( p == 0 ) return false; |
|
if( p > stext_addr && p < etext_addr ) return false; |
|
return true; |
} |
|
externC cyg_bool cyg_check_func_ptr(const void (*ptr)(void)) |
{ |
unsigned long p = (unsigned long)ptr; |
|
if( p == 0 ) return false; |
|
if( p < stext_addr && p > etext_addr ) return false; |
|
return true; |
} |
|
#endif // CYGDBG_USE_ASSERTS |
|
#endif // CYGDBG_INFRA_DEBUG_TRACE_ASSERT_SIMPLE |
|
// ------------------------------------------------------------------------- |
// EOF simple.cxx |
/src/tcdiag.cxx
0,0 → 1,263
//========================================================================== |
// |
// tcdiag.cxx |
// |
// Infrastructure diag test harness. |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): dsm |
// Contributors: dsm, jlarmour |
// Date: 1999-02-16 |
// Description: Test harness implementation that uses the infrastructure |
// diag channel. This is intended for manual testing. |
// |
//####DESCRIPTIONEND#### |
|
#include <pkgconf/infra.h> |
#include <pkgconf/system.h> |
#include CYGBLD_HAL_TARGET_H // get initialization for |
#include CYGBLD_HAL_PLATFORM_H // cyg_test_is_simulator |
|
#include <cyg/infra/cyg_type.h> // base types |
#include <cyg/hal/hal_arch.h> // any architecture specific stuff |
#include <cyg/infra/diag.h> // HAL polled output |
#include <cyg/infra/testcase.h> // what we implement |
|
#include <cyg/hal/hal_intr.h> // exit macro, if defined |
|
#ifdef CYGHWR_TARGET_SIMULATOR_NO_GDB_WORKING |
int cyg_test_is_simulator = 1; // set this anyway |
#else |
int cyg_test_is_simulator = 0; // infrastructure changes as necessary |
#endif |
|
//---------------------------------------------------------------------------- |
// Functions ensuring we get pretty printed assertion messages in the |
// farm - regardless of configuration and GDB capabilities. |
|
#ifdef CYGPKG_KERNEL |
# include <pkgconf/kernel.h> |
# include <cyg/kernel/thread.hxx> // thread id to print |
# include <cyg/kernel/thread.inl> // ancillaries for above |
#endif |
|
#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT |
#include <cyg/hal/hal_if.h> |
#endif |
|
static inline const char *trim_file(const char *file) |
{ |
if ( NULL == file ) |
file = "<nofile>"; |
|
const char *f = file; |
|
while( *f ) f++; |
|
while( *f != '/' && f != file ) f--; |
|
return f==file?f:(f+1); |
} |
|
static inline const char *trim_func(const char *func) |
{ |
static char fbuf[100]; |
int i; |
|
if ( NULL == func ) |
func = "<nofunc>"; |
|
for( i = 0; func[i] && func[i] != '(' ; i++ ) |
fbuf[i] = func[i]; |
|
fbuf[i++] = '('; |
fbuf[i++] = ')'; |
fbuf[i ] = 0; |
|
return &fbuf[0]; |
} |
|
static inline |
void write_lnum( cyg_uint32 lnum) |
{ |
diag_write_char('['); |
diag_write_dec(lnum); |
diag_write_char(']'); |
} |
|
static inline |
void write_thread_id() |
{ |
#ifdef CYGPKG_KERNEL |
Cyg_Thread *t = Cyg_Thread::self(); |
cyg_uint16 tid = 0xFFFF; |
|
if( t != NULL ) tid = t->get_unique_id(); |
|
diag_write_char('<'); |
diag_write_hex(tid); |
diag_write_char('>'); |
#endif |
} |
|
// Called from the CYG_ASSERT_DOCALL macro |
externC void |
cyg_assert_msg( const char *psz_func, const char *psz_file, |
cyg_uint32 linenum, const char *psz_msg ) __THROW |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
#ifdef CYG_HAL_DIAG_LOCK |
CYG_HAL_DIAG_LOCK(); |
#endif |
|
#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT |
{ |
int cur_console; |
int i; |
cur_console = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); |
if ( CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, |
"info_console_force", &i, |
CYGNUM_FLASH_CFG_OP_CONFIG_BOOL ) ) |
if ( i ) |
if ( CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, |
"info_console_number", &i, |
CYGNUM_FLASH_CFG_OP_CONFIG_INT ) ) |
// Then i is the console to force it to: |
CYGACC_CALL_IF_SET_CONSOLE_COMM( i ); |
#endif |
diag_write_string("ASSERT FAIL: "); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
diag_write_string(psz_msg); |
diag_write_char('\n'); |
|
#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT |
CYGACC_CALL_IF_SET_CONSOLE_COMM(cur_console); |
} |
#endif |
#ifdef CYG_HAL_DIAG_UNLOCK |
CYG_HAL_DIAG_UNLOCK(); |
#endif |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
} |
|
externC void |
cyg_test_init(void) |
{ |
// currently nothing |
} |
|
externC void |
cyg_test_output(Cyg_test_code status, const char *msg, int line, |
const char *file) |
{ |
char *st; |
|
switch (status) { |
case CYGNUM_TEST_FAIL: |
st = "FAIL:"; |
break; |
case CYGNUM_TEST_PASS: |
st = "PASS:"; |
break; |
case CYGNUM_TEST_EXIT: |
st = "EXIT:"; |
break; |
case CYGNUM_TEST_INFO: |
st = "INFO:"; |
break; |
case CYGNUM_TEST_GDBCMD: |
st = "GDB:"; |
break; |
case CYGNUM_TEST_NA: |
st = "NOTAPPLICABLE:"; |
break; |
default: |
st = "UNKNOWN STATUS:"; |
break; |
} |
|
#ifdef CYG_HAL_DIAG_LOCK |
CYG_HAL_DIAG_LOCK(); |
#endif |
|
diag_write_string(st); |
diag_write_char('<'); |
diag_write_string(msg); |
diag_write_char('>'); |
if( CYGNUM_TEST_FAIL == status ) { |
diag_write_string(" Line: "); |
diag_write_dec(line); |
diag_write_string(", File: "); |
diag_write_string(file); |
} |
diag_write_char('\n'); |
|
#ifdef CYG_HAL_DIAG_UNLOCK |
CYG_HAL_DIAG_UNLOCK(); |
#endif |
|
|
} |
|
// This is an appropriate function to set a breakpoint on |
externC void |
cyg_test_exit(void) |
{ |
// workaround SH dwarf2 gen problem |
#if defined(CYGPKG_HAL_SH) && (__GNUC__ >= 3) |
static volatile int i; |
i++; |
#endif |
#ifdef CYGHWR_TEST_PROGRAM_EXIT |
CYGHWR_TEST_PROGRAM_EXIT(); |
#endif |
|
for(;;) |
; |
} |
// EOF tcdiag.cxx |
/src/userstart.cxx
0,0 → 1,86
//======================================================================== |
// |
// userstart.cxx |
// |
// General startup code for the target machine |
// |
//======================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//======================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 1999-01-21 |
// Purpose: This provides generic startup code for the eCos system. |
// Description: We start the system with the entry point cyg_start() |
// which is called from the eCos HALs. This in turn invokes |
// cyg_prestart(), cyg_package_start() and cyg_user_start(). |
// All these can be overriden by the user. |
// Usage: Override the defaults to use your own startup code. |
// cyg_user_start() is the default entry point for programs |
// not using a compatibility layer |
// |
//####DESCRIPTIONEND#### |
// |
//======================================================================== |
|
// INCLUDES |
|
#include <cyg/infra/cyg_type.h> // Common type definitions and support |
#include <cyg/infra/cyg_trac.h> // Default tracing support |
|
// FUNCTION PROTOTYPES |
|
externC void |
cyg_user_start( void ) CYGBLD_ATTRIB_WEAK; |
|
|
// FUNCTIONS |
|
void |
cyg_user_start( void ) |
{ |
CYG_REPORT_FUNCTION(); |
CYG_REPORT_FUNCARGVOID(); |
|
CYG_TRACE0( true, "This is the system default cyg_user_start()" ); |
|
CYG_EMPTY_STATEMENT; // don't let it complain about doing nothing |
|
CYG_REPORT_RETURN(); |
} // cyg_user_start() |
|
|
// EOF userstart.cxx |
/src/pkgstart.cxx
0,0 → 1,99
//======================================================================== |
// |
// pkgstart.cxx |
// |
// General startup code for the target machine |
// |
//======================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//======================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 1999-01-21 |
// Purpose: This provides generic startup code for the eCos system. |
// Description: We start the system with the entry point cyg_start() |
// which is called from the eCos HALs. This in turn invokes |
// cyg_prestart(), cyg_package_start() and cyg_user_start(). |
// All these can be overriden by the user. |
// Usage: Override the defaults to use your own startup code. |
// cyg_package_start() is used to call into individual |
// packages' startup code. Alternatively leave it be and |
// use the configuration options to set the appropriate |
// compatibility environment e.g. uItron, etc. |
// This may be automatically generated in the future. |
// |
//####DESCRIPTIONEND#### |
// |
//======================================================================== |
|
// CONFIGURATION |
|
#include <pkgconf/infra.h> // Configuration header |
|
// INCLUDES |
|
#include <cyg/infra/cyg_type.h> // Common type definitions and support |
#include <cyg/infra/cyg_trac.h> // Default tracing support |
|
#ifdef CYGSEM_START_UITRON_COMPATIBILITY |
# include <cyg/compat/uitron/uit_func.h> |
#endif |
|
// FUNCTION PROTOTYPES |
|
externC void |
cyg_package_start( void ) CYGBLD_ATTRIB_WEAK; |
|
// FUNCTIONS |
|
void |
cyg_package_start( void ) |
{ |
CYG_REPORT_FUNCTION(); |
CYG_REPORT_FUNCARGVOID(); |
|
CYG_TRACE0( true, "This is the system default cyg_package_start()" ); |
|
#ifdef CYGSEM_START_UITRON_COMPATIBILITY |
cyg_uitron_start(); |
#endif |
|
CYG_EMPTY_STATEMENT; // don't let it complain about doing nothing |
|
CYG_REPORT_RETURN(); |
} // cyg_package_start() |
|
// EOF pkgstart.cxx |
/src/fancy.cxx
0,0 → 1,662
//========================================================================== |
// |
// fancy.cxx |
// |
// Fancy formatting trace and assert functions |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg |
// Contributors: nickg |
// Date: 1997-12-04 |
// Purpose: Fancy Trace and assert functions |
// Description: The functions in this file are fancy implementations of the |
// standard trace and assert functions. These do printf |
// style formatting, printing the string and arguments. |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#include <pkgconf/system.h> |
#include <pkgconf/infra.h> |
|
#ifdef CYGDBG_INFRA_DEBUG_TRACE_ASSERT_FANCY |
|
#include <cyg/infra/cyg_type.h> // base types |
#include <cyg/infra/cyg_trac.h> // tracing macros |
#include <cyg/infra/cyg_ass.h> // assertion macros |
|
#include <pkgconf/hal.h> // HAL configury |
#include <cyg/infra/diag.h> // HAL polled output |
#include <cyg/hal/hal_arch.h> // architectural stuff for... |
#include <cyg/hal/hal_intr.h> // interrupt control |
|
#ifdef CYGPKG_KERNEL |
#include <pkgconf/kernel.h> // kernel configury |
#include <cyg/kernel/thread.hxx> // thread id to print |
#include <cyg/kernel/sched.hxx> // ancillaries for above |
#include <cyg/kernel/thread.inl> // ancillaries for above |
#endif |
|
// ------------------------------------------------------------------------- |
// Local Configuration: hack me! |
|
// these are generally: |
// if 0, feature is disabled |
// if 1, feature is enabled, printing is default width |
// if >1, field is padded up to that width if necessary |
// (not truncated ever) |
|
#define CYG_FILENAME 20 |
#define CYG_THREADID 0 // DO NOT SET IF NO KERNEL |
#define CYG_LINENUM 4 |
#define CYG_FUNCNAME 100 |
#define CYG_DIAG_PRINTF 1 |
#define CYG_FUNC_INDENT 2 |
|
#ifndef CYGPKG_KERNEL |
# undef CYG_THREADID |
# define CYG_THREADID 0 |
#endif |
|
#if CYG_FUNCNAME == 1 |
#define CYG_FBUF_SIZE 100 |
#else |
#define CYG_FBUF_SIZE (CYG_FUNCNAME+20) |
#endif |
|
// ------------------------------------------------------------------------- |
// Functions to trim file names and function names down to printable lengths |
// (these are shared between trace and assert functions) |
|
#ifdef CYGDBG_USE_TRACING |
|
#if 0 |
static char * tracepremsgs[] = { |
" INFO:", |
"ENTER :", |
"ARGS :", |
"RETURN:", |
"bad code" |
}; |
#endif |
|
static char * tracepremsgs[] = { |
"'", |
"{{", |
"((", |
"}}", |
"bad code" |
}; |
|
static char * tracepostmsgs[] = { |
"'", |
"", |
"))", |
"", |
"bad code" |
}; |
|
static void |
write_whattrace( cyg_uint32 what ) |
{ |
#if CYG_FUNC_INDENT |
static cyg_uint32 cyg_indent = 0; |
if ( 3 == what ) |
cyg_indent -= CYG_FUNC_INDENT; |
cyg_uint32 i = cyg_indent; |
for ( ; i > 0; i-- ) |
diag_write_string( " " ); |
#endif // CYG_FUNC_INDENT |
diag_write_string( tracepremsgs[ what > 4 ? 4 : what ] ); |
#if CYG_FUNC_INDENT |
if ( 1 == what ) |
cyg_indent += CYG_FUNC_INDENT; |
#endif // CYG_FUNC_INDENT |
} |
|
static void |
write_whattracepost( cyg_uint32 what ) |
{ |
diag_write_string( tracepostmsgs[ what > 4 ? 4 : what ] ); |
} |
#endif // CYGDBG_USE_TRACING |
|
static const char *trim_file(const char *file) |
{ |
#if CYG_FILENAME |
if ( NULL == file ) |
file = "<nofile>"; |
|
#if 1 == CYG_FILENAME |
const char *f = file; |
while( *f ) f++; |
while( *f != '/' && f != file ) f--; |
return f==file?f:(f+1); |
#else |
static char fbuf2[100]; |
const char *f = file; |
char *g = fbuf2; |
while( *f ) f++; |
while( *f != '/' && f != file ) f--; |
if ( f > file ) f++; |
while( *f ) *g++ = *f++; |
while( CYG_FILENAME > (g - fbuf2) ) *g++ = ' '; |
*g = 0; |
return fbuf2; |
#endif |
#else |
return ""; |
#endif |
} |
|
static const char *trim_func(const char *func) |
{ |
#if CYG_FUNCNAME |
static char fbuf[CYG_FBUF_SIZE]; |
int i; |
|
if ( NULL == func ) |
func = "<nofunc>"; |
|
for( i = 0; func[i] && func[i] != '(' && i < CYG_FBUF_SIZE-4 ; i++ ) |
fbuf[i] = func[i]; |
|
fbuf[i++] = '('; |
fbuf[i++] = ')'; |
fbuf[i ] = 0; |
i=0; |
#if 1 == CYG_FUNCNAME |
return &fbuf[i]; |
#else |
char *p = &fbuf[i]; |
while ( *p ) p++; |
while ( CYG_FUNCNAME > (p - (&fbuf[i])) ) *p++ = ' '; |
*p = 0; |
return &fbuf[i]; |
#endif |
#else |
return ""; |
#endif |
} |
|
void write_lnum( cyg_uint32 lnum) |
{ |
#if CYG_LINENUM |
diag_write_char('['); |
#if 1 < CYG_LINENUM |
cyg_uint32 i, j; |
for ( i = 2, j = 100; i < CYG_LINENUM ; i++, j *= 10 ) |
if ( lnum < j ) |
diag_write_char(' '); |
#endif |
diag_write_dec(lnum); |
diag_write_char(']'); |
diag_write_char(' '); |
#endif |
} |
|
void write_thread_id() |
{ |
#if CYG_THREADID |
Cyg_Thread *t = Cyg_Thread::self(); |
cyg_uint16 tid = 0xFFFF; |
|
if( t != NULL ) tid = t->get_unique_id(); |
|
diag_write_char('<'); |
diag_write_hex(tid); |
diag_write_char('>'); |
#endif |
} |
|
// ------------------------------------------------------------------------- |
// Trace functions: |
|
#ifdef CYGDBG_USE_TRACING |
|
externC void |
cyg_tracenomsg( const char *psz_func, const char *psz_file, cyg_uint32 linenum ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
diag_write_string("TRACE: "); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char('\n'); |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
|
}; |
|
// provide every other one of these as a space/caller bloat compromise. |
|
externC void |
cyg_tracemsg( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
if ( NULL == psz_msg ) |
psz_msg = "<nomsg>"; |
|
diag_write_string( "TRACE: " ); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
write_whattrace( what ); |
diag_write_string(psz_msg); |
write_whattracepost( what ); |
diag_write_char('\n'); |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
|
}; |
|
externC void |
cyg_tracemsg2( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
if ( NULL == psz_msg ) |
psz_msg = "<nomsg>"; |
|
diag_write_string( "TRACE: " ); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
write_whattrace( what ); |
#if CYG_DIAG_PRINTF |
diag_printf( psz_msg, arg0, arg1 ); |
#else |
diag_write_string(psz_msg); |
diag_write_char(' '); |
diag_write_hex(arg0); |
diag_write_char(' '); |
diag_write_hex(arg1); |
#endif |
write_whattracepost( what ); |
diag_write_char('\n'); |
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
externC void |
cyg_tracemsg4( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
if ( NULL == psz_msg ) |
psz_msg = "<nomsg>"; |
|
diag_write_string( "TRACE: " ); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
write_whattrace( what ); |
#if CYG_DIAG_PRINTF |
diag_printf( psz_msg, arg0, arg1, arg2, arg3 ); |
#else |
diag_write_string(psz_msg); |
diag_write_char(' '); |
diag_write_hex(arg0); |
diag_write_char(' '); |
diag_write_hex(arg1); |
diag_write_char(' '); |
diag_write_hex(arg2); |
diag_write_char(' '); |
diag_write_hex(arg3); |
#endif |
write_whattracepost( what ); |
diag_write_char('\n'); |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
externC void |
cyg_tracemsg6( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5 ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
if ( NULL == psz_msg ) |
psz_msg = "<nomsg>"; |
|
diag_write_string( "TRACE: " ); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
write_whattrace( what ); |
#if CYG_DIAG_PRINTF |
diag_printf( psz_msg, arg0, arg1, arg2, arg3, arg4, arg5 ); |
#else |
diag_write_string(psz_msg); |
diag_write_char(' '); |
diag_write_hex(arg0); |
diag_write_char(' '); |
diag_write_hex(arg1); |
diag_write_char(' '); |
diag_write_hex(arg2); |
diag_write_char(' '); |
diag_write_hex(arg3); |
diag_write_char(' '); |
diag_write_hex(arg4); |
diag_write_char(' '); |
diag_write_hex(arg5); |
#endif |
write_whattracepost( what ); |
diag_write_char('\n'); |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
externC void |
cyg_tracemsg8( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5, |
CYG_ADDRWORD arg6, CYG_ADDRWORD arg7 ) |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
if ( NULL == psz_msg ) |
psz_msg = "<nomsg>"; |
|
diag_write_string( "TRACE: " ); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
write_whattrace( what ); |
#if CYG_DIAG_PRINTF |
diag_printf( psz_msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 ); |
#else |
diag_write_string(psz_msg); |
diag_write_char(' '); |
diag_write_hex(arg0); |
diag_write_char(' '); |
diag_write_hex(arg1); |
diag_write_char(' '); |
diag_write_hex(arg2); |
diag_write_char(' '); |
diag_write_hex(arg3); |
diag_write_char(' '); |
diag_write_hex(arg4); |
diag_write_char(' '); |
diag_write_hex(arg5); |
diag_write_char(' '); |
diag_write_hex(arg6); |
diag_write_char(' '); |
diag_write_hex(arg7); |
#endif |
write_whattracepost( what ); |
diag_write_char('\n'); |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
// ------------------------------------------------------------------------- |
|
externC void |
cyg_trace_dump(void) |
{ |
#if defined(CYGPKG_KERNEL) && defined(CYG_DIAG_PRINTF) |
|
{ |
diag_printf("\nScheduler:\n\n"); |
|
Cyg_Scheduler *sched = &Cyg_Scheduler::scheduler; |
|
diag_printf("Lock: %d\n",sched->get_sched_lock() ); |
|
# ifdef CYGVAR_KERNEL_THREADS_NAME |
|
diag_printf("Current Thread: %s\n",sched->get_current_thread()->get_name()); |
|
# else |
|
diag_printf("Current Thread: %d\n",sched->get_current_thread()->get_unique_id()); |
|
# endif |
|
} |
|
# ifdef CYGVAR_KERNEL_THREADS_LIST |
|
{ |
Cyg_Thread *t = Cyg_Thread::get_list_head(); |
|
diag_printf("\nThreads:\n\n"); |
|
while( NULL != t ) |
{ |
cyg_uint32 state = t->get_state(); |
char tstate[7]; |
char *tstate1 = "SCUKX"; |
static char *(reasons[8]) = |
{ |
"NONE", // No recorded reason |
"WAIT", // Wait with no timeout |
"DELAY", // Simple time delay |
"TIMEOUT", // Wait with timeout/timeout expired |
"BREAK", // forced break out of sleep |
"DESTRUCT", // wait object destroyed[note] |
"EXIT", // forced termination |
"DONE" // Wait/delay complete |
}; |
|
if( 0 != state ) |
{ |
// Knock out chars that do not correspond to set bits. |
for( int i = 0; i < 6 ; i++ ) |
if( 0 == (state & (1<<i)) ) |
tstate[i] = ' '; |
else tstate[i] = tstate1[i]; |
tstate[6] = 0; |
} |
else tstate[0] = 'R', tstate[1] = 0; |
|
# ifdef CYGVAR_KERNEL_THREADS_NAME |
|
diag_printf( "%20s pri = %3d state = %6s id = %3d\n", |
t->get_name(), |
t->get_priority(), |
tstate, |
t->get_unique_id() |
); |
# else |
|
diag_printf( "Thread %3d pri = %3d state = %6s\n", |
t->get_unique_id(), |
t->get_priority(), |
tstate |
); |
|
# endif |
diag_printf( "%20s stack base = %08x ptr = %08x size = %08x\n", |
"", |
t->get_stack_base(), |
#ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT |
t->get_saved_context(), |
#else |
0, |
#endif |
t->get_stack_size() |
); |
|
diag_printf( "%20s sleep reason %8s wake reason %8s\n", |
"", |
reasons[t->get_sleep_reason()], |
reasons[t->get_wake_reason()] |
); |
|
diag_printf( "%20s queue = %08x wait info = %08x\n", |
"", |
t->get_current_queue(), |
t->get_wait_info() |
); |
|
diag_printf("\n"); |
t = t->get_list_next(); |
} |
|
} |
# endif // CYGVAR_KERNEL_THREADS_LIST |
|
#endif // CYG_DIAG_PRINTF |
} |
|
#endif // CYGDBG_USE_TRACING |
|
// ------------------------------------------------------------------------- |
// Assert functions: |
|
#ifdef CYGDBG_USE_ASSERTS |
|
externC void |
cyg_assert_fail( const char *psz_func, const char *psz_file, |
cyg_uint32 linenum, const char *psz_msg ) __THROW |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
diag_write_string("ASSERT FAIL: "); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
diag_write_string(psz_msg); |
diag_write_char('\n'); |
|
#ifdef CYGHWR_TEST_PROGRAM_EXIT |
CYGHWR_TEST_PROGRAM_EXIT(); |
#endif |
for(;;); |
|
// DIAG_DEVICE_END_SYNC(); |
// HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
extern "C" |
{ |
extern unsigned long _stext; |
extern unsigned long _etext; |
|
unsigned long stext_addr = (unsigned long)&_stext; |
unsigned long etext_addr = (unsigned long)&_etext; |
}; |
|
externC cyg_bool cyg_check_data_ptr(const void *ptr) |
{ |
unsigned long p = (unsigned long)ptr; |
|
if( p == 0 ) return false; |
|
if( p > stext_addr && p < etext_addr ) return false; |
|
return true; |
} |
|
externC cyg_bool cyg_check_func_ptr(const void (*ptr)(void)) |
{ |
unsigned long p = (unsigned long)ptr; |
|
if( p == 0 ) return false; |
|
if( p < stext_addr && p > etext_addr ) return false; |
|
return true; |
} |
|
#endif // CYGDBG_USE_ASSERTS |
|
#endif // CYGDBG_INFRA_DEBUG_TRACE_ASSERT_FANCY |
|
// ------------------------------------------------------------------------- |
// EOF fancy.cxx |
/src/delete.cxx
0,0 → 1,79
//========================================================================== |
// |
// common/delete.cxx |
// |
// Default delete implementation |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 1999-08-13 |
// Purpose: Gives a default delete operation if the C library isn't present |
// Description: This file supplies a definition of the default delete |
// operation (aka __builtin_delete and __builtin_vec_delete) |
// for use when the normal delete can't be used - normally when |
// the C library is not present |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#include <pkgconf/system.h> |
#include <pkgconf/infra.h> |
|
#include <cyg/infra/cyg_type.h> |
|
// see the description comment in infra.cdl for |
// CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS |
|
#ifdef CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS |
// then define these empty functions: |
|
void operator delete(void *x) throw() |
{ |
CYG_EMPTY_STATEMENT; |
} |
|
void operator delete[](void *x) throw() |
{ |
CYG_EMPTY_STATEMENT; |
} |
|
#endif // CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS |
|
// EOF delete.cxx |
/src/startup.cxx
0,0 → 1,110
//======================================================================== |
// |
// startup.cxx |
// |
// General startup code for the target machine |
// |
//======================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//======================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 1999-01-21 |
// Purpose: This provides generic startup code for the eCos system. |
// Description: We start the system with the entry point cyg_start() |
// which is called from the eCos HALs. This in turn invokes |
// cyg_prestart(), cyg_package_start() and cyg_user_start(). |
// All these can be overriden by the user. |
// Usage: Override the defaults to use your own startup code, |
// which will allow you to take complete control after the |
// HAL initialization |
// |
//####DESCRIPTIONEND#### |
// |
//======================================================================== |
|
// CONFIGURATION |
|
#include <pkgconf/infra.h> // Configuration header |
|
// INCLUDES |
|
#include <cyg/infra/cyg_type.h> // Common type definitions and support |
#include <cyg/infra/cyg_trac.h> // Default tracing support |
|
#ifdef CYGPKG_KERNEL |
# include <pkgconf/kernel.h> |
# include <cyg/kernel/sched.hxx> |
# include <cyg/kernel/sched.inl> |
#endif |
|
// FUNCTION PROTOTYPES |
|
externC void |
cyg_start( void ) CYGBLD_ATTRIB_WEAK; |
|
externC void |
cyg_prestart( void ); |
|
externC void |
cyg_package_start( void ); |
|
externC void |
cyg_user_start( void ); |
|
|
// FUNCTIONS |
|
void |
cyg_start( void ) |
{ |
CYG_REPORT_FUNCTION(); |
CYG_REPORT_FUNCARGVOID(); |
|
cyg_prestart(); |
|
cyg_package_start(); |
|
cyg_user_start(); |
|
#ifdef CYGPKG_KERNEL |
Cyg_Scheduler::start(); |
#endif |
|
CYG_REPORT_RETURN(); |
} // cyg_start() |
|
// EOF startup.cxx |
/src/diag.cxx
0,0 → 1,707
/*======================================================================== |
// |
// diag.c |
// |
// Infrastructure diagnostic output code |
// |
//======================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// Copyright (C) 2002 Gary Thomas |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//======================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg,gthomas,jlarmour |
// Contributors: |
// Date: 1999-02-22 |
// Purpose: Infrastructure diagnostic output |
// Description: Implementations of infrastructure diagnostic routines. |
// |
//####DESCRIPTIONEND#### |
// |
//======================================================================*/ |
|
#include <pkgconf/system.h> |
#include <pkgconf/hal.h> |
#include <pkgconf/infra.h> |
|
#include <cyg/infra/cyg_type.h> // base types |
|
#include <cyg/infra/diag.h> // HAL polled output |
#include <cyg/hal/hal_arch.h> // architectural stuff for... |
#include <cyg/hal/hal_intr.h> // interrupt control |
#include <cyg/hal/hal_diag.h> // diagnostic output routines |
#include <stdarg.h> |
#include <limits.h> |
|
#ifdef CYG_HAL_DIAG_LOCK_DATA_DEFN |
CYG_HAL_DIAG_LOCK_DATA_DEFN; |
#endif |
|
/*----------------------------------------------------------------------*/ |
|
externC void diag_write_num( |
cyg_uint32 n, /* number to write */ |
cyg_ucount8 base, /* radix to write to */ |
cyg_ucount8 sign, /* sign, '-' if -ve, '+' if +ve */ |
cyg_bool pfzero, /* prefix with zero ? */ |
cyg_ucount8 width /* min width of number */ |
); |
|
class Cyg_dummy_diag_init_class { |
public: |
Cyg_dummy_diag_init_class() { |
HAL_DIAG_INIT(); |
} |
}; |
|
// Initialize after HAL. |
static Cyg_dummy_diag_init_class cyg_dummy_diag_init_obj |
CYGBLD_ATTRIB_INIT_AFTER(CYG_INIT_HAL); |
|
/*----------------------------------------------------------------------*/ |
/* Write single char to output */ |
|
externC void diag_write_char(char c) |
{ |
/* Translate LF into CRLF */ |
|
if( c == '\n' ) |
{ |
HAL_DIAG_WRITE_CHAR('\r'); |
} |
|
HAL_DIAG_WRITE_CHAR(c); |
} |
|
// Default wrapper function used by diag_printf |
static void |
_diag_write_char(char c, void **param) |
{ |
diag_write_char(c); |
} |
|
/*----------------------------------------------------------------------*/ |
/* Initialize. Call to pull in diag initializing constructor */ |
|
externC void diag_init(void) |
{ |
} |
|
// |
// This routine is used to send characters during 'printf()' functions. |
// It can be replaced by providing a replacement via diag_init_putc(). |
// |
static void (*_putc)(char c, void **param) = _diag_write_char; |
|
void |
diag_init_putc(void (*putc)(char c, void **param)) |
{ |
_putc = putc; |
} |
|
/*----------------------------------------------------------------------*/ |
/* Write zero terminated string */ |
|
externC void diag_write_string(const char *psz) |
{ |
while( *psz ) diag_write_char( *psz++ ); |
} |
|
/*----------------------------------------------------------------------*/ |
/* Write decimal value */ |
|
externC void diag_write_dec( cyg_int32 n) |
{ |
cyg_ucount8 sign; |
|
if( n < 0 ) n = -n, sign = '-'; |
else sign = '+'; |
|
diag_write_num( n, 10, sign, false, 0); |
} |
|
/*----------------------------------------------------------------------*/ |
/* Write hexadecimal value */ |
|
externC void diag_write_hex( cyg_uint32 n) |
{ |
diag_write_num( n, 16, '+', false, 0); |
} |
|
/*----------------------------------------------------------------------*/ |
/* Generic number writing function */ |
/* The parameters determine what radix is used, the signed-ness of the */ |
/* number, its minimum width and whether it is zero or space filled on */ |
/* the left. */ |
|
externC void diag_write_long_num( |
cyg_uint64 n, /* number to write */ |
cyg_ucount8 base, /* radix to write to */ |
cyg_ucount8 sign, /* sign, '-' if -ve, '+' if +ve */ |
cyg_bool pfzero, /* prefix with zero ? */ |
cyg_ucount8 width /* min width of number */ |
) |
{ |
char buf[32]; |
cyg_count8 bpos; |
char bufinit = pfzero?'0':' '; |
char *digits = "0123456789ABCDEF"; |
|
/* init buffer to padding char: space or zero */ |
for( bpos = 0; bpos < (cyg_count8)sizeof(buf); bpos++ ) buf[bpos] = bufinit; |
|
/* Set pos to start */ |
bpos = 0; |
|
/* construct digits into buffer in reverse order */ |
if( n == 0 ) buf[bpos++] = '0'; |
else while( n != 0 ) |
{ |
cyg_ucount8 d = n % base; |
buf[bpos++] = digits[d]; |
n /= base; |
} |
|
/* set pos to width if less. */ |
if( (cyg_count8)width > bpos ) bpos = width; |
|
/* set sign if negative. */ |
if( sign == '-' ) |
{ |
if( buf[bpos-1] == bufinit ) bpos--; |
buf[bpos] = sign; |
} |
else bpos--; |
|
/* Now write it out in correct order. */ |
while( bpos >= 0 ) |
diag_write_char(buf[bpos--]); |
} |
|
externC void diag_write_num( |
cyg_uint32 n, /* number to write */ |
cyg_ucount8 base, /* radix to write to */ |
cyg_ucount8 sign, /* sign, '-' if -ve, '+' if +ve */ |
cyg_bool pfzero, /* prefix with zero ? */ |
cyg_ucount8 width /* min width of number */ |
) |
{ |
diag_write_long_num((long long)n, base, sign, pfzero, width); |
} |
|
/*----------------------------------------------------------------------*/ |
/* perform some simple sanity checks on a string to ensure that it */ |
/* consists of printable characters and is of reasonable length. */ |
|
static cyg_bool diag_check_string( const char *str ) |
{ |
cyg_bool result = true; |
const char *s; |
|
if( str == NULL ) return false; |
|
for( s = str ; result && *s ; s++ ) |
{ |
char c = *s; |
|
/* Check for a reasonable length string. */ |
|
if( s-str > 2048 ) result = false; |
|
/* We only really support CR, NL, and backspace at present. If |
* we want to use tabs or other special chars, this test will |
* have to be expanded. */ |
|
if( c == '\n' || c == '\r' || c == '\b' ) |
continue; |
|
/* Check for printable chars. This assumes ASCII */ |
|
if( c < ' ' || c > '~' ) |
result = false; |
|
} |
|
return result; |
} |
|
/*----------------------------------------------------------------------*/ |
|
static int |
_cvt(unsigned long long val, char *buf, long radix, char *digits) |
{ |
char temp[80]; |
char *cp = temp; |
int length = 0; |
|
if (val == 0) { |
/* Special case */ |
*cp++ = '0'; |
} else { |
while (val) { |
*cp++ = digits[val % radix]; |
val /= radix; |
} |
} |
while (cp != temp) { |
*buf++ = *--cp; |
length++; |
} |
*buf = '\0'; |
return (length); |
} |
|
#define is_digit(c) ((c >= '0') && (c <= '9')) |
|
static int |
_vprintf(void (*putc)(char c, void **param), void **param, const char *fmt, va_list ap) |
{ |
char buf[sizeof(long long)*8]; |
char c, sign, *cp=buf; |
int left_prec, right_prec, zero_fill, pad, pad_on_right, |
i, islong, islonglong; |
long long val = 0; |
int res = 0, length = 0; |
|
if (!diag_check_string(fmt)) { |
diag_write_string("<Bad format string: "); |
diag_write_hex((cyg_uint32)fmt); |
diag_write_string(" :"); |
for( i = 0; i < 8; i++ ) { |
diag_write_char(' '); |
val = va_arg(ap, unsigned long); |
diag_write_hex(val); |
} |
diag_write_string(">\n"); |
return 0; |
} |
while ((c = *fmt++) != '\0') { |
if (c == '%') { |
c = *fmt++; |
left_prec = right_prec = pad_on_right = islong = islonglong = 0; |
if (c == '-') { |
c = *fmt++; |
pad_on_right++; |
} |
if (c == '0') { |
zero_fill = true; |
c = *fmt++; |
} else { |
zero_fill = false; |
} |
while (is_digit(c)) { |
left_prec = (left_prec * 10) + (c - '0'); |
c = *fmt++; |
} |
if (c == '.') { |
c = *fmt++; |
zero_fill++; |
while (is_digit(c)) { |
right_prec = (right_prec * 10) + (c - '0'); |
c = *fmt++; |
} |
} else { |
right_prec = left_prec; |
} |
sign = '\0'; |
if (c == 'l') { |
// 'long' qualifier |
c = *fmt++; |
islong = 1; |
if (c == 'l') { |
// long long qualifier |
c = *fmt++; |
islonglong = 1; |
} |
} |
// Fetch value [numeric descriptors only] |
switch (c) { |
case 'p': |
islong = 1; |
case 'd': |
case 'D': |
case 'x': |
case 'X': |
case 'u': |
case 'U': |
case 'b': |
case 'B': |
if (islonglong) { |
val = va_arg(ap, long long); |
} else if (islong) { |
val = (long long)va_arg(ap, long); |
} else{ |
val = (long long)va_arg(ap, int); |
} |
if ((c == 'd') || (c == 'D')) { |
if (val < 0) { |
sign = '-'; |
val = -val; |
} |
} else { |
// Mask to unsigned, sized quantity |
if (islong) { |
val &= ((long long)1 << (sizeof(long) * 8)) - 1; |
} else{ |
val &= ((long long)1 << (sizeof(int) * 8)) - 1; |
} |
} |
break; |
default: |
break; |
} |
// Process output |
switch (c) { |
case 'p': // Pointer |
(*putc)('0', param); |
(*putc)('x', param); |
zero_fill = true; |
left_prec = sizeof(unsigned long)*2; |
case 'd': |
case 'D': |
case 'u': |
case 'U': |
case 'x': |
case 'X': |
switch (c) { |
case 'd': |
case 'D': |
case 'u': |
case 'U': |
length = _cvt(val, buf, 10, "0123456789"); |
break; |
case 'p': |
case 'x': |
length = _cvt(val, buf, 16, "0123456789abcdef"); |
break; |
case 'X': |
length = _cvt(val, buf, 16, "0123456789ABCDEF"); |
break; |
} |
cp = buf; |
break; |
case 's': |
case 'S': |
cp = va_arg(ap, char *); |
if (cp == NULL) |
cp = "<null>"; |
else if (!diag_check_string(cp)) { |
diag_write_string("<Not a string: 0x"); |
diag_write_hex((cyg_uint32)cp); |
cp = ">"; |
} |
length = 0; |
while (cp[length] != '\0') length++; |
break; |
case 'c': |
case 'C': |
c = va_arg(ap, int /*char*/); |
(*putc)(c, param); |
res++; |
continue; |
case 'b': |
case 'B': |
length = left_prec; |
if (left_prec == 0) { |
if (islonglong) |
length = sizeof(long long)*8; |
else if (islong) |
length = sizeof(long)*8; |
else |
length = sizeof(int)*8; |
} |
for (i = 0; i < length-1; i++) { |
buf[i] = ((val & ((long long)1<<i)) ? '1' : '.'); |
} |
cp = buf; |
break; |
case '%': |
(*putc)('%', param); |
break; |
default: |
(*putc)('%', param); |
(*putc)(c, param); |
res += 2; |
} |
pad = left_prec - length; |
if (sign != '\0') { |
pad--; |
} |
if (zero_fill) { |
c = '0'; |
if (sign != '\0') { |
(*putc)(sign, param); |
res++; |
sign = '\0'; |
} |
} else { |
c = ' '; |
} |
if (!pad_on_right) { |
while (pad-- > 0) { |
(*putc)(c, param); |
res++; |
} |
} |
if (sign != '\0') { |
(*putc)(sign, param); |
res++; |
} |
while (length-- > 0) { |
c = *cp++; |
(*putc)(c, param); |
res++; |
} |
if (pad_on_right) { |
while (pad-- > 0) { |
(*putc)(' ', param); |
res++; |
} |
} |
} else { |
(*putc)(c, param); |
res++; |
} |
} |
return (res); |
} |
|
struct _sputc_info { |
char *ptr; |
int max, len; |
}; |
|
static void |
_sputc(char c, void **param) |
{ |
struct _sputc_info *info = (struct _sputc_info *)param; |
|
if (info->len < info->max) { |
*(info->ptr)++ = c; |
*(info->ptr) = '\0'; |
info->len++; |
} |
} |
|
int |
diag_sprintf(char *buf, const char *fmt, ...) |
{ |
int ret; |
va_list ap; |
struct _sputc_info info; |
|
va_start(ap, fmt); |
info.ptr = buf; |
info.max = 1024; // Unlimited |
info.len = 0; |
ret = _vprintf(_sputc, (void **)&info, fmt, ap); |
va_end(ap); |
return (info.len); |
} |
|
int |
diag_snprintf(char *buf, size_t len, const char *fmt, ...) |
{ |
int ret; |
va_list ap; |
struct _sputc_info info; |
|
va_start(ap, fmt); |
info.ptr = buf; |
info.len = 0; |
info.max = len; |
ret = _vprintf(_sputc, (void **)&info, fmt, ap); |
va_end(ap); |
return (info.len); |
} |
|
int |
diag_vsprintf(char *buf, const char *fmt, va_list ap) |
{ |
int ret; |
struct _sputc_info info; |
|
info.ptr = buf; |
info.max = 1024; // Unlimited |
info.len = 0; |
ret = _vprintf(_sputc, (void **)&info, fmt, ap); |
return (info.len); |
} |
|
int |
diag_printf(const char *fmt, ...) |
{ |
va_list ap; |
int ret; |
|
va_start(ap, fmt); |
ret = _vprintf(_putc, (void **)0, fmt, ap); |
va_end(ap); |
return (ret); |
} |
|
int |
diag_vprintf(const char *fmt, va_list ap) |
{ |
int ret; |
|
ret = _vprintf(_putc, (void **)0, fmt, ap); |
return (ret); |
} |
|
void |
diag_vdump_buf_with_offset(__printf_fun *pf, |
cyg_uint8 *p, |
CYG_ADDRWORD s, |
cyg_uint8 *base) |
{ |
int i, c; |
if ((CYG_ADDRWORD)s > (CYG_ADDRWORD)p) { |
s = (CYG_ADDRWORD)s - (CYG_ADDRWORD)p; |
} |
while ((int)s > 0) { |
if (base) { |
(*pf)("%08X: ", (CYG_ADDRWORD)p - (CYG_ADDRWORD)base); |
} else { |
(*pf)("%08X: ", p); |
} |
for (i = 0; i < 16; i++) { |
if (i < (int)s) { |
(*pf)("%02X ", p[i] & 0xFF); |
} else { |
(*pf)(" "); |
} |
if (i == 7) (*pf)(" "); |
} |
(*pf)(" |"); |
for (i = 0; i < 16; i++) { |
if (i < (int)s) { |
c = p[i] & 0xFF; |
if ((c < 0x20) || (c >= 0x7F)) c = '.'; |
} else { |
c = ' '; |
} |
(*pf)("%c", c); |
} |
(*pf)("|\n"); |
s -= 16; |
p += 16; |
} |
} |
|
void |
diag_dump_buf_with_offset(cyg_uint8 *p, |
CYG_ADDRWORD s, |
cyg_uint8 *base) |
{ |
diag_vdump_buf_with_offset(diag_printf, p, s, base); |
} |
|
void |
diag_dump_buf(void *p, CYG_ADDRWORD s) |
{ |
diag_dump_buf_with_offset((cyg_uint8 *)p, s, 0); |
} |
|
void |
diag_dump_buf_with_offset_32bit(cyg_uint32 *p, |
CYG_ADDRWORD s, |
cyg_uint32 *base) |
{ |
int i; |
if ((CYG_ADDRWORD)s > (CYG_ADDRWORD)p) { |
s = (CYG_ADDRWORD)s - (CYG_ADDRWORD)p; |
} |
while ((int)s > 0) { |
if (base) { |
diag_printf("%08X: ", (CYG_ADDRWORD)p - (CYG_ADDRWORD)base); |
} else { |
diag_printf("%08X: ", p); |
} |
for (i = 0; i < 4; i++) { |
if (i < (int)s/4) { |
diag_printf("%08X ", p[i] ); |
} else { |
diag_printf(" "); |
} |
} |
diag_printf("\n"); |
s -= 16; |
p += 4; |
} |
} |
|
externC void |
diag_dump_buf_32bit(void *p, CYG_ADDRWORD s) |
{ |
diag_dump_buf_with_offset_32bit((cyg_uint32 *)p, s, 0); |
} |
|
void |
diag_dump_buf_with_offset_16bit(cyg_uint16 *p, |
CYG_ADDRWORD s, |
cyg_uint16 *base) |
{ |
int i; |
if ((CYG_ADDRWORD)s > (CYG_ADDRWORD)p) { |
s = (CYG_ADDRWORD)s - (CYG_ADDRWORD)p; |
} |
while ((int)s > 0) { |
if (base) { |
diag_printf("%08X: ", (CYG_ADDRWORD)p - (CYG_ADDRWORD)base); |
} else { |
diag_printf("%08X: ", p); |
} |
for (i = 0; i < 8; i++) { |
if (i < (int)s/2) { |
diag_printf("%04X ", p[i] ); |
if (i == 3) diag_printf(" "); |
} else { |
diag_printf(" "); |
} |
} |
diag_printf("\n"); |
s -= 16; |
p += 8; |
} |
} |
|
externC void |
diag_dump_buf_16bit(void *p, CYG_ADDRWORD s) |
{ |
diag_dump_buf_with_offset_16bit((cyg_uint16 *)p, s, 0); |
} |
|
/*-----------------------------------------------------------------------*/ |
/* EOF infra/diag.c */ |
/src/prestart.cxx
0,0 → 1,85
//======================================================================== |
// |
// prestart.cxx |
// |
// General startup code for the target machine |
// |
//======================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//======================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 1999-01-21 |
// Purpose: This provides generic startup code for the eCos system. |
// Description: We start the system with the entry point cyg_start() |
// which is called from the eCos HALs. This in turn invokes |
// cyg_prestart(), cyg_package_start() and cyg_user_start(). |
// All these can be overriden by the user. |
// Usage: Override the defaults to use your own startup code. |
// cyg_prestart() is the first thing called after the |
// HAL initialization, and is before the package |
// initialization |
// |
//####DESCRIPTIONEND#### |
// |
//======================================================================== |
|
// INCLUDES |
|
#include <cyg/infra/cyg_type.h> // Common type definitions and support |
#include <cyg/infra/cyg_trac.h> // Default tracing support |
|
// FUNCTION PROTOTYPES |
|
externC void |
cyg_prestart( void ) CYGBLD_ATTRIB_WEAK; |
|
// FUNCTIONS |
|
void |
cyg_prestart( void ) |
{ |
CYG_REPORT_FUNCTION(); |
CYG_REPORT_FUNCARGVOID(); |
|
CYG_TRACE0( true, "This is the system default cyg_prestart()" ); |
|
CYG_EMPTY_STATEMENT; // don't let it complain about doing nothing |
|
CYG_REPORT_RETURN(); |
} // cyg_prestart() |
|
// EOF prestart.cxx |
/src/abort.cxx
0,0 → 1,66
//========================================================================== |
// |
// abort.cxx |
// |
// Dummy abort() |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 2003 Nick Garnett <nickg@calivar.com> |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg |
// Date: 2003-04-02 |
// Purpose: provide a dummy abort() function |
// Description: Parts of the C and C++ compiler runtime systems have |
// references to abort() built in to them. This definition |
// satisfies these references. Note that it is not expected |
// that this function will ever be called. |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#include <pkgconf/infra.h> |
#include <cyg/infra/cyg_ass.h> |
|
//========================================================================== |
|
extern "C" void |
abort( void ) |
{ |
CYG_FAIL("abort() called"); |
for (;;) |
continue; |
} |
|
//========================================================================== |
// EOF abort.cxx |
/src/strlen.cxx
0,0 → 1,104
//=========================================================================== |
// |
// strlen.cxx |
// |
// ANSI standard strlen() routine |
// |
//=========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// Copyright (C) 2003 Nick Garnett <nickg@calivar.com> |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//=========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: nickg |
// Date: 2000-04-14 |
// Purpose: |
// Description: strlen() function, to satisfy C++ runtime needs. This |
// function functions correctly, but in the interests of |
// keeping code size down, it uses the smallest implementation |
// possible, and is consequently not very fast. |
// Usage: |
// |
//####DESCRIPTIONEND#### |
// |
//=========================================================================== |
|
// CONFIGURATION |
|
#include <pkgconf/system.h> // Configuration header |
#include <pkgconf/infra.h> // Configuration header |
|
//========================================================================== |
// INCLUDES |
|
#include <cyg/infra/cyg_type.h> // Common type definitions |
#include <cyg/infra/cyg_trac.h> // Tracing support |
#include <cyg/infra/cyg_ass.h> // Assertion support |
#include <stddef.h> // Compiler definitions such as size_t, NULL etc. |
|
//========================================================================== |
// EXPORTED SYMBOLS |
|
extern "C" size_t |
strlen( const char *s ) CYGBLD_ATTRIB_WEAK_ALIAS(__strlen); |
|
//========================================================================== |
// FUNCTIONS |
|
extern "C" size_t |
__strlen( const char *s ) |
{ |
int retval; |
|
CYG_REPORT_FUNCNAMETYPE( "__strlen", "returning length %d" ); |
CYG_REPORT_FUNCARG1( "s=%08x", s ); |
|
CYG_CHECK_DATA_PTR( s, "s is not a valid pointer!" ); |
|
const char *start = s; |
|
while (*s) |
s++; |
|
retval = s - start; |
|
CYG_REPORT_RETVAL( retval ); |
|
return retval; |
|
} // __strlen() |
|
//========================================================================== |
// EOF strlen.cxx |
/src/buffer.cxx
0,0 → 1,791
//========================================================================== |
// |
// buffer.cxx |
// |
// Memory buffered trace and assert functions |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg |
// Contributors: nickg |
// Date: 1998-10-16 |
// Purpose: Buffered Trace and assert functions |
// Description: The functions in this file are a buffered implementation |
// of the standard trace and assert functions. These store |
// trace messages in a memory buffer and emit them when an |
// assert is hit, or when requested to. |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#include <pkgconf/system.h> |
#include <pkgconf/infra.h> |
|
#ifdef CYGDBG_INFRA_DEBUG_TRACE_ASSERT_BUFFER |
|
#include <cyg/infra/cyg_type.h> // base types |
#include <cyg/infra/cyg_trac.h> // tracing macros |
#include <cyg/infra/cyg_ass.h> // assertion macros |
|
#include <pkgconf/hal.h> // HAL configury |
#include <cyg/infra/diag.h> // HAL polled output |
#include <cyg/hal/hal_arch.h> // architectural stuff for... |
#include <cyg/hal/hal_intr.h> // interrupt control |
|
#ifdef CYGPKG_KERNEL |
#include <pkgconf/kernel.h> // kernel configury |
#include <cyg/kernel/thread.hxx> // thread id to print |
#include <cyg/kernel/sched.hxx> // ancillaries for above |
#include <cyg/kernel/thread.inl> // ancillaries for above |
#endif |
|
// ------------------------------------------------------------------------- |
// Local Configuration: hack me! |
|
// these are generally: |
// if 0, feature is disabled |
// if 1, feature is enabled, printing is default width |
// if >1, field is padded up to that width if necessary |
// (not truncated ever) |
|
#define CYG_FILENAME 20 |
#define CYG_THREADID 1 |
#define CYG_LINENUM 4 |
#define CYG_FUNCNAME 100 |
#define CYG_DIAG_PRINTF 1 |
#define CYG_FUNC_INDENT 2 |
|
#ifndef CYGPKG_KERNEL |
# undef CYG_THREADID |
# define CYG_THREADID 0 |
#endif |
|
#if CYG_FUNCNAME == 1 |
#define CYG_FBUF_SIZE 100 |
#else |
#define CYG_FBUF_SIZE (CYG_FUNCNAME+20) |
#endif |
|
// ------------------------------------------------------------------------- |
// Trace buffer |
|
#ifdef CYGDBG_USE_TRACING |
|
struct Cyg_TraceRecord |
{ |
cyg_uint32 what; |
cyg_uint32 tid; |
const char *function; |
const char *file; |
const char *message; |
cyg_uint32 line; |
cyg_uint32 narg; |
CYG_ADDRWORD arg[8]; |
}; |
|
Cyg_TraceRecord cyg_infra_trace_buffer[CYGDBG_INFRA_DEBUG_TRACE_BUFFER_SIZE]; |
|
static cyg_uint32 cyg_infra_trace_buffer_pos = 0; |
|
static cyg_bool cyg_infra_trace_buffer_enable = true; |
|
static cyg_bool cyg_infra_trace_buffer_wrap = false; |
|
// ------------------------------------------------------------------------- |
// Functions to trim file names and function names down to printable lengths |
// (these are shared between trace and assert functions) |
|
#if 0 |
static char * tracepremsgs[] = { |
" INFO:", |
"ENTER :", |
"ARGS :", |
"RETURN:", |
"bad code" |
}; |
#endif |
|
static char * tracepremsgs[] = { |
"'", |
"{{", |
"((", |
"}}", |
"bad code" |
}; |
|
static char * tracepostmsgs[] = { |
"'", |
"", |
"))", |
"", |
"bad code" |
}; |
|
static void |
write_whattrace( cyg_uint32 what ) |
{ |
#if CYG_FUNC_INDENT |
static cyg_int32 cyg_indent = 0; |
if ( 3 == what ) |
cyg_indent -= CYG_FUNC_INDENT; |
cyg_int32 i = cyg_indent; |
for ( ; i > 0; i-- ) |
diag_write_string( " " ); |
#endif // CYG_FUNC_INDENT |
diag_write_string( tracepremsgs[ what > 4 ? 4 : what ] ); |
#if CYG_FUNC_INDENT |
if ( 1 == what ) |
cyg_indent += CYG_FUNC_INDENT; |
#endif // CYG_FUNC_INDENT |
} |
|
static void |
write_whattracepost( cyg_uint32 what ) |
{ |
diag_write_string( tracepostmsgs[ what > 4 ? 4 : what ] ); |
} |
|
|
#endif // CYGDBG_USE_TRACING |
|
// ------------------------------------------------------------------------- |
|
#if defined(CYGDBG_USE_TRACING) || defined(CYGDBG_USE_ASSERTS) |
|
static const char *trim_file(const char *file) |
{ |
#if CYG_FILENAME |
if ( NULL == file ) |
file = "<nofile>"; |
|
#if 1 == CYG_FILENAME |
const char *f = file; |
while( *f ) f++; |
while( *f != '/' && f != file ) f--; |
return f==file?f:(f+1); |
#else |
static char fbuf2[100]; |
const char *f = file; |
char *g = fbuf2; |
while( *f ) f++; |
while( *f != '/' && f != file ) f--; |
if ( f > file ) f++; |
while( *f ) *g++ = *f++; |
while( CYG_FILENAME > (g - fbuf2) ) *g++ = ' '; |
*g = 0; |
return fbuf2; |
#endif |
#else |
return ""; |
#endif |
} |
|
static const char *trim_func(const char *func) |
{ |
#if CYG_FUNCNAME |
static char fbuf[CYG_FBUF_SIZE]; |
cyg_count32 i; |
|
if ( NULL == func ) |
func = "<nofunc>"; |
|
for( i = 0; func[i] && func[i] != '(' && i < CYG_FBUF_SIZE-4 ; i++ ) |
fbuf[i] = func[i]; |
|
fbuf[i++] = '('; |
fbuf[i++] = ')'; |
fbuf[i ] = 0; |
i=0; |
#if 1 == CYG_FUNCNAME |
return &fbuf[i]; |
#else |
char *p = &fbuf[i]; |
while ( *p ) p++; |
while ( CYG_FUNCNAME > (p - (&fbuf[i])) ) *p++ = ' '; |
*p = 0; |
return &fbuf[i]; |
#endif |
#else |
return ""; |
#endif |
} |
|
static void write_lnum( cyg_uint32 lnum) |
{ |
#if CYG_LINENUM |
diag_write_char('['); |
#if 1 < CYG_LINENUM |
cyg_uint32 i, j; |
for ( i = 2, j = 100; i < CYG_LINENUM ; i++, j *= 10 ) |
if ( lnum < j ) |
diag_write_char(' '); |
#endif |
diag_write_dec(lnum); |
diag_write_char(']'); |
diag_write_char(' '); |
#endif |
} |
|
#endif // defined(CYGDBG_USE_TRACING) || defined(CYGDBG_USE_ASSERTS) |
|
// ------------------------------------------------------------------------- |
|
#if defined(CYGDBG_USE_TRACING) || defined(CYGDBG_USE_ASSERTS) |
|
#if CYG_THREADID |
static cyg_uint32 get_tid(void) |
{ |
|
Cyg_Thread *t = Cyg_Thread::self(); |
cyg_uint16 tid = 0xFFFF; |
|
if( t != NULL ) tid = t->get_unique_id(); |
|
return tid; |
} |
#else |
# define get_tid() (0xFFFF) |
#endif |
|
#endif // defined(CYGDBG_USE_TRACING) || defined(CYGDBG_USE_ASSERTS) |
|
#ifdef CYGDBG_USE_ASSERTS |
static void write_thread_id() |
{ |
#if CYG_THREADID |
cyg_uint16 tid = get_tid(); |
|
diag_write_char('<'); |
diag_write_hex(tid); |
diag_write_char('>'); |
#endif |
} |
#endif |
|
// ------------------------------------------------------------------------- |
// Trace functions: |
|
#ifdef CYGDBG_USE_TRACING |
|
static void print_trace_buffer(void) |
{ |
cyg_count32 start = cyg_infra_trace_buffer_pos; |
cyg_count32 end = start; |
cyg_count32 i; |
|
// If the buffer has wrapped we want to display the records from |
// the current pos and around back to the same place. If the buffer |
// has not wrapped, we want to display from the start to pos. |
|
if( !cyg_infra_trace_buffer_wrap ) |
start = 0; |
|
i = start; |
do |
{ |
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[i]; |
cyg_uint32 old_ints; |
|
const char *psz_msg = rec->message; |
|
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
if ( NULL == psz_msg ) |
psz_msg = "<nomsg>"; |
|
diag_write_string( "TRACE: " ); |
#if CYG_THREADID |
diag_write_char('<'); |
diag_write_hex(rec->tid); |
diag_write_char('>'); |
#endif |
diag_write_string(trim_file(rec->file)); |
write_lnum(rec->line); |
diag_write_string(trim_func(rec->function)); |
diag_write_char(' '); |
write_whattrace( rec->what ); |
#if CYG_DIAG_PRINTF |
diag_printf( psz_msg, |
rec->arg[0], rec->arg[1], |
rec->arg[2], rec->arg[3], |
rec->arg[4], rec->arg[5], |
rec->arg[6], rec->arg[7] ); |
#else |
diag_write_string(psz_msg); |
diag_write_char(' '); |
|
for( cyg_count8 j = 0; j < rec->narg ; j++ ) |
{ |
diag_write_hex(rec->arg[j]); |
diag_write_char(' '); |
} |
#endif |
write_whattracepost( rec->what ); |
diag_write_char('\n'); |
|
DIAG_DEVICE_END_SYNC(); |
HAL_RESTORE_INTERRUPTS(old_ints); |
|
i++; |
if( i == CYGDBG_INFRA_DEBUG_TRACE_BUFFER_SIZE ) |
i = 0; |
|
} while( i != end ); |
|
} |
|
static void increment_buffer_pos() |
{ |
cyg_infra_trace_buffer_pos++; |
|
if( cyg_infra_trace_buffer_pos == CYGDBG_INFRA_DEBUG_TRACE_BUFFER_SIZE ) |
{ |
#if defined(CYGDBG_INFRA_DEBUG_TRACE_BUFFER_WRAP) |
cyg_infra_trace_buffer_pos = 0; |
cyg_infra_trace_buffer_wrap = true; |
#elif defined(CYGDBG_INFRA_DEBUG_TRACE_BUFFER_HALT) |
cyg_infra_trace_buffer_enable = false; |
#elif defined(CYGDBG_INFRA_DEBUG_TRACE_BUFFER_PRINT) |
cyg_infra_trace_buffer_pos = 0; |
print_trace_buffer(); |
#else |
#error No trace buffer full mode set |
#endif |
} |
|
} |
|
// ------------------------------------------------------------------------- |
|
externC void |
cyg_tracenomsg( const char *psz_func, const char *psz_file, cyg_uint32 linenum ) |
{ |
cyg_uint32 old_ints; |
|
if( !cyg_infra_trace_buffer_enable ) return; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
|
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos]; |
|
rec->what = 0; |
rec->tid = get_tid(); |
rec->function = psz_func; |
rec->file = psz_file; |
rec->line = linenum; |
rec->message = 0; |
rec->narg = 0; |
|
increment_buffer_pos(); |
|
HAL_RESTORE_INTERRUPTS(old_ints); |
|
}; |
|
// provide every other one of these as a space/caller bloat compromise. |
|
externC void |
cyg_tracemsg( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg ) |
{ |
cyg_uint32 old_ints; |
|
if( !cyg_infra_trace_buffer_enable ) return; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
|
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos]; |
|
rec->what = what; |
rec->tid = get_tid(); |
rec->function = psz_func; |
rec->file = psz_file; |
rec->line = linenum; |
rec->message = psz_msg; |
rec->narg = 0; |
|
increment_buffer_pos(); |
|
HAL_RESTORE_INTERRUPTS(old_ints); |
|
}; |
|
externC void |
cyg_tracemsg2( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 ) |
{ |
cyg_uint32 old_ints; |
|
if( !cyg_infra_trace_buffer_enable ) return; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
|
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos]; |
|
rec->what = what; |
rec->tid = get_tid(); |
rec->function = psz_func; |
rec->file = psz_file; |
rec->line = linenum; |
rec->message = psz_msg; |
rec->narg = 2; |
|
rec->arg[0] = arg0; |
rec->arg[1] = arg1; |
|
increment_buffer_pos(); |
|
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
externC void |
cyg_tracemsg4( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 ) |
{ |
cyg_uint32 old_ints; |
|
if( !cyg_infra_trace_buffer_enable ) return; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
|
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos]; |
|
rec->what = what; |
rec->tid = get_tid(); |
rec->function = psz_func; |
rec->file = psz_file; |
rec->line = linenum; |
rec->message = psz_msg; |
rec->narg = 4; |
|
rec->arg[0] = arg0; |
rec->arg[1] = arg1; |
rec->arg[2] = arg2; |
rec->arg[3] = arg3; |
|
increment_buffer_pos(); |
|
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
externC void |
cyg_tracemsg6( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5 ) |
{ |
cyg_uint32 old_ints; |
|
if( !cyg_infra_trace_buffer_enable ) return; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
|
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos]; |
|
rec->what = what; |
rec->tid = get_tid(); |
rec->function = psz_func; |
rec->file = psz_file; |
rec->line = linenum; |
rec->message = psz_msg; |
rec->narg = 6; |
|
rec->arg[0] = arg0; |
rec->arg[1] = arg1; |
rec->arg[2] = arg2; |
rec->arg[3] = arg3; |
rec->arg[4] = arg4; |
rec->arg[5] = arg5; |
|
increment_buffer_pos(); |
|
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
externC void |
cyg_tracemsg8( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5, |
CYG_ADDRWORD arg6, CYG_ADDRWORD arg7 ) |
{ |
cyg_uint32 old_ints; |
|
if( !cyg_infra_trace_buffer_enable ) return; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
|
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos]; |
|
rec->what = what; |
rec->tid = get_tid(); |
rec->function = psz_func; |
rec->file = psz_file; |
rec->line = linenum; |
rec->message = psz_msg; |
rec->narg = 6; |
|
rec->arg[0] = arg0; |
rec->arg[1] = arg1; |
rec->arg[2] = arg2; |
rec->arg[3] = arg3; |
rec->arg[4] = arg4; |
rec->arg[5] = arg5; |
rec->arg[6] = arg6; |
rec->arg[7] = arg7; |
|
increment_buffer_pos(); |
|
HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
// ------------------------------------------------------------------------- |
|
externC void |
cyg_trace_print(void) |
{ |
cyg_bool old_enable = cyg_infra_trace_buffer_enable; |
cyg_infra_trace_buffer_enable = false; |
print_trace_buffer(); |
cyg_infra_trace_buffer_pos = 0; |
cyg_infra_trace_buffer_wrap = false; |
cyg_infra_trace_buffer_enable = old_enable; |
} |
|
|
// ------------------------------------------------------------------------- |
|
externC void |
cyg_trace_dump(void) |
{ |
#if defined(CYGPKG_KERNEL) && defined(CYG_DIAG_PRINTF) |
|
{ |
diag_printf("\nScheduler:\n\n"); |
|
Cyg_Scheduler *sched = &Cyg_Scheduler::scheduler; |
|
diag_printf("Lock: %d\n",sched->get_sched_lock() ); |
|
# ifdef CYGVAR_KERNEL_THREADS_NAME |
|
diag_printf("Current Thread: %s\n",sched->get_current_thread()->get_name()); |
|
# else |
|
diag_printf("Current Thread: %d\n",sched->get_current_thread()->get_unique_id()); |
|
# endif |
|
} |
|
# ifdef CYGVAR_KERNEL_THREADS_LIST |
|
{ |
Cyg_Thread *t = Cyg_Thread::get_list_head(); |
|
diag_printf("\nThreads:\n\n"); |
|
while( NULL != t ) |
{ |
cyg_uint32 state = t->get_state(); |
char tstate[7]; |
char *tstate1 = "SCUKX"; |
static char *(reasons[8]) = |
{ |
"NONE", // No recorded reason |
"WAIT", // Wait with no timeout |
"DELAY", // Simple time delay |
"TIMEOUT", // Wait with timeout/timeout expired |
"BREAK", // forced break out of sleep |
"DESTRUCT", // wait object destroyed[note] |
"EXIT", // forced termination |
"DONE" // Wait/delay complete |
}; |
|
if( 0 != state ) |
{ |
// Knock out chars that do not correspond to set bits. |
for( int i = 0; i < 6 ; i++ ) |
if( 0 == (state & (1<<i)) ) |
tstate[i] = ' '; |
else tstate[i] = tstate1[i]; |
tstate[6] = 0; |
} |
else tstate[0] = 'R', tstate[1] = 0; |
|
# ifdef CYGVAR_KERNEL_THREADS_NAME |
|
diag_printf( "%20s pri = %3d state = %6s id = %3d\n", |
t->get_name(), |
t->get_priority(), |
tstate, |
t->get_unique_id() |
); |
# else |
|
diag_printf( "Thread %3d pri = %3d state = %6s\n", |
t->get_unique_id(), |
t->get_priority(), |
tstate |
); |
|
# endif |
diag_printf( "%20s stack base = %08x ptr = %08x size = %08x\n", |
"", |
t->get_stack_base(), |
#ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT |
t->get_saved_context(), |
#else |
0, |
#endif |
t->get_stack_size() |
); |
|
diag_printf( "%20s sleep reason %8s wake reason %8s\n", |
"", |
reasons[t->get_sleep_reason()], |
reasons[t->get_wake_reason()] |
); |
|
diag_printf( "%20s queue = %08x wait info = %08x\n", |
"", |
t->get_current_queue(), |
t->get_wait_info() |
); |
|
diag_printf("\n"); |
t = t->get_list_next(); |
} |
|
} |
# endif // CYGVAR_KERNEL_THREADS_LIST |
|
#endif // CYG_DIAG_PRINTF |
} |
|
#endif // CYGDBG_USE_TRACING |
|
// ------------------------------------------------------------------------- |
// Assert functions: |
|
#ifdef CYGDBG_USE_ASSERTS |
|
externC void |
cyg_assert_fail( const char *psz_func, const char *psz_file, |
cyg_uint32 linenum, const char *psz_msg ) __THROW |
{ |
cyg_uint32 old_ints; |
|
HAL_DISABLE_INTERRUPTS(old_ints); |
DIAG_DEVICE_START_SYNC(); |
|
diag_write_string("ASSERT FAIL: "); |
write_thread_id(); |
diag_write_string(trim_file(psz_file)); |
write_lnum(linenum); |
diag_write_string(trim_func(psz_func)); |
diag_write_char(' '); |
diag_write_string(psz_msg); |
diag_write_char('\n'); |
|
#ifdef CYGDBG_INFRA_DEBUG_TRACE_BUFFER_PRINT_ON_ASSERT |
|
cyg_trace_print(); |
cyg_trace_dump(); |
|
#endif |
|
#ifdef CYGHWR_TEST_PROGRAM_EXIT |
CYGHWR_TEST_PROGRAM_EXIT(); |
#endif |
for(;;); |
|
// DIAG_DEVICE_END_SYNC(); |
// HAL_RESTORE_INTERRUPTS(old_ints); |
}; |
|
extern "C" |
{ |
extern unsigned long _stext; |
extern unsigned long _etext; |
|
unsigned long stext_addr = (unsigned long)&_stext; |
unsigned long etext_addr = (unsigned long)&_etext; |
}; |
|
externC cyg_bool cyg_check_data_ptr(const void *ptr) |
{ |
unsigned long p = (unsigned long)ptr; |
|
if( p == 0 ) return false; |
|
if( p > stext_addr && p < etext_addr ) return false; |
|
return true; |
} |
|
externC cyg_bool cyg_check_func_ptr(const void (*ptr)(void)) |
{ |
unsigned long p = (unsigned long)ptr; |
|
if( p == 0 ) return false; |
|
if( p < stext_addr && p > etext_addr ) return false; |
|
return true; |
} |
|
#endif // CYGDBG_USE_ASSERTS |
|
#endif // CYGDBG_INFRA_DEBUG_TRACE_ASSERT_BUFFER |
|
// ------------------------------------------------------------------------- |
// EOF buffer.cxx |
/src/memset.c
0,0 → 1,190
/*=========================================================================== |
// |
// memset.c |
// |
// ANSI standard memset() routine |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 1998-06-04 |
// Purpose: This file implements the ANSI memset() function |
// Description: This file implements the memset() function defined in ANSI para |
// 7.11.6.1. This is implemented in the kernel rather than the |
// C library due to it being required by gcc whether or not the |
// C library has been configured in. |
// |
//####DESCRIPTIONEND#### |
// |
//==========================================================================*/ |
|
|
/* INCLUDES */ |
|
#include <pkgconf/infra.h> /* Configuration of infra package */ |
|
#include <cyg/infra/cyg_type.h> /* Common type definitions */ |
#include <cyg/infra/cyg_trac.h> /* Tracing support */ |
#include <cyg/infra/cyg_ass.h> /* Assertion support */ |
#include <stddef.h> /* Compiler defns such as size_t, NULL etc. */ |
|
/* MACROS */ |
|
/* Nonzero if X is not aligned on a word boundary. */ |
#define CYG_STR_UNALIGNED(X) ((CYG_WORD)(X) & (sizeof (CYG_WORD) - 1)) |
|
/* How many bytes are copied each iteration of the word copy loop in the |
* optimised string implementation |
*/ |
#define CYG_STR_OPT_LITTLEBLOCKSIZE (sizeof (CYG_WORD)) |
|
/* EXPORTED SYMBOLS */ |
|
externC void * |
memset( void *s, int c, size_t n ) __attribute__ ((weak, alias("_memset"))); |
|
/* FUNCTIONS */ |
|
void * |
_memset( void *s, int c, size_t n ) |
{ |
#if defined(CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMSET) || defined(__OPTIMIZE_SIZE__) |
char *char_ptr = (char *)s; |
|
#ifdef CYG_TRACING_FIXED |
CYG_REPORT_FUNCNAMETYPE( "_memset", "returning %08x" ); |
CYG_REPORT_FUNCARG3( "s=%08x, c=%d, n=%d", s, c, n ); |
|
if (n != 0) |
{ |
CYG_CHECK_DATA_PTR( char_ptr, "s is not a valid pointer!" ); |
CYG_CHECK_DATA_PTR( (&char_ptr[n-1]), "s+n-1 is not a valid address!" ); |
} |
#endif |
|
while (n-- != 0) |
{ |
*char_ptr++ = (char) c; |
} |
|
#ifdef CYG_TRACING_FIXED |
CYG_REPORT_RETVAL( s ); |
#endif |
return s; |
#else |
char *char_ptr = (char *)s; |
cyg_ucount8 count; |
CYG_WORD buffer; |
CYG_WORD *aligned_addr; |
char *unaligned_addr; |
|
#ifdef CYG_TRACING_FIXED |
CYG_REPORT_FUNCNAMETYPE( "_memset", "returning %08x" ); |
CYG_REPORT_FUNCARG3( "s=%08x, c=%d, n=%d", s, c, n ); |
|
if (n != 0) |
{ |
CYG_CHECK_DATA_PTR( s, "s is not a valid pointer!" ); |
CYG_CHECK_DATA_PTR( (char *)s+n-1, "s+n-1 is not a valid address!" ); |
} |
#endif |
|
if (n < sizeof(CYG_WORD) || CYG_STR_UNALIGNED (s)) |
{ |
while (n-- != 0) |
{ |
*char_ptr++ = (char) c; |
} |
#ifdef CYG_TRACING_FIXED |
CYG_REPORT_RETVAL( s ); |
#endif |
return s; |
} |
|
/* If we get this far, we know that n is large and s is word-aligned. */ |
|
aligned_addr = (CYG_WORD *)s; |
|
/* Store C into each char sized location in BUFFER so that |
* we can set large blocks quickly. |
*/ |
c &= 0xff; |
if (CYG_STR_OPT_LITTLEBLOCKSIZE == 4) |
{ |
buffer = (c << 8) | c; |
buffer |= (buffer << 16); |
} |
else |
{ |
buffer = 0; |
for (count = 0; count < CYG_STR_OPT_LITTLEBLOCKSIZE; count++) |
buffer = (buffer << 8) | c; |
} |
|
while (n >= CYG_STR_OPT_LITTLEBLOCKSIZE*4) |
{ |
*aligned_addr++ = buffer; |
*aligned_addr++ = buffer; |
*aligned_addr++ = buffer; |
*aligned_addr++ = buffer; |
n -= 4*CYG_STR_OPT_LITTLEBLOCKSIZE; |
} |
|
while (n >= CYG_STR_OPT_LITTLEBLOCKSIZE) |
{ |
*aligned_addr++ = buffer; |
n -= CYG_STR_OPT_LITTLEBLOCKSIZE; |
} |
|
/* Pick up the remainder with a bytewise loop. */ |
unaligned_addr = (char*)aligned_addr; |
while (n) |
{ |
*unaligned_addr++ = (char)c; |
n--; |
} |
|
#ifdef CYG_TRACING_FIXED |
CYG_REPORT_RETVAL( s ); |
#endif |
return s; |
#endif /* not defined(CYGIMP_PREFER_SMALL_TO_FAST_MEMSET) || |
* defined(__OPTIMIZE_SIZE__) */ |
} /* _memset() */ |
|
/* EOF memset.c */ |
/src/null.cxx
0,0 → 1,185
//========================================================================== |
// |
// null.cxx |
// |
// Null trace and assert functions |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): nickg |
// Contributors: nickg |
// Date: 1997-09-15 |
// Purpose: Trace and assert functions |
// Description: The functions in this file are null implementations of the |
// standard trace and assert functions. These can be used to |
// eliminate all trace and assert messages without recompiling. |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#include <pkgconf/infra.h> |
|
#ifndef CYGDBG_USE_ASSERTS |
// then you get an empty function regardless, so that other code can link: |
// (for example libc assert() calls this whether or not eCos code has |
// asserts enabled - of course if it does, assert() maps to the chosen |
// implementation; if not, it's the same inner function to breakpoint.) |
|
#include <cyg/infra/cyg_type.h> // base types |
#include <cyg/infra/cyg_trac.h> // tracing macros |
#include <cyg/infra/cyg_ass.h> // assertion macros |
|
externC void |
cyg_assert_fail( const char *psz_func, const char *psz_file, |
cyg_uint32 linenum, const char *psz_msg ) __THROW |
{ |
for(;;); |
}; |
#endif // not CYGDBG_USE_ASSERTS |
|
#ifdef CYGDBG_INFRA_DEBUG_TRACE_ASSERT_NULL |
|
#include <cyg/infra/cyg_type.h> // base types |
#include <cyg/infra/cyg_trac.h> // tracing macros |
#include <cyg/infra/cyg_ass.h> // assertion macros |
|
// ------------------------------------------------------------------------- |
// Trace functions: |
|
#ifdef CYGDBG_USE_TRACING |
|
externC void |
cyg_tracenomsg( const char *psz_func, const char *psz_file, cyg_uint32 linenum ) |
{} |
|
// provide every other one of these as a space/caller bloat compromise. |
|
externC void |
cyg_tracemsg( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg ) |
{} |
|
externC void |
cyg_tracemsg2( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 ) |
{} |
externC void |
cyg_tracemsg4( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 ) |
{} |
externC void |
cyg_tracemsg6( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5 ) |
{} |
externC void |
cyg_tracemsg8( cyg_uint32 what, |
const char *psz_func, const char *psz_file, cyg_uint32 linenum, |
const char *psz_msg, |
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1, |
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3, |
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5, |
CYG_ADDRWORD arg6, CYG_ADDRWORD arg7 ) |
{} |
|
// ------------------------------------------------------------------------- |
|
externC void |
cyg_trace_dump(void) |
{} |
|
#endif // CYGDBG_USE_TRACING |
|
// ------------------------------------------------------------------------- |
// Assert functions: |
|
#ifdef CYGDBG_USE_ASSERTS |
|
externC void |
cyg_assert_fail( const char *psz_func, const char *psz_file, |
cyg_uint32 linenum, const char *psz_msg ) __THROW |
{ |
for(;;); |
}; |
|
extern "C" |
{ |
extern unsigned long _stext; |
extern unsigned long _etext; |
|
unsigned long stext_addr = (unsigned long)&_stext; |
unsigned long etext_addr = (unsigned long)&_etext; |
}; |
|
externC cyg_bool cyg_check_data_ptr(const void *ptr) |
{ |
unsigned long p = (unsigned long)ptr; |
|
if( p == 0 ) return false; |
|
if( p > stext_addr && p < etext_addr ) return false; |
|
return true; |
} |
|
externC cyg_bool cyg_check_func_ptr(const void (*ptr)(void)) |
{ |
unsigned long p = (unsigned long)ptr; |
|
if( p == 0 ) return false; |
|
if( p < stext_addr && p > etext_addr ) return false; |
|
return true; |
} |
|
#endif // CYGDBG_USE_ASSERTS |
|
#endif // CYGDBG_INFRA_DEBUG_TRACE_ASSERT_NULL |
|
// ------------------------------------------------------------------------- |
// EOF null.cxx |
/src/memcpy.c
0,0 → 1,193
/*=========================================================================== |
// |
// memcpy.c |
// |
// ANSI standard memcpy() routine |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 1998-06-04 |
// Purpose: This file implements the ANSI memcpy() function |
// Description: This file implements the memcpy() function defined in ANSI para |
// 7.11.2.1. This is implemented in the kernel rather than the |
// C library due to it being required by gcc whether or not the |
// C library has been configured in. |
// |
//####DESCRIPTIONEND#### |
// |
//==========================================================================*/ |
|
|
/* INCLUDES */ |
|
#include <pkgconf/infra.h> /* Configuration of infra package */ |
|
#include <cyg/infra/cyg_type.h> /* Common type definitions */ |
#include <cyg/infra/cyg_trac.h> /* Tracing support */ |
#include <cyg/infra/cyg_ass.h> /* Assertion support */ |
#include <stddef.h> /* Compiler defns such as size_t, NULL etc. */ |
|
/* MACROS */ |
|
/* Nonzero if either X or Y is not aligned on a word boundary. */ |
#define CYG_STR_UNALIGNED(X, Y) \ |
(((CYG_WORD)(X) & (sizeof (CYG_WORD) - 1)) | \ |
((CYG_WORD)(Y) & (sizeof (CYG_WORD) - 1))) |
|
/* How many bytes are copied each iteration of the 4X unrolled loop in the |
* optimised string implementation |
*/ |
#define CYG_STR_OPT_BIGBLOCKSIZE (sizeof(CYG_WORD) << 2) |
|
|
/* How many bytes are copied each iteration of the word copy loop in the |
* optimised string implementation |
*/ |
#define CYG_STR_OPT_LITTLEBLOCKSIZE (sizeof (CYG_WORD)) |
|
/* EXPORTED SYMBOLS */ |
|
externC void * |
memcpy( void *s1, const void *s2, size_t n ) __attribute__((weak, |
alias("_memcpy"))); |
|
/* FUNCTIONS */ |
|
void * |
_memcpy( void *s1, const void *s2, size_t n ) |
{ |
#if defined(CYGIMP_INFRA_PREFER_SMALL_TO_FAST_MEMCPY) || defined(__OPTIMIZE_SIZE__) |
char *dst = (char *) s1; |
const char *src = (const char *) s2; |
|
#ifdef CYG_TRACING_FIXED |
CYG_REPORT_FUNCNAMETYPE( "_memcpy", "returning %08x" ); |
CYG_REPORT_FUNCARG3( "dst=%08x, src=%08x, n=%d", dst, src, n ); |
|
if (n != 0) |
{ |
CYG_CHECK_DATA_PTR( dst, "dst is not a valid pointer!" ); |
CYG_CHECK_DATA_PTR( src, "src is not a valid pointer!" ); |
CYG_CHECK_DATA_PTR( dst+n-1, "dst+n-1 is not a valid address!" ); |
CYG_CHECK_DATA_PTR( src+n-1, "src+n-1 is not a valid address!" ); |
} |
#endif |
|
while (n--) |
{ |
*dst++ = *src++; |
} /* while */ |
|
#ifdef CYG_TRACING_FIXED |
CYG_REPORT_RETVAL( s1 ); |
#endif |
return s1; |
#else |
char *dst; |
const char *src; |
CYG_WORD *aligned_dst; |
const CYG_WORD *aligned_src; |
|
#ifdef CYG_TRACING_FIXED |
CYG_REPORT_FUNCNAMETYPE( "_memcpy", "returning %08x" ); |
#endif |
|
dst = (char *)s1; |
src = (const char *)s2; |
|
#ifdef CYG_TRACING_FIXED |
CYG_REPORT_FUNCARG3( "dst=%08x, src=%08x, n=%d", dst, src, n ); |
|
if (n != 0) |
{ |
CYG_CHECK_DATA_PTR( dst, "dst is not a valid pointer!" ); |
CYG_CHECK_DATA_PTR( src, "src is not a valid pointer!" ); |
CYG_CHECK_DATA_PTR( dst+n-1, "dst+n-1 is not a valid address!" ); |
CYG_CHECK_DATA_PTR( src+n-1, "src+n-1 is not a valid address!" ); |
} |
#endif |
|
/* If the size is small, or either SRC or DST is unaligned, |
* then punt into the byte copy loop. This should be rare. |
*/ |
if (n < sizeof(CYG_WORD) || CYG_STR_UNALIGNED (src, dst)) |
{ |
while (n--) |
*dst++ = *src++; |
#ifdef CYG_TRACING_FIXED |
CYG_REPORT_RETVAL( s1 ); |
#endif |
return s1; |
} /* if */ |
|
aligned_dst = (CYG_WORD *)dst; |
aligned_src = (const CYG_WORD *)src; |
|
/* Copy 4X long words at a time if possible. */ |
while (n >= CYG_STR_OPT_BIGBLOCKSIZE) |
{ |
*aligned_dst++ = *aligned_src++; |
*aligned_dst++ = *aligned_src++; |
*aligned_dst++ = *aligned_src++; |
*aligned_dst++ = *aligned_src++; |
n -= CYG_STR_OPT_BIGBLOCKSIZE; |
} /* while */ |
|
/* Copy one long word at a time if possible. */ |
while (n >= CYG_STR_OPT_LITTLEBLOCKSIZE) |
{ |
*aligned_dst++ = *aligned_src++; |
n -= CYG_STR_OPT_LITTLEBLOCKSIZE; |
} /* while */ |
|
/* Pick up any residual with a byte copier. */ |
dst = (char*)aligned_dst; |
src = (const char*)aligned_src; |
while (n--) |
*dst++ = *src++; |
|
#ifdef CYG_TRACING_FIXED |
CYG_REPORT_RETVAL( s1 ); |
#endif |
return s1; |
#endif /* not defined(CYGIMP_PREFER_SMALL_TO_FAST_MEMCPY) || |
* defined(__OPTIMIZE_SIZE__) */ |
} /* _memcpy() */ |
|
/* EOF memcpy.c */ |
/src/pure.cxx
0,0 → 1,65
//========================================================================== |
// |
// pure.cxx |
// |
// g++ support |
// |
//========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 2003 Bart Veer |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): bartv |
// Date: 2003-03-27 |
// Purpose: provide a __cxa_pure_virtual() function |
// Description: g++ v3.x generates references to a function __cxa_pure_virtual() |
// whenever the code contains pure virtual functions. This is a |
// placeholder used while constructing an object, and the function |
// should never actually get called. There is a default |
// implementation in libsupc++ but that has dependencies on I/O |
// and so on, unwanted in a minimal eCos environment. Instead we |
// want a minimal __cxa_pure_virtual(). |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#include <pkgconf/infra.h> |
#include <cyg/infra/cyg_ass.h> |
|
extern "C" void |
__cxa_pure_virtual(void) |
{ |
CYG_FAIL("attempt to use a virtual function before object has been constructed"); |
for ( ; ; ); |
} |
|
// EOF pure.cxx |