summaryrefslogtreecommitdiff
path: root/cesar/common
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/common')
-rw-r--r--cesar/common/defs/ethernet.h24
-rw-r--r--cesar/common/defs/homeplugAV.h29
-rw-r--r--cesar/common/doc/Doxyfile1255
-rw-r--r--cesar/common/doc/Makefile14
-rwxr-xr-xcesar/common/doc/docfilter28
-rwxr-xr-xcesar/common/doc/dox2rst40
-rw-r--r--cesar/common/doc/doxygen.h41
-rwxr-xr-xcesar/common/doc/extractdoc39
-rw-r--r--cesar/common/make/build.mk66
-rw-r--r--cesar/common/make/config.mk28
-rw-r--r--cesar/common/make/default.mk30
-rw-r--r--cesar/common/make/ecos.mk149
-rw-r--r--cesar/common/make/func.mk71
-rw-r--r--cesar/common/make/misc.mk13
-rw-r--r--cesar/common/make/print.mk67
-rw-r--r--cesar/common/make/setup.mk67
-rw-r--r--cesar/common/make/target.mk23
-rw-r--r--cesar/common/make/test/Config-output3
-rw-r--r--cesar/common/make/test/Config.alt-output8
-rw-r--r--cesar/common/make/test/b_shout.h-output6
-rw-r--r--cesar/common/make/test/clean-output12
-rw-r--r--cesar/common/make/test/ecos.ecc.sh-output5
-rw-r--r--cesar/common/make/test/first-output19
-rw-r--r--cesar/common/make/test/modules/a/Module2
-rw-r--r--cesar/common/make/test/modules/a/a.h23
-rw-r--r--cesar/common/make/test/modules/a/src/a.c25
-rw-r--r--cesar/common/make/test/modules/b/Config3
-rw-r--r--cesar/common/make/test/modules/b/Module1
-rw-r--r--cesar/common/make/test/modules/b/b.h26
-rw-r--r--cesar/common/make/test/modules/b/inc/b_shout.h18
-rw-r--r--cesar/common/make/test/modules/b/src/b_print.c33
-rw-r--r--cesar/common/make/test/modules/b/src/b_shout.c34
-rw-r--r--cesar/common/make/test/nothing-output1
-rw-r--r--cesar/common/make/test/project/Config2
-rw-r--r--cesar/common/make/test/project/Config.alt2
-rw-r--r--cesar/common/make/test/project/Makefile20
-rw-r--r--cesar/common/make/test/project/ecos.ecc.sh11
-rw-r--r--cesar/common/make/test/project/inc/test_make.h18
-rw-r--r--cesar/common/make/test/project/src/test_cpp.cpp27
-rw-r--r--cesar/common/make/test/project/src/test_make.c26
-rw-r--r--cesar/common/make/test/project_synth/Config1
-rw-r--r--cesar/common/make/test/project_synth/Makefile12
-rw-r--r--cesar/common/make/test/project_synth/ecos.ecc.sh5
-rw-r--r--cesar/common/make/test/project_synth/inc/test_make.h18
-rw-r--r--cesar/common/make/test/project_synth/src/test_make.c26
-rw-r--r--cesar/common/make/test/test_make.c-output5
-rw-r--r--cesar/common/make/test/test_make.h-output7
-rwxr-xr-xcesar/common/make/test/test_make.sh65
-rw-r--r--cesar/common/make/top.mk22
-rw-r--r--cesar/common/std.h33
-rw-r--r--cesar/common/tests/Makefile31
-rwxr-xr-xcesar/common/tests/get-cov.pl32
-rwxr-xr-xcesar/common/tests/run-test.pl235
-rw-r--r--cesar/common/tests/tests291
-rwxr-xr-xcesar/common/tools/check-filename66
-rwxr-xr-xcesar/common/tools/compact-ecos-config122
-rwxr-xr-xcesar/common/tools/config-headers100
-rwxr-xr-xcesar/common/tools/config-merge54
-rwxr-xr-xcesar/common/tools/gentags1
-rwxr-xr-xcesar/common/tools/project-template193
-rw-r--r--cesar/common/tools/sdl.ps655
-rwxr-xr-xcesar/common/tools/sdl2dot227
-rwxr-xr-xcesar/common/tools/vcd-merge111
-rwxr-xr-xcesar/common/tools/vcd-trace129
64 files changed, 4750 insertions, 0 deletions
diff --git a/cesar/common/defs/ethernet.h b/cesar/common/defs/ethernet.h
new file mode 100644
index 0000000000..914be30b91
--- /dev/null
+++ b/cesar/common/defs/ethernet.h
@@ -0,0 +1,24 @@
+#ifndef common_defs_ethernet_h
+#define common_defs_ethernet_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file common/defs/ethernet.h
+ * \brief Defines concerning the Ethernet Norme.
+ * \ingroup common_defs
+ *
+ * Based on the norme 802.3
+ */
+
+/** Ethernet packet minimum size. */
+#define ETH_PACKET_MIN_SIZE 60
+
+/** Ethernet packet maximum size. */
+#define ETH_PACKET_MAX_SIZE 1518
+
+#endif /* common_defs_ethernet_h */
diff --git a/cesar/common/defs/homeplugAV.h b/cesar/common/defs/homeplugAV.h
new file mode 100644
index 0000000000..9448c0c0e6
--- /dev/null
+++ b/cesar/common/defs/homeplugAV.h
@@ -0,0 +1,29 @@
+#ifndef common_defs_homeplugAV_h
+#define common_defs_homeplugAV_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file common/defs/homeplugAV.h
+ * \brief Home Plug AV constants.
+ * \ingroup common_defs
+ *
+ * Defines for all the HPAV constants.
+ */
+
+/** Define the MTYPE for MME. */
+#define HPAV_MTYPE_MME 0x88E1
+
+/** MMV version for the MME HomePlug 1.0 see section 11.1.5 */
+#define HPAV_MMV0 0x0
+/** MMV version for the MME HomePlug 1.1 see section 11.1.5 */
+#define HPAV_MMV1 0x1
+
+/** Define the MMV default type for HPAV. */
+#define HPAV_MMV HPAV_MMV1
+
+#endif /* common_defs_homeplugAV_h */
diff --git a/cesar/common/doc/Doxyfile b/cesar/common/doc/Doxyfile
new file mode 100644
index 0000000000..e57100bf51
--- /dev/null
+++ b/cesar/common/doc/Doxyfile
@@ -0,0 +1,1255 @@
+# Doxyfile 1.5.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = cesar
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = common/doc
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian,
+# Italian, Japanese, Japanese-en (Japanese with English messages), Korean,
+# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian,
+# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# This tag can be used to specify the encoding used in the generated output.
+# The encoding is not always determined by the language that is chosen,
+# but also whether or not the output is meant for Windows or non-Windows users.
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
+# forces the Windows encoding (this is the default for the Windows binary),
+# whereas setting the tag to NO uses a Unix-style encoding (the default for
+# all platforms other than Windows).
+
+USE_WINDOWS_ENCODING = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like the Qt-style comments (thus requiring an
+# explicit @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF = YES
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+ALIASES += "context=\par Context:\n"
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for Java.
+# For instance, namespaces will be presented as packages, qualified scopes
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
+# include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = YES
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = YES
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from the
+# version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = cl common hal lib interface mac host cp hle
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS = */.svn/* */test/* */ecos/*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH = cp/sta/action/doc
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS = *.h=common/doc/docfilter
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default)
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default)
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = "DOXYGEN_ONLY=1" "__attribute__(x)=" "BEGIN_DECLS=" \
+ "END_DECLS=" "BITFIELDS_WORD=" "__FL=" \
+ "void_FL=void"
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
+# generate a call dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will
+# generate a caller dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_WIDTH = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT = 1024
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that a graph may be further truncated if the graph's
+# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
+# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
+# the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, which results in a white background.
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
diff --git a/cesar/common/doc/Makefile b/cesar/common/doc/Makefile
new file mode 100644
index 0000000000..aa4253ff9d
--- /dev/null
+++ b/cesar/common/doc/Makefile
@@ -0,0 +1,14 @@
+
+.PHONY: all clean
+
+all: clean
+ cd ../.. && doxygen common/doc/Doxyfile
+
+all.%: Doxyfile.% clean
+ cd ../.. && doxygen common/doc/$<
+
+Doxyfile.quiet: Doxyfile
+ perl -lpe '/^WARN/ && s/YES/NO/' < $< > $@
+
+clean:
+ rm -rf html
diff --git a/cesar/common/doc/docfilter b/cesar/common/doc/docfilter
new file mode 100755
index 0000000000..39ccbcc806
--- /dev/null
+++ b/cesar/common/doc/docfilter
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my $last;
+
+while (<>)
+{
+ chomp;
+ if (defined $last && /^ \* ([-=~]{5,})$/)
+ {
+ my $l = length $1;
+ my $c = substr $1, 0, 1;
+ if ($last =~ /^ \* (.*)$/ && length $1 == $l)
+ {
+ my %sec = ('=' => 'section', '-' => 'subsection',
+ '~' => 'subsubsection');
+ my $title = $1;
+ my $name = $1;
+ $name =~ tr/A-Z/a-z/;
+ $name =~ s/\W/-/g;
+ $last = " * \\$sec{$c} $name $title";
+ $_ = undef;
+ }
+ }
+ print $last . "\n" if defined $last;
+ $last = $_;
+}
diff --git a/cesar/common/doc/dox2rst b/cesar/common/doc/dox2rst
new file mode 100755
index 0000000000..99273c02ea
--- /dev/null
+++ b/cesar/common/doc/dox2rst
@@ -0,0 +1,40 @@
+#!/usr/bin/perl -l
+use strict;
+use warnings;
+
+my $blank = 0;
+
+while (<>)
+{
+ chomp;
+ if (/^\\image html (.*?) "(.*)"$/)
+ {
+ $_ = <<EOF;
+.. figure:: $1
+
+ $2
+EOF
+ }
+ if (s/^\s(\s*- )\(/$1\\(/
+ or s/^\s(\s*- )/$1/
+ or s/\\param (.*?) (.*)/:$1: $2/
+ or s/\\return (.*)/:Returns: $1/)
+ {
+ print '' unless $blank && !/^\s*-/;
+ $blank = 1;
+ }
+ elsif (s/^\s(\s*)/$1/)
+ {
+ }
+ elsif (s/^> {3}/ /)
+ {
+ print "::\n" unless $blank;
+ $blank = 1;
+ }
+ else
+ {
+ $blank = 0;
+ }
+} continue {
+ print;
+}
diff --git a/cesar/common/doc/doxygen.h b/cesar/common/doc/doxygen.h
new file mode 100644
index 0000000000..4da8563835
--- /dev/null
+++ b/cesar/common/doc/doxygen.h
@@ -0,0 +1,41 @@
+#ifndef common_doc_doxygen_h
+#define common_doc_doxygen_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+
+/**
+ * \defgroup lib Library functions
+ * \defgroup common Common
+ * \defgroup hle HLE - High Entity Layer
+ * \defgroup hal HAL - Hardware Abstraction Layer
+ * \defgroup hal_phy HAL / Phy
+ * \ingroup hal
+ * \defgroup hal_leon HAL / Leon
+ * \ingroup hal
+ * \defgroup hal_timer HAL / API Timer soft Leon
+ * \ingroup hal
+ * \defgroup interface Interface - Interface module CP - DP
+ * \defgroup interface_sniffer Sniffer - Sniffer module
+ * \ingroup interface
+ * \defgroup host Host - Fulminata station
+ * \defgroup mac MAC
+ * \defgroup mac_common MAC / Common
+ * \ingroup mac
+ * \defgroup mac_sar MAC / Segmentation and Reassembly
+ * \ingroup mac
+ * \defgroup mac_ca MAC / Channel Access
+ * \ingroup mac
+ * \defgroup mac_pbproc MAC / PB Processing
+ * \ingroup mac
+ * \defgroup cp CP - Control Plane
+ * \defgroup cp_beacon CP / Beacon
+ * \ingroup cp
+ * \defgroup cl CL - Convergence Layer
+ */
+
+#endif /* common_doc_doxygen_h */
diff --git a/cesar/common/doc/extractdoc b/cesar/common/doc/extractdoc
new file mode 100755
index 0000000000..b63ec398b9
--- /dev/null
+++ b/cesar/common/doc/extractdoc
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -nl
+use strict;
+use warnings;
+
+# Extract the file comment.
+if (/^\/\*\*$/ .. /^ \*\/$/)
+{
+ if (/^ \* \\file/ .. /^ \*\/$/)
+ {
+ if (not /^ \* \\(?:file|brief|ingroup)| \*\//)
+ {
+ s/^ \* ?//;
+ print;
+ }
+ }
+}
+
+if (/^BEGIN_DECLS$/ .. /^END_DECLS$/)
+{
+ if (/^BEGIN_DECLS$/)
+ {
+ print "\nFunctions\n---------";
+ }
+ elsif (/^END_DECLS$/)
+ {
+ }
+ elsif (m#^$|^/\*\*$|^ \*/$#)
+ {
+ print '';
+ }
+ elsif (s/^ \* ?//)
+ {
+ print;
+ }
+ else
+ {
+ print '> ' . $_;
+ }
+}
diff --git a/cesar/common/make/build.mk b/cesar/common/make/build.mk
new file mode 100644
index 0000000000..4ff67afd85
--- /dev/null
+++ b/cesar/common/make/build.mk
@@ -0,0 +1,66 @@
+# Define build rules.
+
+# No default implicit rules.
+.SUFFIXES:
+
+HOST_CC ?= $(CC)
+HOST_CXX ?= $(CXX)
+TARGET_CC ?= $(CROSS_COMPILE)gcc
+TARGET_CXX ?= $(CROSS_COMPILE)g++
+
+HOST_COMPILE.c = $(HOST_CC) $(HOST_CPPFLAGS) $(HOST_CFLAGS) -c
+HOST_COMPILE.cpp = $(HOST_CXX) $(HOST_CPPFLAGS) $(HOST_CXXFLAGS) -c
+HOST_COMPILE.S = $(HOST_CC) $(HOST_CPPFLAGS) $(HOST_ASFLAGS) -c
+HOST_LINK = $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS)
+HOST_LINK_CXX = $(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_LDFLAGS)
+
+TARGET_COMPILE.c = $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -c
+TARGET_COMPILE.cpp = $(TARGET_CXX) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -c
+TARGET_COMPILE.S = $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) -c
+TARGET_LINK = $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)
+TARGET_LINK_CXX = $(TARGET_CXX) $(TARGET_CXXFLAGS) $(TARGET_LDFLAGS)
+
+.PHONY: build.all host.all target.all build.clean
+
+build.all: host.all target.all
+
+host.all: $(HOST_EXES)
+
+target.all: $(TARGET_ELFS)
+
+# For each program, define the link rule.
+PROGRAM_rule_template_echo := "LINK"
+PROGRAM_rule_template_echo_CXX := "LDXX"
+define PROGRAM_rule_template
+.PHONY: $1
+$1: $$(call prog2exe,$1,$2)
+$$(call prog2exe,$1,$2): $$($1_OBJECTS) $$($1_MODULES_OBJECTS) $$($(call type2var,$2)_LINK_DEPS)
+ @echo $(PROGRAM_rule_template_echo$3)" [$2] $$@"
+ $Q$$($(call type2var,$2)_LINK$3) $$($1_OBJECTS) $$($1_MODULES_OBJECTS) $$($(call type2var,$2)_LDLIBS) $$($1_LDLIBS) -o $$@
+endef
+$(foreach program,$(HOST_PROGRAMS),$(eval $(call PROGRAM_rule_template,$(program),host,$(call iscxx,$(program)))))
+$(foreach program,$(TARGET_PROGRAMS),$(eval $(call PROGRAM_rule_template,$(program),target,$(call iscxx,$(program)))))
+
+# For each source, define the compile rule.
+SOURCE_rule_template_echo.c := "CC "
+SOURCE_rule_template_echo.cpp := "CXX "
+SOURCE_rule_template_echo.S := "AS "
+define SOURCE_rule_template
+$$(call src2obj,$1,$2): $1 | $$(OBJ_DIR_STAMP) $$($(call type2var,$2)_COMPILE_DEPS)
+ @echo $(SOURCE_rule_template_echo$3)" [$2] $$<"
+ $Q$$($(call type2var,$2)_COMPILE$3) -I$$(dir $$<).. -MMD -MP -MF $$(@:.o=.d) -MQ $$@ -o $$@ $$<
+endef
+$(foreach source,$(HOST_SOURCES),$(eval $(call SOURCE_rule_template,$(source),host,$(suffix $(source)))))
+$(foreach source,$(TARGET_SOURCES),$(eval $(call SOURCE_rule_template,$(source),target,$(suffix $(source)))))
+
+# Include deps.
+-include $(call src2dep,$(HOST_SOURCES),host)
+-include $(call src2dep,$(TARGET_SOURCES),target)
+
+# Clean rules.
+build.clean:
+ rm -f $(HOST_EXES) $(TARGET_ELFS) \
+ $(call src2obj,$(HOST_SOURCES),host) \
+ $(call src2obj,$(TARGET_SOURCES),target) \
+ $(call src2dep,$(HOST_SOURCES),host) \
+ $(call src2dep,$(TARGET_SOURCES),target)
diff --git a/cesar/common/make/config.mk b/cesar/common/make/config.mk
new file mode 100644
index 0000000000..ae18a21b80
--- /dev/null
+++ b/cesar/common/make/config.mk
@@ -0,0 +1,28 @@
+# Build time configuration.
+
+USER_PROJECT_CONFIG ?= $(wildcard $(if $(VARIANT),$(VARIANT)-)Config)
+DEFAULT_PROJECT_CONFIG := $(OBJ_DIR)/Config.empty
+PROJECT_CONFIG := $(if $(USER_PROJECT_CONFIG),$(USER_PROJECT_CONFIG),$(DEFAULT_PROJECT_CONFIG))
+HEADERS_CONFIG := $(OBJ_INC_DIR)/config
+
+HEADERS_CONFIG_STAMP := $(HEADERS_CONFIG)/headers.stamp
+
+HOST_COMPILE_DEPS += $(HEADERS_CONFIG_STAMP)
+TARGET_COMPILE_DEPS += $(HEADERS_CONFIG_STAMP)
+
+$(DEFAULT_PROJECT_CONFIG): $(OBJ_DIR_STAMP)
+ touch $@
+
+$(MERGED_CONFIG): $(PROJECT_CONFIG) $(MODULES_CONFIG) $(OBJ_DIR_STAMP)
+ @echo CONF merge
+ $Q$(TOOLS_DIR)/config-merge $(PROJECT_CONFIG) $(MODULES_CONFIG) > $@
+
+$(HEADERS_CONFIG_STAMP): $(MERGED_CONFIG)
+ @echo CONF headers
+ $Qmkdir -p $(dir $@)
+ $Q$(TOOLS_DIR)/config-headers $(OBJ_INC_DIR) $<
+ $Qtouch $@
+
+config.clean:
+ rm -f $(DEFAULT_PROJECT_CONFIG) $(MERGED_CONFIG)
+ rm -rf $(OBJ_INC_DIR)/config.h $(HEADERS_CONFIG)
diff --git a/cesar/common/make/default.mk b/cesar/common/make/default.mk
new file mode 100644
index 0000000000..0ac7fdfea5
--- /dev/null
+++ b/cesar/common/make/default.mk
@@ -0,0 +1,30 @@
+# Define default build parameters.
+
+INCLUDES := $(INCLUDES:%=-I$(BASE)/%) -I$(BASE) -I$(OBJ_DIR)/inc
+DEFS := $(DEFS)
+
+HOST_INCLUDES := $(HOST_INCLUDES:%=-I$(BASE)/%) $(INCLUDES)
+HOST_DEFS := $(HOST_DEFS) $(DEFS)
+HOST_CPPFLAGS = $(EXTRA_HOST_CPPFLAGS) $(HOST_DEFS) $(HOST_INCLUDES)
+HOST_CFLAGS := $(EXTRA_HOST_CFLAGS) -g $(call isdebug,,-O2) -finline -W -Wall -Wundef -Wno-unused-parameter
+ifneq ($(HOST_COV)$(COV),)
+ HOST_CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+HOST_ASFLAGS := $(HOST_CFLAGS)
+HOST_CXXFLAGS := $(HOST_CFLAGS)
+HOST_LDFLAGS := $(EXTRA_HOST_LDFLAGS)
+HOST_LDLIBS := $(EXTRA_HOST_LDLIBS)
+
+TARGET_INCLUDES := $(TARGET_INCLUDES:%=-I$(BASE)/%) $(INCLUDES)
+TARGET_DEFS := $(TARGET_DEFS) $(DEFS)
+TARGET_CPPFLAGS = $(EXTRA_TARGET_CPPFLAGS) $(TARGET_DEFS) $(TARGET_INCLUDES)
+TARGET_CFLAGS := $(EXTRA_TARGET_CFLAGS) -g $(call isdebug,,-O2) -finline -W -Wall -Wundef -Wno-unused-parameter
+ifneq ($(TARGET_COV)$(COV),)
+ TARGET_CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+TARGET_ASFLAGS := $(TARGET_CFLAGS)
+TARGET_CXXFLAGS := $(TARGET_CFLAGS)
+TARGET_LDFLAGS := $(EXTRA_TARGET_LDFLAGS)
+TARGET_LDLIBS := $(EXTRA_TARGET_LDLIBS)
+
+Q = @@
diff --git a/cesar/common/make/ecos.mk b/cesar/common/make/ecos.mk
new file mode 100644
index 0000000000..5c9d70735c
--- /dev/null
+++ b/cesar/common/make/ecos.mk
@@ -0,0 +1,149 @@
+ifneq ($(ECOS),)
+
+# Ecos files and directories.
+ECOS_DIR := $(OBJ_DIR)/ecos
+ECOS_INSTALL_DIR := $(ECOS_DIR)/install
+ECOS_BUILD_DIR := $(ECOS_DIR)/build
+ECOS_TREE_STAMP := $(ECOS_DIR)/tree.stamp
+ECOS_HEADERS_STAMP := $(ECOS_DIR)/headers.stamp
+ECOS_DEFS := $(ECOS_INSTALL_DIR)/include/pkgconf/ecos.mak
+ECOS_CONFIG_COMPACT ?= $(if $(VARIANT),$(VARIANT)-)ecos.ecc.sh
+ECOS_CONFIG := $(ECOS_DIR)/ecos.ecc
+ECOS_CONFIG_COV := $(ECOS_CONFIG:%.ecc=%-cov.ecc)
+ECOS_CONFIG_FOR_TREE := $(ECOS_CONFIG)
+ifneq ($(TARGET_COV)$(COV),)
+ ECOS_CONFIG_FOR_TREE := $(ECOS_CONFIG_COV)
+endif
+ECOS_NEW_CONFIG_COMPACT := new-ecos.ecc.sh
+ECOS_NEW_CONFIG := new-ecos.ecc
+ECOS_INCLUDE_DIR := $(ECOS_INSTALL_DIR)/include
+ECOS_LIB_DIR := $(ECOS_INSTALL_DIR)/lib
+ECOS_LIB_FILES := vectors.o extras.o libtarget.a
+ECOS_LIBS := $(ECOS_LIB_FILES:%=$(ECOS_LIB_DIR)/%)
+ECOS_LD_SCRIPT := $(ECOS_LIB_DIR)/target.ld
+ECOS_SILENT := -s
+
+# Ecos packages repository.
+ifdef ECOS_REPOSITORY
+ $(warning overiding ECOS_REPOSITORY)
+endif
+override ECOS_REPOSITORY := $(CURDIR)/$(BASE)/ecos/packages
+export ECOS_REPOSITORY
+
+# Only include ecos definitions if needed (do not include it if clean or
+# *.clean).
+ifneq ($(if $(MAKECMDGOALS),$(filter-out \
+ %.clean clean,$(MAKECMDGOALS)),default),)
+ # Include and filter ecos defined flags.
+ -include $(ECOS_DEFS)
+endif
+
+ifdef ECOS_GLOBAL_CFLAGS
+ # GCC since 2.95 does -finit-priority by default so remove it from old HALs.
+ ECOS_GLOBAL_CFLAGS := $(subst -finit-priority,,$(ECOS_GLOBAL_CFLAGS))
+ # -fvtable-gc is known to be broken in all recent GCC.
+ ECOS_GLOBAL_CFLAGS := $(subst -fvtable-gc,,$(ECOS_GLOBAL_CFLAGS))
+
+ # To support more recent GCC whilst preserving existing behaviour, we need
+ # to increase the inlining limit globally from the default 600. Note this
+ # will break GCC 2.95 based tools and earlier. You must use "make OLDGCC=1"
+ # to avoid this.
+ ifneq ($(OLDGCC),1)
+ ECOS_GLOBAL_CFLAGS := -finline-limit=7000 $(ECOS_GLOBAL_CFLAGS)
+ endif
+
+ # Filter out unwanted options.
+ ECOS_GLOBAL_CFLAGS := $(subst -O2,,$(ECOS_GLOBAL_CFLAGS))
+ ECOS_GLOBAL_CFLAGS := $(subst -fdata-sections,,$(ECOS_GLOBAL_CFLAGS))
+ ECOS_GLOBAL_CFLAGS := $(subst -ffunction-sections,,$(ECOS_GLOBAL_CFLAGS))
+
+ # Separate C++ flags out from C flags.
+ ECOS_CFLAGS := $(ECOS_GLOBAL_CFLAGS)
+ ECOS_CFLAGS := $(subst -fno-rtti,,$(ECOS_CFLAGS))
+ ECOS_CFLAGS := $(subst -frtti,,$(ECOS_CFLAGS))
+ ECOS_CFLAGS := $(subst -Woverloaded-virtual,,$(ECOS_CFLAGS))
+ ECOS_CFLAGS := $(subst -fvtable-gc,,$(ECOS_CFLAGS))
+
+ ECOS_CXXFLAGS := $(ECOS_GLOBAL_CFLAGS)
+ ECOS_CXXFLAGS := $(subst -Wstrict-prototypes,,$(ECOS_CXXFLAGS))
+
+ ECOS_LDFLAGS := $(ECOS_GLOBAL_LDFLAGS)
+
+ # Use ecos defined flags.
+ TARGET_DEFS += -DECOS=1
+ TARGET_CFLAGS := $(sort $(TARGET_CFLAGS) $(ECOS_CFLAGS))
+ TARGET_CXXFLAGS := $(sort $(TARGET_CXXFLAGS) $(ECOS_CXXFLAGS))
+ TARGET_INCLUDES += -I$(ECOS_INCLUDE_DIR)
+ TARGET_LDFLAGS := $(sort $(TARGET_LDFLAGS) $(ECOS_LDFLAGS))
+ TARGET_LDFLAGS += -L$(ECOS_LIB_DIR) -T$(ECOS_LD_SCRIPT)
+ TARGET_COMPILE_DEPS += $(ECOS_HEADERS_STAMP)
+ TARGET_LINK_DEPS += $(ECOS_LIBS) $(ECOS_LD_SCRIPT)
+ ifneq ($(CROSS_COMPILE),$(ECOS_COMMAND_PREFIX))
+ ECOS_MAKEFLAGS := COMMAND_PREFIX=$(CROSS_COMPILE)
+ endif
+ ECOS_MAKEFLAGS += BASE=$(CURDIR)/$(BASE) OBJ_DIR=$(CURDIR)/$(OBJ_DIR)
+else
+ # Catch errors.
+ TARGET_CC = $(error no ecos definitions included)
+ TARGET_CXX = $(error no ecos definitions included)
+endif
+
+EXTRA_CLEAN += ecos.clean
+
+.PHONY: ecos.all ecos.headers ecos.tree ecos.config ecos.compact-config ecos.clean
+
+$(ECOS_LIBS) $(ECOS_LD_SCRIPT): ecos.all
+ecos.all: $(ECOS_TREE_STAMP)
+ @echo MAKE ecos.all
+ $Q$(MAKE) $(ECOS_MAKEFLAGS) $(ECOS_SILENT) -C $(ECOS_BUILD_DIR)
+
+ecos.headers: $(ECOS_HEADERS_STAMP)
+$(ECOS_HEADERS_STAMP): $(ECOS_TREE_STAMP)
+ @echo MAKE ecos.headers
+ $Q$(MAKE) $(ECOS_MAKEFLAGS) $(ECOS_SILENT) -C $(ECOS_BUILD_DIR) headers
+ touch $@
+
+ecos.tree: $(ECOS_TREE_STAMP) ; @:
+$(ECOS_TREE_STAMP): $(ECOS_CONFIG_FOR_TREE)
+ @echo ECOS tree
+ mkdir -p $(ECOS_BUILD_DIR)
+ cd $(ECOS_BUILD_DIR) && \
+ ecosconfig --config=$(CURDIR)/$(ECOS_CONFIG_FOR_TREE) \
+ --prefix=$(CURDIR)/$(ECOS_INSTALL_DIR) tree
+ touch $@
+
+$(ECOS_DEFS): $(ECOS_TREE_STAMP)
+ @echo MAKE ecos.defs
+ $Q$(MAKE) $(ECOS_MAKEFLAGS) $(ECOS_SILENT) -C $(ECOS_BUILD_DIR) $(CURDIR)/$@
+
+ecos.config: $(ECOS_CONFIG)
+$(ECOS_CONFIG): $(ECOS_CONFIG_COMPACT)
+ @echo ECOS conf
+ mkdir -p $(ECOS_DIR)
+ sh -e $< $@
+
+$(ECOS_CONFIG_COV): $(ECOS_CONFIG)
+ @echo ECOS conf cov
+ cp $< $@
+ ecosconfig --config=$(CURDIR)/$@ add CYGPKG_GCOV
+
+# Generate the compacted ecos configuration.
+$(ECOS_NEW_CONFIG_COMPACT): $(ECOS_CONFIG)
+ $(TOOLS_DIR)/compact-ecos-config $< > $@
+
+$(ECOS_NEW_CONFIG): $(ECOS_NEW_CONFIG_COMPACT)
+ @echo ECOS new-conf
+ sh -e $< $@
+
+ecos.compact-config: $(ECOS_NEW_CONFIG)
+ -diff $(ECOS_NEW_CONFIG) $(ECOS_CONFIG)
+ @echo copy $(ECOS_NEW_CONFIG_COMPACT) to $(ECOS_CONFIG_COMPACT) if satisfied.
+ false # Stop make
+
+ecos.clean:
+ rm -rf $(ECOS_TREE_STAMP) $(ECOS_BUILD_DIR)
+ rm -rf $(ECOS_HEADERS_STAMP) $(ECOS_INSTALL_DIR)
+ rm -f $(ECOS_CONFIG) $(ECOS_CONFIG_COV) $(ECOS_NEW_CONFIG)
+ -if [ -d $(ECOS_DIR) ]; then rmdir $(ECOS_DIR); fi
+
+endif # ifneq ($(ECOS),)
diff --git a/cesar/common/make/func.mk b/cesar/common/make/func.mk
new file mode 100644
index 0000000000..6564fc8c5e
--- /dev/null
+++ b/cesar/common/make/func.mk
@@ -0,0 +1,71 @@
+# Define utility functions.
+
+# Module name to variable name.
+# $(call mod2var,foo/bar)
+# => foo_bar
+mod2var = $(subst /,_,$1)
+
+# Get source file basename.
+# $(call src2base,foo.c bar.S)
+# => foo bar
+src2base = $(patsubst %.cpp,%,$(patsubst %.c,%,$(patsubst %.S,%,$1)))\
+$(if $(filter-out %.c %.S %.cpp,$1),$(error unknown source extension))
+
+# Source file to source file, adding path.
+# $(call src2src,foo.c bar.c,mod/src)
+# => mod/src/foo.c mod/src/bar.c
+# $(call src2src,all,mod/src)
+# => $(call wild2src,mod/src/*.c mod/src/*.cpp)
+src2src = $(if $(filter all,$1),\
+$(call wild2src,$(patsubst %,$2/%,*.c *.cpp)),$(1:%=$2/%))
+
+# Wildcard expand a source pattern.
+# $(call wild2src,mod/src/*.c mod/src/*.cpp)
+# => mod/src/foo.c mod/src/bar.c
+wild2src = $(wildcard $1) $(patsubst $(BASE)/%,%,$(wildcard $(1:%=$(BASE)/%)))
+
+# Source file to object file.
+# $(call src2obj,foo.c,target)
+# => $(OBJ_DIR)/foo.target.o
+# $(call src2obj,foo/bar.c,host)
+# => $(OBJ_DIR)/foo__bar.host.o
+src2obj = $(patsubst %,$(OBJ_DIR)/%.$2.o,$(subst /,__,$(call src2base,$1)))
+
+# Source file to dependency file.
+# $(call src2dep,foo.c,target)
+# => $(OBJ_DIR)/foo.target.d
+# $(call src2dep,bar.c,host)
+# => $(OBJ_DIR)/bar.host.d
+src2dep = $(patsubst %.o,%.d,$(call src2obj,$1,$2))
+
+# Program name to executable file name.
+# $(call prog2exe,test_foo,target)
+# => $(OBJ_DIR)/test_foo.elf
+# $(call prog2exe,test_bar,host)
+# => $(OBJ_DIR)/test_bar
+prog2exe = $(patsubst %,$(OBJ_DIR)/%$(if $(filter host,$2),,.elf),$1)
+
+# Build type (target or host) to variable name.
+# $(call type2var,target)_CC
+# => TARGET_CC
+# $(call type2var,host)_CC
+# => HOST_CC
+type2var = $(if $(filter target,$1),TARGET,$(if $(filter host,$1),HOST,$(error unknown type)))
+
+# Find whether a C++ link should be made.
+# $(call iscxx,prog), if prog sources include a c++ file
+# => _CXX
+# else
+# =>
+iscxx = $(if $(filter %.cpp,$($1_SOURCES) $($1_MODULES_SOURCES)),_CXX,)
+
+# Expand to the first argument when debug, to the second one when non debug.
+# $(call isdebug,-g,-O2), if debug is activated
+# => -g
+# else
+# => -O2
+ifeq ($(CONFIG_DEBUG),n)
+isdebug = $2
+else
+isdebug = $1
+endif
diff --git a/cesar/common/make/misc.mk b/cesar/common/make/misc.mk
new file mode 100644
index 0000000000..5205344aed
--- /dev/null
+++ b/cesar/common/make/misc.mk
@@ -0,0 +1,13 @@
+# Define miscellaneous rules.
+
+.PHONY: clean
+
+$(OBJ_DIR_STAMP) $(OBJ_INC_DIR_STAMP):
+ @mkdir -p $(dir $@) && touch $@
+
+clean: config.clean build.clean $(EXTRA_CLEAN)
+ rm -f $(OBJ_INC_DIR_STAMP) $(OBJ_DIR_STAMP) \
+ $(CLEAN_FILES)
+ rm -rf $(CLEAN_DIRS)
+ -if [ -d $(OBJ_INC_DIR) ]; then rmdir $(OBJ_INC_DIR); fi
+ -if [ -d $(OBJ_DIR) ]; then rmdir $(OBJ_DIR); fi
diff --git a/cesar/common/make/print.mk b/cesar/common/make/print.mk
new file mode 100644
index 0000000000..35bc17096d
--- /dev/null
+++ b/cesar/common/make/print.mk
@@ -0,0 +1,67 @@
+# Define print rules mainly for debuging.
+
+.PHONY: print print_modules print_programs print_setup
+
+empty :=
+
+print: print_modules print_programs print_setup
+
+define MODULE_print
+ $(empty)
+ @echo ' $1:'
+ @echo ' $(call mod2var,$1)_MODULE_SOURCES = $($(call mod2var,$1)_MODULE_SOURCES)'
+ @echo ' $(call mod2var,$1)_MODULE_MODULES = $($(call mod2var,$1)_MODULE_MODULES)'
+endef
+
+print_modules:
+ @echo 'ALL_MODULES = $(ALL_MODULES)'
+ $(foreach module,$(ALL_MODULES),$(call MODULE_print,$(module)))
+
+define PROGRAM_print
+ $(empty)
+ @echo ' $1:'
+ @echo ' $1_SOURCES = $($1_SOURCES)'
+ @echo ' $1_MODULES = $($1_MODULES)'
+ @echo ' $1_MODULES_SOURCES = $($1_MODULES_SOURCES)'
+ @echo ' $1_OBJECTS = $($1_OBJECTS)'
+ @echo ' $1_MODULES_OBJECTS = $($1_MODULES_OBJECTS)'
+ @echo ' $1_LDLIBS = $($1_LDLIBS)'
+endef
+
+print_programs:
+ @echo 'HOST_PROGRAMS = $(HOST_PROGRAMS)'
+ $(foreach program,$(HOST_PROGRAMS),$(call PROGRAM_print,$(program)))
+ @echo 'TARGET_PROGRAMS = $(TARGET_PROGRAMS)'
+ $(foreach program,$(TARGET_PROGRAMS),$(call PROGRAM_print,$(program)))
+
+print_setup:
+ @echo 'HOST_...'
+ @echo ' INCLUDES = $(HOST_INCLUDES)'
+ @echo ' DEFS = $(HOST_DEFS)'
+ @echo ' CPPFLAGS = $(HOST_CPPFLAGS)'
+ @echo ' CFLAGS = $(HOST_CFLAGS)'
+ @echo ' CXXFLAGS = $(HOST_CXXFLAGS)'
+ @echo ' LDFLAGS = $(HOST_LDFLAGS)'
+ @echo ' LDLIBS = $(HOST_LDLIBS)'
+ @echo ' CC = $(HOST_CC)'
+ @echo ' CXX = $(HOST_CXX)'
+ @echo ' COMPILE.c = $(HOST_COMPILE.c)'
+ @echo ' COMPILE.cpp = $(HOST_COMPILE.cpp)'
+ @echo ' COMPILE.S = $(HOST_COMPILE.S)'
+ @echo ' LINK = $(HOST_LINK)'
+ @echo ' LINK_CXX = $(HOST_LINK_CXX)'
+ @echo 'TARGET_...'
+ @echo ' INCLUDES = $(TARGET_INCLUDES)'
+ @echo ' DEFS = $(TARGET_DEFS)'
+ @echo ' CPPFLAGS = $(TARGET_CPPFLAGS)'
+ @echo ' CFLAGS = $(TARGET_CFLAGS)'
+ @echo ' CXXFLAGS = $(TARGET_CXXFLAGS)'
+ @echo ' LDFLAGS = $(TARGET_LDFLAGS)'
+ @echo ' LDLIBS = $(TARGET_LDLIBS)'
+ @echo ' CC = $(TARGET_CC)'
+ @echo ' CXX = $(TARGET_CXX)'
+ @echo ' COMPILE.c = $(TARGET_COMPILE.c)'
+ @echo ' COMPILE.cpp = $(TARGET_COMPILE.cpp)'
+ @echo ' COMPILE.S = $(TARGET_COMPILE.S)'
+ @echo ' LINK = $(TARGET_LINK)'
+ @echo ' LINK_CXX = $(TARGET_LINK_CXX)'
diff --git a/cesar/common/make/setup.mk b/cesar/common/make/setup.mk
new file mode 100644
index 0000000000..d19dcbc3f3
--- /dev/null
+++ b/cesar/common/make/setup.mk
@@ -0,0 +1,67 @@
+# Setup build parameters.
+
+HOST_EXES := $(call prog2exe,$(HOST_PROGRAMS),host)
+TARGET_ELFS := $(call prog2exe,$(TARGET_PROGRAMS),target)
+
+ALL_PROGRAMS := $(HOST_PROGRAMS) $(TARGET_PROGRAMS)
+ALL_MODULES := $(sort $(foreach program,$(ALL_PROGRAMS),$($(program)_MODULES)))
+
+MODULES_CONFIG :=
+
+ifdef SOURCES
+$(error the SOURCES variable should not be defined)
+endif
+
+ifdef MODULES
+$(error the MODULES variable should not be defined)
+endif
+
+# For each used module, include its Module file. Well, this could be made
+# simpler by using more verbose Module files...
+define MODULE_template
+# Include module file.
+MODULE := $1
+include $$(BASE)/$1/Module
+MODULE :=
+# Use defined sources or overridden ones.
+SOURCES := $$(if $$($(call mod2var,$1)_MODULE_SOURCES),$$($(call mod2var,$1)_MODULE_SOURCES),$$(SOURCES))
+$(call mod2var,$1)_MODULE_SOURCES := $$(call src2src,$$(SOURCES),$1/src)
+SOURCES :=
+# Merge module configuration.
+MODULES_CONFIG += $$(wildcard $$(BASE)/$1/Config)
+# Add any dependent modules.
+$(call mod2var,$1)_MODULE_MODULES := $$(MODULES)
+MODULES :=
+$$(foreach module,$$(filter-out $$(ALL_MODULES),$$($(call mod2var,$1)_MODULE_MODULES)),$$(eval $$(call MODULE_template,$$(module))))
+ALL_MODULES := $$(sort $$(ALL_MODULES) $$($(call mod2var,$1)_MODULE_MODULES))
+endef
+$(foreach module,$(ALL_MODULES),$(eval $(call MODULE_template,$(module))))
+
+# Add any dependent modules. For the moment, does not support multiple level
+# of dependencies.
+define PROGRAM_MODULES_template
+$1_MODULES := $$(sort $$($1_MODULES) $$(foreach module,$$($1_MODULES),$$($$(call mod2var,$$(module))_MODULE_MODULES)))
+endef
+$(foreach program,$(ALL_PROGRAMS),$(eval $(call PROGRAM_MODULES_template,$(program),host)))
+
+# For each program.
+define PROGRAM_template
+$1_SOURCES := $$(call src2src,$$($1_SOURCES),src)
+$1_OBJECTS := $$(call src2obj,$$($1_SOURCES),$2)
+$1_MODULES_SOURCES := $$(foreach module,$$($1_MODULES),$$($$(call mod2var,$$(module))_MODULE_SOURCES))
+$1_MODULES_OBJECTS := $$(call src2obj,$$($1_MODULES_SOURCES),$2)
+endef
+$(foreach program,$(HOST_PROGRAMS),$(eval $(call PROGRAM_template,$(program),host)))
+$(foreach program,$(TARGET_PROGRAMS),$(eval $(call PROGRAM_template,$(program),target)))
+
+HOST_SOURCES := $(sort $(foreach program,$(HOST_PROGRAMS),$($(program)_SOURCES) $($(program)_MODULES_SOURCES)))
+TARGET_SOURCES := $(sort $(foreach program,$(TARGET_PROGRAMS),$($(program)_SOURCES) $($(program)_MODULES_SOURCES)))
+ALL_SOURCES := $(sort $(HOST_SOURCES) $(TARGET_SOURCES))
+
+vpath %.c $(BASE)
+vpath %.cpp $(BASE)
+vpath %.S $(BASE)
+
+OBJ_DIR_STAMP := $(OBJ_DIR)/dir.stamp
+OBJ_INC_DIR := $(OBJ_DIR)/inc
+OBJ_INC_DIR_STAMP := $(OBJ_INC_DIR)/dir.stamp
diff --git a/cesar/common/make/target.mk b/cesar/common/make/target.mk
new file mode 100644
index 0000000000..eec2a3d546
--- /dev/null
+++ b/cesar/common/make/target.mk
@@ -0,0 +1,23 @@
+# Define target specific options.
+
+ifeq ($(TARGET),)
+
+ # Target is synthetic or maximus.
+
+else
+ifeq ($(TARGET),sparc)
+
+ # Target is sparc.
+ CROSS_COMPILE := $(TARGET)-elf-
+
+else
+ifneq ($(TARGET_PROGRAMS),)
+ $(error unknown TARGET)
+endif
+endif
+endif
+
+# User defined compiler.
+ifneq ($(CROSS_COMPILE_$(TARGET)),)
+ CROSS_COMPILE := $(CROSS_COMPILE_$(TARGET))
+endif
diff --git a/cesar/common/make/test/Config-output b/cesar/common/make/test/Config-output
new file mode 100644
index 0000000000..312d3bef5e
--- /dev/null
+++ b/cesar/common/make/test/Config-output
@@ -0,0 +1,3 @@
+CONF merge
+CONF headers
+MAKE ecos.all
diff --git a/cesar/common/make/test/Config.alt-output b/cesar/common/make/test/Config.alt-output
new file mode 100644
index 0000000000..5bbb668b24
--- /dev/null
+++ b/cesar/common/make/test/Config.alt-output
@@ -0,0 +1,8 @@
+CONF merge
+CONF headers
+CC [host] ../../../../common/make/test/modules/b/src/b_shout.c
+LINK [host] obj/test_make
+LDXX [host] obj/test_cpp
+CC [target] ../../../../common/make/test/modules/b/src/b_shout.c
+MAKE ecos.all
+LINK [target] obj/test_make_ecos.elf
diff --git a/cesar/common/make/test/b_shout.h-output b/cesar/common/make/test/b_shout.h-output
new file mode 100644
index 0000000000..f07242314c
--- /dev/null
+++ b/cesar/common/make/test/b_shout.h-output
@@ -0,0 +1,6 @@
+CC [host] ../../../../common/make/test/modules/b/src/b_shout.c
+LINK [host] obj/test_make
+LDXX [host] obj/test_cpp
+CC [target] ../../../../common/make/test/modules/b/src/b_shout.c
+MAKE ecos.all
+LINK [target] obj/test_make_ecos.elf
diff --git a/cesar/common/make/test/clean-output b/cesar/common/make/test/clean-output
new file mode 100644
index 0000000000..638c799cc1
--- /dev/null
+++ b/cesar/common/make/test/clean-output
@@ -0,0 +1,12 @@
+rm -f obj/Config.empty obj/Config.merged
+rm -rf obj/inc/config.h obj/inc/config
+rm -f obj/test_make obj/test_cpp obj/test_make_ecos.elf \
+rm -rf obj/ecos/tree.stamp obj/ecos/build
+rm -rf obj/ecos/headers.stamp obj/ecos/install
+rm -f obj/ecos/ecos.ecc obj/ecos/ecos-cov.ecc new-ecos.ecc
+if [ -d obj/ecos ]; then rmdir obj/ecos; fi
+rm -f obj/inc/dir.stamp obj/dir.stamp \
+
+rm -rf
+if [ -d obj/inc ]; then rmdir obj/inc; fi
+if [ -d obj ]; then rmdir obj; fi
diff --git a/cesar/common/make/test/ecos.ecc.sh-output b/cesar/common/make/test/ecos.ecc.sh-output
new file mode 100644
index 0000000000..fe4145120f
--- /dev/null
+++ b/cesar/common/make/test/ecos.ecc.sh-output
@@ -0,0 +1,5 @@
+ECOS conf
+ECOS tree
+MAKE ecos.defs
+MAKE ecos.headers
+MAKE ecos.all
diff --git a/cesar/common/make/test/first-output b/cesar/common/make/test/first-output
new file mode 100644
index 0000000000..dede1a43ea
--- /dev/null
+++ b/cesar/common/make/test/first-output
@@ -0,0 +1,19 @@
+ECOS conf
+ECOS tree
+MAKE ecos.defs
+CONF merge
+CONF headers
+CC [host] src/test_make.c
+CC [host] ../../../../common/make/test/modules/a/src/a.c
+CC [host] ../../../../common/make/test/modules/b/src/b_print.c
+CC [host] ../../../../common/make/test/modules/b/src/b_shout.c
+LINK [host] obj/test_make
+CXX [host] src/test_cpp.cpp
+LDXX [host] obj/test_cpp
+MAKE ecos.headers
+CC [target] src/test_make.c
+CC [target] ../../../../common/make/test/modules/a/src/a.c
+CC [target] ../../../../common/make/test/modules/b/src/b_print.c
+CC [target] ../../../../common/make/test/modules/b/src/b_shout.c
+MAKE ecos.all
+LINK [target] obj/test_make_ecos.elf
diff --git a/cesar/common/make/test/modules/a/Module b/cesar/common/make/test/modules/a/Module
new file mode 100644
index 0000000000..247658ae25
--- /dev/null
+++ b/cesar/common/make/test/modules/a/Module
@@ -0,0 +1,2 @@
+SOURCES := a.c
+MODULES := common/make/test/modules/b
diff --git a/cesar/common/make/test/modules/a/a.h b/cesar/common/make/test/modules/a/a.h
new file mode 100644
index 0000000000..843e51522b
--- /dev/null
+++ b/cesar/common/make/test/modules/a/a.h
@@ -0,0 +1,23 @@
+#ifndef a_h
+#define a_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file a.h
+ * \brief Test module header for build system tests.
+ * \ingroup test
+ */
+
+BEGIN_DECLS
+
+void
+a_print (void);
+
+END_DECLS
+
+#endif /* a_h */
diff --git a/cesar/common/make/test/modules/a/src/a.c b/cesar/common/make/test/modules/a/src/a.c
new file mode 100644
index 0000000000..9fa32f6ae7
--- /dev/null
+++ b/cesar/common/make/test/modules/a/src/a.c
@@ -0,0 +1,25 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file a.c
+ * \brief Test module for build system tests.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "a.h"
+
+#include <stdio.h>
+
+/**
+ * Print module's deepest thought.
+ */
+void
+a_print (void)
+{
+ printf ("I am the a module!\n");
+}
diff --git a/cesar/common/make/test/modules/b/Config b/cesar/common/make/test/modules/b/Config
new file mode 100644
index 0000000000..860e294ba9
--- /dev/null
+++ b/cesar/common/make/test/modules/b/Config
@@ -0,0 +1,3 @@
+CONFIG_B_LISTEN_CAREFULLY = y
+CONFIG_B_SHOUT_TWICE = y
+CONFIG_B_REPEAT = 1
diff --git a/cesar/common/make/test/modules/b/Module b/cesar/common/make/test/modules/b/Module
new file mode 100644
index 0000000000..b52b97a009
--- /dev/null
+++ b/cesar/common/make/test/modules/b/Module
@@ -0,0 +1 @@
+SOURCES := b_print.c b_shout.c
diff --git a/cesar/common/make/test/modules/b/b.h b/cesar/common/make/test/modules/b/b.h
new file mode 100644
index 0000000000..4e0724428b
--- /dev/null
+++ b/cesar/common/make/test/modules/b/b.h
@@ -0,0 +1,26 @@
+#ifndef b_h
+#define b_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file b.h
+ * \brief Test module header for build system tests.
+ * \ingroup test
+ */
+
+BEGIN_DECLS
+
+void
+b_print (void);
+
+void
+b_shout (void);
+
+END_DECLS
+
+#endif /* b_h */
diff --git a/cesar/common/make/test/modules/b/inc/b_shout.h b/cesar/common/make/test/modules/b/inc/b_shout.h
new file mode 100644
index 0000000000..9e80de10e3
--- /dev/null
+++ b/cesar/common/make/test/modules/b/inc/b_shout.h
@@ -0,0 +1,18 @@
+#ifndef b_shout_h
+#define b_shout_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file b_shout.h
+ * \brief Test module private header for build system tests.
+ * \ingroup test
+ */
+
+#define B_SHOUT "I AM THE B MODULE!\n"
+
+#endif /* b_shout_h */
diff --git a/cesar/common/make/test/modules/b/src/b_print.c b/cesar/common/make/test/modules/b/src/b_print.c
new file mode 100644
index 0000000000..b3b5d2f2ea
--- /dev/null
+++ b/cesar/common/make/test/modules/b/src/b_print.c
@@ -0,0 +1,33 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file b_print.c
+ * \brief Test module for build system tests.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "b.h"
+
+#include "config/b/listen/carefully.h"
+#include "config/b/repeat.h"
+
+#include <stdio.h>
+
+/**
+ * Print module's deepest thought.
+ */
+void
+b_print (void)
+{
+#if CONFIG_B_LISTEN_CAREFULLY
+ printf ("please listen carefully (however, it is a stupid example):\n");
+#endif
+ uint i;
+ for (i = 0; i < CONFIG_B_REPEAT; i++)
+ printf ("I am the b module!\n");
+}
diff --git a/cesar/common/make/test/modules/b/src/b_shout.c b/cesar/common/make/test/modules/b/src/b_shout.c
new file mode 100644
index 0000000000..06472cf872
--- /dev/null
+++ b/cesar/common/make/test/modules/b/src/b_shout.c
@@ -0,0 +1,34 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file b_shout.c
+ * \brief Test module for build system tests.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "inc/b_shout.h"
+#include "b.h"
+
+#include "config/b.h"
+
+#include <stdio.h>
+
+/**
+ * Shout module's deepest thought.
+ */
+void
+b_shout (void)
+{
+#if CONFIG_B_LISTEN_CAREFULLY
+ printf ("please listen carefully (however, it is a stupid example):\n");
+#endif
+ printf (B_SHOUT);
+#if CONFIG_B_SHOUT_TWICE
+ printf (B_SHOUT);
+#endif
+}
diff --git a/cesar/common/make/test/nothing-output b/cesar/common/make/test/nothing-output
new file mode 100644
index 0000000000..ae63c9beb5
--- /dev/null
+++ b/cesar/common/make/test/nothing-output
@@ -0,0 +1 @@
+MAKE ecos.all
diff --git a/cesar/common/make/test/project/Config b/cesar/common/make/test/project/Config
new file mode 100644
index 0000000000..31dbc59855
--- /dev/null
+++ b/cesar/common/make/test/project/Config
@@ -0,0 +1,2 @@
+CONFIG_B_SHOUT_TWICE = n
+CONFIG_B_REPEAT = 3
diff --git a/cesar/common/make/test/project/Config.alt b/cesar/common/make/test/project/Config.alt
new file mode 100644
index 0000000000..b46399634a
--- /dev/null
+++ b/cesar/common/make/test/project/Config.alt
@@ -0,0 +1,2 @@
+CONFIG_B_SHOUT_TWICE = y
+CONFIG_B_REPEAT = 3
diff --git a/cesar/common/make/test/project/Makefile b/cesar/common/make/test/project/Makefile
new file mode 100644
index 0000000000..f247892fe9
--- /dev/null
+++ b/cesar/common/make/test/project/Makefile
@@ -0,0 +1,20 @@
+BASE = ../../../..
+
+ECOS = y
+TARGET = sparc
+
+# This is an extra include.
+INCLUDES = common/make/test
+
+HOST_PROGRAMS = test_make test_cpp
+test_make_SOURCES = test_make.c
+test_make_MODULES = lib common/make/test/modules/a
+
+test_cpp_SOURCES = test_cpp.cpp
+test_cpp_MODULES = lib common/make/test/modules/a common/make/test/modules/b
+
+TARGET_PROGRAMS = test_make_ecos
+test_make_ecos_SOURCES = test_make.c
+test_make_ecos_MODULES = lib common/make/test/modules/a
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/common/make/test/project/ecos.ecc.sh b/cesar/common/make/test/project/ecos.ecc.sh
new file mode 100644
index 0000000000..be98f3e872
--- /dev/null
+++ b/cesar/common/make/test/project/ecos.ecc.sh
@@ -0,0 +1,11 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new sparc_leon default
+cat >> $config <<EOF
+cdl_component CYGHWR_HAL_SPARC_FLAT {
+ user_value 1
+}
+cdl_component CYGPKG_HAL_SPARC_REGISTER_WINDOWS {
+ user_value 2
+}
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/common/make/test/project/inc/test_make.h b/cesar/common/make/test/project/inc/test_make.h
new file mode 100644
index 0000000000..acbf024439
--- /dev/null
+++ b/cesar/common/make/test/project/inc/test_make.h
@@ -0,0 +1,18 @@
+#ifndef test_make_h
+#define test_make_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_make.h
+ * \brief Test program header for build system tests.
+ * \ingroup test
+ */
+
+#define TEST_MAKE_EXIT 0
+
+#endif /* test_make_h */
diff --git a/cesar/common/make/test/project/src/test_cpp.cpp b/cesar/common/make/test/project/src/test_cpp.cpp
new file mode 100644
index 0000000000..a514ab66e0
--- /dev/null
+++ b/cesar/common/make/test/project/src/test_cpp.cpp
@@ -0,0 +1,27 @@
+// Cesar project {{{
+//
+// Copyright (C) 2007 Spidcom
+//
+// <<<Licence>>>
+//
+// }}}
+/// \file test_cpp.cpp
+/// \brief Test c++ program for build system tests.
+/// \ingroup test
+#include "common/std.h"
+#include "inc/test_make.h"
+
+#include "modules/a/a.h"
+#include "modules/b/b.h"
+
+#include <iostream>
+
+int
+main (void)
+{
+ std::cout << "I am a c++ program" << std::endl;
+ a_print ();
+ b_print ();
+ b_shout ();
+ return TEST_MAKE_EXIT;
+}
diff --git a/cesar/common/make/test/project/src/test_make.c b/cesar/common/make/test/project/src/test_make.c
new file mode 100644
index 0000000000..faf947c5b2
--- /dev/null
+++ b/cesar/common/make/test/project/src/test_make.c
@@ -0,0 +1,26 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_make.c
+ * \brief Test program for build system tests.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "inc/test_make.h"
+
+#include "modules/a/a.h"
+#include "modules/b/b.h"
+
+int
+main (void)
+{
+ a_print ();
+ b_print ();
+ b_shout ();
+ return TEST_MAKE_EXIT;
+}
diff --git a/cesar/common/make/test/project_synth/Config b/cesar/common/make/test/project_synth/Config
new file mode 100644
index 0000000000..0fde81207e
--- /dev/null
+++ b/cesar/common/make/test/project_synth/Config
@@ -0,0 +1 @@
+CONFIG_B_SHOUT_TWICE = n
diff --git a/cesar/common/make/test/project_synth/Makefile b/cesar/common/make/test/project_synth/Makefile
new file mode 100644
index 0000000000..cdc62ac448
--- /dev/null
+++ b/cesar/common/make/test/project_synth/Makefile
@@ -0,0 +1,12 @@
+BASE = ../../../..
+
+ECOS = y
+
+# This is an extra include.
+INCLUDES = common/make/test
+
+TARGET_PROGRAMS = test_ecos_synth
+test_ecos_synth_SOURCES = test_make.c
+test_ecos_synth_MODULES = lib common/make/test/modules/a
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/common/make/test/project_synth/ecos.ecc.sh b/cesar/common/make/test/project_synth/ecos.ecc.sh
new file mode 100644
index 0000000000..8253d98c9a
--- /dev/null
+++ b/cesar/common/make/test/project_synth/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new linux default
+cat >> $config <<EOF
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/common/make/test/project_synth/inc/test_make.h b/cesar/common/make/test/project_synth/inc/test_make.h
new file mode 100644
index 0000000000..acbf024439
--- /dev/null
+++ b/cesar/common/make/test/project_synth/inc/test_make.h
@@ -0,0 +1,18 @@
+#ifndef test_make_h
+#define test_make_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_make.h
+ * \brief Test program header for build system tests.
+ * \ingroup test
+ */
+
+#define TEST_MAKE_EXIT 0
+
+#endif /* test_make_h */
diff --git a/cesar/common/make/test/project_synth/src/test_make.c b/cesar/common/make/test/project_synth/src/test_make.c
new file mode 100644
index 0000000000..faf947c5b2
--- /dev/null
+++ b/cesar/common/make/test/project_synth/src/test_make.c
@@ -0,0 +1,26 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_make.c
+ * \brief Test program for build system tests.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "inc/test_make.h"
+
+#include "modules/a/a.h"
+#include "modules/b/b.h"
+
+int
+main (void)
+{
+ a_print ();
+ b_print ();
+ b_shout ();
+ return TEST_MAKE_EXIT;
+}
diff --git a/cesar/common/make/test/test_make.c-output b/cesar/common/make/test/test_make.c-output
new file mode 100644
index 0000000000..e3b5060376
--- /dev/null
+++ b/cesar/common/make/test/test_make.c-output
@@ -0,0 +1,5 @@
+CC [host] src/test_make.c
+LINK [host] obj/test_make
+CC [target] src/test_make.c
+MAKE ecos.all
+LINK [target] obj/test_make_ecos.elf
diff --git a/cesar/common/make/test/test_make.h-output b/cesar/common/make/test/test_make.h-output
new file mode 100644
index 0000000000..ef51e5aa92
--- /dev/null
+++ b/cesar/common/make/test/test_make.h-output
@@ -0,0 +1,7 @@
+CC [host] src/test_make.c
+LINK [host] obj/test_make
+CXX [host] src/test_cpp.cpp
+LDXX [host] obj/test_cpp
+CC [target] src/test_make.c
+MAKE ecos.all
+LINK [target] obj/test_make_ecos.elf
diff --git a/cesar/common/make/test/test_make.sh b/cesar/common/make/test/test_make.sh
new file mode 100755
index 0000000000..330943f6d2
--- /dev/null
+++ b/cesar/common/make/test/test_make.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+tmp=make.log
+
+function failure () {
+ echo FAIL >&2
+ exit 1
+}
+
+trap failure ERR
+
+function runmake () {
+ t=$1
+ shift
+ echo "$t: make $*"
+ sleep 1
+ make -C project "$@" &> "$tmp"
+ sleep 1
+}
+function grepcap () {
+ grep '^[[:upper:]]\{2,\} ' | grep -v '\.\./lib/'
+}
+
+if [[ "$1" = quick ]]
+then
+ make -C project &> /dev/null
+else
+ make -C project clean &> /dev/null
+
+ runmake first
+ grepcap < "$tmp" | diff - first-output
+fi
+
+touch project/inc/test_make.h
+runmake test_make.h
+grepcap < "$tmp" | diff - test_make.h-output
+
+touch project/ecos.ecc.sh
+runmake ecos.ecc.sh
+grepcap < "$tmp" | diff - ecos.ecc.sh-output
+
+touch project/src/test_make.c
+runmake test_make.c
+grepcap < "$tmp" | diff - test_make.c-output
+
+runmake nothing
+grepcap < "$tmp" | diff - nothing-output
+
+touch modules/b/inc/b_shout.h
+runmake b_shout.h
+grepcap < "$tmp" | diff - b_shout.h-output
+
+touch project/Config
+runmake Config
+grepcap < "$tmp" | diff - Config-output
+
+touch project/Config.alt
+runmake Config.alt PROJECT_CONFIG=Config.alt
+grepcap < "$tmp" | diff - Config.alt-output
+
+runmake clean clean
+grep -v 'make:' < "$tmp" | grep -v ' obj/' | diff - clean-output
+
+rm -f "$tmp"
+echo PASS
diff --git a/cesar/common/make/top.mk b/cesar/common/make/top.mk
new file mode 100644
index 0000000000..21c3260008
--- /dev/null
+++ b/cesar/common/make/top.mk
@@ -0,0 +1,22 @@
+# Compilation system top file.
+
+MAKE_DIR := $(BASE)/common/make
+TOOLS_DIR := $(BASE)/common/tools
+OBJ_DIR ?= obj$(if $(VARIANT),/$(VARIANT))
+MERGED_CONFIG := $(OBJ_DIR)/Config.merged
+
+.PHONY: all
+
+all: build.all
+
+-include $(MERGED_CONFIG)
+
+include $(MAKE_DIR)/func.mk
+include $(MAKE_DIR)/setup.mk
+include $(MAKE_DIR)/config.mk
+include $(MAKE_DIR)/default.mk
+include $(MAKE_DIR)/target.mk
+include $(MAKE_DIR)/ecos.mk
+include $(MAKE_DIR)/build.mk
+include $(MAKE_DIR)/misc.mk
+include $(MAKE_DIR)/print.mk
diff --git a/cesar/common/std.h b/cesar/common/std.h
new file mode 100644
index 0000000000..d4387ead82
--- /dev/null
+++ b/cesar/common/std.h
@@ -0,0 +1,33 @@
+#ifndef common_std_h
+#define common_std_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file common/std.h
+ * \brief Standard header.
+ * \ingroup common
+ *
+ * Standard header to be included on top of each source file.
+ */
+
+#ifdef __cplusplus
+# define BEGIN_DECLS extern "C" {
+# define END_DECLS }
+#else
+# define BEGIN_DECLS
+# define END_DECLS
+#endif
+
+#include "lib/types.h"
+#include "lib/defs.h"
+#include "lib/utils.h"
+#include "lib/dbg.h"
+
+#else
+# error "common/std.h should be included only once in non header files."
+#endif /* common_std_h */
diff --git a/cesar/common/tests/Makefile b/cesar/common/tests/Makefile
new file mode 100644
index 0000000000..2295421607
--- /dev/null
+++ b/cesar/common/tests/Makefile
@@ -0,0 +1,31 @@
+BASE = ../..
+RUN_TEST = run-test.pl
+GET_COV = get-cov.pl
+COVERAGE_OUTPUT = coverage
+COVERAGE_TITLE = Cesar
+
+all: tests.all.brief tests.all.result
+
+.PHONY: tests.all
+
+tests.all: tests $(RUN_TEST)
+ -perl $(RUN_TEST) $(BASE) < $< > $@ 2>&1
+
+clean: tests.clean
+ rm -f tests.all.brief tests.all tests.clean
+
+.PHONY: tests.clean
+
+tests.clean: tests $(RUN_TEST)
+ perl $(RUN_TEST) -I clean $(BASE) < $< > $@ 2>&1
+
+%.brief: %
+ grep '^==' < $< > $@
+
+%.result: %.brief
+ grep '^===' < $<
+
+.PHONY: cov
+
+cov: tests $(GET_COV)
+ genhtml -q -t $(COVERAGE_TITLE) -o $(COVERAGE_OUTPUT) -s $$(perl $(GET_COV) $(BASE) < $<)
diff --git a/cesar/common/tests/get-cov.pl b/cesar/common/tests/get-cov.pl
new file mode 100755
index 0000000000..25164caa15
--- /dev/null
+++ b/cesar/common/tests/get-cov.pl
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+#
+# Get the list of coverage trace files.
+#
+use strict;
+use warnings;
+
+my $base = shift @ARGV;
+my $dir;
+my $fail = 0;
+
+# Read tests file.
+while (<STDIN>)
+{
+ chomp;
+ # Drop comments.
+ next if /^\s*(?:#.*)?$/;
+ if (/^(.*):(:)?$/)
+ {
+ # Directory line.
+ $dir = $1;
+ -d "$base/$dir"
+ or die "cannot change directory";
+ }
+ elsif (/^cov.*? (.*?): .*$/)
+ {
+ # Coverage test line.
+ my $f = "$base/$dir/obj/$1.info";
+ -f $f
+ and print "$f\n";
+ }
+}
diff --git a/cesar/common/tests/run-test.pl b/cesar/common/tests/run-test.pl
new file mode 100755
index 0000000000..aff9799327
--- /dev/null
+++ b/cesar/common/tests/run-test.pl
@@ -0,0 +1,235 @@
+#!/usr/bin/perl
+#
+# Run all defined tests.
+#
+use strict;
+use warnings;
+use Cwd;
+use Getopt::Long qw(:config no_ignore_case bundling);
+use Pod::Usage;
+
+# Option parsing.
+my $help;
+my $timeout = 5 * 60;
+my @include;
+my @exclude;
+my @include_dir;
+GetOptions (
+ 'help|h' => \$help,
+ 'timeout|t' => \$timeout,
+ 'include|I=s' => \@include,
+ 'exclude|X=s' => \@exclude,
+ 'directory|d=s' => \@include_dir,
+) or pod2usage (2);
+pod2usage (1) if $help;
+
+@ARGV == 1 or pod2usage (2);
+
+my $base = getcwd . '/' . shift @ARGV;
+
+my %include;
+@include{@include} = ();
+my %exclude;
+@exclude{@exclude} = ();
+
+# Initialise signal number to name table.
+use Config;
+my @signame;
+my %signum;;
+my $i = 0;
+defined $Config{sig_name} || die "No sigs?";
+foreach (split (' ', $Config{sig_name}))
+{
+ $signame[$i] = $_;
+ $signum{$_} = $i;
+ $i++;
+}
+
+# Test macros.
+my %macros = (
+ 'cov' => \&cov_macro,
+ 'cov-target' => \&cov_target_macro,
+);
+my $lcov;
+
+# Read tests file.
+my $dir;
+my $fail = 0;
+while (<STDIN>)
+{
+ chomp;
+ # Drop comments.
+ next if /^\s*(?:#.*)?$/;
+ # This table will enable an unget system to fake input lines.
+ my @ungeted;
+ push @ungeted, $_;
+ while (@ungeted)
+ {
+ $_ = shift @ungeted;
+ if (/^(.*):(:)?$/)
+ {
+ # Directory line.
+ $dir = $1;
+ chdir "$base/$dir"
+ or die "cannot change directory";
+ # Push automatic clean test.
+ push @ungeted, '-clean: make -s clean' unless $2;
+ }
+ else
+ {
+ # Test line.
+ defined $dir
+ or die "bad format";
+ # Read '-' and '!' flags.
+ my ($dontcare, $expected) = (0, '');
+ $dontcare = 1 if s/^-//;
+ $expected = ' (expected)' if s/^!//;
+ # Decode name and command.
+ my ($name, $cmd);
+ /^(.*?): (.*)$/
+ and ($name, $cmd) = ($1, $2)
+ or ($name, $cmd) = ($_, $_);
+ # Decode macros.
+ $name =~ /^(.*?) (.*)$/ && exists $macros{$1}
+ and ($name, $cmd) = $macros{$1} ($1, $2, $cmd);
+ # Skip test?
+ next if @include_dir && !grep { $dir =~ /^$_/ } @include_dir;
+ next if %include && !exists $include{$name};
+ next if exists $exclude{$name};
+ # Start test.
+ my $t = "=> $dir - $name";
+ print "\n$t\n";
+ my $status = timed_system ($cmd);
+ # Check result.
+ if ($dontcare)
+ {
+ print "=$t: DONE\n";
+ }
+ else
+ {
+ if ($status != 0)
+ {
+ $fail++ unless $expected;
+ if ($status == -1 || $status == 128 << 8) {
+ print "=$t: FAIL$expected command not found\n";
+ } elsif ($status & 127) {
+ printf "=$t: FAIL$expected killed with signal %s\n",
+ $signame[$status & 127];
+ die "interrupted" if ($signame[$status & 127] eq 'INT');
+ } else {
+ printf "=$t: FAIL$expected exited with value %d\n",
+ ($status >> 8);
+ }
+ }
+ else
+ {
+ print "=$t: PASS\n";
+ }
+ }
+ }
+ }
+}
+# Print summary.
+if ($fail)
+{
+ print "\n===> FAIL $fail unexpected tests\n";
+ exit 1;
+}
+else
+{
+ print "\n===> PASS all tests\n";
+ exit 0;
+}
+
+sub cov_macro
+{
+ my ($name, $arg, $cmd, $objdir, $gcov) = @_;
+ if (not defined $lcov)
+ {
+ system ('lcov --version > /dev/null');
+ $lcov = $? == 0 ? 1 : 0;
+ }
+ if ($lcov)
+ {
+ $objdir = 'obj' unless defined $objdir;
+ $gcov = '' unless defined $gcov;
+ return ($name,
+ "rm -f obj/$arg.info && "
+ . "lcov -q -d $objdir -b . -z $gcov && "
+ . "$cmd && "
+ . "lcov -q -d $objdir -b . -c -t $arg -o obj/$arg.info $gcov");
+ }
+ else
+ {
+ return ('run', $cmd);
+ }
+}
+
+sub cov_target_macro
+{
+ my ($name, $arg, $cmd) = @_;
+ if (exists $ENV{CROSS_COMPILE_})
+ {
+ return cov_macro ($name, $arg, $cmd, '.', " -g $ENV{CROSS_COMPILE_}gcov");
+ }
+ else
+ {
+ return ('run', $cmd);
+ }
+}
+
+sub timed_system
+{
+ my $cmd = shift;
+ my $pid = fork;
+ defined $pid or die "fork: $!,";
+ if ($pid == 0)
+ {
+ # Son.
+ exec $cmd;
+ exit 128;
+ }
+ else
+ {
+ # Father.
+ eval {
+ local $SIG{ALRM} = sub { die "alarm\n" };
+ alarm $timeout;
+ do { $_ = wait } until $_ == $pid;
+ alarm 0;
+ };
+ if ($@)
+ {
+ die unless $@ eq "alarm\n";
+ kill INT => $pid;
+ sleep 3;
+ kill KILL => $pid;
+ print "Timed out!\n";
+ return $signum{ALRM};
+ }
+ else
+ {
+ return $?;
+ }
+ }
+}
+
+__END__
+
+=head1 NAME
+
+run-test.pl - Read a tests file and run all configured tests
+
+=head1 SYNOPSIS
+
+run-test.pl [options] base
+
+ Options:
+ -h, --help brief help message
+ -I, --include=NAME only include named tests, can be issued multiple times
+ -X, --exclude=NAME do not include named tests
+ -d, --directory=DIR only include tests below given directories
+ -t, --timeout=SEC timeout for each test (seconds)
+
+=cut
+
diff --git a/cesar/common/tests/tests b/cesar/common/tests/tests
new file mode 100644
index 0000000000..9090dd3f69
--- /dev/null
+++ b/cesar/common/tests/tests
@@ -0,0 +1,291 @@
+# tests file.
+#
+# Define tests using the following format:
+#
+# path/to/test/directory:[:]
+# [!|-][test name: ]command
+# [!|-][test name: ]command...
+#
+# The commands are run in the given directory. If the second colon is not
+# present, first command is 'make -s clean'. Commands starting with a bang
+# (!) are expected to fail. Result of commands starting with a dash (-) are
+# ignored.
+#
+# If test name is 'cov <test_name>', lcov is run on this test if found,
+# producing a file obj/<test_name>.info.
+
+#common/make/test::
+#run: ./test_make.sh
+
+hal/arch/test/atomic:
+make: make COV=y
+cov test_atomic: ./obj/test_atomic
+
+hal/phy/test/phy:
+make
+run: ./obj/maximus/host_test_phy -e obj/maximus/test_phy.elf -d false -t 2500000000
+
+hal/phy/maximus/test:
+make: make COV=y
+cov test_phy_maximus: ./obj/test_phy_maximus
+
+hal/phy/maximus/dur/test:
+make: make COV=y
+cov test_dur: ./obj/test_dur
+
+hal/hle/maximus/test:
+make: make COV=y
+cov test_maximus_hle: ./obj/test_maximus_hle
+
+hal/leon/maximus/test:
+make: make COV=y
+cov test_maximus_timer: ./obj/test_maximus_timer
+
+lib/test/blk:
+make: make COV=y
+cov test_blk: ./obj/test_blk
+
+lib/test/crc:
+make: make COV=y
+cov test_crc: ./obj/test_crc
+
+lib/test/heap:
+make: make COV=y
+cov test_heap: ./obj/test_heap
+
+lib/test/list:
+make: make COV=y
+cov test_list: ./obj/test_list
+
+lib/test/restrack:
+make: make COV=y
+cov test_restrack: ./obj/test_restrack
+
+lib/test/rnd:
+make: make COV=y
+cov test_rnd: ./obj/test_rnd
+
+lib/test/set:
+make: make COV=y
+cov test_set: ./obj/test_set
+
+lib/test/test:
+make
+!run: ./obj/test_test
+
+lib/test/trace:
+make: make COV=y
+cov test_trace: ./obj/test_trace
+
+lib/test/try:
+make: make COV=y
+cov test_try: ./obj/test_try
+
+lib/test/read_word:
+make: make COV=y
+cov test_read_word: ./obj/test_read_word
+
+lib/test/circular_buffer:
+make: make COV=y
+cov test_circular_buffer: ./obj/test_circular_list
+
+maximus/stationtest:
+make
+
+maximus/python:
+make: make COV=y
+python test/test_channel.py -e ../stationtest/obj/test_station.elf -d false -t 2500000000
+python test/test_cli.py
+python test/test_ethernet.py -e ../stationtest/obj/test_ether.elf -d false -t 2500000000
+python test/test_fsm.py
+python test/test_interface.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+python test/test_lib_cesar.py -e ../stationtest/obj/test_lib_cesar.elf -d false -t 2500000000
+python test/test_lib_proto.py
+python test/test_macframe.py -e ../stationtest/obj/test_send.elf -d false -t 2500000000
+python test/test_mme.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+python test/test_result.py
+python test/test_simu.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+python test/test_station.py -e ../stationtest/obj/test_station.elf -d false -t 2500000000
+python test/test_utils.py
+python py/script_example.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+python py/test_cb.py -e ../stationtest/obj/test_cb.elf -d false -t 2500000000
+python py/test_send_mpdu.py -e ../stationtest/obj/test_send.elf -d false -t 2500000000
+python py/test_send_noise.py -e ../stationtest/obj/test_send.elf -d false -t 2500000000
+python py/test_tx_rx.py -e ../stationtest/obj/test_tx_rx.elf -d false -t 2500000000
+python py/test_ether.py -e ../stationtest/obj/test_ether.elf -d false -t 2500000000
+python py/test_false_alarm.py -e ../stationtest/obj/test_false_alarm.elf -d false -t 2500000000
+
+mac/ca/test/ca:
+make: make COV=y
+cov test_ca: ./obj/test_ca
+
+mac/common/test/pb:
+make
+run: ./obj/test_pb
+
+mac/common/test/store:
+make: make COV=y
+cov test_store: ./obj/test_store
+
+mac/common/test/tonemap:
+make: make COV=y
+cov test_tonemap: ./obj/test_tonemap
+
+mac/design/test/mfs_tx:
+make
+
+mac/design/test/mfs_tx2:
+make
+
+mac/design/test/sacki:
+make
+run: ./obj/test_sacki
+
+mac/pbproc/test/fc:
+make: make COV=y
+cov test_fc: ./obj/test_fc
+
+mac/pbproc/test/fsm:
+make: make COV=y
+cov test_fsm: ./obj/test_fsm
+
+mac/pbproc/test/mfs:
+make: make COV=y
+cov test_mfs: ./obj/test_mfs
+
+mac/pbproc/test/pbproc:
+make: make COV=y
+cov test_pbproc: ./obj/test_pbproc
+
+mac/pbproc/test/maximus:
+make
+run: python py/host_test_pbproc.py -d false -t 2500000000
+run: python py/test_coll.py -d false -t 2500000000
+
+mac/pbproc/test/sacki:
+make: make COV=y
+cov test_sacki: ./obj/test_sacki
+
+mac/sar/test/unit_test/ecos:
+make: make COV=y
+cov-target lib_sar_expiration: ./obj/lib_sar_expiration.elf
+cov-target lib_sar_mfs: ./obj/lib_sar_mfs.elf
+cov-target reassembly_complete: ./obj/reassembly_complete.elf
+cov-target reassembly_create_mfs: ./obj/reassembly_create_mfs.elf
+cov-target reassembly_measurement: ./obj/reassembly_measurement.elf
+cov-target reassembly_mfs_update_expiration_date: ./obj/reassembly_mfs_update_expiration_date.elf
+cov-target sar_call_back_ul: ./obj/sar_call_back_ul.elf
+cov-target sar_mf_function_test: ./obj/sar_mf_function_test.elf
+cov-target sar_mfs_resising: ./obj/sar_mfs_resising.elf
+cov-target segmentation_complete: ./obj/segmentation_complete.elf
+cov-target test_store_memory: ./obj/test_store_memory.elf
+
+mac/sar/test/unit_test/host:
+make: make COV=y
+cov bridgedma_list: ./obj/bridgedma_list
+cov lib_sar_mf: ./obj/lib_sar_mf
+cov test_store_memory: ./obj/test_store_memory
+
+cl/test:
+make: make COV=y
+cov cl_mactotei_api: ./obj/cl_mactotei_api
+cov cl_mactotei_heapsort: ./obj/cl_mactotei_heapsort
+cov cl_mactotei_find: ./obj/cl_mactotei_find
+cov cl_recv_data: ./obj/cl_recv_data
+cov cl_send_data: ./obj/cl_send_data
+cov cl_mme_send_as_mme: ./obj/cl_mme_send_as_mme
+cov cl_mme_send_as_data: ./obj/cl_mme_send_as_data
+cov cl_mme_recv: ./obj/cl_mme_recv
+
+ce/test/rx/general:
+make COV=y
+cov ce_test_cei: ./obj/host/test_cei_host_linux_i386
+cov ce_test_cei_param: ./obj/host/test_cei_param_host_linux_i386
+cov ce_test_mpdu_measure_store: ./obj/host/test_measure_store_host_linux_i386
+cov ce_test_bitloading: ./obj/host/test_bitloading_host_linux_i386
+cov-target ce_test_sar_integration: ./obj/target/test_sar_target_ecos_synth.elf
+cov-target ce_test_rx: ./obj/target/test_rx_target_ecos_synth.elf
+
+ce/test/rx/tonemap_refresh:
+make COV=y
+cov-target ce_test_tonemaps_refresh: ./obj/test_tonemaps_refresh_target_ecos_synth.elf
+
+ce/test/tx:
+make COV=y
+cov ce_test_tx: ./obj/host/test_tx
+cov-target ce_test_tonemaps_expiration: ./obj/target/test_expiration_target_ecos_synth.elf
+
+cp/test:
+make: make COV=y
+cov-target test_cp: ./obj/UnitTestCP.elf
+
+cp/beacon/test/central_beacon:
+make: make
+ac_line: ./obj/ac_line.elf
+estimation: ./obj/estimation.elf
+central_beacon: ./obj/central_beacon.elf
+usta: ./obj/usta.elf
+bentries: ./obj/bentry_test.elf
+cco_request_discover_beacon: ./obj/cco_request_discover.elf
+
+cp/beacon/test/cco:
+make: make
+ucco: ./obj/ucco.elf
+cco: ./obj/cco.elf
+
+ce/test/rx/maximus:
+make COV=y
+cov-target ce_test_rx_maximus: python send_noise.py -e ./obj/test_rx.elf -d false -t 2500000000
+
+maximus/unittest:
+make: make COV=y
+obj/unittest -e ../stationtest/obj/stationtest.elf
+
+maximus/usertest:
+make: make COV=y
+obj/usertest -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+
+mac/sar/test/maximus_test:
+make
+obj/Maximus_sar -e obj/Sta_sar.elf -d false -t 25000000000
+
+test_general/integration/cl-sar-pbproc:
+make
+python src/Maximus.py -e obj/cl-sar-pbproc.elf -d false -t 2500000000
+
+test_general/integration/sar-pbproc:
+make
+python src/Maximus.py -e obj/sar-pbproc.elf -d false -t 2500000000
+
+test_general/integration/hle-cl-sar-pbproc:
+make
+python src/Maximus.py -e obj/hle-cl-sar-pbproc.elf -d false -t 2500000000
+
+test_general/integration/ipmbox-hle-cl-sar-pbproc:
+make
+python src/Maximus.py -e obj/ipmbox-hle-cl-sar-pbproc.elf -d false -t 2500000000
+python src/Maximus_mme.py -e obj/ipmbox-hle-cl-sar-pbproc.elf -d false -t 2500000000
+
+test_general/integration/station-cp-dp:
+make
+src:
+python Maximus.py -d false -t 500000000
+
+interface/sniffer/test:
+make: make COV=y
+sniffer: ./obj/test-sniffer
+
+interface/test:
+make: make COV=y
+interface: ./obj/test-interface.elf
+
+hle/test/:
+make: make COV=y
+hle_recv_from_arm: ./obj/hle_recv_from_arm
+hle_add_buffer: ./obj/hle_add_buffer
+hle_send_to_arm: ./obj/hle_send_to_arm
+interface_send: ./obj/interface_send
+
+host/test:
+make: make COV=y
+./obj/test_host
diff --git a/cesar/common/tools/check-filename b/cesar/common/tools/check-filename
new file mode 100755
index 0000000000..379bdac2fb
--- /dev/null
+++ b/cesar/common/tools/check-filename
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+#
+# Check that header guard defines and doxygen \file command are set
+# appropriately.
+#
+use strict;
+use warnings;
+use File::Find;
+
+-f 'common/tools/check-filename'
+ or die "should be run from base root\n";
+
+if ($ENV{'VIM'})
+{
+ print "nmap <buffer> <space> yy<cr>pkdd^df\"f\"D\n";
+ print "nmap <C-N> :copen<cr>j<space>\n";
+}
+
+sub check_file
+{
+ my $file = shift;
+ $file =~ s#^\./##;
+ my $cc = $file =~ /\.[ch]\{2\}$/;
+ my $filep;
+ ($filep = $file) =~ s#[/.]#_#g;
+ print "check $file\n";
+ open FILE, "<$file";
+ while (<FILE>)
+ {
+ chomp;
+ /^#(ifndef|define) (.*_h)$/ && $2 ne $filep
+ and print "$file:$.: should be \"#$1 $filep\"\n";
+ /^#(endif \/\*) (.*_h)( \*\/)$/ && $2 ne $filep
+ and print "$file:$.: should be \"#$1 $filep$3\"\n";
+ m#^((?:///| \*) \\file) +(.*)$# && $2 ne $file
+ and print "$file:$.: should be \"$1 $file\"\n";
+ }
+ close FILE;
+}
+
+my %exclude;
+@exclude{'ecos', 'obj', '.svn', 'html', 'test'} = ();
+
+@ARGV = ('.') if !@ARGV;
+
+for (@ARGV)
+{
+ if (-d $_)
+ {
+ find ({ no_chdir => 1, wanted => sub {
+ my $f = $_;
+ $f =~ s#.*/##;
+ exists $exclude{$f}
+ and $File::Find::prune = 1
+ or /\.[ch]+$/ and check_file $_;
+ } }, $_);
+ }
+ elsif (-f $_)
+ {
+ check_file ($_);
+ }
+ else
+ {
+ die "$_: not a directory, nor a file, what should I do?\n";
+ }
+}
diff --git a/cesar/common/tools/compact-ecos-config b/cesar/common/tools/compact-ecos-config
new file mode 100755
index 0000000000..71e78c3ce0
--- /dev/null
+++ b/cesar/common/tools/compact-ecos-config
@@ -0,0 +1,122 @@
+#!/usr/bin/perl
+#
+# Read an ecos configuration and generate a minimal script to regenerate this
+# configuration.
+#
+use strict;
+use warnings;
+
+my $string_re = qr/ " (?: [^\\] | \\. )* " /sx;
+# Limitation: braces can nest only once.
+my $brace_re = qr/ (?: [^{}] | { [^{}]* } )* /sx;
+my $cmd_re = qr( [-<>./\w]+ )x;
+my $arg_re = qr/ $cmd_re | $string_re | { $brace_re } /x;
+my $option_cmd_re = qr/(?:value_source|(?:user|wizard|inferred)_value)/;
+
+sub read_config_check
+{
+ my ($file, $target, $tmpl) = @_;
+ # Open ecosconfig output.
+ open CONFIG, "ecosconfig --config='$file' check|"
+ or die "can not read ecosconfig output\n";
+ # Decode target and template.
+ $_ = <CONFIG>; chomp;
+ /^Target: (\w+)$/ or die "target expected\n";
+ $$target = $1;
+ $_ = <CONFIG>; chomp;
+ /^Template: (\w+)$/ or die "template expected\n";
+ $$tmpl = $1;
+ print "ecosconfig --config=\$config new $$target $$tmpl\n";
+ # Decode added and removed.
+ $_ = <CONFIG>; chomp;
+ for my $i (['Added', 'add'], ['Removed', 'remove'])
+ {
+ my ($re, $cmd) = @$i;
+ if (/^$re:$/)
+ {
+ while ($_ = <CONFIG>, chomp, /^ (\w+)/)
+ {
+ print "ecosconfig --config=\$config $cmd $1\n";
+ }
+ }
+ }
+ /^No conflicts$/ or die "no conflicts expected\n";
+ # Close.
+ close CONFIG;
+}
+
+sub read_config_file
+{
+ my ($file, $target, $tmpl) = @_;
+ # Open file.
+ open CONFIG, "<$file" or die "can not open \"$file\"\n";
+ # Slurp config text.
+ local $/;
+ local $_ = <CONFIG>;
+ close CONFIG;
+ tr/\t/ /;
+ # Decode.
+ while ($_)
+ {
+ s/^ *(?:#.*)?\n// and next;
+ s/^cdl_savefile_version 1;\n// and next;
+ s/^cdl_savefile_command $cmd_re {$brace_re};\n// and next;
+ s/^cdl_configuration eCos {($brace_re)};\n//
+ and do { decode_conf ($1, $target, $tmpl); next; };
+ s/^(cdl_(?:package|component|option|interface) \w+) {($brace_re)};\n//
+ and do { decode_option ($1, $2); next; };
+ die "unmatched text: \"" . (/(.{200})/s, $1) . "...\".\n";
+ }
+}
+
+sub decode_conf
+{
+ local $_ = shift;
+ my ($target, $tmpl) = @_;
+ while ($_)
+ {
+ s/^ *(?:#.*)?\n// and next;
+ s/^ *description +$arg_re *;\n// and next;
+ s/^ *hardware +($arg_re) *;\n// and do {
+ $target eq $1 or die "target mismatch\n";
+ next;
+ };
+ s/^ *template +($arg_re) *;\n// and do {
+ $tmpl eq $1 or die "target mismatch\n";
+ next;
+ };
+ s/^ *package +-(?:hardware|template) +$arg_re +$arg_re +;// and next;
+ s/^ *package +($arg_re) +$arg_re +;// and next;
+ die "unmatched text in conf: \"" . (/(.{200})/s, $1) . "...\".\n";
+ }
+}
+
+sub decode_option
+{
+ my $option = shift;
+ local $_ = shift;
+ my $open = 0;
+ while ($_)
+ {
+ s/^ *(?:#.*)?\n// and next;
+ s/^( *$option_cmd_re(?: +$arg_re){1,2}\n)// and do {
+ print $option, " {\n" unless $open;
+ $open = 1;
+ print $1;
+ } and next;
+ die "unmatched text in conf: \"" . (/(.{200})/s, $1) . "...\".\n";
+ }
+ print "}\n" if $open;
+}
+
+$#ARGV == 0 or die "syntax: $0 FILE\n";
+my $config_file = $ARGV[0];
+
+my ($target, $tmpl);
+
+print "config=\${1:-ecos-gen.ecc}\n";
+read_config_check ($config_file, \$target, \$tmpl);
+print "cat >> \$config <<'EOF'\n";
+read_config_file ($config_file, $target, $tmpl);
+print "EOF\n";
+print "ecosconfig --config=\$config check\n";
diff --git a/cesar/common/tools/config-headers b/cesar/common/tools/config-headers
new file mode 100755
index 0000000000..a091e5dd27
--- /dev/null
+++ b/cesar/common/tools/config-headers
@@ -0,0 +1,100 @@
+#!/usr/bin/perl
+#
+# Read a merged configuration from stdin and generate C headers.
+#
+use strict;
+use warnings;
+use File::Path;
+use File::Find;
+
+my $outdir = shift @ARGV;
+
+if (!defined $outdir)
+{
+ die <<EOF;
+$0 - generate C header from merged configuration.
+Syntax: $0 output_dir
+EOF
+}
+
+my %conf;
+
+while (<>)
+{
+ chomp;
+ next if /^\s*#/;
+ next if /^$/;
+ if (/^\s*([A-Z_]+)\s*=\s*([yn]|[0-9]+)\s*$/)
+ {
+ my ($var, $val) = ($1, $2);
+ $var =~ /^CONFIG_[A-Z_]*[A-Z]$/
+ or die "$ARGV:$.:unaccepted identifier \"$var\"\n";
+ !exists $conf{$var}
+ or die "$ARGV:$.:duplicated identifier \"$var\"\n";
+ $conf{$var} = $val;
+ next;
+ }
+ die "$ARGV:$.:unrecognized line\n";
+} continue {
+ close ARGV if eof;
+}
+
+my %headers;
+
+my %valmap = ('y' => 1, 'n' => 0);
+
+for my $var (sort keys %conf)
+{
+ my @svar = split /_/, $var;
+ # Generate the bottom file.
+ my $mfile = lc join '/', @svar;
+ $headers{$mfile} = '' unless exists $headers{$mfile};
+ $headers{$mfile} .= "#define $var "
+ . (exists $valmap{$conf{$var}} ? $valmap{$conf{$var}} : $conf{$var})
+ . "\n";
+ # Generate the intermediates files.
+ for (0 .. $#svar - 1)
+ {
+ my $file = lc join '/', @svar[0 .. $_];
+ $headers{$file} = '' unless exists $headers{$file};
+ $headers{$file} .= "#include \"$mfile.h\"\n";
+ }
+}
+
+my %seen;
+
+for my $file (sort keys %headers)
+{
+ my $path = "$outdir/$file.h";
+ $seen{$path} = 1;
+ $path =~ m#(.+)/[^/]+#;
+ mkpath $1;
+ my $prot = $file;
+ $prot =~ s#[/.]#_#g;
+ $prot = "included_${prot}_h";
+ my $new = <<EOF;
+#ifndef $prot
+#define $prot
+$headers{$file}#endif /* $prot */
+EOF
+ my $old = '';
+ if (open FILE, "<$path")
+ {
+ $old = join '', <FILE>;
+ close FILE;
+ }
+ if ($new ne $old)
+ {
+ open FILE, ">$path"
+ or die "can not open \"$path\" for writing\n";
+ print FILE $new;
+ close FILE;
+ }
+}
+
+sub remove_unused
+{
+ unlink $_ if m#^$outdir/config/.*\.h$# && !exists $seen{$_};
+}
+
+find ({ no_chdir => 1, wanted => \&remove_unused }, "$outdir/config");
diff --git a/cesar/common/tools/config-merge b/cesar/common/tools/config-merge
new file mode 100755
index 0000000000..ae6b63a78e
--- /dev/null
+++ b/cesar/common/tools/config-merge
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+#
+# Read a project configuration and modules configurations and merge them to
+# stdout.
+#
+use strict;
+use warnings;
+
+if (scalar @ARGV < 1)
+{
+ die <<EOF;
+$0 - merge project and modules configuration to stdout.
+Syntax: $0 project_config module_configs...
+EOF
+}
+
+my %conf;
+
+my $proj = shift @ARGV;
+push @ARGV, $proj;
+
+while (<>)
+{
+ chomp;
+ next if /^\s*#/;
+ next if /^$/;
+ if (/^\s*([A-Z_]+)\s*=\s*([yn]|[0-9]+)\s*$/)
+ {
+ my ($var, $val) = ($1, $2);
+ $var =~ /^CONFIG_[A-Z_]*[A-Z]$/
+ or die "$ARGV:$.:unaccepted identifier \"$var\"\n";
+ if (scalar @ARGV == 0)
+ {
+ # Project config.
+ exists $conf{$var}
+ or die "$ARGV:$.:unknown identifier \"$var\"\n";
+ $val =~ /^[yn]$/ ^ $conf{$var} =~ /^[yn]$/
+ and die "$ARGV:$.:bad type for \"$var\"\n";
+ }
+ else
+ {
+ # Module config.
+ !exists $conf{$var}
+ or die "$ARGV:$.:duplicated identifier \"$var\"\n";
+ }
+ $conf{$var} = $val;
+ next;
+ }
+ die "$ARGV:$.:unrecognized line\n";
+} continue {
+ close ARGV if eof;
+}
+
+print "$_ = $conf{$_}\n" for (sort keys %conf);
diff --git a/cesar/common/tools/gentags b/cesar/common/tools/gentags
new file mode 100755
index 0000000000..b399335114
--- /dev/null
+++ b/cesar/common/tools/gentags
@@ -0,0 +1 @@
+ctags -I BITFIELDS_WORD --exclude=.svn --exclude=obj --exclude=test --exclude=ecos --c-kinds=+p --langmap=c:.c --langmap=c++:.h.hh.hpp.cc.cpp.inl.tpp --languages=c,c++ -R
diff --git a/cesar/common/tools/project-template b/cesar/common/tools/project-template
new file mode 100755
index 0000000000..7bf98aedfa
--- /dev/null
+++ b/cesar/common/tools/project-template
@@ -0,0 +1,193 @@
+#!/usr/bin/perl
+#
+# Prompt the user to create a simple project template.
+#
+use strict;
+use warnings;
+use File::Find;
+
+my @modules;
+my @sources;
+
+sub prompt_yn
+{
+ my $prompt = shift;
+ my $rep = '';
+ while (1)
+ {
+ print "\n$prompt [yn] ";
+ $rep = <>;
+ die "bye...\n" unless $rep;
+ chomp $rep;
+ last if $rep eq 'y' || $rep eq 'n';
+ print "Please answer 'y' or 'n' and hit the enter key.\n";
+ }
+ return $rep eq 'y' ? 1 : 0;
+}
+
+sub prompt_str
+{
+ my ($prompt, $re) = @_;
+ my $rep = '';
+ while (1)
+ {
+ print "\n$prompt ";
+ $rep = <>;
+ die "bye...\n" unless $rep;
+ chomp $rep;
+ last if $rep =~ /$re/;
+ print "I do not understand, please try again.\n";
+ }
+ return $rep;
+}
+
+sub prompt_list
+{
+ my ($prompt, $one, @list) = @_;
+ my $rep;
+ INPUT: while (1)
+ {
+ print "\n$prompt:\n";
+ print " [$_] $list[$_]\n" for (0 .. $#list);
+ $one
+ and print "enter a number: "
+ or print "enter a list of space separated number: ";
+ $rep = <>;
+ die "bye...\n" unless $rep;
+ chomp $rep;
+ my @rep = split / /, $rep;
+ if ($one && scalar @rep != 1)
+ {
+ print "I want one and only one response.\n";
+ next INPUT;
+ }
+ for (@rep)
+ {
+ if (!/^\d+$/ || !exists $list[$_])
+ {
+ print "I can not understand \"$_\".\n";
+ next INPUT;
+ }
+ }
+ return @list[@rep];
+ }
+}
+
+sub prompt_prog
+{
+ my ($var, $fh, $prompt) = @_;
+ my @programs = split / +/,
+ prompt_str "Please give ${prompt}programs names, separated with spaces:",
+ qr/\w+(?: +\w)* */;
+ print $fh "$var = ", join (' ', @programs), "\n";
+ for (@programs)
+ {
+ my @prog_sources = scalar @sources
+ ? prompt_list ("Choose the sources to include for $_", 0, @sources)
+ : ();
+ print $fh "${_}_SOURCES = ", join (' ', @prog_sources), "\n";
+ my @prog_modules = scalar @modules
+ ? prompt_list ("Choose the modules to include for $_", 0, @modules)
+ : ();
+ print $fh "${_}_MODULES = ", join (' ', @prog_modules), "\n";
+ print $fh "\n";
+ }
+}
+
+sub prompt_platform
+{
+ my ($ecos) = @_;
+ my @platforms;
+ push @platforms, 'none' unless $ecos;
+ push @platforms, 'sparc', 'synthetic', 'maximus';
+ return prompt_list ("For which platform do you compile?", 1, @platforms);
+}
+
+print <<EOF;
+Welcome to the project template creator. I will prompt you to learn some
+coarse details about your project and I will then generate the Makefile and
+the ecos.ecc.sh if needed.
+
+EOF
+
+# Find base.
+my $base = '..';
+while (!-r "$base/common/make/top.mk")
+{
+ $base .= '/..';
+ die "I can not find the base directory.\n"
+ unless -d $base && length $base < 3 * 12;
+}
+print "I have found the sources root in `$base'.\n";
+
+my ($ecos, $platform);
+
+if (scalar @ARGV && $ARGV[0] eq 'ecos.ecc.sh')
+{
+ @ARGV = ();
+ print "\nI will only generate the ecos.ecc.sh file.\n";
+ $ecos = 1;
+}
+else
+{
+ # Find modules and local sources.
+ find (sub {
+ /^(?:ecos|\.svn|test)$/s && ($File::Find::prune = 1)
+ || /^Module$/s && do { push @modules, $File::Find::dir };
+ } , $base);
+ $_ =~ s#^$base/## for @modules;
+
+ find (sub {
+ /\.c$/s && do { push @sources, $_ };
+ }, 'src') if -d 'src';
+
+ # Generate Makefile.
+ die "Makefile in the ways, I will not clobber it.\n" if -f 'Makefile';
+
+ open MAKEFILE, ">Makefile" or die "I can not open Makefile for writing.\n";
+
+ print MAKEFILE "BASE = $base\n\n";
+
+ $ecos = prompt_yn 'Do you want to use ecos?';
+ print MAKEFILE "ECOS = y\n" if $ecos;
+
+ $platform = prompt_platform $ecos;
+ print MAKEFILE "TARGET = sparc\n" if $platform eq 'sparc';
+
+ print MAKEFILE "\n" if $ecos || $platform eq 'sparc';
+
+ my $host = prompt_yn 'Do you want to build host programs?';
+ prompt_prog 'HOST_PROGRAMS', \*MAKEFILE, 'host ' if $host;
+
+ my $target = $ecos || $platform ne 'none';
+ prompt_prog 'TARGET_PROGRAMS', \*MAKEFILE, 'target ' if $target;
+
+ print MAKEFILE "include \$(BASE)/common/make/top.mk\n";
+ close MAKEFILE;
+}
+
+if ($ecos)
+{
+ # Generate ecos compact config.
+ die "ecos.ecc.sh in the ways, I will not clobber it.\n" if -f 'ecos.ecc.sh';
+ open ECOS, ">ecos.ecc.sh" or die "I can not open ecos.ecc.sh for writing.\n";
+
+ $platform = prompt_platform $ecos unless defined $platform;
+
+ my %ecos_targets = (
+ sparc => 'sparc_leon',
+ synthetic => 'linux',
+ maximus => 'maximus',
+ );
+ die unless exists $ecos_targets{$platform};
+ my $ecos_target = $ecos_targets{$platform};
+ my $ecos_tmpl = prompt_list ("Choose template", 1, 'minimal', 'kernel',
+ 'default');
+
+ print ECOS "config=\${1:-ecos-gen.ecc}\n";
+ print ECOS "ecosconfig --config=\$config new $ecos_target $ecos_tmpl\n";
+ print ECOS "cat >> \$config <<'EOF'\n";
+ print ECOS "EOF\n";
+ print ECOS "ecosconfig --config=\$config check\n";
+ close ECOS;
+}
diff --git a/cesar/common/tools/sdl.ps b/cesar/common/tools/sdl.ps
new file mode 100644
index 0000000000..305e03d046
--- /dev/null
+++ b/cesar/common/tools/sdl.ps
@@ -0,0 +1,655 @@
+%! SDL shapes for Graphviz/dot in PostScript output mode
+
+% FILE
+% sdl.ps - SDL shapes for Graphviz/dot in PostScript output mode
+%
+% USE
+% All procedures expect to be passed a rectangular bounding box in the
+% order [upper right, lower right, lower left, upper left, upper right].
+% All procedures expect to be used with "peripheries = 0".
+%
+% BUGS
+% The following shapes are currently not implemented:
+% - frame/system/block/process/procedure/service/procedure, and types thereof
+% - macro inlet/outlet/call
+% - exception handler/handle/raise
+% - decision (suggest use diamond)
+% - alternative (suggest use triangle)
+% - internal input/output (suggest stop using historical relics!)
+%
+% COPYRIGHT AND PERMISSION NOTICE
+% Copyright (C) 2005 Cambridge Silicon Radio Ltd.; all rights reserved.
+%
+% Permission is hereby granted, free of charge, to any person obtaining
+% a copy of this software and associated documentation files (the
+% "Software"), to deal in the Software without restriction, including
+% without limitation the rights to use, copy, modify, merge, publish,
+% distribute, sublicense, and/or sell copies of the Software, and to
+% permit persons to whom the Software is furnished to do so, subject to
+% the following conditions:
+%
+% The above copyright notice and this permission notice shall be
+% included in all copies or substantial portions of the Software.
+%
+% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+% LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+% OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+% WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+%
+% Except as contained in this notice, the name of a copyright holder
+% shall not be used in advertising or otherwise to promote the sale, use
+% or other dealings in the Software without prior written authorization
+% of the copyright holder.
+%
+% REVISION
+% #4
+
+/xdef {exch def} bind def
+
+% SDL task
+
+/sdl_task {
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ newpath
+ moveto
+ lineto
+ lineto
+ lineto
+ pop pop
+ closepath
+ { fill } { stroke } ifelse
+} bind def
+
+% SDL input from right
+% The indent has lines at 45 degrees
+% There should be a few spaces at the end of this shape's label
+
+/sdl_input_from_right {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /h2 ury lry sub 2 div def
+ newpath
+ moveto
+ urx h2 sub ury h2 sub lineto
+ lrx lry lineto
+ llx lly lineto
+ ulx uly lineto
+ closepath
+ { fill } { stroke } ifelse
+ end
+} bind def
+
+% SDL input from left
+% Similar to SDL input from right
+% There should be a few spaces at the start of this shape's label
+
+/sdl_input_from_left {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /h2 uly lly sub 2 div def
+ newpath
+ moveto
+ lrx lry lineto
+ llx lly lineto
+ ulx h2 add ury h2 sub lineto
+ ulx uly lineto
+ closepath
+ { fill } { stroke } ifelse
+ end
+} bind def
+
+% SDL priority input from right
+% Similar to SDL input from right
+% The chevrons are displaced by an eighth of the shape height
+% The filled version is indistinguishable from a non-priority SDL input
+
+/sdl_priority_input_from_right {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /h2 ury lry sub 2 div def
+ newpath
+ moveto
+ urx h2 sub ury h2 sub lineto
+ lrx lry lineto
+ llx lly lineto
+ ulx uly lineto
+ closepath
+ { fill } { stroke
+ urx h2 4 div sub ury moveto
+ urx h2 sub h2 4 div sub ury h2 sub lineto
+ lrx h2 4 div sub lry lineto
+ stroke } ifelse
+ end
+} bind def
+
+% SDL priority input from left
+% Similar to SDL priority input from right
+
+/sdl_priority_input_from_left {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /h2 uly lly sub 2 div def
+ newpath
+ moveto
+ lrx lry lineto
+ llx lly lineto
+ ulx h2 add uly h2 sub lineto
+ ulx uly lineto
+ closepath
+ { fill } { stroke
+ llx h2 4 div add lly moveto
+ ulx h2 add h2 4 div add uly h2 sub lineto
+ ulx h2 4 div add uly lineto
+ stroke } ifelse
+ end
+} bind def
+
+% SDL start
+% The left and right sides are semicircles
+% This should be used with "label = " ""
+
+/sdl_start {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ pop pop
+ /r ury lry sub 2 div def
+ newpath
+ urx r sub ury r sub r 90 -90 arcn
+ ulx r add uly r sub r -90 90 arcn
+ closepath
+ { fill } { stroke } ifelse
+ end
+} bind def
+
+% SDL procedure start
+% Similar to SDL start
+% The filled version is indistinguishable from an SDL start
+% This should be used with "label = " ""
+
+/sdl_procedure_start {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ pop pop
+ /r ury lry sub 2 div def
+ newpath
+ urx r sub ury r sub r 90 -90 arcn
+ ulx r add uly r sub r -90 90 arcn
+ closepath
+ { fill } { stroke
+ lrx r sub lry moveto
+ 0 r 2 mul rlineto
+ llx r add lly moveto
+ 0 r 2 mul rlineto
+ stroke } ifelse
+ end
+} bind def
+
+% SDL state/nextstate
+% The left and right sides are arcs
+
+/sdl_state {
+ 12 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ pop pop
+ /h2 ury lry sub 2 div def
+ /w2 h2 1.5 mul def % was urx ulx sub 2 div def but this made curvature width-dependent
+ /r w2 def
+ /th h2 r dup mul h2 dup mul sub sqrt atan def
+ newpath
+ urx w2 sub ury h2 sub r th th neg arcn
+ ulx w2 add uly h2 sub r -180 th add -180 th sub arcn
+ closepath
+ { fill } { stroke } ifelse
+ end
+} bind def
+
+% SDL output to right
+% The outdent has lines at 45 degrees
+% There should be a few spaces at the end of this shape's label
+
+/sdl_output_to_right {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /h2 ury lry sub 2 div def
+ newpath
+ exch h2 sub exch moveto
+ urx ury h2 sub lineto
+ lrx h2 sub lry lineto
+ llx lly lineto
+ ulx uly lineto
+ closepath
+ { fill } { stroke } ifelse
+ end
+} bind def
+
+% SDL output to left
+% Similar to SDL output to right
+% There should be a few spaces at the start of this shape's label
+
+/sdl_output_to_left {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /h2 ury lry sub 2 div def
+ newpath
+ moveto
+ lrx lry lineto
+ llx h2 add lly lineto
+ ulx ury h2 sub lineto
+ ulx h2 add uly lineto
+ closepath
+ { fill } { stroke } ifelse
+ end
+} bind def
+
+% SDL continuous signal/enabling condition
+% The chevrons have lines at 45 degrees
+% There should be a few spaces at the start and end of this shape's label
+
+/sdl_condition {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /h2 ury lry sub 2 div def
+ newpath
+ exch h2 sub exch moveto
+ urx ury h2 sub lineto
+ lrx h2 sub lry lineto
+ dup llx h2 add lly 3 -1 roll { lineto } { moveto } ifelse
+ ulx uly h2 sub lineto
+ ulx h2 add uly lineto
+ { fill } { stroke } ifelse
+ end
+} bind def
+
+% SDL save
+% The left and right edges are at about 60 degrees
+% There should be a few spaces at the start and end of this shape's label
+
+/sdl_save {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /h3 ury lry sub 3 div def
+ newpath
+ moveto
+ lrx h3 sub lry lineto
+ llx lly lineto
+ ulx h3 add uly lineto
+ closepath
+ { fill } { stroke } ifelse
+ end
+} bind def
+
+% SDL stop
+% The width of the bounding box is ignored; the lines are set at 45 degrees
+% This shape cannot be filled
+% This should be used with "label = """ and "arrowhead = none, headclip = false"
+
+/sdl_stop {
+ 7 dict begin
+ { stop } if % make sure not asked to fill this
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ pop pop
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef pop
+ /h2 uly lly sub 2 div def
+ /mx llx lrx add 2 div def
+ newpath
+ mx h2 add exch moveto pop
+ mx h2 sub lly lineto
+ mx h2 sub uly moveto
+ mx h2 add lry lineto
+ closepath
+ stroke
+ end
+} bind def
+
+% SDL return
+% The width of the bounding box is ignored; the lines are set at 45 degrees
+% The filled version is indistinguishable from an SDL connection
+
+/sdl_return {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef pop
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef pop
+ pop pop
+ /h2 uly lly sub 2 div 2 sqrt div def
+ /mx llx lrx add 2 div def
+ /my lry ury add 2 div def
+ newpath
+ mx my uly lly sub 2 div 0 360 arc
+ { fill } { stroke
+ mx h2 add my h2 add moveto
+ mx h2 sub my h2 sub lineto
+ mx h2 sub my h2 add moveto
+ mx h2 add my h2 sub lineto
+ stroke } ifelse
+ end
+} bind def
+
+% SDL create
+% The extra lines are displaced by an eighth of the shape height
+% The filled version is indistinguishable from an SDL task
+
+/sdl_create {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /h8 ury lry sub 8 div def
+ newpath
+ moveto
+ lrx lry lineto
+ llx lly lineto
+ ulx uly lineto
+ closepath
+ { fill } { stroke
+ ulx uly h8 sub moveto
+ urx ury h8 sub lineto
+ llx lly h8 add moveto
+ lrx lry h8 add lineto
+ stroke } ifelse
+ end
+} bind def
+
+% SDL call
+% The extra lines are displaced by an eighth of the shape height
+% The filled version is indistinguishable from an SDL task
+% There should be a few spaces at the start and end of this shape's label
+
+/sdl_call {
+ 9 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /h8 ury lry sub 8 div def
+ newpath
+ moveto
+ lrx lry lineto
+ llx lly lineto
+ ulx uly lineto
+ closepath
+ { fill } { stroke
+ urx h8 sub ury moveto
+ lrx h8 sub lry lineto
+ llx h8 add lly moveto
+ ulx h8 add uly lineto
+ stroke } ifelse
+ end
+} bind def
+
+% SDL text symbol
+% The corner has a size of twice the H height
+
+/sdl_text {
+ 10 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /h8 ury lry sub 8 div def
+ newpath
+ moveto
+ /d (H) true charpath flattenpath pathbbox exch pop exch sub exch pop 2 mul def
+ newpath
+ urx ury d sub moveto
+ lrx lry lineto
+ llx lly lineto
+ ulx uly lineto
+ urx d sub ury lineto
+ closepath
+ { fill } { stroke } ifelse
+ urx ury d sub moveto
+ d neg 0 rlineto
+ 0 d rlineto
+ stroke
+ end
+} bind def
+
+% SDL text extension from left
+% This should be used with "rank = same"
+
+/sdl_text_extension_from_left {
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ pop pop
+ moveto
+ lineto
+ lineto
+ lineto
+ { fill } { stroke } ifelse
+} bind def
+
+% SDL text extension from right
+% This should be used with "rank = same"
+
+/sdl_text_extension_from_right {
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ pop pop
+ 8 4 roll
+ moveto
+ lineto
+ lineto
+ lineto
+ { fill } { stroke } ifelse
+} bind def
+
+% SDL comment from left
+% This should be used with "style = dashed" and "rank = same"
+
+/sdl_comment_from_left { sdl_text_extension_from_left } bind def
+
+% SDL comment from right
+% This should be used with "style = dashed" and "rank = same"
+
+/sdl_comment_from_right { sdl_text_extension_from_right } bind def
+
+% SDL connector
+% The width of the bounding box is ignored
+
+/sdl_connector {
+ 7 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ pop pop
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef pop
+ pop pop
+ /h2 uly lly sub 2 div def
+ /mx llx lrx add 2 div def
+ newpath
+ mx uly h2 sub h2 0 360 arc
+ { fill } { stroke } ifelse
+ end
+} bind def
+
+% SDL set (extension)
+% The hourglass has a size of twice the H height
+% There should be a few spaces at the start of this shape's label
+
+/sdl_set {
+ 10 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /my uly lly add 2 div def
+ newpath
+ moveto
+ /d (H) true charpath flattenpath pathbbox exch pop exch sub exch pop def
+ newpath
+ llx d add my d add moveto
+ ulx d add uly lineto
+ urx ury lineto
+ lrx lry lineto
+ llx d add lly lineto
+ llx d add my d sub lineto
+ dup { closepath fill } { stroke } ifelse
+ llx my d sub moveto
+ d 2 mul dup rlineto
+ d 2 mul neg 0 rlineto
+ d 2 mul dup neg rlineto
+ closepath
+ { fill } { stroke } ifelse
+ end
+} bind def
+
+% SDL reset (extension)
+% The cross has a size of twice the H height
+% There should be a few spaces at the start of this shape's label
+
+/sdl_reset {
+ 10 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /my uly lly add 2 div def
+ newpath
+ moveto
+ /d (H) true charpath flattenpath pathbbox exch pop exch sub exch pop def
+ newpath
+ urx ury moveto
+ lrx lry lineto
+ llx d add lly lineto
+ ulx d add uly lineto
+ closepath
+ { fill } { stroke } ifelse
+ llx my d sub moveto
+ d 2 mul dup rlineto
+ llx d 2 mul add my d sub moveto
+ d 2 mul dup neg exch rlineto
+ stroke
+ end
+} bind def
+
+% SDL export (extension)
+% The store has a width of twice the H height
+% There should be a few spaces at the start of this shape's label
+
+/sdl_export {
+ 10 dict begin
+ 3 1 roll % put filled flag at end
+ 4 ne { stop } if % sanity-check number of sides
+ aload pop
+ /ury xdef /urx xdef
+ /lry xdef /lrx xdef
+ /lly xdef /llx xdef
+ /uly xdef /ulx xdef
+ /my uly lly add 2 div def
+ newpath
+ moveto
+ /d (H) true charpath flattenpath pathbbox exch pop exch sub exch pop def
+ newpath
+ llx d add my d 2 div add moveto
+ ulx d add uly lineto
+ urx ury lineto
+ lrx lry lineto
+ llx d add lly lineto
+ llx d add my d 2 div sub lineto
+ { closepath fill } { stroke } ifelse
+ llx my d 2 div sub moveto
+ d 2 mul 0 rlineto
+ llx my d 2 div add moveto
+ d 2 mul 0 rlineto
+ stroke
+ end
+} bind def
diff --git a/cesar/common/tools/sdl2dot b/cesar/common/tools/sdl2dot
new file mode 100755
index 0000000000..1d86c14d59
--- /dev/null
+++ b/cesar/common/tools/sdl2dot
@@ -0,0 +1,227 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my %re = (
+ start => qr/\(\((.*?)\)\)/,
+ pstart => qr/\(\|(.*?)\|\)/,
+ state => qr/\(([^(|X].*?)\)/,
+ call => qr/\|\|(.+?)\|\|/,
+ task => qr/\|([^|%X].*?)\|/,
+ toright => qr/\|(.+?)>/,
+ toleft => qr/<(.+?)\|/,
+ fromright => qr/\|(.+?)</,
+ fromleft => qr/>(.+?)\|/,
+ cond => qr/<(.+?)>/,
+ stop => qr/X(.*?)X/,
+ connector => qr/O(.*?)O/,
+ pstop => qr/\(X(.*?)X\)/,
+ set => qr/\|%(.*?)\|/,
+ 'reset' => qr/\|X(.*?)\|/,
+ 'continue' => qr/\.\.\./,
+);
+my $renode = qr/(?:
+ \( [^(|X].*? \)
+ | \(\( .*? \)\)
+ | \(\| .*? \|\)
+ | \(X .*? X\)
+ | \| [^|%X].*? [|<>]
+ | \|\| .+? \|\|
+ | [<>] .+? [|>]
+ | X .*? X
+ | O .*? O
+ | \|% .*? \|
+ | \|X .*? \|
+ | \.\.\.
+ )/x;
+
+my @edges;
+my %nodes;
+my $name;
+my $using = '';
+
+my $continue_node;
+while (<>)
+{
+ chomp;
+ my $last_node;
+ my %last_edge;
+ next if /^\s*$/;
+ do { $name = $1; next; } if /^\s*# (.+)$/ and !defined $name;
+ do { $using = $1; next; } if /^\s*(\w*):$/;
+ while (1)
+ {
+ unless (/\G\s*($renode)/gc)
+ {
+ /\G(.{0,10})/;
+ die "invalid line \"...$1...\"";
+ }
+ my ($node, $label);
+ for my $k (keys %re)
+ {
+ if ($1 =~ /^$re{$k}$/)
+ {
+ if ($k eq 'continue')
+ {
+ die "invalid continuation" unless defined $continue_node;
+ $node = $continue_node;
+ last;
+ }
+ $node = $1;
+ $node =~ /(?:.*:)?(.*)/;
+ $label = $1;
+ $node = $using . $node if $node =~ /^:.*$/;
+ if (exists $nodes{$node})
+ {
+ !exists $nodes{$node}{node}
+ and $nodes{$node}{node} = $k;
+ $nodes{$node}{node} eq $k
+ or die "changed node type for \"$node\"";
+ }
+ else
+ {
+ $nodes{$node} = { label => $label, node => $k };
+ }
+ #print " n $node $k\n";
+ last;
+ }
+ }
+ defined $node or die 'invalid node';
+ if (defined $last_node)
+ {
+ if ($nodes{$node}{node} eq 'stop')
+ {
+ $last_edge{attr} = 'arrowhead = none, headclip = false';
+ }
+ push @edges, { from => $last_node, to => $node, %last_edge };
+ }
+ $last_node = $node;
+ if (/\G\s*$/)
+ {
+ last;
+ }
+ elsif (/\G\s*--->/gc)
+ {
+ %last_edge = (edge => 'long');
+ }
+ elsif (/\G\s*->/gc)
+ {
+ %last_edge = (edge => 'short');
+ }
+ elsif (/\G\s*--(.*?)->/gc)
+ {
+ %last_edge = (edge => 'longc', cond => $1);
+ }
+ elsif (/\G\s*-(.*?)->/gc)
+ {
+ %last_edge = (edge => 'shortc', cond => $1);
+ }
+ else
+ {
+ /\G(.{0,10})/;
+ die "invalid edge \"$1...\"";
+ }
+ }
+ $continue_node = $last_node;
+}
+
+my %render = (
+ start => sub {
+ my ($n, $l) = @_;
+ $l = ' ' x 16 unless $l;
+ "\t\"$n\" [ shape=sdl_start, label=\"$l\" ]\n";
+ },
+ pstart => sub {
+ my ($n, $l) = @_;
+ $l = ' ' x 12 unless $l;
+ "\t\"$n\" [ shape=sdl_procedure_start, label=\" $l \" ]\n";
+ },
+ state => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_state, style=filled, fillcolor=lavender, label=\"$l\" ]\n";
+ },
+ call => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_call, label=\" $l \" ]\n";
+ },
+ task => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_task, label=\"$l\" ]\n";
+ },
+ toright => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_output_to_right, label=\"$l \" ]\n";
+ },
+ toleft => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_output_to_left, label=\" $l\" ]\n";
+ },
+ fromright => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_input_from_right, label=\"$l \" ]\n";
+ },
+ fromleft => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_input_from_left, label=\" $l\" ]\n";
+ },
+ cond => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=diamond, peripheries=1, label=\"$l\" ]\n";
+ },
+ stop => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_stop, label=\"$l\" ]\n";
+ },
+ connector => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_connector, label=\"$l\" ]\n";
+ },
+ pstop => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_return, label=\"$l\" ]\n";
+ },
+ set => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_set, label=\" $l\" ]\n";
+ },
+ 'reset' => sub {
+ my ($n, $l) = @_;
+ "\t\"$n\" [ shape=sdl_reset, label=\" $l\" ]\n";
+ },
+ short => sub {
+ my ($f, $t, $a) = @_;
+ $a = " [ $a ]" if $a;
+ "\t\"$f\" -> \"$t\"$a\n";
+ },
+ shortc => sub {
+ my ($f, $t, $a, $c) = @_;
+ $a = ", $a" if $a;
+ "\t\"$f\" -> \"$t\" [ label=\"$c\"$a ]\n";
+ },
+ long => sub {
+ my ($f, $t, $a) = @_;
+ $a = ", $a" if $a;
+ "\t\"$f\" -> \"$t\" [ weight=0.8$a ]\n";
+ },
+ longc => sub {
+ my ($f, $t, $a, $c) = @_;
+ $a = ", $a" if $a;
+ "\t\"$f\" -> \"$t\" [ weight=0.8, label=\"$c\"$a ]\n";
+ },
+);
+
+$name = 'noname' unless defined $name;
+print <<EOF;
+digraph $name {
+\tnode [ peripheries=0 ]
+EOF
+for (@edges)
+{
+ print $render{$$_{edge}} ($$_{from}, $$_{to}, exists $$_{attr} ? $$_{attr} : '', $$_{cond});
+}
+for (keys %nodes)
+{
+ print $render{$nodes{$_}{node}} ($_, $nodes{$_}{label});
+}
+print "}\n";
+
diff --git a/cesar/common/tools/vcd-merge b/cesar/common/tools/vcd-merge
new file mode 100755
index 0000000000..8d82777cce
--- /dev/null
+++ b/cesar/common/tools/vcd-merge
@@ -0,0 +1,111 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+my $timescale;
+my $id = 'a';
+my @files;
+
+sub new_file
+{
+ my $file = shift;
+ my $fd;
+ open $fd, "<$file" or die;
+ my %signals;
+ while (<$fd>)
+ {
+ chomp;
+ if (/^\$version .* \$end$/) {
+ } elsif (/^\$timescale (.*) \$end$/) {
+ unless (defined $timescale)
+ {
+ print "\$timescale $1 \$end\n";
+ $timescale = $1;
+ }
+ die if $timescale ne $1;
+ } elsif (/^\$(?:scope|upscope) .*\$end$/) {
+ print "$_\n";
+ } elsif (/^\$var real 1 (.) (.*) \$end$/) {
+ print "\$var real 1 $id $2 \$end\n";
+ $signals{$1} = $id;
+ $id++;
+ } elsif (/^\$enddefinitions \$end$/) {
+ last;
+ } else {
+ die;
+ }
+ }
+ push @files, [ $fd, { %signals } ];
+}
+
+sub dumpvars
+{
+ my ($fd, $signals) = @_;
+ my %signals = %$signals;
+ while (<$fd>)
+ {
+ chomp;
+ if (/^s(.+) (.)$/)
+ {
+ die unless exists $signals{$2};
+ print "s$1 $signals{$2}\n";
+ } elsif (/^\$dumpvars$/) {
+ } elsif (/^\$end$/) {
+ last;
+ } else {
+ die;
+ }
+ }
+}
+
+sub body
+{
+ # Read first time.
+ for my $file (@files)
+ {
+ my $fd = $$file[0];
+ $_ = <$fd>;
+ chomp;
+ die unless /^#(\d+)$/;
+ push @$file, ($1 + 0);
+ }
+ my $time = -1;
+ while (@files)
+ {
+ @files = sort { $$a[2] <=> $$b[2] } @files;
+ my $min = $files[0];
+ if ($time != $$min[2])
+ {
+ $time = $$min[2];
+ print "#$time\n";
+ }
+ my $fd = $$min[0];
+ while (1)
+ {
+ unless (defined ($_ = <$fd>))
+ {
+ close $fd;
+ shift @files;
+ last;
+ }
+ chomp;
+ if (/^#(\d+)$/) {
+ $$min[2] = $1 + 0;
+ last;
+ } elsif (/^s(.+) (.)$/) {
+ die unless exists $$min[1]{$2};
+ print "s$1 $$min[1]{$2}\n";
+ } else {
+ die;
+ }
+ }
+ }
+}
+
+print "\$version mergevcd \$end\n";
+new_file ($_) for @ARGV;
+print "\$enddefinitions \$end\n\$dumpvars\n";
+for my $f (@files)
+{ dumpvars (@$f); }
+print "\$end\n";
+body;
diff --git a/cesar/common/tools/vcd-trace b/cesar/common/tools/vcd-trace
new file mode 100755
index 0000000000..d669b5de73
--- /dev/null
+++ b/cesar/common/tools/vcd-trace
@@ -0,0 +1,129 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+sub date
+{
+ my ($date, $offset) = (@_, 0);
+ print '#' . ($offset + hex $date) . "\n";
+}
+
+my $sta = 'sta';
+$sta = $ARGV[0] if defined $ARGV[0];
+
+my $header = <<EOF;
+\$version trace2vcd \$end
+\$timescale 40 ns \$end
+\$scope module $sta \$end
+\$var real 1 ! medium \$end
+\$var real 1 < rx \$end
+\$var real 1 > tx \$end
+\$upscope \$end
+\$enddefinitions \$end
+\$dumpvars
+sIDLE !
+sIDLE <
+sIDLE >
+\$end
+EOF
+
+my $pre = [ 'PRE', 1280 ];
+my $pre10 = [ 'PRE', 1152 ];
+my $fc = [ 'FC', 1482 ];
+my $fc10 = [ 'FC10', 964 ];
+my %pf = (
+ '0' => [ $pre10, $fc10, $fc ],
+ '1' => [ $pre10, $fc10, $fc, $fc ],
+ '2' => [ $pre, $fc ],
+ '3' => [ $pre, $fc, $fc ],
+);
+my $pre_detect_delay_tck = 500;
+
+my ($dx417, $dx567, $dx3534) = (1163, 1213, 2202);
+my %dx = ('0' => $dx417, '1' => $dx567, '2' => $dx3534);
+my %gilpmod = ('0' => '0', '1' => '0', '2' => '1');
+
+my $rx_fc_mode = '0';
+my @fc_end_date;
+my %tx_param;
+my $tx_symb_nb;
+
+print $header;
+
+while (<>)
+{
+ chomp;
+ s/\r$//;
+ if (/^\[.\] rx param mode=(.+)$/) {
+ $rx_fc_mode = $1;
+ } elsif (/^\[(.+)\] prp([01])$/) {
+ date ($1);
+ print "sPRP$2 !\n";
+ } elsif (/^\[(.+)\] slot count=(.+)$/ && $2 > 1) {
+ date ($1);
+ print "sCW$2 !\n";
+ } elsif (/^\[(.+)\] pre detect$/) {
+ date ($1, -$pre_detect_delay_tck);
+ print "sRX !\n";
+ my $t = -$pre_detect_delay_tck;
+ for my $s (@{$pf{$rx_fc_mode}})
+ {
+ print "s$$s[0] <\n";
+ $t += $$s[1];
+ date ($1, $t);
+ }
+ @fc_end_date = ($1, $t);
+ } elsif (/^\[\.\] rx prepare short=true.*/) {
+ next unless @fc_end_date;
+ print "sIDLE <\nsIDLE !\n";
+ @fc_end_date = ();
+ } elsif (/^\[\.\] rx prepare short=false.*mod=(.+?) .* gil=(.+?) .*symb_nb=(.+)$/) {
+ next unless @fc_end_date;
+ my $t = $fc_end_date[1];
+ my $gil = exists $gilpmod{$1} ? $gilpmod{$1} : $2;
+ for my $d (1 .. $3)
+ {
+ print "sD$d <\n";
+ $t += $d <= 2 ? $dx567 : $dx{$gil};
+ date ($fc_end_date[0], $t);
+ }
+ print "sIDLE <\nsIDLE !\n";
+ @fc_end_date = ();
+ } elsif (/^\[\.\] tx param mode=(.+?) short=(.+?) mod=(.+?) .*gil=(.+?)/) {
+ %tx_param = (fc_mode => $1, short => $2, mod => $3, gil => $4);
+ } elsif (/^\[\.\] tx symb_nb=(.*?)$/) {
+ $tx_symb_nb = $1;
+ } elsif (/^\[(.+)\] tx frame$/) {
+ next unless %tx_param;
+ date ($1);
+ print "sTX !\n";
+ my $t = 0;
+ for my $s (@{$pf{$tx_param{fc_mode}}})
+ {
+ print "s$$s[0] >\n";
+ $t += $$s[1];
+ date ($1, $t);
+ }
+ @fc_end_date = ($1, $t);
+ if ($tx_param{short} eq 'true')
+ {
+ print "sIDLE >\nsIDLE !\n";
+ %tx_param = ();
+ }
+ } elsif (/^\[.*\] tx mpdu/) {
+ next unless %tx_param;
+ next unless @fc_end_date;
+ my $t = $fc_end_date[1];
+ my $gil = exists $gilpmod{$tx_param{mod}}
+ ? $gilpmod{$tx_param{mod}} : $tx_param{gil};
+ for my $d (1 .. $tx_symb_nb)
+ {
+ print "sD$d >\n";
+ $t += $d <= 2 ? $dx567 : $dx{$gil};
+ date ($fc_end_date[0], $t);
+ }
+ print "sIDLE >\nsIDLE !\n";
+ %tx_param = ();
+ @fc_end_date = ();
+ }
+}