Merge pull request #4 from lategoodbye/master
Improved telegram parsing
This commit is contained in:
commit
44eec2c92e
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,7 @@
|
||||
.project
|
||||
*~
|
||||
*.o
|
||||
*.so
|
||||
*.la
|
||||
*.lo
|
||||
.libs/
|
||||
|
365
INSTALL
Normal file
365
INSTALL
Normal file
@ -0,0 +1,365 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
|
||||
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell commands `./configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the `README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
`INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
||||
you want to change it or regenerate `configure' using a newer version
|
||||
of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system.
|
||||
|
||||
Running `configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the `make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type `make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior `make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type `make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide `make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like `make install' and `make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'. This
|
||||
is known as a "VPATH" build.
|
||||
|
||||
With a non-GNU `make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use `make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple `-arch' options to the
|
||||
compiler but only a single `-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the `lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the
|
||||
default for these options is expressed in terms of `${prefix}', so that
|
||||
specifying just `--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to `configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
`make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, `make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
`${prefix}'. Any directories that were specified during `configure',
|
||||
but not in terms of `${prefix}', must each be overridden at install
|
||||
time for the entire installation to be relocated. The approach of
|
||||
makefile variable overrides for each directory variable is required by
|
||||
the GNU Coding Standards, and ideally causes no recompilation.
|
||||
However, some platforms have known limitations with the semantics of
|
||||
shared libraries that end up requiring recompilation when using this
|
||||
method, particularly noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the `DESTDIR' variable. For
|
||||
example, `make install DESTDIR=/alternate/directory' will prepend
|
||||
`/alternate/directory' before all installation names. The approach of
|
||||
`DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of `${prefix}'
|
||||
at `configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of `make' will be. For these packages, running `./configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with `make V=1'; while running `./configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with `make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
|
||||
CC is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
|
||||
a workaround. If GNU CC is not installed, it is therefore recommended
|
||||
to try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
|
||||
in your `PATH', put it _after_ `/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in `/boot/common',
|
||||
not `/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
||||
an Autoconf bug. Until the bug is fixed you can use this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of all of the options to `configure', and exit.
|
||||
|
||||
`--help=short'
|
||||
`--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
`configure', and exit. The `short' variant lists options used
|
||||
only in the top level, while the `recursive' variant lists options
|
||||
also present in any nested packages.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names::
|
||||
for more details, including other options available for fine-tuning
|
||||
the installation locations.
|
||||
|
||||
`--no-create'
|
||||
`-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
630
depcomp
Executable file
630
depcomp
Executable file
@ -0,0 +1,630 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
||||
# Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
@ -1,654 +0,0 @@
|
||||
EESchema Schematic File Version 2 date 07/12/2011 21:02:04
|
||||
LIBS:power
|
||||
LIBS:device
|
||||
LIBS:transistors
|
||||
LIBS:conn
|
||||
LIBS:linear
|
||||
LIBS:regul
|
||||
LIBS:74xx
|
||||
LIBS:cmos4000
|
||||
LIBS:adc-dac
|
||||
LIBS:memory
|
||||
LIBS:xilinx
|
||||
LIBS:special
|
||||
LIBS:microcontrollers
|
||||
LIBS:dsp
|
||||
LIBS:microchip
|
||||
LIBS:analog_switches
|
||||
LIBS:motorola
|
||||
LIBS:texas
|
||||
LIBS:intel
|
||||
LIBS:audio
|
||||
LIBS:interface
|
||||
LIBS:digital-audio
|
||||
LIBS:philips
|
||||
LIBS:display
|
||||
LIBS:cypress
|
||||
LIBS:siliconi
|
||||
LIBS:opto
|
||||
LIBS:atmel
|
||||
LIBS:contrib
|
||||
LIBS:valves
|
||||
LIBS:MBus-cache
|
||||
EELAYER 25 0
|
||||
EELAYER END
|
||||
$Descr A4 11700 8267
|
||||
encoding utf-8
|
||||
Sheet 1 1
|
||||
Title ""
|
||||
Date "7 dec 2011"
|
||||
Rev ""
|
||||
Comp ""
|
||||
Comment1 ""
|
||||
Comment2 ""
|
||||
Comment3 ""
|
||||
Comment4 ""
|
||||
$EndDescr
|
||||
Text Notes 5550 2900 0 60 ~ 0
|
||||
approx 34V
|
||||
Text Notes 1300 1600 0 60 ~ 0
|
||||
Optional external\npower supply
|
||||
Text Notes 9700 3150 0 60 ~ 0
|
||||
MBus
|
||||
Text Label 8900 3250 0 60 ~ 0
|
||||
MBus-
|
||||
Wire Wire Line
|
||||
9200 3250 8900 3250
|
||||
Wire Wire Line
|
||||
8900 3250 8900 3500
|
||||
Connection ~ 8700 3500
|
||||
Wire Wire Line
|
||||
8900 3500 8700 3500
|
||||
Connection ~ 7700 2900
|
||||
Wire Wire Line
|
||||
7700 2950 7700 2900
|
||||
Wire Wire Line
|
||||
5450 3050 5450 2900
|
||||
Wire Wire Line
|
||||
5450 2900 8900 2900
|
||||
Wire Wire Line
|
||||
8900 2900 8900 3050
|
||||
Wire Wire Line
|
||||
6050 4050 5750 4050
|
||||
Wire Wire Line
|
||||
5750 4050 5750 5050
|
||||
Wire Wire Line
|
||||
5750 5050 3500 5050
|
||||
Wire Wire Line
|
||||
3550 5300 3550 5250
|
||||
Wire Wire Line
|
||||
3550 5250 3500 5250
|
||||
Wire Wire Line
|
||||
2700 3200 2700 1800
|
||||
Wire Wire Line
|
||||
2150 1800 2250 1800
|
||||
Connection ~ 7700 3900
|
||||
Wire Wire Line
|
||||
7700 3950 7700 3450
|
||||
Wire Wire Line
|
||||
6600 4050 6550 4050
|
||||
Connection ~ 7300 3750
|
||||
Wire Wire Line
|
||||
6900 4250 6900 4450
|
||||
Wire Wire Line
|
||||
7700 4450 7700 4550
|
||||
Wire Wire Line
|
||||
8350 4150 8500 4150
|
||||
Connection ~ 8700 4000
|
||||
Wire Wire Line
|
||||
8700 4000 8500 4000
|
||||
Wire Wire Line
|
||||
8700 3950 8700 4050
|
||||
Connection ~ 5450 3900
|
||||
Wire Wire Line
|
||||
5400 3900 5450 3900
|
||||
Connection ~ 2700 2200
|
||||
Wire Wire Line
|
||||
2650 2200 2700 2200
|
||||
Wire Wire Line
|
||||
2400 2400 2400 2350
|
||||
Wire Wire Line
|
||||
2400 2350 2700 2350
|
||||
Wire Wire Line
|
||||
3775 2975 3775 2950
|
||||
Connection ~ 3775 3600
|
||||
Wire Wire Line
|
||||
3775 3575 3775 3600
|
||||
Wire Wire Line
|
||||
3550 3600 3850 3600
|
||||
Connection ~ 3600 3900
|
||||
Wire Wire Line
|
||||
3650 3900 3550 3900
|
||||
Connection ~ 4750 3900
|
||||
Wire Wire Line
|
||||
5450 4400 5450 4500
|
||||
Wire Wire Line
|
||||
3600 4450 3600 4500
|
||||
Connection ~ 1800 3200
|
||||
Wire Wire Line
|
||||
1800 3200 1950 3200
|
||||
Wire Wire Line
|
||||
3550 3500 3600 3500
|
||||
Wire Wire Line
|
||||
3600 3500 3600 3200
|
||||
Wire Wire Line
|
||||
3600 3200 3550 3200
|
||||
Wire Wire Line
|
||||
3050 3200 3000 3200
|
||||
Wire Wire Line
|
||||
3000 3200 3000 2950
|
||||
Wire Wire Line
|
||||
1800 3550 1800 2950
|
||||
Wire Wire Line
|
||||
1800 4300 1800 4350
|
||||
Wire Wire Line
|
||||
2700 3200 2450 3200
|
||||
Wire Wire Line
|
||||
1850 3850 1800 3850
|
||||
Wire Wire Line
|
||||
1800 3850 1800 3900
|
||||
Wire Wire Line
|
||||
2700 4200 2700 4350
|
||||
Connection ~ 3000 2950
|
||||
Wire Wire Line
|
||||
1800 3550 1850 3550
|
||||
Wire Wire Line
|
||||
3600 3900 3600 3950
|
||||
Wire Wire Line
|
||||
4750 4400 4750 4500
|
||||
Wire Wire Line
|
||||
4800 3900 4700 3900
|
||||
Wire Wire Line
|
||||
4200 3900 4150 3900
|
||||
Wire Wire Line
|
||||
3600 3800 3600 3750
|
||||
Wire Wire Line
|
||||
3600 3750 3550 3750
|
||||
Wire Wire Line
|
||||
4250 3600 4750 3600
|
||||
Wire Wire Line
|
||||
4750 3600 4750 4000
|
||||
Wire Wire Line
|
||||
1800 2950 3775 2950
|
||||
Wire Wire Line
|
||||
2400 2800 2400 2850
|
||||
Wire Wire Line
|
||||
2700 1800 2650 1800
|
||||
Connection ~ 2700 2350
|
||||
Wire Wire Line
|
||||
5450 3550 5450 4000
|
||||
Wire Wire Line
|
||||
8700 3550 8700 3450
|
||||
Wire Wire Line
|
||||
8700 4550 8700 4600
|
||||
Wire Wire Line
|
||||
8050 4350 8050 4550
|
||||
Wire Wire Line
|
||||
7300 4350 7300 4450
|
||||
Wire Wire Line
|
||||
7300 3450 7300 3850
|
||||
Wire Wire Line
|
||||
8050 3950 8050 3900
|
||||
Wire Wire Line
|
||||
8400 3750 6900 3750
|
||||
Wire Wire Line
|
||||
6900 3750 6900 3850
|
||||
Wire Wire Line
|
||||
8500 4000 8500 4150
|
||||
Wire Wire Line
|
||||
8050 3900 7500 3900
|
||||
Wire Wire Line
|
||||
7500 3900 7500 4650
|
||||
Wire Wire Line
|
||||
7500 4650 6550 4650
|
||||
Wire Wire Line
|
||||
2150 2000 2200 2000
|
||||
Wire Wire Line
|
||||
2200 2000 2200 2050
|
||||
Wire Wire Line
|
||||
3500 4950 3550 4950
|
||||
Wire Wire Line
|
||||
3550 4950 3550 4750
|
||||
Wire Wire Line
|
||||
3550 4750 3500 4750
|
||||
Wire Wire Line
|
||||
2900 4750 1450 4750
|
||||
Wire Wire Line
|
||||
1450 4750 1450 2200
|
||||
Wire Wire Line
|
||||
1450 2200 2250 2200
|
||||
Wire Wire Line
|
||||
3500 5150 5950 5150
|
||||
Wire Wire Line
|
||||
5950 5150 5950 4650
|
||||
Wire Wire Line
|
||||
5950 4650 6050 4650
|
||||
Wire Wire Line
|
||||
7300 2950 7300 2900
|
||||
Connection ~ 7300 2900
|
||||
Wire Wire Line
|
||||
8700 2950 8700 2900
|
||||
Connection ~ 8700 2900
|
||||
Wire Wire Line
|
||||
8900 3050 9200 3050
|
||||
Text Label 8900 3050 0 60 ~ 0
|
||||
MBus+
|
||||
Text Label 3550 5150 0 60 ~ 0
|
||||
RxD (receive from MBus)
|
||||
Text Label 3550 5050 0 60 ~ 0
|
||||
TxD (send to MBus)
|
||||
Text Label 3550 5250 0 60 ~ 0
|
||||
USB GND
|
||||
Text Label 3550 4950 0 60 ~ 0
|
||||
USB +5V
|
||||
Text Notes 2000 5050 0 60 ~ 0
|
||||
To USB serial adapter\n(e.g. PL2303,\nwith 3.3V/5V levels)
|
||||
$Comp
|
||||
L CONN_2 P1
|
||||
U 1 1 4EAA8D88
|
||||
P 1800 1900
|
||||
F 0 "P1" V 1750 1900 40 0000 C CNN
|
||||
F 1 "CONN_2" V 1850 1900 40 0000 C CNN
|
||||
1 1800 1900
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_2 P3
|
||||
U 1 1 4EAA8D6F
|
||||
P 9550 3150
|
||||
F 0 "P3" V 9500 3150 40 0000 C CNN
|
||||
F 1 "CONN_2" V 9600 3150 40 0000 C CNN
|
||||
1 9550 3150
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR2
|
||||
U 1 1 4EAA8D62
|
||||
P 2200 2050
|
||||
F 0 "#PWR2" H 2200 2050 30 0001 C CNN
|
||||
F 1 "GND" H 2200 1980 30 0001 C CNN
|
||||
1 2200 2050
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR5
|
||||
U 1 1 4EAA8D58
|
||||
P 3550 5300
|
||||
F 0 "#PWR5" H 3550 5300 30 0001 C CNN
|
||||
F 1 "GND" H 3550 5230 30 0001 C CNN
|
||||
1 3550 5300
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L INDUCTOR L1
|
||||
U 1 1 4EAA8D47
|
||||
P 3200 4750
|
||||
F 0 "L1" V 3150 4750 40 0000 C CNN
|
||||
F 1 "INDUCTOR" V 3300 4750 40 0000 C CNN
|
||||
1 3200 4750
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L CONN_4 P2
|
||||
U 1 1 4EAA8D01
|
||||
P 3150 5100
|
||||
F 0 "P2" V 3100 5100 50 0000 C CNN
|
||||
F 1 "CONN_4" V 3200 5100 50 0000 C CNN
|
||||
1 3150 5100
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR11
|
||||
U 1 1 4EAA8A6A
|
||||
P 7300 4450
|
||||
F 0 "#PWR11" H 7300 4450 30 0001 C CNN
|
||||
F 1 "GND" H 7300 4380 30 0001 C CNN
|
||||
1 7300 4450
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR12
|
||||
U 1 1 4EAA8A65
|
||||
P 7700 4550
|
||||
F 0 "#PWR12" H 7700 4550 30 0001 C CNN
|
||||
F 1 "GND" H 7700 4480 30 0001 C CNN
|
||||
1 7700 4550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR10
|
||||
U 1 1 4EAA8A62
|
||||
P 6900 4450
|
||||
F 0 "#PWR10" H 6900 4450 30 0001 C CNN
|
||||
F 1 "GND" H 6900 4380 30 0001 C CNN
|
||||
1 6900 4450
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR13
|
||||
U 1 1 4EAA8A5F
|
||||
P 8050 4550
|
||||
F 0 "#PWR13" H 8050 4550 30 0001 C CNN
|
||||
F 1 "GND" H 8050 4480 30 0001 C CNN
|
||||
1 8050 4550
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR14
|
||||
U 1 1 4EAA8A57
|
||||
P 8700 4600
|
||||
F 0 "#PWR14" H 8700 4600 30 0001 C CNN
|
||||
F 1 "GND" H 8700 4530 30 0001 C CNN
|
||||
1 8700 4600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R7
|
||||
U 1 1 4EAA8A32
|
||||
P 6300 4650
|
||||
F 0 "R7" V 6380 4650 50 0000 C CNN
|
||||
F 1 "1k" V 6300 4650 50 0000 C CNN
|
||||
1 6300 4650
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R11
|
||||
U 1 1 4EAA8A2E
|
||||
P 7700 4200
|
||||
F 0 "R11" V 7780 4200 50 0000 C CNN
|
||||
F 1 "3k3" V 7700 4200 50 0000 C CNN
|
||||
1 7700 4200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R9
|
||||
U 1 1 4EAA8A2B
|
||||
P 7300 4100
|
||||
F 0 "R9" V 7380 4100 50 0000 C CNN
|
||||
F 1 "22k" V 7300 4100 50 0000 C CNN
|
||||
1 7300 4100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R6
|
||||
U 1 1 4EAA8A29
|
||||
P 6300 4050
|
||||
F 0 "R6" V 6380 4050 50 0000 C CNN
|
||||
F 1 "1k" V 6300 4050 50 0000 C CNN
|
||||
1 6300 4050
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R13
|
||||
U 1 1 4EAA8A22
|
||||
P 8700 4300
|
||||
F 0 "R13" V 8780 4300 50 0000 C CNN
|
||||
F 1 "82" V 8700 4300 50 0000 C CNN
|
||||
1 8700 4300
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R8
|
||||
U 1 1 4EAA8A1F
|
||||
P 7300 3200
|
||||
F 0 "R8" V 7380 3200 50 0000 C CNN
|
||||
F 1 "39k" V 7300 3200 50 0000 C CNN
|
||||
1 7300 3200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R10
|
||||
U 1 1 4EAA8A1D
|
||||
P 7700 3200
|
||||
F 0 "R10" V 7780 3200 50 0000 C CNN
|
||||
F 1 "33k" V 7700 3200 50 0000 C CNN
|
||||
1 7700 3200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R12
|
||||
U 1 1 4EAA8A07
|
||||
P 8700 3200
|
||||
F 0 "R12" V 8780 3200 50 0000 C CNN
|
||||
F 1 "220k" V 8700 3200 50 0000 C CNN
|
||||
1 8700 3200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L BC237 Q2
|
||||
U 1 1 4EAA89E3
|
||||
P 8150 4150
|
||||
F 0 "Q2" H 8350 4050 50 0000 C CNN
|
||||
F 1 "BC337" H 8400 4300 50 0000 C CNN
|
||||
F 2 "TO92-EBC" H 8340 4150 30 0001 C CNN
|
||||
1 8150 4150
|
||||
-1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L DIODE D1
|
||||
U 1 1 4EAA899B
|
||||
P 2450 1800
|
||||
F 0 "D1" H 2450 1900 40 0000 C CNN
|
||||
F 1 "DIODE" H 2450 1700 40 0000 C CNN
|
||||
1 2450 1800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR3
|
||||
U 1 1 4EAA895D
|
||||
P 2400 2850
|
||||
F 0 "#PWR3" H 2400 2850 30 0001 C CNN
|
||||
F 1 "GND" H 2400 2780 30 0001 C CNN
|
||||
1 2400 2850
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR9
|
||||
U 1 1 4EAA88DA
|
||||
P 5450 4500
|
||||
F 0 "#PWR9" H 5450 4500 30 0001 C CNN
|
||||
F 1 "GND" H 5450 4430 30 0001 C CNN
|
||||
1 5450 4500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR8
|
||||
U 1 1 4EAA88D5
|
||||
P 4750 4500
|
||||
F 0 "#PWR8" H 4750 4500 30 0001 C CNN
|
||||
F 1 "GND" H 4750 4430 30 0001 C CNN
|
||||
1 4750 4500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR6
|
||||
U 1 1 4EAA888F
|
||||
P 3600 3800
|
||||
F 0 "#PWR6" H 3600 3800 30 0001 C CNN
|
||||
F 1 "GND" H 3600 3730 30 0001 C CNN
|
||||
1 3600 3800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L DIODESCH D3
|
||||
U 1 1 4EAA8633
|
||||
P 4050 3600
|
||||
F 0 "D3" H 4050 3700 40 0000 C CNN
|
||||
F 1 "DIODESCH" H 4050 3500 40 0000 C CNN
|
||||
1 4050 3600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L DIODE D2
|
||||
U 1 1 4EAA862B
|
||||
P 2450 2200
|
||||
F 0 "D2" H 2450 2300 40 0000 C CNN
|
||||
F 1 "DIODE" H 2450 2100 40 0000 C CNN
|
||||
1 2450 2200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L INDUCTOR L3
|
||||
U 1 1 4EAA8616
|
||||
P 5100 3900
|
||||
F 0 "L3" V 5050 3900 40 0000 C CNN
|
||||
F 1 "INDUCTOR" V 5200 3900 40 0000 C CNN
|
||||
1 5100 3900
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L INDUCTOR L2
|
||||
U 1 1 4EAA860E
|
||||
P 3775 3275
|
||||
F 0 "L2" V 3725 3275 40 0000 C CNN
|
||||
F 1 "150uH" V 3875 3275 40 0000 C CNN
|
||||
1 3775 3275
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L FUSE F1
|
||||
U 1 1 4EAA8605
|
||||
P 5450 3300
|
||||
F 0 "F1" H 5550 3350 40 0000 C CNN
|
||||
F 1 "FUSE" H 5350 3250 40 0000 C CNN
|
||||
1 5450 3300
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L CP1 C3
|
||||
U 1 1 4EAA85ED
|
||||
P 4750 4200
|
||||
F 0 "C3" H 4800 4300 50 0000 L CNN
|
||||
F 1 "47u" H 4800 4100 50 0000 L CNN
|
||||
1 4750 4200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CP1 C4
|
||||
U 1 1 4EAA85E6
|
||||
P 5450 4200
|
||||
F 0 "C4" H 5500 4300 50 0000 L CNN
|
||||
F 1 "47u" H 5500 4100 50 0000 L CNN
|
||||
1 5450 4200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L CP1 C2
|
||||
U 1 1 4EAA85E2
|
||||
P 2400 2600
|
||||
F 0 "C2" H 2450 2700 50 0000 L CNN
|
||||
F 1 "22u / 50V" H 2450 2500 50 0000 L CNN
|
||||
1 2400 2600
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R2
|
||||
U 1 1 4EAA85C4
|
||||
P 3300 3200
|
||||
F 0 "R2" V 3380 3200 50 0000 C CNN
|
||||
F 1 "180" V 3300 3200 50 0000 C CNN
|
||||
1 3300 3200
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R1
|
||||
U 1 1 4EAA85BA
|
||||
P 2200 3200
|
||||
F 0 "R1" V 2280 3200 50 0000 C CNN
|
||||
F 1 "0.47" V 2200 3200 50 0000 C CNN
|
||||
1 2200 3200
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR7
|
||||
U 1 1 4EAA85A1
|
||||
P 3600 4500
|
||||
F 0 "#PWR7" H 3600 4500 30 0001 C CNN
|
||||
F 1 "GND" H 3600 4430 30 0001 C CNN
|
||||
1 3600 4500
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR1
|
||||
U 1 1 4EAA8599
|
||||
P 1800 4350
|
||||
F 0 "#PWR1" H 1800 4350 30 0001 C CNN
|
||||
F 1 "GND" H 1800 4280 30 0001 C CNN
|
||||
1 1800 4350
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L C C1
|
||||
U 1 1 4EAA8585
|
||||
P 1800 4100
|
||||
F 0 "C1" H 1850 4200 50 0000 L CNN
|
||||
F 1 "330p" H 1850 4000 50 0000 L CNN
|
||||
1 1800 4100
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R5
|
||||
U 1 1 4EAA8565
|
||||
P 4450 3900
|
||||
F 0 "R5" V 4530 3900 50 0000 C CNN
|
||||
F 1 "22k" V 4450 3900 50 0000 C CNN
|
||||
1 4450 3900
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R4
|
||||
U 1 1 4EAA855B
|
||||
P 3900 3900
|
||||
F 0 "R4" V 3980 3900 50 0000 C CNN
|
||||
F 1 "100k" V 3900 3900 50 0000 C CNN
|
||||
1 3900 3900
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R3
|
||||
U 1 1 4EAA8543
|
||||
P 3600 4200
|
||||
F 0 "R3" V 3680 4200 50 0000 C CNN
|
||||
F 1 "4k7" V 3600 4200 50 0000 C CNN
|
||||
1 3600 4200
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L GND #PWR4
|
||||
U 1 1 4EAA84C7
|
||||
P 2700 4350
|
||||
F 0 "#PWR4" H 2700 4350 30 0001 C CNN
|
||||
F 1 "GND" H 2700 4280 30 0001 C CNN
|
||||
1 2700 4350
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L MC34063 U1
|
||||
U 1 1 4EAA8411
|
||||
P 2700 3700
|
||||
F 0 "U1" H 2850 4050 60 0000 L CNN
|
||||
F 1 "MC34063" H 2800 3350 60 0000 L CNN
|
||||
1 2700 3700
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L BC307 Q3
|
||||
U 1 1 4EAA83EE
|
||||
P 8600 3750
|
||||
F 0 "Q3" H 8800 3650 50 0000 C CNN
|
||||
F 1 "BD136" H 8850 3900 50 0000 C CNN
|
||||
1 8600 3750
|
||||
1 0 0 1
|
||||
$EndComp
|
||||
$Comp
|
||||
L BC237 Q1
|
||||
U 1 1 4EAA83E1
|
||||
P 6800 4050
|
||||
F 0 "Q1" H 7000 3950 50 0000 C CNN
|
||||
F 1 "BC337" H 7050 4200 50 0000 C CNN
|
||||
F 2 "TO92-EBC" H 6990 4050 30 0001 C CNN
|
||||
1 6800 4050
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$EndSCHEMATC
|
||||
|
@ -1426,7 +1426,7 @@ mbus_sendrecv_request(mbus_handle *handle, int address, mbus_frame *reply, int m
|
||||
// more records are available.
|
||||
//
|
||||
|
||||
if (reply_data.type == MBUS_DATA_TYPE_FIXED)
|
||||
if (reply_data.type != MBUS_DATA_TYPE_VARIABLE)
|
||||
{
|
||||
// only single frame replies for FIXED type frames
|
||||
more_frames = 0;
|
||||
|
@ -265,9 +265,11 @@ mbus_frame_type(mbus_frame *frame)
|
||||
//
|
||||
// Possible checks:
|
||||
//
|
||||
// 1) Start/stop bytes
|
||||
// 2) length field and actual data size
|
||||
// 3) checksum
|
||||
// 1) frame type
|
||||
// 2) Start/stop bytes
|
||||
// 3) control field
|
||||
// 4) length field and actual data size
|
||||
// 5) checksum
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
int
|
||||
@ -290,6 +292,17 @@ mbus_frame_verify(mbus_frame *frame)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((frame->control != MBUS_CONTROL_MASK_SND_NKE) &&
|
||||
(frame->control != MBUS_CONTROL_MASK_REQ_UD1) &&
|
||||
(frame->control != MBUS_CONTROL_MASK_REQ_UD1 | MBUS_CONTROL_MASK_FCB) &&
|
||||
(frame->control != MBUS_CONTROL_MASK_REQ_UD2) &&
|
||||
(frame->control != MBUS_CONTROL_MASK_REQ_UD2 | MBUS_CONTROL_MASK_FCB))
|
||||
{
|
||||
snprintf(error_str, sizeof(error_str), "Unknown Control Code 0x%.2x", frame->control);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MBUS_FRAME_TYPE_CONTROL:
|
||||
@ -302,6 +315,18 @@ mbus_frame_verify(mbus_frame *frame)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((frame->control != MBUS_CONTROL_MASK_SND_UD) &&
|
||||
(frame->control != MBUS_CONTROL_MASK_SND_UD | MBUS_CONTROL_MASK_FCB) &&
|
||||
(frame->control != MBUS_CONTROL_MASK_RSP_UD) &&
|
||||
(frame->control != MBUS_CONTROL_MASK_RSP_UD | MBUS_CONTROL_MASK_DFC) &&
|
||||
(frame->control != MBUS_CONTROL_MASK_RSP_UD | MBUS_CONTROL_MASK_ACD) &&
|
||||
(frame->control != MBUS_CONTROL_MASK_RSP_UD | MBUS_CONTROL_MASK_DFC | MBUS_CONTROL_MASK_ACD))
|
||||
{
|
||||
snprintf(error_str, sizeof(error_str), "Unknown Control Code 0x%.2x", frame->control);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (frame->length1 != frame->length2)
|
||||
{
|
||||
snprintf(error_str, sizeof(error_str), "Frame length 1 != 2");
|
||||
@ -1595,7 +1620,6 @@ mbus_vif_unit_lookup(u_char vif)
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
snprintf(buff, sizeof(buff), "Unknown (VIF=0x%.2X)", vif);
|
||||
break;
|
||||
}
|
||||
@ -1604,6 +1628,68 @@ mbus_vif_unit_lookup(u_char vif)
|
||||
return buff;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Lookup the error message
|
||||
//
|
||||
// See section 6.6 Codes for general application errors in the M-BUS spec
|
||||
//------------------------------------------------------------------------------
|
||||
const char *
|
||||
mbus_data_error_lookup(int error)
|
||||
{
|
||||
static char buff[256];
|
||||
|
||||
switch (error)
|
||||
{
|
||||
case MBUS_ERROR_DATA_UNSPECIFIED:
|
||||
snprintf(buff, sizeof(buff), "Unspecified error");
|
||||
break;
|
||||
|
||||
case MBUS_ERROR_DATA_UNIMPLEMENTED_CI:
|
||||
snprintf(buff, sizeof(buff), "Unimplemented CI-Field");
|
||||
break;
|
||||
|
||||
case MBUS_ERROR_DATA_BUFFER_TOO_LONG:
|
||||
snprintf(buff, sizeof(buff), "Buffer too long, truncated");
|
||||
break;
|
||||
|
||||
case MBUS_ERROR_DATA_TOO_MANY_RECORDS:
|
||||
snprintf(buff, sizeof(buff), "Too many records");
|
||||
break;
|
||||
|
||||
case MBUS_ERROR_DATA_PREMATURE_END:
|
||||
snprintf(buff, sizeof(buff), "Premature end of record");
|
||||
break;
|
||||
|
||||
case MBUS_ERROR_DATA_TOO_MANY_DIFES:
|
||||
snprintf(buff, sizeof(buff), "More than 10 DIFE´s");
|
||||
break;
|
||||
|
||||
case MBUS_ERROR_DATA_TOO_MANY_VIFES:
|
||||
snprintf(buff, sizeof(buff), "More than 10 VIFE´s");
|
||||
break;
|
||||
|
||||
case MBUS_ERROR_DATA_RESERVED:
|
||||
snprintf(buff, sizeof(buff), "Reserved");
|
||||
break;
|
||||
|
||||
case MBUS_ERROR_DATA_APPLICATION_BUSY:
|
||||
snprintf(buff, sizeof(buff), "Application busy");
|
||||
break;
|
||||
|
||||
case MBUS_ERROR_DATA_TOO_MANY_READOUTS:
|
||||
snprintf(buff, sizeof(buff), "Too many readouts");
|
||||
break;
|
||||
|
||||
default:
|
||||
snprintf(buff, sizeof(buff), "Unknown error (0x%.2X)", error);
|
||||
break;
|
||||
}
|
||||
|
||||
return buff;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Lookup the unit from the VIB (VIF or VIFE)
|
||||
//
|
||||
@ -2009,7 +2095,7 @@ mbus_data_record_function(mbus_data_record *record)
|
||||
|
||||
if (record)
|
||||
{
|
||||
switch (record->drh.dib.dif & 0x30)
|
||||
switch (record->drh.dib.dif & MBUS_DATA_RECORD_DIF_MASK_FUNCTION)
|
||||
{
|
||||
case 0x00:
|
||||
snprintf(buff, sizeof(buff), "Instantaneous value");
|
||||
@ -2366,21 +2452,50 @@ mbus_data_variable_parse(mbus_frame *frame, mbus_data_variable *data)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Check the stype of the frame data (fixed or variable) and dispatch to the
|
||||
/// Check the stype of the frame data (error, fixed or variable) and dispatch to the
|
||||
/// corresponding parser function.
|
||||
//------------------------------------------------------------------------------
|
||||
int
|
||||
mbus_frame_data_parse(mbus_frame *frame, mbus_frame_data *data)
|
||||
{
|
||||
if (frame && data && frame->data_size > 0)
|
||||
if (frame && data)
|
||||
{
|
||||
if (frame->control_information == MBUS_CONTROL_INFO_RESP_FIXED)
|
||||
if (frame->control_information == MBUS_CONTROL_INFO_ERROR_GENERAL)
|
||||
{
|
||||
data->type = MBUS_DATA_TYPE_ERROR;
|
||||
|
||||
if (frame->data_size > 0)
|
||||
{
|
||||
data->error = (int) frame->data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
data->error = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (frame->control_information == MBUS_CONTROL_INFO_RESP_FIXED)
|
||||
{
|
||||
if (frame->data_size == 0)
|
||||
{
|
||||
snprintf(error_str, sizeof(error_str), "Got zero data_size.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
data->type = MBUS_DATA_TYPE_FIXED;
|
||||
return mbus_data_fixed_parse(frame, &(data->data_fix));
|
||||
}
|
||||
else if (frame->control_information == MBUS_CONTROL_INFO_RESP_VARIABLE)
|
||||
{
|
||||
if (frame->data_size == 0)
|
||||
{
|
||||
snprintf(error_str, sizeof(error_str), "Got zero data_size.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
data->type = MBUS_DATA_TYPE_VARIABLE;
|
||||
return mbus_data_variable_parse(frame, &(data->data_var));
|
||||
}
|
||||
@ -2392,7 +2507,7 @@ mbus_frame_data_parse(mbus_frame *frame, mbus_frame_data *data)
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(error_str, sizeof(error_str), "Got null pointer to frame, data or zero data_size.");
|
||||
snprintf(error_str, sizeof(error_str), "Got null pointer to frame or data.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -2519,6 +2634,12 @@ mbus_frame_internal_pack(mbus_frame *frame, mbus_frame_data *frame_data)
|
||||
|
||||
switch (frame_data->type)
|
||||
{
|
||||
case MBUS_DATA_TYPE_ERROR:
|
||||
|
||||
frame->data[frame->data_size++] = (char) frame_data->error;
|
||||
|
||||
break;
|
||||
|
||||
case MBUS_DATA_TYPE_FIXED:
|
||||
|
||||
//
|
||||
@ -2656,6 +2777,11 @@ mbus_frame_data_print(mbus_frame_data *data)
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
if (data->type == MBUS_DATA_TYPE_ERROR)
|
||||
{
|
||||
return mbus_data_error_print(data->error);
|
||||
}
|
||||
|
||||
if (data->type == MBUS_DATA_TYPE_FIXED)
|
||||
{
|
||||
return mbus_data_fixed_print(&(data->data_fix));
|
||||
@ -2790,6 +2916,14 @@ mbus_data_fixed_print(mbus_data_fixed *data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
mbus_data_error_print(int error)
|
||||
{
|
||||
printf("%s: Error = %d\n", __PRETTY_FUNCTION__, error);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// XML RELATED FUNCTIONS
|
||||
@ -3031,6 +3165,30 @@ mbus_data_fixed_xml(mbus_data_fixed *data)
|
||||
return "";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Generate XML representation of a general application error.
|
||||
//------------------------------------------------------------------------------
|
||||
char *
|
||||
mbus_data_error_xml(int error)
|
||||
{
|
||||
static char buff[512];
|
||||
char str_encoded[256];
|
||||
size_t len = 0;
|
||||
|
||||
len += snprintf(&buff[len], sizeof(buff) - len, "<MBusData>\n\n");
|
||||
|
||||
len += snprintf(&buff[len], sizeof(buff) - len, " <SlaveInformation>\n");
|
||||
|
||||
mbus_str_xml_encode(str_encoded, mbus_data_error_lookup(error), sizeof(str_encoded));
|
||||
len += snprintf(&buff[len], sizeof(buff) - len, " <Error>%s</Error>\n", str_encoded);
|
||||
|
||||
len += snprintf(&buff[len], sizeof(buff) - len, " </SlaveInformation>\n\n");
|
||||
|
||||
len += snprintf(&buff[len], sizeof(buff) - len, "</MBusData>\n");
|
||||
|
||||
return buff;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Return a string containing an XML representation of the M-BUS frame data.
|
||||
//------------------------------------------------------------------------------
|
||||
@ -3039,6 +3197,11 @@ mbus_frame_data_xml(mbus_frame_data *data)
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
if (data->type == MBUS_DATA_TYPE_ERROR)
|
||||
{
|
||||
return mbus_data_error_xml(data->error);
|
||||
}
|
||||
|
||||
if (data->type == MBUS_DATA_TYPE_FIXED)
|
||||
{
|
||||
return mbus_data_fixed_xml(&(data->data_fix));
|
||||
@ -3071,20 +3234,29 @@ mbus_frame_xml(mbus_frame *frame)
|
||||
|
||||
if (frame)
|
||||
{
|
||||
if (frame->type == MBUS_DATA_TYPE_FIXED)
|
||||
{
|
||||
//
|
||||
// generate XML for fixed data
|
||||
//
|
||||
if (mbus_frame_data_parse(iter, &frame_data) == -1)
|
||||
if (mbus_frame_data_parse(frame, &frame_data) == -1)
|
||||
{
|
||||
mbus_error_str_set("M-bus data parse error.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (frame_data.type == MBUS_DATA_TYPE_ERROR)
|
||||
{
|
||||
//
|
||||
// generate XML for error
|
||||
//
|
||||
return mbus_data_error_xml(frame_data.error);
|
||||
}
|
||||
|
||||
if (frame_data.type == MBUS_DATA_TYPE_FIXED)
|
||||
{
|
||||
//
|
||||
// generate XML for fixed data
|
||||
//
|
||||
return mbus_data_fixed_xml(&(frame_data.data_fix));
|
||||
}
|
||||
|
||||
if (frame->type == MBUS_DATA_TYPE_VARIABLE)
|
||||
if (frame_data.type == MBUS_DATA_TYPE_VARIABLE)
|
||||
{
|
||||
//
|
||||
// generate XML for a sequence of variable data frames
|
||||
@ -3096,7 +3268,29 @@ mbus_frame_xml(mbus_frame *frame)
|
||||
|
||||
len += snprintf(&buff[len], sizeof(buff) - len, "<MBusData>\n\n");
|
||||
|
||||
for (iter = frame; iter; iter = iter->next, frame_cnt++)
|
||||
// only print the header info for the first frame (should be
|
||||
// the same for each frame in a sequence of a multi-telegram
|
||||
// transfer.
|
||||
len += snprintf(&buff[len], sizeof(buff) - len, "%s",
|
||||
mbus_data_variable_header_xml(&(frame_data.data_var.header)));
|
||||
|
||||
// loop through all records in the current frame, using a global
|
||||
// record count as record ID in the XML output
|
||||
for (record = frame_data.data_var.record; record; record = record->next, record_cnt++)
|
||||
{
|
||||
len += snprintf(&buff[len], sizeof(buff) - len, "%s",
|
||||
mbus_data_variable_record_xml(record, record_cnt, frame_cnt));
|
||||
}
|
||||
|
||||
// free all records in the list
|
||||
if (frame_data.data_var.record)
|
||||
{
|
||||
mbus_data_record_free(frame_data.data_var.record);
|
||||
}
|
||||
|
||||
frame_cnt++;
|
||||
|
||||
for (iter = frame->next; iter; iter = iter->next, frame_cnt++)
|
||||
{
|
||||
if (mbus_frame_data_parse(iter, &frame_data) == -1)
|
||||
{
|
||||
@ -3104,15 +3298,6 @@ mbus_frame_xml(mbus_frame *frame)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// only print the header info for the first frame (should be
|
||||
// the same for each frame in a sequence of a multi-telegram
|
||||
// transfer.
|
||||
if (frame_cnt < 1)
|
||||
{
|
||||
len += snprintf(&buff[len], sizeof(buff) - len, "%s",
|
||||
mbus_data_variable_header_xml(&(frame_data.data_var.header)));
|
||||
}
|
||||
|
||||
// loop through all records in the current frame, using a global
|
||||
// record count as record ID in the XML output
|
||||
for (record = frame_data.data_var.record; record; record = record->next, record_cnt++)
|
||||
|
@ -214,16 +214,19 @@ typedef struct _mbus_data_fixed {
|
||||
} mbus_data_fixed;
|
||||
|
||||
//
|
||||
// ABSTRACT DATA FORMAT (either fixed or variable length)
|
||||
// ABSTRACT DATA FORMAT (error, fixed or variable length)
|
||||
//
|
||||
#define MBUS_DATA_TYPE_FIXED 1
|
||||
#define MBUS_DATA_TYPE_VARIABLE 2
|
||||
#define MBUS_DATA_TYPE_ERROR 3
|
||||
|
||||
typedef struct _mbus_frame_data {
|
||||
|
||||
mbus_data_variable data_var;
|
||||
mbus_data_fixed data_fix;
|
||||
|
||||
int type;
|
||||
int error;
|
||||
|
||||
} mbus_frame_data;
|
||||
|
||||
@ -370,6 +373,14 @@ typedef struct _mbus_data_secondary_address {
|
||||
#define MBUS_CONTROL_INFO_EEPROM_READ 0xB4
|
||||
#define MBUS_CONTROL_INFO_SW_TEST_START 0xB6
|
||||
|
||||
//Mode 1 Mode 2 Application Definition in
|
||||
// 70h report of general application errors Usergroup March 94
|
||||
// 71h report of alarm status Usergroup March 94
|
||||
// 72h 76h variable data respond EN1434-3
|
||||
// 73h 77h fixed data respond EN1434-3
|
||||
#define MBUS_CONTROL_INFO_ERROR_GENERAL 0x70
|
||||
#define MBUS_CONTROL_INFO_STATUS_ALARM 0x71
|
||||
|
||||
#define MBUS_CONTROL_INFO_RESP_FIXED 0x73
|
||||
#define MBUS_CONTROL_INFO_RESP_FIXED_MSB 0x77
|
||||
|
||||
@ -394,9 +405,25 @@ typedef struct _mbus_data_secondary_address {
|
||||
#define MBUS_DATA_RECORD_DIF_MASK_MIN 0x10
|
||||
|
||||
#define MBUS_DATA_RECORD_DIF_MASK_TYPE_INT32 0x04
|
||||
#define MBUS_DATA_RECORD_DIF_MASK_DATA 0x0F
|
||||
#define MBUS_DATA_RECORD_DIF_MASK_FUNCTION 0x30
|
||||
#define MBUS_DATA_RECORD_DIF_MASK_STORAGE_NO 0x40
|
||||
#define MBUS_DATA_RECORD_DIF_MASK_EXTENTION 0x80
|
||||
#define MBUS_DATA_RECORD_DIF_MASK_NON_DATA 0xF0
|
||||
|
||||
//
|
||||
// GENERAL APPLICATION ERRORS
|
||||
//
|
||||
#define MBUS_ERROR_DATA_UNSPECIFIED 0x00
|
||||
#define MBUS_ERROR_DATA_UNIMPLEMENTED_CI 0x01
|
||||
#define MBUS_ERROR_DATA_BUFFER_TOO_LONG 0x02
|
||||
#define MBUS_ERROR_DATA_TOO_MANY_RECORDS 0x03
|
||||
#define MBUS_ERROR_DATA_PREMATURE_END 0x04
|
||||
#define MBUS_ERROR_DATA_TOO_MANY_DIFES 0x05
|
||||
#define MBUS_ERROR_DATA_TOO_MANY_VIFES 0x06
|
||||
#define MBUS_ERROR_DATA_RESERVED 0x07
|
||||
#define MBUS_ERROR_DATA_APPLICATION_BUSY 0x08
|
||||
#define MBUS_ERROR_DATA_TOO_MANY_READOUTS 0x09
|
||||
|
||||
//
|
||||
// FIXED DATA FLAGS
|
||||
@ -488,6 +515,7 @@ void mbus_str_xml_encode(u_char *dst, const u_char *src, size_t max_len);
|
||||
char *mbus_data_xml(mbus_frame_data *data);
|
||||
char *mbus_data_variable_xml(mbus_data_variable *data);
|
||||
char *mbus_data_fixed_xml(mbus_data_fixed *data);
|
||||
char *mbus_data_error_xml(int error);
|
||||
char *mbus_frame_data_xml(mbus_frame_data *data);
|
||||
|
||||
char *mbus_data_variable_header_xml(mbus_data_variable_header *header);
|
||||
@ -500,6 +528,7 @@ char *mbus_frame_xml(mbus_frame *frame);
|
||||
int mbus_frame_print(mbus_frame *frame);
|
||||
int mbus_frame_data_print(mbus_frame_data *data);
|
||||
int mbus_data_fixed_print(mbus_data_fixed *data);
|
||||
int mbus_data_error_print(int error);
|
||||
int mbus_data_variable_header_print(mbus_data_variable_header *header);
|
||||
int mbus_data_variable_print(mbus_data_variable *data);
|
||||
|
||||
@ -536,6 +565,7 @@ const char *mbus_data_fixed_unit(int medium_unit_byte);
|
||||
const char *mbus_data_variable_medium_lookup(u_char medium);
|
||||
const char *mbus_unit_prefix(int exp);
|
||||
|
||||
const char *mbus_data_error_lookup(int error);
|
||||
|
||||
const char *mbus_vib_unit_lookup(mbus_value_information_block *vib);
|
||||
const char *mbus_vif_unit_lookup(u_char vif);
|
||||
|
1
test/error-frames/application_busy.hex
Normal file
1
test/error-frames/application_busy.hex
Normal file
@ -0,0 +1 @@
|
||||
68 04 04 68 08 01 70 08 81 16
|
1
test/error-frames/buffer_too_long.hex
Normal file
1
test/error-frames/buffer_too_long.hex
Normal file
@ -0,0 +1 @@
|
||||
68 04 04 68 08 01 70 02 7B 16
|
1
test/error-frames/error.hex
Normal file
1
test/error-frames/error.hex
Normal file
@ -0,0 +1 @@
|
||||
68 03 03 68 08 01 70 79 16
|
1
test/error-frames/premature_end_of_record.hex
Normal file
1
test/error-frames/premature_end_of_record.hex
Normal file
@ -0,0 +1 @@
|
||||
68 04 04 68 08 01 70 04 7D 16
|
1
test/error-frames/too_many_difes.hex
Normal file
1
test/error-frames/too_many_difes.hex
Normal file
@ -0,0 +1 @@
|
||||
68 04 04 68 08 01 70 05 7E 16
|
1
test/error-frames/too_many_readouts.hex
Normal file
1
test/error-frames/too_many_readouts.hex
Normal file
@ -0,0 +1 @@
|
||||
68 04 04 68 08 01 70 09 82 16
|
1
test/error-frames/too_many_records.hex
Normal file
1
test/error-frames/too_many_records.hex
Normal file
@ -0,0 +1 @@
|
||||
68 04 04 68 08 01 70 03 7C 16
|
1
test/error-frames/too_many_vifes.hex
Normal file
1
test/error-frames/too_many_vifes.hex
Normal file
@ -0,0 +1 @@
|
||||
68 04 04 68 08 01 70 06 7F 16
|
1
test/error-frames/unimplemented_ci.hex
Normal file
1
test/error-frames/unimplemented_ci.hex
Normal file
@ -0,0 +1 @@
|
||||
68 04 04 68 08 01 70 01 7A 16
|
1
test/error-frames/unspecified_error.hex
Normal file
1
test/error-frames/unspecified_error.hex
Normal file
@ -0,0 +1 @@
|
||||
68 04 04 68 08 01 70 00 79 16
|
Loading…
x
Reference in New Issue
Block a user