summaryrefslogtreecommitdiff
path: root/ecos/packages/infra/current/include
diff options
context:
space:
mode:
authorMichael Gielda <mgielda@antmicro.com>2014-04-03 14:53:04 +0200
committerMichael Gielda <mgielda@antmicro.com>2014-04-03 14:53:04 +0200
commitae1e4e08a1005a0c487f03ba189d7536e7fdcba6 (patch)
treef1c296f8a966a9a39876b0e98e16d9c5da1776dd /ecos/packages/infra/current/include
parentf157da5337118d3c5cd464266796de4262ac9dbd (diff)
Added the OS files
Diffstat (limited to 'ecos/packages/infra/current/include')
-rw-r--r--ecos/packages/infra/current/include/clist.hxx364
-rw-r--r--ecos/packages/infra/current/include/cyg_ass.h616
-rw-r--r--ecos/packages/infra/current/include/cyg_trac.h1654
-rw-r--r--ecos/packages/infra/current/include/cyg_type.h559
-rw-r--r--ecos/packages/infra/current/include/cyg_type.inc86
-rw-r--r--ecos/packages/infra/current/include/diag.h117
-rw-r--r--ecos/packages/infra/current/include/testcase.h198
7 files changed, 3594 insertions, 0 deletions
diff --git a/ecos/packages/infra/current/include/clist.hxx b/ecos/packages/infra/current/include/clist.hxx
new file mode 100644
index 0000000..d90428d
--- /dev/null
+++ b/ecos/packages/infra/current/include/clist.hxx
@@ -0,0 +1,364 @@
+#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 Free Software Foundation, 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.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2.
+//
+// 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
+// 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
+
diff --git a/ecos/packages/infra/current/include/cyg_ass.h b/ecos/packages/infra/current/include/cyg_ass.h
new file mode 100644
index 0000000..3517b21
--- /dev/null
+++ b/ecos/packages/infra/current/include/cyg_ass.h
@@ -0,0 +1,616 @@
+#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 Free Software Foundation, 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.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2.
+//
+// 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 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(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((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((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
diff --git a/ecos/packages/infra/current/include/cyg_trac.h b/ecos/packages/infra/current/include/cyg_trac.h
new file mode 100644
index 0000000..07d62ef
--- /dev/null
+++ b/ecos/packages/infra/current/include/cyg_trac.h
@@ -0,0 +1,1654 @@
+#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 Free Software Foundation, 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.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2.
+//
+// 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 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
diff --git a/ecos/packages/infra/current/include/cyg_type.h b/ecos/packages/infra/current/include/cyg_type.h
new file mode 100644
index 0000000..5047493
--- /dev/null
+++ b/ecos/packages/infra/current/include/cyg_type.h
@@ -0,0 +1,559 @@
+#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, 2009 Free Software Foundation, 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.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2.
+//
+// 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 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
+
+// Compiler version.
+#ifdef __GNUC__
+# if defined(__GNU_PATCHLEVEL__)
+# define __GNUC_VERSION__ (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+# else
+# define __GNUC_VERSION__ (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100)
+# endif
+#endif
+
+// -------------------------------------------------------------------------
+// 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
+
+
+//----------------------------------------------------------------------------
+// The unused attribute stops the compiler warning about the variable
+// not being used.
+// The used attribute prevents the compiler from optimizing it away.
+
+#define CYG_REFERENCE_OBJECT(__object__) \
+ CYG_MACRO_START \
+ static const void* __cygvar_discard_me__ \
+ __attribute__ ((unused, used)) = (const void*)&(__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;
+
+// -------------------------------------------------------------------------
+// Number of elements in a (statically allocated) array.
+
+#define CYG_NELEM(a) (sizeof(a) / sizeof((a)[0]))
+
+// -------------------------------------------------------------------------
+// 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)
+
+#if defined(__GNUC__) && !defined(__cplusplus) && (__GNUC_VERSION__ >= 40300)
+// Equivalents of the above for C functions, available from gcc 4.3 onwards.
+# define CYGBLD_ATTRIB_C_INIT_PRI( _pri_) __attribute__((constructor (_pri_)))
+# define CYGBLD_ATTRIB_C_INIT_BEFORE( _pri_ ) __attribute__((constructor (_pri_-100)))
+# define CYGBLD_ATTRIB_C_INIT_AFTER( _pri_ ) __attribute__((constructor (_pri_+100)))
+#endif
+
+// Start with initializing everything inside the cpu and the main memory.
+#define CYG_INIT_HAL 10000
+#define CYG_INIT_SCHEDULER 11000
+#define CYG_INIT_IDLE_THREAD 11100
+#define CYG_INIT_INTERRUPTS 12000
+#define CYG_INIT_CLOCK 14000
+#define CYG_INIT_THREADS 16000
+#define CYG_INIT_KERNEL 19000
+#define CYG_INIT_MEMALLOC 20000
+// Now move on to I/O subsystems and device drivers. These can make use of
+// kernel and HAL functionality, and can dynamically allocate memory if
+// absolutely needed. For now they can also assume that diag_printf()
+// functionality is available, but that may change in future.
+//
+// Primary buses are ones very closely tied to the processor, e.g. PCI.
+#define CYG_INIT_BUS_PRIMARY 30000
+// Not yet: on some targets cyg_pci_init() has to be called very early
+// on for HAL diagnostics to work.
+// #define CYG_INIT_BUS_PCI CYG_INIT_BUS_PRIMARY
+//
+// Secondary buses may hang off primary buses, e.g. USB host.
+#define CYG_INIT_BUS_SECONDARY 31000
+// Tertiary buses are everything else.
+#define CYG_INIT_BUS_TERTIARY 32000
+#define CYG_INIT_BUS_I2C CYG_INIT_BUS_TERTIARY
+#define CYG_INIT_BUS_SPI CYG_INIT_BUS_TERTIARY
+//
+// In future HAL diag initialization may happen at this point.
+//
+// Watchdogs and wallclocks often hang off a tertiary bus but
+// have no dependencies
+#define CYG_INIT_DEV_WATCHDOG 35000
+#define CYG_INIT_DEV_WALLCLOCK 36000
+// A primary block configuration can be initialized with no need
+// for per-unit configuration information.
+#define CYG_INIT_DEV_BLOCK_PRIMARY 37000
+#define CYG_INIT_DEV_FLASH CYG_INIT_DEV_BLOCK_PRIMARY
+// Per-unit configuration data extracted from primary storage.
+// NOTE: for future use, not implemented yet.
+#define CYG_INIT_CONFIG 38000
+// Secondary block devices may use per-unit configuration data
+// for e.g. interpreting partition layout. Few devices are expected
+// to fall into this category. Note that these devices, as well as
+// some char devices, may not actually be usable until interrupts
+// are enabled.
+#define CYG_INIT_DEV_BLOCK_SECONDARY 40000
+// Char devices are everything else: serial, ethernet, CAN, ...
+#define CYG_INIT_DEV_CHAR 41000
+// For backwards compatibility. Subject to change in future so
+// a CYG_INIT_DEV_ priority should be used instead.
+#define CYG_INIT_DRIVERS 48000
+// CYG_INIT_IO and CYG_INIT_IO_FS are poorly defined at present,
+// and may get reorganized in future.
+#define CYG_INIT_IO 49000
+#define CYG_INIT_IO_FS 50000
+// The I/O subsystems and device drivers have been initialized.
+#define CYG_INIT_LIBC 56000
+#define CYG_INIT_COMPAT 58000
+#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
+
+# if !defined(CYGBLD_ATTRIB_ALIGN_MAX)
+# define CYGBLD_ATTRIB_ALIGN_MAX __attribute__((aligned))
+# endif
+
+# if !defined(CYGBLD_ATTRIB_ALIGNOFTYPE)
+# define CYGBLD_ATTRIB_ALIGNOFTYPE( _type_ ) \
+ __attribute__((aligned(__alignof__( _type_ ))))
+# endif
+
+// Teach compiler how to check format of printf-like functions
+# define CYGBLD_ATTRIB_PRINTF_FORMAT(__format__, __args__) \
+ __attribute__((format (printf, __format__, __args__)))
+
+// Teach compiler how to check format of scanf-like functions
+# define CYGBLD_ATTRIB_SCANF_FORMAT(__format__, __args__) \
+ __attribute__((format (scanf, __format__, __args__)))
+
+// Teach compiler how to check format of strftime-like functions
+# define CYGBLD_ATTRIB_STRFTIME_FORMAT(__format__, __args__) \
+ __attribute__((format (strftime, __format__, __args__)))
+
+// Tell compiler not to warn us about an unused variable -- generally
+// because it will be used when sources are build under certain
+// circumstances (e.g. with debugging or asserts enabled.
+# define CYGBLD_ATTRIB_UNUSED __attribute__((unused))
+
+// Tell the compiler not to throw away a variable or function. Only known
+// available on 3.3.2 or above. Old version's didn't throw them away,
+// but using the unused attribute should stop warnings.
+# if !defined(CYGBLD_ATTRIB_USED)
+# if __GNUC_VERSION__ >= 30302
+# define CYGBLD_ATTRIB_USED __attribute__((used))
+# else
+# define CYGBLD_ATTRIB_USED __attribute__((unused))
+# endif
+# endif
+
+// Enforce inlining of a C function. GCC does not inline any C
+// function when not optimizing, unless you specify "always_inline" attribute.
+// Other attributes suppress generation of standalone function.
+# if !defined(CYGBLD_FORCE_INLINE)
+# define CYGBLD_FORCE_INLINE __externC inline __attribute((gnu_inline)) __attribute((always_inline))
+# endif
+
+// Suppress function inlining
+#define CYGBLD_ATTRIB_NO_INLINE __attribute__((noinline))
+
+#else // non-GNU
+
+# define CYGBLD_ATTRIB_UNUSED /* nothing */
+
+# 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_ALIGN_MAX !!!-- Alignment alias not defined --!!!
+
+# define CYGBLD_ATTRIB_ALIGNOFTYPE( _type_ ) !!!-- Alignment alias not defined --!!!
+
+# define CYGBLD_ATTRIB_PRINTF_FORMAT(__format__, __args__)
+
+# define CYGBLD_ATTRIB_SCANF_FORMAT(__format__, __args__)
+
+# define CYGBLD_ATTRIB_STRFTIME_FORMAT(__format__, __args__)
+
+#define CYGBLD_FORCE_INLINE
+
+#define CYGBLD_ATTRIB_NO_INLINE
+
+#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
diff --git a/ecos/packages/infra/current/include/cyg_type.inc b/ecos/packages/infra/current/include/cyg_type.inc
new file mode 100644
index 0000000..724b318
--- /dev/null
+++ b/ecos/packages/infra/current/include/cyg_type.inc
@@ -0,0 +1,86 @@
+#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 Free Software Foundation, 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.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2.
+//
+// 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): 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
diff --git a/ecos/packages/infra/current/include/diag.h b/ecos/packages/infra/current/include/diag.h
new file mode 100644
index 0000000..633e4e3
--- /dev/null
+++ b/ecos/packages/infra/current/include/diag.h
@@ -0,0 +1,117 @@
+#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 Free Software Foundation, 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.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2.
+//
+// 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
+// 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);
+
+/* Formatted print */
+externC int diag_printf( const char *fmt, ... ) CYGBLD_ATTRIB_PRINTF_FORMAT(1,2);
+
+externC void diag_init_putc(void (*putc)(char c, void **param));
+externC int diag_sprintf(char *buf, const char *fmt, ...)
+ CYGBLD_ATTRIB_PRINTF_FORMAT(2,3);
+externC int diag_snprintf(char *buf, size_t len, const char *fmt, ...)
+ CYGBLD_ATTRIB_PRINTF_FORMAT(3,4);
+externC int diag_vsprintf(char *buf, const char *fmt, va_list ap)
+ CYGBLD_ATTRIB_PRINTF_FORMAT(2,0);
+externC int diag_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap)
+ CYGBLD_ATTRIB_PRINTF_FORMAT(3,0);
+externC int diag_vprintf(const char *fmt, va_list ap)
+ CYGBLD_ATTRIB_PRINTF_FORMAT(1,0);
+
+
+/*---------------------------------------------------------------------------*/
+/* Internal Diagnostic MACROS */
+
+#define DIAG_DEVICE_START_SYNC()
+#define DIAG_DEVICE_END_SYNC()
+
+/*---------------------------------------------------------------------------*/
+#endif /* CYGONCE_INFRA_DIAG_H */
+/* EOF diag.h */
diff --git a/ecos/packages/infra/current/include/testcase.h b/ecos/packages/infra/current/include/testcase.h
new file mode 100644
index 0000000..9d359b2
--- /dev/null
+++ b/ecos/packages/infra/current/include/testcase.h
@@ -0,0 +1,198 @@
+#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 Free Software Foundation, 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.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2.
+//
+// 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): 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