From fea10954a69c4d7f4774ea6e9773adede4ce55ba Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Tue, 29 Nov 2011 06:33:47 +0000 Subject: [PATCH 01/20] [libgloss] * configure.in: Add rl78. * configure: Regenerate. * rl78: New directory [newlib] * configure.host: Add rl78. * libc/include/machine/ieeefp.h: Add rl78 support. * libc/include/machine/setjmp.h: Add rl78 support. * libc/machine/configure.in: Add rl78. * libc/machine/rl78: New directory. --- Makefile.in | 160 ++ abort.S | 50 + argv.S | 35 + argvlen.S | 35 + chdir.S | 35 + chmod.S | 35 + close.S | 35 + configure | 3815 ++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 55 + crt0.S | 327 +++++ crtn.S | 47 + exit.S | 43 + fstat.S | 35 + gcrt0.S | 58 + getpid.S | 36 + gettimeofday.S | 35 + isatty.S | 36 + kill.S | 35 + link.S | 35 + lseek.S | 35 + mcount.c | 422 ++++++ open.S | 35 + read.S | 35 + rl78-sim.ld | 224 +++ rl78-sys.h | 84 ++ rl78.ld | 224 +++ sbrk.c | 57 + stat.S | 35 + time.S | 35 + times.S | 35 + unlink.S | 35 + utime.S | 35 + write.c | 107 ++ 33 files changed, 6340 insertions(+) create mode 100644 Makefile.in create mode 100644 abort.S create mode 100644 argv.S create mode 100644 argvlen.S create mode 100644 chdir.S create mode 100644 chmod.S create mode 100644 close.S create mode 100644 configure create mode 100644 configure.in create mode 100644 crt0.S create mode 100644 crtn.S create mode 100644 exit.S create mode 100644 fstat.S create mode 100644 gcrt0.S create mode 100644 getpid.S create mode 100644 gettimeofday.S create mode 100644 isatty.S create mode 100644 kill.S create mode 100644 link.S create mode 100644 lseek.S create mode 100644 mcount.c create mode 100644 open.S create mode 100644 read.S create mode 100644 rl78-sim.ld create mode 100644 rl78-sys.h create mode 100644 rl78.ld create mode 100644 sbrk.c create mode 100644 stat.S create mode 100644 time.S create mode 100644 times.S create mode 100644 unlink.S create mode 100644 utime.S create mode 100644 write.c diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 000000000..bdb634032 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,160 @@ +# Copyright (c) 2008, 2009, 2011 Red Hat Inc +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. + +# Makefile for libgloss/rl78. + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ +AR_FLAGS = rc + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +SCRIPTS = $(srcdir)/rl78.ld $(srcdir)/rl78-sim.ld +CRT = gcrt0.o crt0.o crtn.o +SIM_BSP = libsim.a +LIBNOSYS = ../libnosys/libnosys.a +SIM_OBJS = \ + sbrk.o \ + exit.o \ + open.o \ + close.o \ + read.o \ + write.o \ + lseek.o \ + unlink.o \ + getpid.o \ + kill.o \ + fstat.o \ + argvlen.o \ + argv.o \ + chdir.o \ + stat.o \ + chmod.o \ + utime.o \ + time.o \ + gettimeofday.o \ + times.o \ + link.o \ + isatty.o \ + abort.o \ + mcount.o + +#### Host specific Makefile fragment comes in here. +@host_makefile_frag@ + + +# Override .S.o rule to pass assembler debugging flags +.S.o: + $(CC) -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< + +all: $(CRT) $(SIM_BSP) copy_scripts_to_objdir + +$(SIM_BSP): $(SIM_OBJS) + $(AR) $(ARFLAGS) $@ $? + $(RANLIB) $@ + +copy_scripts_to_objdir: $(SCRIPTS) + cp $(SCRIPTS) $(objdir) + +# Dependencies + +SDEPS = $(srcdir)/rl78-sys.h $(srcdir)/../syscall.h + +abort.o : $(SDEPS) +argv.o : $(SDEPS) +argvlen.o : $(SDEPS) +chdir.o : $(SDEPS) +chmod.o : $(SDEPS) +close.o : $(SDEPS) +exit.o : $(SDEPS) +fstat.o : $(SDEPS) +getpid.o : $(SDEPS) +gettimeofday.o : $(SDEPS) +gcrt0.o: gcrt0.S crt0.S +kill.o : $(SDEPS) +link.o : $(SDEPS) +lseek.o : $(SDEPS) +mcount.o : $(SDEPS) +open.o : $(SDEPS) +read.o : $(SDEPS) +sigprocmask.o : $(SDEPS) +sleep.o : $(SDEPS) +stat.o : $(SDEPS) +time.o : $(SDEPS) +times.o : $(SDEPS) +unlink.o : $(SDEPS) +utime.o : $(SDEPS) +write.o : $(SDEPS) + +install: $(CRT) $(SIM_BSP) $(SCRIPTS) + for c in $(CRT) $(SIM_BSP); do \ + $(INSTALL_DATA) $$c $(tooldir)/lib${MULTISUBDIR}/$$c ;\ + done + for c in $(SCRIPTS); do \ + b=`basename $$c`; \ + $(INSTALL_DATA) $$c $(tooldir)/lib${MULTISUBDIR}/$$b ;\ + done + +clean mostlyclean: + rm -f *.o *.a + +distclean maintainer-clean realclean: clean + rm -f Makefile config.cache config.log config.status + +.PHONY: info dvi doc install-info clean-info +info doc dvi: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/abort.S b/abort.S new file mode 100644 index 000000000..c39932db7 --- /dev/null +++ b/abort.S @@ -0,0 +1,50 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + + .global _abort + .type _abort, @function +_abort: + /* This is for debuggers. The simulator stops here too. */ + brk + + movw ax, #42 + push ax + SYSCALL(SYS_kill) + pop ax + + /* Else, exit. */ + call !!__exit + + .size _abort, . - _abort + diff --git a/argv.S b/argv.S new file mode 100644 index 000000000..43be134a8 --- /dev/null +++ b/argv.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(argv) diff --git a/argvlen.S b/argvlen.S new file mode 100644 index 000000000..624b6bceb --- /dev/null +++ b/argvlen.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(argvlen) diff --git a/chdir.S b/chdir.S new file mode 100644 index 000000000..8344a823e --- /dev/null +++ b/chdir.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(chdir) diff --git a/chmod.S b/chmod.S new file mode 100644 index 000000000..6e6f338ae --- /dev/null +++ b/chmod.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(chmod) diff --git a/close.S b/close.S new file mode 100644 index 000000000..5b213905e --- /dev/null +++ b/close.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +OK(close) diff --git a/configure b/configure new file mode 100644 index 000000000..066c9a666 --- /dev/null +++ b/configure @@ -0,0 +1,3815 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.66. +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= + +ac_unique_file="crt0.S" +ac_subst_vars='LTLIBOBJS +LIBOBJS +host_makefile_frag_path +CCASFLAGS +CCAS +RANLIB +LD +AR +AS +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +am__leading_dot +CC +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_os +target_vendor +target_cpu +target +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='host_makefile_frag' +ac_user_opts=' +enable_option_checking +enable_dependency_tracking +' + ac_precious_vars='build_alias +host_alias +target_alias +CCAS +CCASFLAGS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + +Some influential environment variables: + CCAS assembler compiler command (defaults to CC) + CCASFLAGS assembler compiler flags (defaults to CFLAGS) + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.66 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.66. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir "$srcdir"/$libgloss_topdir; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in $libgloss_topdir \"$srcdir\"/$libgloss_topdir" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if test "${ac_cv_build+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if test "${ac_cv_host+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if test "${ac_cv_target+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -z "$CC" && as_fn_error $? "no acceptable cc found in \$PATH" "$LINENO" 5 +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using GNU C" >&5 +$as_echo_n "checking whether we are using GNU C... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_c_compiler_gnu=yes +else + ac_cv_c_compiler_gnu=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } + +if test $ac_cv_c_compiler_gnu = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +# By default we simply use the C compiler to build assembly code. + +test "${CCAS+set}" = set || CCAS=$CC +test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS + + + + +host_makefile_frag=${srcdir}/../config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.66. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.66, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +srcdir=${srcdir} +target=${target} +with_multisubdir=${with_multisubdir} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + +if $AWK 'BEGIN { getline <"/dev/null" }' /dev/null; then + ac_cs_awk_getline=: + ac_cs_awk_pipe_init= + ac_cs_awk_read_file=' + while ((getline aline < (F[key])) > 0) + print(aline) + close(F[key])' + ac_cs_awk_pipe_fini= +else + ac_cs_awk_getline=false + ac_cs_awk_pipe_init="print \"cat <<'|#_!!_#|' &&\"" + ac_cs_awk_read_file=' + print "|#_!!_#|" + print "cat " F[key] " &&" + '$ac_cs_awk_pipe_init + # The final `:' finishes the AND list. + ac_cs_awk_pipe_fini='END { print "|#_!!_#|"; print ":" }' +fi +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + +# Create commands to substitute file output variables. +{ + echo "cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1" && + echo 'cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&' && + echo "$ac_subst_files" | sed 's/.*/F["&"]="$&"/' && + echo "_ACAWK" && + echo "_ACEOF" +} >conf$$files.sh && +. ./conf$$files.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +rm -f conf$$files.sh + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + \$ac_cs_awk_pipe_init +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + if (nfields == 3 && !substed) { + key = field[2] + if (F[key] != "" && line ~ /^[ ]*@.*@[ ]*$/) { + \$ac_cs_awk_read_file + next + } + } + print line +} +\$ac_cs_awk_pipe_fini +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | +if $ac_cs_awk_getline; then + $AWK -f "$tmp/subs.awk" +else + $AWK -f "$tmp/subs.awk" | $SHELL +fi >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + "Makefile":F) . ${libgloss_topdir}/config-ml.in ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/configure.in b/configure.in new file mode 100644 index 000000000..04169f1b5 --- /dev/null +++ b/configure.in @@ -0,0 +1,55 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.59) +AC_INIT(crt0.S) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +LIB_AC_PROG_CC + +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB +LIB_AM_PROG_AS + +host_makefile_frag=${srcdir}/../config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_CONFIG_FILES(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +with_multisubdir=${with_multisubdir} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) +AC_OUTPUT diff --git a/crt0.S b/crt0.S new file mode 100644 index 000000000..d5c078df0 --- /dev/null +++ b/crt0.S @@ -0,0 +1,327 @@ +/* Copyright (c) 2011 Red Hat Incorporated. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + + This software is provided by the copyright holders and contributors + "AS IS" and any express or implied warranties, including, but not + limited to, the implied warranties of merchantability and fitness for + a particular purpose are disclaimed. In no event shall Red Hat + incorporated be liable for any direct, indirect, incidental, special, + exemplary, or consequential damages (including, but not limited to, + procurement of substitute goods or services; loss of use, data, or + profits; or business interruption) however caused and on any theory of + liability, whether in contract, strict liability, or tort (including + negligence or otherwise) arising in any way out of the use of this + software, even if advised of the possibility of such damage. */ + +#include "rl78-sys.h" + + .section ".vec","a" + .short _start + + .section ".ivec","a" +#define IV(x) .weak _##x##_handler | .short _##x##_handler +#define IVx() .short 0 + + /* To use a vector, simply define a global function named foo_handler() + for any IV(foo) listed below (i.e. tm05_handler) */ + + .global _interrupt_vector_table +_interrupt_vector_table: + IV(wdti) + IV(lvi) + IV(p0) + IV(p1) + IV(p2) + IV(p3) + IV(p4) + IV(p5) + + IV(st2) + IV(sr2) + IV(sre2) + IV(dma0) + IV(dma1) + IV(st0) + IV(sr0) + IV(tm01h) + + IV(st1) + IV(sr1) + IV(sre1) + IV(iica0) + IV(tm00) + IV(tm01) + IV(tm02) + IV(tm03) + + IV(ad) + IV(rtc) + IV(it) + IV(kr) + IV(st3) + IV(sr3) + IV(tm13) + IV(tm04) + + IV(tm05) + IV(tm06) + IV(tm07) + IV(p6) + IV(p7) + IV(p8) + IV(p9) + IV(p10) + + IV(p11) + IV(tm10) + IV(tm12) + IV(sre3) + IV(tm13h) + IV(md) + IV(iica1) + IV(fl) + + IV(dma2) + IV(dma3) + IV(tm14) + IV(tm15) + IV(tm16) + IV(tm17) + IVx() + IVx() + + IVx() + IVx() + IVx() + IVx() + IVx() + IV(brk) + /* Note: 126 vectors */ + + .section ".csstart", "ax" + .global __csstart +__csstart: + br !!_start + + .weak __rl78_option_byte_0 + .weak __rl78_option_byte_1 + .weak __rl78_option_byte_2 + .weak __rl78_option_byte_3 +__rl78_option_byte_0 = 0x6e +__rl78_option_byte_1 = 0xff +__rl78_option_byte_2 = 0xe8 +__rl78_option_byte_3 = 0x85 + + .section ".opt", "a" + .byte __rl78_option_byte_0 + .byte __rl78_option_byte_1 + .byte __rl78_option_byte_2 + .byte __rl78_option_byte_3 + + .text + + .global _start + .type _start, @function +_start: + movw sp, #__stack + + +;; block move to initialize .data + + ;; we're copying from 00:[_romdatastart] to 0F:[_datastart] + ;; and our data is not in the mirrored area. + mov es, #0 + + sel rb0 ; bank 0 + movw hl, #__datastart + movw de, #__romdatastart + sel rb1 ; bank 1 + movw ax, #__romdatacopysize + shrw ax,1 +1: + cmpw ax, #0 + bz $1f + decw ax + sel rb0 ; bank 0 + movw ax, es:[de] + movw [hl], ax + incw de + incw de + incw hl + incw hl + sel rb1 + br $1b +1: + sel rb0 ; bank 0 + + +;; block fill to .bss + + sel rb0 ; bank 0 + movw hl, #__bssstart + movw ax, #0 + sel rb1 ; bank 1 + movw ax, #__bsssize + shrw ax,1 +1: + cmpw ax, #0 + bz $1f + decw ax + sel rb0 ; bank 0 + movw [hl], ax + incw hl + incw hl + sel rb1 + br $1b +1: + sel rb0 ; bank 0 + + + + call !!__rl78_init + +#ifdef PROFILE_SUPPORT /* Defined in gcrt0.S. */ + movw ax, # _start + push ax + movw ax, # _etext + push ax + call !!__monstartup +#endif + + movw ax, #0 + push ax /* envp */ + push ax /* argv */ + push ax /* argc */ + call !!_main +.LFE2: + + movw ax, r8 ; Save return code. + push ax + +#ifdef PROFILE_SUPPORT + call !!__mcleanup +#endif + + call !!_exit + + .size _start, . - _start + + .global _rl78_run_preinit_array + .type _rl78_run_preinit_array,@function +_rl78_run_preinit_array: + movw hl, #__preinit_array_start + movw de, #__preinit_array_end + movw bc, #-2 + br $_rl78_run_inilist + + .global _rl78_run_init_array + .type _rl78_run_init_array,@function +_rl78_run_init_array: + movw hl, #__init_array_start + movw de, #__init_array_end + movw bc, #2 + br $_rl78_run_inilist + + .global _rl78_run_fini_array + .type _rl78_run_fini_array,@function +_rl78_run_fini_array: + movw hl, #__fini_array_start + movw de, #__fini_array_end + movw bc, #-2 + /* fall through */ + + ;; HL = start of list + ;; DE = end of list + ;; BC = step direction (+2 or -2) +_rl78_run_inilist: +next_inilist: + movw ax, hl + cmpw ax, de + bz $done_inilist + movw ax, [hl] + cmpw ax, #-1 + bz $skip_inilist + cmpw ax, #0 + bz $skip_inilist + push ax + push bc + push de + push hl + call ax + pop hl + pop de + pop bc + pop ax +skip_inilist: + movw ax, hl + addw ax, bc + movw hl, ax + br $next_inilist +done_inilist: + ret + + .section .init,"ax" + + .global __rl78_init +__rl78_init: + + .section .fini,"ax" + + .global __rl78_fini +__rl78_fini: + call !!_rl78_run_fini_array + + .section .data + .global ___dso_handle + .weak ___dso_handle +___dso_handle: + .long 0 + +;;; Provide Dwarf unwinding information that will help GDB stop +;;; backtraces at the right place. This is stolen from assembly +;;; code generated by GCC with -dA. + .section .debug_frame,"",@progbits +.Lframe0: + .4byte .LECIE0-.LSCIE0 ; Length of Common Information Entry +.LSCIE0: + .4byte 0xffffffff ; CIE Identifier Tag + .byte 0x1 ; CIE Version + .ascii "\0" ; CIE Augmentation + .uleb128 0x1 ; CIE Code Alignment Factor + .sleb128 -1 ; CIE Data Alignment Factor + .byte 0xd ; CIE RA Column + .byte 0xc ; DW_CFA_def_cfa + .uleb128 0xc + .uleb128 0x3 + .byte 0x8d ; DW_CFA_offset, column 0xd + .uleb128 0x3 + .p2align 2 +.LECIE0: +.LSFDE0: + .4byte .LEFDE0-.LASFDE0 ; FDE Length +.LASFDE0: + .4byte .Lframe0 ; FDE CIE offset + .4byte _start ; FDE initial location + .4byte .LFE2 - _start ; FDE address range + .byte 0xf ; DW_CFA_def_cfa_expression + .uleb128 1 ; length of expression + .byte 0x30 ; DW_OP_lit0 + .p2align 2 +.LEFDE0: + + .text diff --git a/crtn.S b/crtn.S new file mode 100644 index 000000000..8b3002c2d --- /dev/null +++ b/crtn.S @@ -0,0 +1,47 @@ +/* + +Copyright (c) 2005,2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + + .section .init,"ax" + call !!_rl78_run_preinit_array + call !!_rl78_run_init_array + ret + .global __rl78_init_end +__rl78_init_end: + + .section .fini,"ax" + + ret + .global __rl78_fini_end +__rl78_fini_end: + + .text + diff --git a/exit.S b/exit.S new file mode 100644 index 000000000..e394315ef --- /dev/null +++ b/exit.S @@ -0,0 +1,43 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + + .global __exit + .type __exit, @function +__exit: + call !!__rl78_fini + mov a, [sp+4] + halt + SYSCALL(SYS_exit) + .size __exit, . - __exit + diff --git a/fstat.S b/fstat.S new file mode 100644 index 000000000..1f68e6f37 --- /dev/null +++ b/fstat.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(fstat) diff --git a/gcrt0.S b/gcrt0.S new file mode 100644 index 000000000..a75614f89 --- /dev/null +++ b/gcrt0.S @@ -0,0 +1,58 @@ +/* Copyright (c) 2011 Red Hat Incorporated. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + + This software is provided by the copyright holders and contributors + "AS IS" and any express or implied warranties, including, but not + limited to, the implied warranties of merchantability and fitness for + a particular purpose are disclaimed. In no event shall Red Hat + incorporated be liable for any direct, indirect, incidental, special, + exemplary, or consequential damages (including, but not limited to, + procurement of substitute goods or services; loss of use, data, or + profits; or business interruption) however caused and on any theory of + liability, whether in contract, strict liability, or tort (including + negligence or otherwise) arising in any way out of the use of this + software, even if advised of the possibility of such damage. */ + +#define PROFILE_SUPPORT 1 + +#include "crt0.S" + + .global __mcount + .type __mcount, @function +__mcount: + ;; When a function is compiled for profiling, gcc creates code + ;; like this at the start of each profiled function: + ;; + ;; .global + ;; : + ;; bsr __mcount + ;; <...function's prologue...> + ;; <...function's body...> + ;; + ;; We must save all of the argument registers, extract the + ;; address of , call _mcount_internal to do the + ;; real work and then restore the argument registers before + ;; returning. + + movw ax, [sp] + push ax + call !!__mcount_internal + pop ax + ret + + .size __mcount, . - __mcount diff --git a/getpid.S b/getpid.S new file mode 100644 index 000000000..58e75ba15 --- /dev/null +++ b/getpid.S @@ -0,0 +1,36 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +RET(getpid,42) + diff --git a/gettimeofday.S b/gettimeofday.S new file mode 100644 index 000000000..1611e7db8 --- /dev/null +++ b/gettimeofday.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(gettimeofday) diff --git a/isatty.S b/isatty.S new file mode 100644 index 000000000..a77b3754a --- /dev/null +++ b/isatty.S @@ -0,0 +1,36 @@ +/* Copyright (c) 2011 Red Hat Incorporated. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "rl78-sys.h" + + .global _isatty + .weak _isatty +_isatty: + +RET(_isatty,1) + diff --git a/kill.S b/kill.S new file mode 100644 index 000000000..111b1114a --- /dev/null +++ b/kill.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(kill) diff --git a/link.S b/link.S new file mode 100644 index 000000000..152e65f07 --- /dev/null +++ b/link.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(link) diff --git a/lseek.S b/lseek.S new file mode 100644 index 000000000..8aa58cfa5 --- /dev/null +++ b/lseek.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(lseek) diff --git a/mcount.c b/mcount.c new file mode 100644 index 000000000..567abd0e5 --- /dev/null +++ b/mcount.c @@ -0,0 +1,422 @@ +/*- + * Copyright (c) 1983, 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* This file implements a subset of the profiling support functions. + It has been copied and adapted from mcount.c, gmon.c and gmon.h in + the glibc sources. + Since we do not have access to a timer interrupt in the simulator + the histogram and basic block information is not generated. */ + +#include +#include +#include +#include +#include + +/* Fraction of text space to allocate for histogram counters here, 1/2. */ +#define HISTFRACTION 2 + +/* Fraction of text space to allocate for from hash buckets. + The value of HASHFRACTION is based on the minimum number of bytes + of separation between two subroutine call points in the object code. + Given MIN_SUBR_SEPARATION bytes of separation the value of + HASHFRACTION is calculated as: + + HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof (short) - 1); + + For example, on the VAX, the shortest two call sequence is: + + calls $0,(r0) + calls $0,(r0) + + which is separated by only three bytes, thus HASHFRACTION is + calculated as: + + HASHFRACTION = 3 / (2 * 2 - 1) = 1 + + Note that the division above rounds down, thus if MIN_SUBR_FRACTION + is less than three, this algorithm will not work! + + In practice, however, call instructions are rarely at a minimal + distance. Hence, we will define HASHFRACTION to be 2 across all + architectures. This saves a reasonable amount of space for + profiling data structures without (in practice) sacrificing + any granularity. */ +#define HASHFRACTION 2 + +/* Percent of text space to allocate for tostructs. + This is a heuristic; we will fail with a warning when profiling + programs with a very large number of very small functions, but + that's normally OK. + 2 is probably still a good value for normal programs. + Profiling a test case with 64000 small functions will work if + you raise this value to 3 and link statically (which bloats the + text size, thus raising the number of arcs expected by the heuristic). */ +#define ARCDENSITY 3 + +/* Always allocate at least this many tostructs. This hides the + inadequacy of the ARCDENSITY heuristic, at least for small programs. */ +#define MINARCS 50 + +/* Maximum number of arcs we want to allow. + Used to be max representable value of ARCINDEX minus 2, but now + that ARCINDEX is a long, that's too large; we don't really want + to allow a 48 gigabyte table. + The old value of 1<<16 wasn't high enough in practice for large C++ + programs; will 1<<20 be adequate for long? FIXME */ +#define MAXARCS (1L << 20) + +#define SCALE_1_TO_1 0x10000L + +#define GMON_MAGIC "gmon" /* Magic cookie. */ +#define GMON_VERSION 1 /* Version number. */ + + +/* General rounding functions. */ +#define ROUNDDOWN(x ,y) (((x) / (y)) * (y)) +#define ROUNDUP(x, y) ((((x) + (y) - 1) / (y)) * (y)) + +struct tostruct +{ + unsigned long selfpc; + unsigned long count; + unsigned long link; +}; + +/* Possible states of profiling. */ +enum profiling_state +{ + GMON_PROF_OFF, + GMON_PROF_ON, + GMON_PROF_BUSY, + GMON_PROF_ERROR +}; + +/* The profiling data structures are housed in this structure. */ +struct gmonparam +{ + enum profiling_state state; + unsigned short * kcount; + unsigned long kcountsize; + unsigned long * froms; + unsigned long fromssize; + struct tostruct * tos; + unsigned long tossize; + long tolimit; + unsigned long lowpc; + unsigned long highpc; + unsigned long textsize; + unsigned long hashfraction; + long log_hashfraction; +}; + +/* Raw header as it appears in the gmon.out file (without padding). + This header always comes first and is then followed by a series + records defined below. */ +struct gmon_hdr +{ + char cookie[4]; + char version[4]; + char spare[3 * 4]; +}; + +/* Types of records in this file. */ +typedef enum +{ + GMON_TAG_TIME_HIST = 0, + GMON_TAG_CG_ARC = 1, +} GMON_Record_Tag; + +struct gmon_cg_arc_record +{ + char tag; /* Set to GMON_TAG_CG_ARC. */ + char from_pc[sizeof (char *)]; /* Address within caller's body. */ + char self_pc[sizeof (char *)]; /* Address within callee's body. */ + char count[4]; /* Number of arc traversals. */ +}; + + +/* Forward declarations. */ +void _mcount_internal (unsigned long); +void _monstartup (unsigned long, unsigned long); +void _mcleanup (void); + +static struct gmonparam _gmonparam; + +void +_mcount_internal (unsigned long frompc) +{ + unsigned long selfpc = frompc; + unsigned long * frompcindex; + struct tostruct * top; + struct tostruct * prevtop; + struct gmonparam * p; + unsigned long toindex; + int i; + + p = & _gmonparam; + + /* Check that we are profiling and that we aren't recursively invoked. + NB/ This version is not thread-safe. */ + if (p->state != GMON_PROF_ON) + return; + p->state = GMON_PROF_BUSY; + + /* Check that frompcindex is a reasonable pc value. + For example: signal catchers get called from the stack, + not from text space. Too bad. */ + frompc -= p->lowpc; + if (frompc > p->textsize) + goto done; + + i = frompc >> p->log_hashfraction; + + frompcindex = p->froms + i; + toindex = * frompcindex; + + if (toindex == 0) + { + /* First time traversing this arc. */ + toindex = ++ p->tos[0].link; + if (toindex >= p->tolimit) + /* Halt further profiling. */ + goto overflow; + + * frompcindex = toindex; + top = p->tos + toindex; + top->selfpc = selfpc; + top->count = 1; + top->link = 0; + goto done; + } + + top = p->tos + toindex; + + if (top->selfpc == selfpc) + { + /* Arc at front of chain: usual case. */ + top->count ++; + goto done; + } + + /* Have to go looking down chain for it. + Top points to what we are looking at, + prevtop points to previous top. + We know it is not at the head of the chain. */ + for (;;) + { + if (top->link == 0) + { + /* Top is end of the chain and none of the chain + had top->selfpc == selfpc. So we allocate a + new tostruct and link it to the head of the + chain. */ + toindex = ++ p->tos[0].link; + if (toindex >= p->tolimit) + goto overflow; + + top = p->tos + toindex; + top->selfpc = selfpc; + top->count = 1; + top->link = * frompcindex; + * frompcindex = toindex; + goto done; + } + + /* Otherwise, check the next arc on the chain. */ + prevtop = top; + top = p->tos + top->link; + + if (top->selfpc == selfpc) + { + /* There it is. Increment its count + move it to the head of the chain. */ + top->count ++; + toindex = prevtop->link; + prevtop->link = top->link; + top->link = * frompcindex; + * frompcindex = toindex; + goto done; + } + } + + done: + p->state = GMON_PROF_ON; + return; + + overflow: + p->state = GMON_PROF_ERROR; + return; +} + +void +_monstartup (unsigned long lowpc, unsigned long highpc) +{ + char * cp; + struct gmonparam * p = & _gmonparam; + + /* If the calloc() function has been instrumented we must make sure + that it is not profiled until we are ready. */ + p->state = GMON_PROF_BUSY; + + /* Round lowpc and highpc to multiples of the density we're using + so the rest of the scaling (here and in gprof) stays in ints. */ + p->lowpc = ROUNDDOWN (lowpc, HISTFRACTION * sizeof (* p->kcount)); + p->highpc = ROUNDUP (highpc, HISTFRACTION * sizeof (* p->kcount)); + p->textsize = p->highpc - p->lowpc; + p->kcountsize = ROUNDUP (p->textsize / HISTFRACTION, sizeof (*p->froms)); + p->hashfraction = HASHFRACTION; + p->log_hashfraction = -1; + p->log_hashfraction = ffs (p->hashfraction * sizeof (*p->froms)) - 1; + p->fromssize = p->textsize / HASHFRACTION; + p->tolimit = p->textsize * ARCDENSITY / 100; + + if (p->tolimit < MINARCS) + p->tolimit = MINARCS; + else if (p->tolimit > MAXARCS) + p->tolimit = MAXARCS; + + p->tossize = p->tolimit * sizeof (struct tostruct); + + cp = calloc (p->kcountsize + p->fromssize + p->tossize, 1); + if (cp == NULL) + { + write (2, "monstartup: out of memory\n", 26); + p->tos = NULL; + p->state = GMON_PROF_ERROR; + return; + } + + p->tos = (struct tostruct *) cp; + cp += p->tossize; + p->kcount = (unsigned short *) cp; + cp += p->kcountsize; + p->froms = (unsigned long *) cp; + + p->tos[0].link = 0; + p->state = GMON_PROF_ON; +} + + +static void +write_call_graph (int fd) +{ +#define NARCS_PER_WRITE 32 + + struct gmon_cg_arc_record raw_arc[NARCS_PER_WRITE] + __attribute__ ((aligned (__alignof__ (char *)))); + unsigned long from_index; + unsigned long to_index; + unsigned long from_len; + unsigned long frompc; + int nfilled; + + for (nfilled = 0; nfilled < NARCS_PER_WRITE; ++ nfilled) + raw_arc[nfilled].tag = GMON_TAG_CG_ARC; + + nfilled = 0; + from_len = _gmonparam.fromssize / sizeof (*_gmonparam.froms); + + for (from_index = 0; from_index < from_len; ++from_index) + { + if (_gmonparam.froms[from_index] == 0) + continue; + + frompc = _gmonparam.lowpc; + frompc += (from_index * _gmonparam.hashfraction + * sizeof (*_gmonparam.froms)); + + for (to_index = _gmonparam.froms[from_index]; + to_index != 0; + to_index = _gmonparam.tos[to_index].link) + { + struct gmon_cg_arc_record * arc = raw_arc + nfilled; + + memcpy (arc->from_pc, & frompc, sizeof (arc->from_pc)); + memcpy (arc->self_pc, & _gmonparam.tos[to_index].selfpc, sizeof (arc->self_pc)); + memcpy (arc->count, & _gmonparam.tos[to_index].count, sizeof (arc->count)); + + if (++ nfilled == NARCS_PER_WRITE) + { + write (fd, raw_arc, sizeof raw_arc); + nfilled = 0; + } + } + } + + if (nfilled > 0) + write (fd, raw_arc, nfilled * sizeof (raw_arc[0])); +} + +#include + +static void +write_gmon (void) +{ + struct gmon_hdr ghdr __attribute__ ((aligned (__alignof__ (int)))); + int fd; + + fd = open ("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666); + if (fd < 0) + { + write (2, "_mcleanup: could not create gmon.out\n", 37); + return; + } + + /* Write gmon.out header: */ + memset (& ghdr, '\0', sizeof (ghdr)); + memcpy (ghdr.cookie, GMON_MAGIC, sizeof (ghdr.cookie)); + * (unsigned long *) ghdr.version = GMON_VERSION; + write (fd, & ghdr, sizeof (ghdr)); + + /* We do not have histogram or basic block information, + so we do not generate these parts of the gmon.out file. */ + + /* Write call-graph. */ + write_call_graph (fd); + + close (fd); +} + +void +_mcleanup (void) +{ + if (_gmonparam.state != GMON_PROF_ERROR) + { + _gmonparam.state = GMON_PROF_OFF; + write_gmon (); + } + + /* Free the memory. */ + if (_gmonparam.tos != NULL) + { + free (_gmonparam.tos); + _gmonparam.tos = NULL; + } +} diff --git a/open.S b/open.S new file mode 100644 index 000000000..ae83e0ba9 --- /dev/null +++ b/open.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(open) diff --git a/read.S b/read.S new file mode 100644 index 000000000..9cbea1dfd --- /dev/null +++ b/read.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(read) diff --git a/rl78-sim.ld b/rl78-sim.ld new file mode 100644 index 000000000..f69fb95d5 --- /dev/null +++ b/rl78-sim.ld @@ -0,0 +1,224 @@ +/* + +Copyright (c) 2005,2008,2009,2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +/* Default linker script, for normal executables */ +OUTPUT_ARCH(rl78) +ENTRY(_start) + +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +/* This is for the simulator - 512k flash, 32k ram, no data flash */ +MEMORY { + VEC (r) : ORIGIN = 0x00000, LENGTH = 0x00002 + IVEC (r) : ORIGIN = 0x00004, LENGTH = 0x0007c + OPT (r) : ORIGIN = 0x000c0, LENGTH = 0x00004 + ROM (r) : ORIGIN = 0x000d8, LENGTH = 0x7ff28 + RAM (w) : ORIGIN = 0xf8000, LENGTH = 0x07ee0 + STACK (w) : ORIGIN = 0xffee0, LENGTH = 0x00002 +} + +SECTIONS +{ + .vec : + { + *(.vec) + } > VEC + .ivec : + { + *(.ivec) + } > IVEC + .opt : + { + *(.opt) + } > OPT + + /* CubeSuite always starts at 0xd8. */ + .csstart : { + *(.csstart) + } > ROM + + /* For code that must be in the first 64k, or could fill unused + space below .rodata. */ + .lowtext : { + *(.plt) + *(.lowtext) + } > ROM + + .data : { + . = ALIGN(2); + PROVIDE (__datastart = .); + + KEEP (*(.jcr)) + *(.data.rel.ro.local) *(.data.rel.ro*) + *(.dynamic) + + *(.data D .data.* .gnu.linkonce.d.*) + KEEP (*(.gnu.linkonce.d.*personality*)) + SORT(CONSTRUCTORS) + *(.data1) + *(.got.plt) *(.got) + + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + . = ALIGN(2); + *(.sdata .sdata.* .gnu.linkonce.s.* D_2 D_1) + + . = ALIGN(2); + _edata = .; + PROVIDE (edata = .); + PROVIDE (__dataend = .); + } > RAM AT> ROM + + /* Note that crt0 assumes this is a multiple of two; all the + start/stop symbols are also assumed word-aligned. */ + PROVIDE(__romdatastart = LOADADDR(.data)); + PROVIDE (__romdatacopysize = SIZEOF(.data)); + + .bss : { + . = ALIGN(2); + PROVIDE (__bssstart = .); + *(.dynbss) + *(.sbss .sbss.*) + *(.bss B B_2 B_1 .bss.* .gnu.linkonce.b.*) + . = ALIGN(2); + *(COMMON) + . = ALIGN(2); + PROVIDE (__bssend = .); + _end = .; + PROVIDE (end = .); + } > RAM + PROVIDE (__bsssize = SIZEOF(.bss)); + + .stack (ORIGIN (STACK)) : + { + PROVIDE (__stack = .); + *(.stack) + } + + .rodata (MAX(__romdatastart + __romdatacopysize, 0x1000)) : { + . = ALIGN(2); + *(.plt) + *(.rodata C C_2 C_1 .rodata.* .gnu.linkonce.r.*) + *(.rodata1) + *(.eh_frame_hdr) + KEEP (*(.eh_frame)) + KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) + PROVIDE (__preinit_array_start = .); + KEEP (*(.preinit_array)) + PROVIDE (__preinit_array_end = .); + PROVIDE (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE (__init_array_end = .); + PROVIDE (__fini_array_start = .); + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + PROVIDE (__fini_array_end = .); + LONG(0); /* Sentinel. */ + + /* gcc uses crtbegin.o to find the start of the constructors, so + we make sure it is first. Because this is a wildcard, it + doesn't matter if the user does not actually link against + crtbegin.o; the linker won't look for a file to match a + wildcard. The wildcard also means that it doesn't matter which + directory crtbegin.o is in. */ + KEEP (*crtbegin*.o(.ctors)) + + /* We don't want to include the .ctor section from from the + crtend.o file until after the sorted ctors. The .ctor section + from the crtend file contains the end of ctors marker and it + must be last */ + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + + KEEP (*crtbegin*.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } > ROM + + .text : + { + PROVIDE (_start = .); + *(.text P .stub .text.* .gnu.linkonce.t.*) + KEEP (*(.text.*personality*)) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.interp .hash .dynsym .dynstr .gnu.version*) + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + . = ALIGN(2); + KEEP (*(.init)) + KEEP (*(.fini)) + } > ROM + + /* The rest are all not normally part of the runtime image. */ + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /DISCARD/ : { *(.note.GNU-stack) } +} diff --git a/rl78-sys.h b/rl78-sys.h new file mode 100644 index 000000000..281dad07f --- /dev/null +++ b/rl78-sys.h @@ -0,0 +1,84 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "syscall.h" + +r8 = 0xffef0 +r9 = 0xffef1 +r10 = 0xffef2 +r11 = 0xffef3 +r12 = 0xffef4 +r13 = 0xffef5 +r14 = 0xffef6 +r15 = 0xffef7 +r16 = 0xffee8 +r17 = 0xffee9 +r18 = 0xffeea +r19 = 0xffeeb +r20 = 0xffeec +r21 = 0xffeed +r22 = 0xffeee +r23 = 0xffeef + +#define SYS__exit SYS_exit + + .macro syscall_body number + /* The RL78 doesn't really have an "interrupt" upcode, just + BRK, which we emulate exactly. We use the STOP opcode, + which is a breakpoint in the simulator. */ + mov A, #\number + stop + ret + .endm + + .macro do_syscall name number +__\name: + .global __\name +_\name: + .weak _\name + syscall_body \number + .endm + + .macro syscall_returns name number +__\name: + .global __\name +_\name: + .weak _\name + mov r8, #\number + ret + .endm + +#define S(name) do_syscall name, SYS_##name +#define SYSCALL(number) syscall_body number +#define ERR(name) syscall_returns name, -1 +#define OK(name) syscall_returns name, 0 +#define RET(name,val) syscall_returns name, val diff --git a/rl78.ld b/rl78.ld new file mode 100644 index 000000000..f062e2c90 --- /dev/null +++ b/rl78.ld @@ -0,0 +1,224 @@ +/* + +Copyright (c) 2005,2008,2009,2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +/* Default linker script, for normal executables */ +OUTPUT_ARCH(rl78) +ENTRY(_start) + +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +/* This is for an RL78/G13, 64k flash, 4k ram */ +MEMORY { + VEC (r) : ORIGIN = 0x00000, LENGTH = 0x00002 + IVEC (r) : ORIGIN = 0x00004, LENGTH = 0x0007c + OPT (r) : ORIGIN = 0x000c0, LENGTH = 0x00004 + ROM (r) : ORIGIN = 0x000d8, LENGTH = 0x0ff28 + RAM (w) : ORIGIN = 0xfef00, LENGTH = 0x00fe0 + STACK (w) : ORIGIN = 0xffee0, LENGTH = 0x00002 +} + +SECTIONS +{ + .vec : + { + *(.vec) + } > VEC + .ivec : + { + *(.ivec) + } > IVEC + .opt : + { + *(.opt) + } > OPT + + /* CubeSuite always starts at 0xd8. */ + .csstart : { + *(.csstart) + } > ROM + + /* For code that must be in the first 64k, or could fill unused + space below .rodata. */ + .lowtext : { + *(.plt) + *(.lowtext) + } > ROM + + .data : { + . = ALIGN(2); + PROVIDE (__datastart = .); + + KEEP (*(.jcr)) + *(.data.rel.ro.local) *(.data.rel.ro*) + *(.dynamic) + + *(.data D .data.* .gnu.linkonce.d.*) + KEEP (*(.gnu.linkonce.d.*personality*)) + SORT(CONSTRUCTORS) + *(.data1) + *(.got.plt) *(.got) + + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + . = ALIGN(2); + *(.sdata .sdata.* .gnu.linkonce.s.* D_2 D_1) + + . = ALIGN(2); + _edata = .; + PROVIDE (edata = .); + PROVIDE (__dataend = .); + } > RAM AT> ROM + + /* Note that crt0 assumes this is a multiple of two; all the + start/stop symbols are also assumed word-aligned. */ + PROVIDE(__romdatastart = LOADADDR(.data)); + PROVIDE (__romdatacopysize = SIZEOF(.data)); + + .bss : { + . = ALIGN(2); + PROVIDE (__bssstart = .); + *(.dynbss) + *(.sbss .sbss.*) + *(.bss B B_2 B_1 .bss.* .gnu.linkonce.b.*) + . = ALIGN(2); + *(COMMON) + . = ALIGN(2); + PROVIDE (__bssend = .); + _end = .; + PROVIDE (end = .); + } > RAM + PROVIDE (__bsssize = SIZEOF(.bss)); + + .stack (ORIGIN (STACK)) : + { + PROVIDE (__stack = .); + *(.stack) + } + + .rodata (MAX(__romdatastart + __romdatacopysize, 0x2000)) : { + . = ALIGN(2); + *(.plt) + *(.rodata C C_2 C_1 .rodata.* .gnu.linkonce.r.*) + *(.rodata1) + *(.eh_frame_hdr) + KEEP (*(.eh_frame)) + KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) + PROVIDE (__preinit_array_start = .); + KEEP (*(.preinit_array)) + PROVIDE (__preinit_array_end = .); + PROVIDE (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE (__init_array_end = .); + PROVIDE (__fini_array_start = .); + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + PROVIDE (__fini_array_end = .); + LONG(0); /* Sentinel. */ + + /* gcc uses crtbegin.o to find the start of the constructors, so + we make sure it is first. Because this is a wildcard, it + doesn't matter if the user does not actually link against + crtbegin.o; the linker won't look for a file to match a + wildcard. The wildcard also means that it doesn't matter which + directory crtbegin.o is in. */ + KEEP (*crtbegin*.o(.ctors)) + + /* We don't want to include the .ctor section from from the + crtend.o file until after the sorted ctors. The .ctor section + from the crtend file contains the end of ctors marker and it + must be last */ + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + + KEEP (*crtbegin*.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } > ROM + + .text : + { + PROVIDE (_start = .); + *(.text P .stub .text.* .gnu.linkonce.t.*) + KEEP (*(.text.*personality*)) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.interp .hash .dynsym .dynstr .gnu.version*) + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + . = ALIGN(2); + KEEP (*(.init)) + KEEP (*(.fini)) + } > ROM + + /* The rest are all not normally part of the runtime image. */ + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /DISCARD/ : { *(.note.GNU-stack) } +} diff --git a/sbrk.c b/sbrk.c new file mode 100644 index 000000000..acff713fb --- /dev/null +++ b/sbrk.c @@ -0,0 +1,57 @@ +/* + +Copyright (c) 2005, 2009 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include + +char * +_sbrk (int adj) +{ + extern char end; + static char * heap = & end; + char * rv = heap; + char * heaptop = (char *) &adj; + + heap += adj; + + /* The allocated chunk spans our stack? */ + if (rv < heaptop && heap > heaptop + /* The allocated chunk spans our address space? */ + || heap < rv) + { + errno = ENOMEM; + return (char *) -1; + } + + return rv; +} + +char * sbrk (int) __attribute__((weak, alias ("_sbrk"))); diff --git a/stat.S b/stat.S new file mode 100644 index 000000000..1726ffca5 --- /dev/null +++ b/stat.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(stat) diff --git a/time.S b/time.S new file mode 100644 index 000000000..a07a0d3f3 --- /dev/null +++ b/time.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(time) diff --git a/times.S b/times.S new file mode 100644 index 000000000..e034929d6 --- /dev/null +++ b/times.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(times) diff --git a/unlink.S b/unlink.S new file mode 100644 index 000000000..4feab0f6a --- /dev/null +++ b/unlink.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(unlink) diff --git a/utime.S b/utime.S new file mode 100644 index 000000000..f72a5951f --- /dev/null +++ b/utime.S @@ -0,0 +1,35 @@ +/* + +Copyright (c) 2011 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "rl78-sys.h" + +ERR(utime) diff --git a/write.c b/write.c new file mode 100644 index 000000000..2adeb94f1 --- /dev/null +++ b/write.c @@ -0,0 +1,107 @@ +/* + +Copyright (c) 2010 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +/* These definitions are for the RL78/G13, which the simulator + simulates. */ + +typedef unsigned char UQI __attribute__((mode(QI))); +typedef unsigned int UHI __attribute__((mode(HI))); + +#define s8(x) (*(volatile UQI *)(x)) +#define s16(x) (*(volatile UHI *)(x)) + +#define P(x) s8(0xfff00+(x)) +#define PM(x) s8(0xfff20+(x)) + +#define PER0 s8(0xf00f0) + +#define SSR00 s16(0xf0100) +#define SMR00 s16(0xf0110) +#define SCR00 s16(0xf0118) +#define SS0 s16(0xf0122) +#define SPS0 s16(0xf0126) +#define SO0 s16(0xf0128) +#define SOE0 s16(0xf012a) +#define SOL0 s16(0xf0134) + +#define SDR00 s16(0xfff10) + +static int initted = 0; + +static void +init_uart0 () +{ + initted = 1; + + PER0 = 0xff; + SPS0 = 0x0011; /* 16 MHz */ + SMR00 = 0x0022; /* uart mode */ + SCR00 = 0x8097; /* 8-N-1 */ + SDR00 = 0x8a00; /* baud in MSB - 115200 */ + SOL0 = 0x0000; /* not inverted */ + SO0 = 0x000f; /* initial value */ + SOE0 = 0x0001; /* enable TxD0 */ + P(1) |= 0b00000100; + PM(1) &= 0b11111011; + SS0 = 0x0001; +} + +static void +tputc (char c) +{ + /* Wait for transmit buffer to be empty. */ + while (SSR00 & 0x0020) + asm(""); + /* Transmit that byte. */ + SDR00 = c; +} + +int +_write(int fd, char *ptr, int len) +{ + int rv = len; + + if (!initted) + init_uart0 (); + + while (len != 0) + { + if (*ptr == '\n') + tputc ('\r'); + tputc (*ptr); + ptr ++; + len --; + } + return rv; +} + +char * write (int) __attribute__((weak, alias ("_write"))); From d722c765392420230addcb21693070011bdbf43e Mon Sep 17 00:00:00 2001 From: Maxim Salov Date: Wed, 3 Oct 2012 21:37:11 +0300 Subject: [PATCH 02/20] Initial commit --- Makefile | 56 +++++++++++++++++++++++++++ main.c | 62 +++++++++++++++++++++++++++++ uart0.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ uart0.h | 7 ++++ 4 files changed, 241 insertions(+) create mode 100644 Makefile create mode 100644 main.c create mode 100644 uart0.c create mode 100644 uart0.h diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..4196a66fe --- /dev/null +++ b/Makefile @@ -0,0 +1,56 @@ +PROJECT_ELF=uart.elf +PROJECT_MOT=$(PROJECT_ELF:.elf=.mot) +PROJECT_MAP=$(PROJECT_ELF:.elf=.map) +PROJECT_LST=$(PROJECT_ELF:.elf=.lst) + +PREFIX=rl78-elf + +LD = $(PREFIX)-gcc +CC = $(PREFIX)-gcc +AS = $(PREFIX)-gcc +OBJCOPY = $(PREFIX)-objcopy +OBJDUMP = $(PREFIX)-objdump +SIZE = $(PREFIX)-size + +COMMON_PATH = ../common +PROJECT_PATH = . + +PROJECT_LNK = $(COMMON_PATH)/rl78-R5F100SL.ld + +CFLAGS = -Wall -Wextra -Os -ggdb -ffunction-sections -fdata-sections -I$(PROJECT_PATH) -I$(COMMON_PATH) -mmul=g13 +LDFLAGS = -Wl,--gc-sections -Wl,-Map=$(PROJECT_MAP) -T $(PROJECT_LNK) -nostartfiles + +SOURCES = \ + $(PROJECT_PATH)/main.c \ + $(PROJECT_PATH)/uart0.c \ + $(END) + +OBJS = $(SOURCES:.c=.o) $(COMMON_PATH)/crt0.o + +.PHONY: all + +all: $(PROJECT_MOT) $(PROJECT_LST) + $(SIZE) $(PROJECT_ELF) + +rom: $(PROJECT_MOT) + +$(PROJECT_MOT): $(PROJECT_ELF) + $(OBJCOPY) -O srec $^ $@ + +$(PROJECT_LST): $(PROJECT_ELF) + $(OBJDUMP) -DS $^ > $@ + +$(PROJECT_ELF): $(OBJS) + $(LD) $(LDFLAGS) -o $@ $^ + +flash: $(PROJECT_MOT) + rl78flash -m2 -b500000 -vvwri /dev/ttyUSB0 $^ + +erase: + rl78flash -m2 -b500000 -vveri /dev/ttyUSB0 + +terminal: + rl78flash -t9600 /dev/ttyUSB0 + +clean: + -rm -f $(OBJS) $(PROJECT_ELF) $(PROJECT_MOT) $(PROJECT_MAP) $(PROJECT_LST) diff --git a/main.c b/main.c new file mode 100644 index 000000000..480321676 --- /dev/null +++ b/main.c @@ -0,0 +1,62 @@ +#include "QB-R5F100SL-TB.h" +#include "uart0.h" + +volatile unsigned char ticks = 0; +volatile unsigned char flag_1hz = 0; + +__attribute__((interrupt)) +void wdti_handler(void) +{ +} + +__attribute__((interrupt)) +void it_handler(void) +{ + ++ticks; + LED1 ^= 1; + if (0 == (0x07 & ticks)) + { + flag_1hz = 1; + } +} + +int main(void) +{ + asm("di"); + /* Setup LEDs */ + LED1 = 1; + LED2 = 1; + LED1_PIN = 0; + LED2_PIN = 0; + /* Setup clocks */ + CMC.cmc = 0x11U; /* Enable XT1, disable X1 */ + CSC.csc = 0x80U; /* Start XT1 and HOCO, stop X1 */ + CKC.ckc = 0x00U; + /* Delay 1 second */ + register unsigned long int i; + for (i = 0x000FFFFFUL; i; --i) + asm("nop"); + OSMC.osmc = 0x00; /* Supply fsub to peripherals, including Interval Timer */ + uart0_init(); + /* Setup 12-bit interval timer */ + RTCEN = 1; /* Enable 12-bit interval timer and RTC */ + ITMK = 1; /* Disable IT interrupt */ + ITPR0 = 0; /* Set interrupt priority - highest */ + ITPR1 = 0; + ITMC.itmc = 0x8FFFU; /* Set maximum period 4096/32768Hz = 1/8 s, and start timer */ + ITIF = 0; /* Clear interrupt request flag */ + ITMK = 0; /* Enable IT interrupt */ + asm ("ei"); /* Enable interrupts */ + for(;;) + { + if (flag_1hz) + { + LED2 = 0; + flag_1hz = 0; + const char msg[] = "Hello, RL78! [:"; + uart0_puts(msg); + LED2 = 1; + } + asm("halt"); + } +} diff --git a/uart0.c b/uart0.c new file mode 100644 index 000000000..0b79e4ac0 --- /dev/null +++ b/uart0.c @@ -0,0 +1,116 @@ +#include "uart0.h" +#include +#include + +void uart0_init(void) +{ + /* Reference R01AN0459EJ0100 or hardware manual for details */ + PIOR.pior = 0U; /* Disable IO redirection */ + PM1.pm1 |= 0x06U; /* Set P11 and P12 as inputs */ + SAU0EN = 1; /* Supply clock to serial array unit 0 */ + SPS0.sps0 = 0x44U; /* Set input clock (CK00 and CK01) to fclk/16 = 2MHz */ + ST0.st0 = 0x03U; /* Stop operation of channel 0 and 1 */ + /* Setup interrupts (disable) */ + STMK0 = 1; /* Disable INTST0 interrupt */ + STIF0 = 0; /* Clear INTST0 interrupt request flag */ + STPR10 = 1; /* Set INTST0 priority: lowest */ + STPR00 = 1; + SRMK0 = 1; /* Disable INTSR0 interrupt */ + SRIF0 = 0; /* Clear INTSR0 interrupt request flag */ + SRPR10 = 1; /* Set INTSR0 priority: lowest */ + SRPR00 = 1; + SREMK0 = 1; /* Disable INTSRE0 interrupt */ + SREIF0 = 0; /* Clear INTSRE0 interrupt request flag */ + SREPR10 = 1; /* Set INTSRE0 priority: lowest */ + SREPR00 = 1; + /* Setup operation mode for transmitter (channel 0) */ + SMR00.smr00 = 0x0023U; /* Operation clock : CK00, + Transfer clock : division of CK00 + Start trigger : software + Detect falling edge as start bit + Operation mode : UART + Interrupt source : buffer empty + */ + SCR00.scr00 = 0x8097U; /* Transmission only + Reception error interrupt masked + Phase clock : type 1 + No parity + LSB first + 1 stop bit + 8-bit data length + */ + SDR00.sdr00 = 0xCE00U; /* transfer clock : operation clock divided by 208 + 2 MHz / 208 = ~9600 bps + */ + /* Setup operation mode for receiver (channel 1) */ + NFEN0.nfen0 |= 1; /* Enable noise filter on RxD0 pin */ + SIR01.sir01 = 0x0007U; /* Clear error flags */ + SMR01.smr01 = 0x0122U; /* Operation clock : CK00 + Transfer clock : division of CK00 + Start trigger : valid edge on RxD pin + Detect falling edge as start bit + Operation mode : UART + Interrupt source : transfer end + */ + SCR01.scr01 = 0x4097U; /* Reception only + Reception error interrupt masked + Phase clock : type 1 + No parity + LSB first + 1 stop bit + 8-bit data length + */ + SDR01.sdr01 = 0xCE00U; /* transfer clock : operation clock divided by 208 + 2 MHz / 208 = ~9600 bps + */ + SO0.so0 |= 1; /* Prepare for use of channel 0 */ + SOE0.soe0 |= 1; + P1.p1 |= (1 << 2); /* Set TxD0 high */ + PM1.pm1 &= ~(1 << 2); /* Set output mode for TxD0 */ + PM1.pm1 |= (1 << 1); /* Set input mode for RxD0 */ + SS0.ss0 |= 0x03U; /* Enable UART0 operation (both channels) */ + STIF0 = 1; /* Set buffer empty interrupt request flag */ +} + +int uart0_puts(const char * s) +{ + int len = 0; + SMR00.smr00 |= 0x0001U; /* Set buffer empty interrupt */ + while ('\0' != *s) + { + while (0 == STIF0); + STIF0 = 0; + SDR00.sdr00 = *s++; + ++len; + } +#if 0 + while (0 == STIF0); + STIF0 = 0; + SDR00.sdr00 = '\r'; +#endif + while (0 == STIF0); + STIF0 = 0; + SMR00.smr00 &= ~0x0001U; + SDR00.sdr00 = '\n'; + while (0 == STIF0); +#if 0 + while (0 != SSR00.BIT.bit6); /* Wait until TSF00 == 0 */ +#endif + return len; +} + +__attribute__((interrupt)) +void st0_handler(void) +{ +} + +__attribute__((interrupt)) +void sr0_handler(void) +{ +} + +/* This is actually INTSRE0 interrupt handler */ +__attribute__((interrupt)) +void tm01h_handler(void) +{ +} diff --git a/uart0.h b/uart0.h new file mode 100644 index 000000000..fd97204f5 --- /dev/null +++ b/uart0.h @@ -0,0 +1,7 @@ +#ifndef UART0_H__ +#define UART0_H__ + +void uart0_init(void); +int uart0_puts(const char * s); + +#endif // UART0_H__ From 458c93a430ba0092c602b300d648c33e6562204c Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Wed, 3 Oct 2012 20:24:49 +0000 Subject: [PATCH 03/20] * libc/machine/rl78/setjmp.S: Convert from CPP macros to GAS macros, to avoid dependence on the line separation character. * rl78/crt0.S (_interrupt_vector_table): Convert from CPP macros to GAS macros, to avoid dependence on the line separation character. --- crt0.S | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crt0.S b/crt0.S index d5c078df0..d5a07df90 100644 --- a/crt0.S +++ b/crt0.S @@ -34,7 +34,11 @@ .short _start .section ".ivec","a" -#define IV(x) .weak _##x##_handler | .short _##x##_handler + .macro _iv x + .weak \x + .short \x + .endm +#define IV(x) _iv _##x##_handler #define IVx() .short 0 /* To use a vector, simply define a global function named foo_handler() From 8ced0a746b2cdafd7e00d3440aa20b55669b0ec3 Mon Sep 17 00:00:00 2001 From: Maxim Salov Date: Sun, 17 Mar 2013 22:37:57 +0300 Subject: [PATCH 04/20] Find and use latest installed GNURL78 toolchain automatically. --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4196a66fe..f81106dca 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,10 @@ PROJECT_MOT=$(PROJECT_ELF:.elf=.mot) PROJECT_MAP=$(PROJECT_ELF:.elf=.map) PROJECT_LST=$(PROJECT_ELF:.elf=.lst) -PREFIX=rl78-elf +# Find latest installed GNURL78 toolchain. If your toolchain is already in PATH, just comment next line. +TOOL_PATH:=$(shell find /usr/share -maxdepth 1 -type d -iname "gnurl78*" | sort | tail -n 1)/bin + +PREFIX:=$(TOOL_PATH)/rl78-elf LD = $(PREFIX)-gcc CC = $(PREFIX)-gcc From ec8b88252ac3639c59c21c74bed7aaa9e443cd30 Mon Sep 17 00:00:00 2001 From: Maxim Salov Date: Sun, 17 Mar 2013 22:44:04 +0300 Subject: [PATCH 05/20] Add reset action to terminal target of Makefile. If reset signal is routed to MCU and reset action is not requested, reset signal will be held low. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f81106dca..3b183d6e8 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ erase: rl78flash -m2 -b500000 -vveri /dev/ttyUSB0 terminal: - rl78flash -t9600 /dev/ttyUSB0 + rl78flash -rt9600 /dev/ttyUSB0 clean: -rm -f $(OBJS) $(PROJECT_ELF) $(PROJECT_MOT) $(PROJECT_MAP) $(PROJECT_LST) From f576489c6e90d29d15fc3c66277021e8abd98bd0 Mon Sep 17 00:00:00 2001 From: Maxim Salov Date: Sun, 17 Mar 2013 22:52:01 +0300 Subject: [PATCH 06/20] In GNURL78 v13.01 __far keyword is fixed. Now it is possible to use far pointers to flash area. --- main.c | 3 +-- uart0.c | 2 +- uart0.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 480321676..ca249c544 100644 --- a/main.c +++ b/main.c @@ -53,8 +53,7 @@ int main(void) { LED2 = 0; flag_1hz = 0; - const char msg[] = "Hello, RL78! [:"; - uart0_puts(msg); + uart0_puts("Hello, RL78! [:"); LED2 = 1; } asm("halt"); diff --git a/uart0.c b/uart0.c index 0b79e4ac0..d58fa787b 100644 --- a/uart0.c +++ b/uart0.c @@ -72,7 +72,7 @@ void uart0_init(void) STIF0 = 1; /* Set buffer empty interrupt request flag */ } -int uart0_puts(const char * s) +int uart0_puts(const char __far * s) { int len = 0; SMR00.smr00 |= 0x0001U; /* Set buffer empty interrupt */ diff --git a/uart0.h b/uart0.h index fd97204f5..9512eacfb 100644 --- a/uart0.h +++ b/uart0.h @@ -2,6 +2,6 @@ #define UART0_H__ void uart0_init(void); -int uart0_puts(const char * s); +int uart0_puts(const char __far * s); #endif // UART0_H__ From a1bc241c0684144a5c37ff1fe0a4efceea905856 Mon Sep 17 00:00:00 2001 From: Dragos Bogdan Date: Thu, 9 May 2013 18:31:37 +0300 Subject: [PATCH 07/20] Added the PmodRF3 demo for Renesas RL78G14 board. --- ADF7023.c | 284 +++++++++++++++++++++++++++++++++ ADF7023.h | 401 +++++++++++++++++++++++++++++++++++++++++++++++ ADF7023_Config.h | 191 ++++++++++++++++++++++ 3 files changed, 876 insertions(+) create mode 100644 ADF7023.c create mode 100644 ADF7023.h create mode 100644 ADF7023_Config.h diff --git a/ADF7023.c b/ADF7023.c new file mode 100644 index 000000000..4dfb4660c --- /dev/null +++ b/ADF7023.c @@ -0,0 +1,284 @@ +/***************************************************************************//** + * @file ADF7023.c + * @brief Implementation of ADF7023 Driver. + * @author DBogdan (Dragos.Bogdan@analog.com) +******************************************************************************** + * Copyright 2013(c) Analog Devices, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * - The use of this software may or may not infringe the patent rights + * of one or more patent holders. This license does not release you + * from the requirement that you obtain separate licenses from these + * patent holders to use this software. + * - Use of the software either in source or binary form, must be run + * on or directly connected to an Analog Devices Inc. component. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +******************************************************************************** + * SVN Revision: $WCREV$ +*******************************************************************************/ + +/******************************************************************************/ +/***************************** Include Files **********************************/ +/******************************************************************************/ +#include "ADF7023.h" +#include "ADF7023_Config.h" +#include "Communication.h" + +/******************************************************************************/ +/*************************** Macros Definitions *******************************/ +/******************************************************************************/ +#define ADF7023_CS_ASSERT CS_PIN_LOW +#define ADF7023_CS_DEASSERT CS_PIN_HIGH +#define ADF7023_MISO MISO_PIN + +/******************************************************************************/ +/************************ Variables Definitions *******************************/ +/******************************************************************************/ +struct ADF7023_BBRAM ADF7023_BBRAMCurrent; + +/***************************************************************************//** + * @brief Transfers one byte of data. + * + * @param writeByte - Write data. + * @param readByte - Read data. + * + * @return None. +*******************************************************************************/ +void ADF7023_WriteReadByte(unsigned char writeByte, + unsigned char* readByte) +{ + unsigned char data = 0; + + data = writeByte; + SPI_Read(0, &data, 1); + if(readByte) + { + *readByte = data; + } +} + +/***************************************************************************//** + * @brief Initializes the ADF7023. + * + * @return retVal - Result of the initialization procedure. + * Example: 0 - if initialization was successful; + * -1 - if initialization was unsuccessful. +*******************************************************************************/ +char ADF7023_Init(void) +{ + char retVal = 0; + unsigned char miso = 0; + unsigned short timeout = 0; + unsigned char status = 0; + + ADF7023_BBRAMCurrent = ADF7023_BBRAMDefault; + SPI_Init(0, // MSB first. + 1000000, // Clock frequency. + 0, // Idle state for clock is a high level; active state is a low level. + 1); // Serial output data changes on transition from idle clock state to active clock state. + ADF7023_CS_ASSERT; + while ((miso == 0) && (timeout < 1000)) + { + miso = ADF7023_MISO; + timeout++; + } + if(timeout == 1000) + { + retVal = -1; + } + while(!(status & STATUS_CMD_READY)) + { + ADF7023_GetStatus(&status); + } + ADF7023_SetRAM(0x100, 64, (unsigned char*)&ADF7023_BBRAMCurrent); + ADF7023_SetCommand(CMD_CONFIG_DEV); + + return retVal; +} + +/***************************************************************************//** + * @brief Reads the status word of the ADF7023. + * + * @param status - Status word. + * + * @return None. +*******************************************************************************/ +void ADF7023_GetStatus(unsigned char* status) +{ + ADF7023_CS_ASSERT; + ADF7023_WriteReadByte(SPI_NOP, 0); + ADF7023_WriteReadByte(SPI_NOP, status); + ADF7023_CS_DEASSERT; +} + +/***************************************************************************//** + * @brief Initiates a command. + * + * @param command - Command. + * + * @return None. +*******************************************************************************/ +void ADF7023_SetCommand(unsigned char command) +{ + ADF7023_CS_ASSERT; + ADF7023_WriteReadByte(command, 0); + ADF7023_CS_DEASSERT; +} + +/***************************************************************************//** + * @brief Sets a FW state and waits until the device enters in that state. + * + * @param fwState - FW state. + * + * @return None. +*******************************************************************************/ +void ADF7023_SetFwState(unsigned char fwState) +{ + unsigned char status = 0; + + switch(fwState) + { + case FW_STATE_PHY_OFF: + ADF7023_SetCommand(CMD_PHY_OFF); + break; + case FW_STATE_PHY_ON: + ADF7023_SetCommand(CMD_PHY_ON); + break; + case FW_STATE_PHY_RX: + ADF7023_SetCommand(CMD_PHY_RX); + break; + case FW_STATE_PHY_TX: + ADF7023_SetCommand(CMD_PHY_TX); + break; + default: + ADF7023_SetCommand(CMD_PHY_SLEEP); + } + while((status & STATUS_FW_STATE) != fwState) + { + ADF7023_GetStatus(&status); + } +} + +/***************************************************************************//** + * @brief Reads data from the RAM. + * + * @param address - Start address. + * @param length - Number of bytes to write. + * @param data - Read buffer. + * + * @return None. +*******************************************************************************/ +void ADF7023_GetRAM(unsigned long address, + unsigned long length, + unsigned char* data) +{ + ADF7023_CS_ASSERT; + ADF7023_WriteReadByte(SPI_MEM_RD | ((address & 0x700) >> 8), 0); + ADF7023_WriteReadByte(address & 0xFF, 0); + ADF7023_WriteReadByte(SPI_NOP, 0); + while(length--) + { + ADF7023_WriteReadByte(SPI_NOP, data++); + } + ADF7023_CS_DEASSERT; +} + +/***************************************************************************//** + * @brief Writes data to RAM. + * + * @param address - Start address. + * @param length - Number of bytes to write. + * @param data - Write buffer. + * + * @return None. +*******************************************************************************/ +void ADF7023_SetRAM(unsigned long address, + unsigned long length, + unsigned char* data) +{ + ADF7023_CS_ASSERT; + ADF7023_WriteReadByte(SPI_MEM_WR | ((address & 0x700) >> 8), 0); + ADF7023_WriteReadByte(address & 0xFF, 0); + while(length--) + { + ADF7023_WriteReadByte(*(data++), 0); + } + ADF7023_CS_DEASSERT; +} + +/***************************************************************************//** + * @brief Receives one packet. + * + * @param packet - Data buffer. + * @param length - Number of received bytes. + * + * @return None. +*******************************************************************************/ +void ADF7023_ReceivePacket(unsigned char* packet, unsigned char* length) +{ + unsigned char interruptReg = 0; + + ADF7023_SetFwState(FW_STATE_PHY_ON); + ADF7023_SetFwState(FW_STATE_PHY_RX); + while(!(interruptReg & BBRAM_INTERRUPT_MASK_0_INTERRUPT_CRC_CORRECT)) + { + ADF7023_GetRAM(MCR_REG_INTERRUPT_SOURCE_0, + 0x1, + &interruptReg); + } + ADF7023_SetRAM(MCR_REG_INTERRUPT_SOURCE_0, + 0x1, + &interruptReg); + ADF7023_GetRAM(0x10, 1, length); + ADF7023_GetRAM(0x12, *length - 2, packet); +} + +/***************************************************************************//** + * @brief Transmits one packet. + * + * @param packet - Data buffer. + * @param length - Number of bytes to transmit. + * + * @return None. +*******************************************************************************/ +void ADF7023_TransmitPacket(unsigned char* packet, unsigned char length) +{ + unsigned char interruptReg = 0; + unsigned char header[2] = {0, 0}; + + header[0] = 2 + length; + header[1] = ADF7023_BBRAMCurrent.addressMatchOffset; + ADF7023_SetRAM(0x10, 2, header); + ADF7023_SetRAM(0x12, length, packet); + ADF7023_SetFwState(FW_STATE_PHY_ON); + ADF7023_SetFwState(FW_STATE_PHY_TX); + while(!(interruptReg & BBRAM_INTERRUPT_MASK_0_INTERRUPT_TX_EOF)) + { + ADF7023_GetRAM(MCR_REG_INTERRUPT_SOURCE_0, + 0x1, + &interruptReg); + } +} diff --git a/ADF7023.h b/ADF7023.h new file mode 100644 index 000000000..26536647c --- /dev/null +++ b/ADF7023.h @@ -0,0 +1,401 @@ +/***************************************************************************//** + * @file ADF7023.h + * @brief Header file of ADF7023 Driver. + * @author DBogdan (Dragos.Bogdan@analog.com) +******************************************************************************** + * Copyright 2013(c) Analog Devices, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * - The use of this software may or may not infringe the patent rights + * of one or more patent holders. This license does not release you + * from the requirement that you obtain separate licenses from these + * patent holders to use this software. + * - Use of the software either in source or binary form, must be run + * on or directly connected to an Analog Devices Inc. component. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +******************************************************************************** + * SVN Revision: $WCREV$ +*******************************************************************************/ +#ifndef __ADF7023_H__ +#define __ADF7023_H__ + +/* Status Word */ +#define STATUS_SPI_READY (0x1 << 7) +#define STATUS_IRQ_STATUS (0x1 << 6) +#define STATUS_CMD_READY (0x1 << 5) +#define STATUS_FW_STATE (0x1F << 0) + +/* FW_STATE Description */ +#define FW_STATE_INIT 0x0F +#define FW_STATE_BUSY 0x00 +#define FW_STATE_PHY_OFF 0x11 +#define FW_STATE_PHY_ON 0x12 +#define FW_STATE_PHY_RX 0x13 +#define FW_STATE_PHY_TX 0x14 +#define FW_STATE_PHY_SLEEP 0x06 +#define FW_STATE_GET_RSSI 0x05 +#define FW_STATE_IR_CAL 0x07 +#define FW_STATE_AES_DECRYPT_INIT 0x08 +#define FW_STATE_AES_DECRYPT 0x09 +#define FW_STATE_AES_ENCRYPT 0x0A + +/* SPI Memory Access Commands */ +#define SPI_MEM_WR 0x18 // Write data to packet RAM sequentially. +#define SPI_MEM_RD 0x38 // Read data from packet RAM sequentially. +#define SPI_MEMR_WR 0x08 // Write data to packet RAM nonsequentially. +#define SPI_MEMR_RD 0x28 // Read data from packet RAM nonsequentially. +#define SPI_NOP 0xFF // No operation. + +/* Radio Controller Commands */ +#define CMD_SYNC 0xA2 // This is an optional command. It is not necessary to use it during device initialization +#define CMD_PHY_OFF 0xB0 // Performs a transition of the device into the PHY_OFF state. +#define CMD_PHY_ON 0xB1 // Performs a transition of the device into the PHY_ON state. +#define CMD_PHY_RX 0xB2 // Performs a transition of the device into the PHY_RX state. +#define CMD_PHY_TX 0xB5 // Performs a transition of the device into the PHY_TX state. +#define CMD_PHY_SLEEP 0xBA // Performs a transition of the device into the PHY_SLEEP state. +#define CMD_CONFIG_DEV 0xBB // Configures the radio parameters based on the BBRAM values. +#define CMD_GET_RSSI 0xBC // Performs an RSSI measurement. +#define CMD_BB_CAL 0xBE // Performs a calibration of the IF filter. +#define CMD_HW_RESET 0xC8 // Performs a full hardware reset. The device enters the PHY_SLEEP state. +#define CMD_RAM_LOAD_INIT 0xBF // Prepares the program RAM for a firmware module download. +#define CMD_RAM_LOAD_DONE 0xC7 // Performs a reset of the communications processor after download of a firmware module to program RAM. +#define CMD_IR_CAL 0xBD // Initiates an image rejection calibration routine. +#define CMD_AES_ENCRYPT 0xD0 // Performs an AES encryption on the transmit payload data stored in packet RAM. +#define CMD_AES_DECRYPT 0xD2 // Performs an AES decryption on the received payload data stored in packet RAM. +#define CMD_AES_DECRYPT_INIT 0xD1 // Initializes the internal variables required for AES decryption. +#define CMD_RS_ENCODE_INIT 0xD1 // Initializes the internal variables required for the Reed Solomon encoding. +#define CMD_RS_ENCODE 0xD0 // Calculates and appends the Reed Solomon check bytes to the transmit payload data stored in packet RAM. +#define CMD_RS_DECODE 0xD2 // Performs a Reed Solomon error correction on the received payload data stored in packet RAM. + +/* Battery Backup Memory (BBRAM) */ +#define BBRAM_REG_INTERRUPT_MASK_0 0x100 +#define BBRAM_REG_INTERRUPT_MASK_1 0x101 +#define BBRAM_REG_NUMBER_OF_WAKEUPS_0 0x102 +#define BBRAM_REG_NUMBER_OF_WAKEUPS_1 0x103 +#define BBRAM_REG_NUMBER_OF_WAKEUPS_IRQ_THRESHOLD_0 0x104 +#define BBRAM_REG_NUMBER_OF_WAKEUPS_IRQ_THRESHOLD_1 0x105 +#define BBRAM_REG_RX_DWELL_TIME 0x106 +#define BBRAM_REG_PARMTIME_DIVIDER 0x107 +#define BBRAM_REG_SWM_RSSI_THRESH 0x108 +#define BBRAM_REG_CHANNEL_FREQ_0 0x109 +#define BBRAM_REG_CHANNEL_FREQ_1 0x10A +#define BBRAM_REG_CHANNEL_FREQ_2 0x10B +#define BBRAM_REG_RADIO_CFG_0 0x10C +#define BBRAM_REG_RADIO_CFG_1 0x10D +#define BBRAM_REG_RADIO_CFG_2 0x10E +#define BBRAM_REG_RADIO_CFG_3 0x10F +#define BBRAM_REG_RADIO_CFG_4 0x110 +#define BBRAM_REG_RADIO_CFG_5 0x111 +#define BBRAM_REG_RADIO_CFG_6 0x112 +#define BBRAM_REG_RADIO_CFG_7 0x113 +#define BBRAM_REG_RADIO_CFG_8 0x114 +#define BBRAM_REG_RADIO_CFG_9 0x115 +#define BBRAM_REG_RADIO_CFG_10 0x116 +#define BBRAM_REG_RADIO_CFG_11 0x117 +#define BBRAM_REG_IMAGE_REJECT_CAL_PHASE 0x118 +#define BBRAM_REG_IMAGE_REJECT_CAL_AMPLITUDE 0x119 +#define BBRAM_REG_MODE_CONTROL 0x11A +#define BBRAM_REG_PREAMBLE_MATCH 0x11B +#define BBRAM_REG_SYMBOL_MODE 0x11C +#define BBRAM_REG_PREAMBLE_LEN 0x11D +#define BBRAM_REG_CRC_POLY_0 0x11E +#define BBRAM_REG_CRC_POLY_1 0x11F +#define BBRAM_REG_SYNC_CONTROL 0x120 +#define BBRAM_REG_SYNC_BYTE_0 0x121 +#define BBRAM_REG_SYNC_BYTE_1 0x122 +#define BBRAM_REG_SYNC_BYTE_2 0x123 +#define BBRAM_REG_TX_BASE_ADR 0x124 +#define BBRAM_REG_RX_BASE_ADR 0x125 +#define BBRAM_REG_PACKET_LENGTH_CONTROL 0x126 +#define BBRAM_REG_PACKET_LENGTH_MAX 0x127 +#define BBRAM_REG_STATIC_REG_FIX 0x128 +#define BBRAM_REG_ADDRESS_MATCH_OFFSET 0x129 +#define BBRAM_REG_ADDRESS_LENGTH 0x12A +#define BBRAM_REG_ADDRESS_FILTERING_0 0x12B +#define BBRAM_REG_ADDRESS_FILTERING_1 0x12C +#define BBRAM_REG_ADDRESS_FILTERING_2 0x12D +#define BBRAM_REG_ADDRESS_FILTERING_3 0x12E +#define BBRAM_REG_ADDRESS_FILTERING_4 0x12F +#define BBRAM_REG_ADDRESS_FILTERING_5 0x130 +#define BBRAM_REG_ADDRESS_FILTERING_6 0x131 +#define BBRAM_REG_ADDRESS_FILTERING_7 0x132 +#define BBRAM_REG_ADDRESS_FILTERING_8 0x133 +#define BBRAM_REG_ADDRESS_FILTERING_9 0x134 +#define BBRAM_REG_ADDRESS_FILTERING_10 0x135 +#define BBRAM_REG_ADDRESS_FILTERING_11 0x136 +#define BBRAM_REG_ADDRESS_FILTERING_12 0x137 +#define BBRAM_REG_RSSI_WAIT_TIME 0x138 +#define BBRAM_REG_TESTMODES 0x139 +#define BBRAM_REG_TRANSITION_CLOCK_DIV 0x13A +#define BBRAM_REG_RESERVED_0 0x13B +#define BBRAM_REG_RESERVED_1 0x13C +#define BBRAM_REG_RESERVED_2 0x13D +#define BBRAM_REG_RX_SYNTH_LOCK_TIME 0x13E +#define BBRAM_REG_TX_SYNTH_LOCK_TIME 0x13F + +/* BBRAM_REG_INTERRUPT_MASK_0 - 0x100 */ +#define BBRAM_INTERRUPT_MASK_0_INTERRUPT_NUM_WAKEUPS (0x1 << 7) +#define BBRAM_INTERRUPT_MASK_0_INTERRUPT_SWM_RSSI_DET (0x1 << 6) +#define BBRAM_INTERRUPT_MASK_0_INTERRUPT_AES_DONE (0x1 << 5) +#define BBRAM_INTERRUPT_MASK_0_INTERRUPT_TX_EOF (0x1 << 4) +#define BBRAM_INTERRUPT_MASK_0_INTERRUPT_ADDRESS_MATCH (0x1 << 3) +#define BBRAM_INTERRUPT_MASK_0_INTERRUPT_CRC_CORRECT (0x1 << 2) +#define BBRAM_INTERRUPT_MASK_0_INTERRUPT_SYNC_DETECT (0x1 << 1) +#define BBRAM_INTERRUPT_MASK_0_INTERRUPT_PREMABLE_DETECT (0x1 << 0) + +/* BBRAM_REG_INTERRUPT_MASK_1 - 0x101*/ +#define BBRAM_INTERRUPT_MASK_1_BATTERY_ALARM (0x1 << 7) +#define BBRAM_INTERRUPT_MASK_1_CMD_READY (0x1 << 6) +#define BBRAM_INTERRUPT_MASK_1_WUC_TIMEOUT (0x1 << 4) +#define BBRAM_INTERRUPT_MASK_1_SPI_READY (0x1 << 1) +#define BBRAM_INTERRUPT_MASK_1_CMD_FINISHED (0x1 << 0) + +/* BBRAM_REG_RADIO_CFG_0 - 0x10C */ +#define BBRAM_RADIO_CFG_0_DATA_RATE_7_0(x) ((x & 0xFF) << 0) + +/* BBRAM_REG_RADIO_CFG_1 - 0x10D */ +#define BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8(x) ((x & 0xF) << 4) +#define BBRAM_RADIO_CFG_1_DATA_RATE_11_8(x) ((x & 0xF) << 0) + +/* BBRAM_REG_RADIO_CFG_2 - 0x10E */ +#define BBRAM_RADIO_CFG_2_FREQ_DEVIATION_7_0(x) ((x & 0xFF) << 0) + +/* BBRAM_REG_RADIO_CFG_6 - 0x112 */ +#define BBRAM_RADIO_CFG_6_SYNTH_LUT_CONFIG_0(x) ((x & 0x3F) << 2) +#define BBRAM_RADIO_CFG_6_DISCRIM_PHASE(x) ((x & 0x3) << 0) + +/* BBRAM_REG_RADIO_CFG_7 - 0x113 */ +#define BBRAM_RADIO_CFG_7_AGC_LOCK_MODE(x) ((x & 0x3) << 6) +#define BBRAM_RADIO_CFG_7_SYNTH_LUT_CONTROL(x) ((x & 0x3) << 4) +#define BBRAM_RADIO_CFG_7_SYNTH_LUT_CONFIG_1(x) ((x & 0xF) << 0) + +/* BBRAM_REG_RADIO_CFG_8 - 0x114 */ +#define BBRAM_RADIO_CFG_8_PA_SINGLE_DIFF_SEL (0x1 << 7) +#define BBRAM_RADIO_CFG_8_PA_LEVEL(x) ((x & 0xF) << 3) +#define BBRAM_RADIO_CFG_8_PA_RAMP(x) ((x & 0x7) << 0) + +/* BBRAM_REG_RADIO_CFG_9 - 0x115 */ +#define BBRAM_RADIO_CFG_9_IFBW(x) ((x & 0x3) << 6) +#define BBRAM_RADIO_CFG_9_MOD_SCHEME(x) ((x & 0x7) << 3) +#define BBRAM_RADIO_CFG_9_DEMOD_SCHEME(x) ((x & 0x7) << 0) + +/* BBRAM_REG_RADIO_CFG_10 - 0x116 */ +#define BBRAM_RADIO_CFG_10_AFC_POLARITY (0x0 << 4) +#define BBRAM_RADIO_CFG_10_AFC_SCHEME(x) ((x & 0x3) << 2) +#define BBRAM_RADIO_CFG_10_AFC_LOCK_MODE(x) ((x & 0x3) << 0) + +/* BBRAM_REG_RADIO_CFG_11 - 0x117 */ +#define BBRAM_RADIO_CFG_11_AFC_KP(x) ((x & 0xF) << 4) +#define BBRAM_RADIO_CFG_11_AFC_KI(x) ((x & 0xF) << 0) + +/* BBRAM_REG_MODE_CONTROL - 0x11A */ +#define BBRAM_MODE_CONTROL_SWM_EN (0x1 << 7) +#define BBRAM_MODE_CONTROL_BB_CAL (0x1 << 6) +#define BBRAM_MODE_CONTROL_SWM_RSSI_QUAL (0x1 << 5) +#define BBRAM_MODE_CONTROL_TX_TO_RX_AUTO_TURNAROUND (0x1 << 4) +#define BBRAM_MODE_CONTROL_RX_TO_TX_AUTO_TURNAROUND (0x1 << 3) +#define BBRAM_MODE_CONTROL_CUSTOM_TRX_SYNTH_LOCK_TIME_EN (0x1 << 2) +#define BBRAM_MODE_CONTROL_EXT_LNA_EN (0x1 << 1) +#define BBRAM_MODE_CONTROL_EXT_PA_EN (0x1 << 0) + +/* BBRAM_REG_SYMBOL_MODE - 0x11C */ +#define BBRAM_SYMBOL_MODE_MANCHESTER_ENC (0x1 << 6) +#define BBRAM_SYMBOL_MODE_PROG_CRC_EN (0x1 << 5) +#define BBRAM_SYMBOL_MODE_EIGHT_TEN_ENC (0x1 << 4) +#define BBRAM_SYMBOL_MODE_DATA_WHITENING (0x1 << 3) +#define BBRAM_SYMBOL_MODE_SYMBOL_LENGTH(x) ((x & 0x7) << 0) + +/* BBRAM_REG_SYNC_CONTROL - 0x120 */ +#define BBRAM_SYNC_CONTROL_SYNC_ERROR_TOL(x) ((x & 0x3) << 6) +#define BBRAM_SYNC_CONTROL_SYNC_WORD_LENGTH(x) ((x & 0x1F) << 0) + +/* BBRAM_REG_PACKET_LENGTH_CONTROL - 0x126 */ +#define BBRAM_PACKET_LENGTH_CONTROL_DATA_BYTE (0x1 << 7) +#define BBRAM_PACKET_LENGTH_CONTROL_PACKET_LEN (0x1 << 6) +#define BBRAM_PACKET_LENGTH_CONTROL_CRC_EN (0x1 << 5) +#define BBRAM_PACKET_LENGTH_CONTROL_DATA_MODE(x) ((x & 0x3) << 3) +#define BBRAM_PACKET_LENGTH_CONTROL_LENGTH_OFFSET(x) ((x & 0x7) << 0) + +/* BBRAM_REG_TESTMODES - 0x139 */ +#define BBRAM_TESTMODES_EXT_PA_LNA_ATB_CONFIG (0x1 << 7) +#define BBRAM_TESTMODES_PER_IRQ_SELF_CLEAR (0x1 << 3) +#define BBRAM_TESTMODES_PER_ENABLE (0x1 << 2) +#define BBRAM_TESTMODES_CONTINUOUS_TX (0x1 << 1) +#define BBRAM_TESTMODES_CONTINUOUS_RX (0x1 << 0) + +/* Modem Configuration Memory (MCR) */ +#define MCR_REG_PA_LEVEL_MCR 0x307 +#define MCR_REG_WUC_CONFIG_HIGH 0x30C +#define MCR_REG_WUC_CONFIG_LOW 0x30D +#define MCR_REG_WUC_VALUE_HIGH 0x30E +#define MCR_REG_WUC_VALUE_LOW 0x30F +#define MCR_REG_WUC_FLAG_RESET 0x310 +#define MCR_REG_WUC_STATUS 0x311 +#define MCR_REG_RSSI_READBACK 0x312 +#define MCR_REG_MAX_AFC_RANGE 0x315 +#define MCR_REG_IMAGE_REJECT_CAL_CONFIG 0x319 +#define MCR_REG_CHIP_SHUTDOWN 0x322 +#define MCR_REG_POWERDOWN_RX 0x324 +#define MCR_REG_POWERDOWN_AUX 0x325 +#define MCR_REG_ADC_READBACK_HIGH 0x327 +#define MCR_REG_ADC_READBACK_LOW 0x328 +#define MCR_REG_BATTERY_MONITOR_THRESHOLD_VOLTAGE 0x32D +#define MCR_REG_EXT_UC_CLK_DIVIDE 0x32E +#define MCR_REG_AGC_CLK_DIVIDE 0x32F +#define MCR_REG_INTERRUPT_SOURCE_0 0x336 +#define MCR_REG_INTERRUPT_SOURCE_1 0x337 +#define MCR_REG_CALIBRATION_CONTROL 0x338 +#define MCR_REG_CALIBRATION_STATUS 0x339 +#define MCR_REG_RXBB_CAL_CALWRD_READBACK 0x345 +#define MCR_REG_RXBB_CAL_CALWRD_OVERWRITE 0x346 +#define MCR_REG_RCOSC_CAL_READBACK_HIGH 0x34F +#define MCR_REG_RCOSC_CAL_READBACK_LOW 0x350 +#define MCR_REG_ADC_CONFIG_LOW 0x359 +#define MCR_REG_ADC_CONFIG_HIGH 0x35A +#define MCR_REG_AGC_OOK_CONTROL 0x35B +#define MCR_REG_AGC_CONFIG 0x35C +#define MCR_REG_AGC_MODE 0x35D +#define MCR_REG_AGC_LOW_THRESHOLD 0x35E +#define MCR_REG_AGC_HIGH_THRESHOLD 0x35F +#define MCR_REG_AGC_GAIN_STATUS 0x360 +#define MCR_REG_AGC_ADC_WORD 0x361 +#define MCR_REG_FREQUENCY_ERROR_READBACK 0x372 +#define MCR_REG_VCO_BAND_OVRW_VAL 0x3CB +#define MCR_REG_VCO_AMPL_OVRW_VAL 0x3CC +#define MCR_REG_VCO_OVRW_EN 0x3CD +#define MCR_REG_VCO_CAL_CFG 0x3D0 +#define MCR_REG_OSC_CONFIG 0x3D2 +#define MCR_REG_VCO_BAND_READBACK 0x3DA +#define MCR_REG_VCO_AMPL_READBACK 0x3DB +#define MCR_REG_ANALOG_TEST_BUS 0x3F8 +#define MCR_REG_RSSI_TSTMUX_SEL 0x3F9 +#define MCR_REG_GPIO_CONFIGURE 0x3FA +#define MCR_REG_TEST_DAC_GAIN 0x3FD + +struct ADF7023_BBRAM +{ + unsigned char interruptMask0; // 0x100 + unsigned char interruptMask1; // 0x101 + unsigned char numberOfWakeups0; // 0x102 + unsigned char numberOfWakeups1; // 0x103 + unsigned char numberOfWakeupsIrqThreshold0; // 0x104 + unsigned char numberOfWakeupsIrqThreshold1; // 0x105 + unsigned char rxDwellTime; // 0x106 + unsigned char parmtimeDivider; // 0x107 + unsigned char swmRssiThresh; // 0x108 + unsigned char channelFreq0; // 0x109 + unsigned char channelFreq1; // 0x10A + unsigned char channelFreq2; // 0x10B + unsigned char radioCfg0; // 0x10C + unsigned char radioCfg1; // 0x10D + unsigned char radioCfg2; // 0x10E + unsigned char radioCfg3; // 0x10F + unsigned char radioCfg4; // 0x110 + unsigned char radioCfg5; // 0x111 + unsigned char radioCfg6; // 0x112 + unsigned char radioCfg7; // 0x113 + unsigned char radioCfg8; // 0x114 + unsigned char radioCfg9; // 0x115 + unsigned char radioCfg10; // 0x116 + unsigned char radioCfg11; // 0x117 + unsigned char imageRejectCalPhase; // 0x118 + unsigned char imageRejectCalAmplitude; // 0x119 + unsigned char modeControl; // 0x11A + unsigned char preambleMatch; // 0x11B + unsigned char symbolMode; // 0x11C + unsigned char preambleLen; // 0x11D + unsigned char crcPoly0; // 0x11E + unsigned char crcPoly1; // 0x11F + unsigned char syncControl; // 0x120 + unsigned char syncByte0; // 0x121 + unsigned char syncByte1; // 0x122 + unsigned char syncByte2; // 0x123 + unsigned char txBaseAdr; // 0x124 + unsigned char rxBaseAdr; // 0x125 + unsigned char packetLengthControl; // 0x126 + unsigned char packetLengthMax; // 0x127 + unsigned char staticRegFix; // 0x128 + unsigned char addressMatchOffset; // 0x129 + unsigned char addressLength; // 0x12A + unsigned char addressFiltering0; // 0x12B + unsigned char addressFiltering1; // 0x12C + unsigned char addressFiltering2; // 0x12D + unsigned char addressFiltering3; // 0x12E + unsigned char addressFiltering4; // 0x12F + unsigned char addressFiltering5; // 0x130 + unsigned char addressFiltering6; // 0x131 + unsigned char addressFiltering7; // 0x132 + unsigned char addressFiltering8; // 0x133 + unsigned char addressFiltering9; // 0x134 + unsigned char addressFiltering10; // 0x135 + unsigned char addressFiltering11; // 0x136 + unsigned char addressFiltering12; // 0x137 + unsigned char rssiWaitTime; // 0x138 + unsigned char testmodes; // 0x139 + unsigned char transitionClockDiv; // 0x13A + unsigned char reserved0; // 0x13B + unsigned char reserved1; // 0x13C + unsigned char reserved2; // 0x13D + unsigned char rxSynthLockTime; // 0x13E + unsigned char txSynthLockTime; // 0x13F +}; + +#define ADF7023_TX_BASE_ADR 0x10 +#define ADF7023_RX_BASE_ADR 0x10 + +/******************************************************************************/ +/************************ Functions Declarations ******************************/ +/******************************************************************************/ + +/* Initializes the ADF7023. */ +char ADF7023_Init(void); + +/* Reads the status word of the ADF7023. */ +void ADF7023_GetStatus(unsigned char* status); + +/* Initiates a command. */ +void ADF7023_SetCommand(unsigned char command); + +/* Sets a FW state and waits until the device enters in that state. */ +void ADF7023_SetFwState(unsigned char fwState); + +/* Reads data from the RAM. */ +void ADF7023_GetRAM(unsigned long address, + unsigned long length, + unsigned char* data); + +/* Writes data to RAM. */ +void ADF7023_SetRAM(unsigned long address, + unsigned long length, + unsigned char* data); + +/* Receives one packet. */ +void ADF7023_ReceivePacket(unsigned char* packet, unsigned char* length); + +/* Transmits one packet. */ +void ADF7023_TransmitPacket(unsigned char* packet, unsigned char length); + +#endif // __ADF7023_H__ diff --git a/ADF7023_Config.h b/ADF7023_Config.h new file mode 100644 index 000000000..3f97aaab3 --- /dev/null +++ b/ADF7023_Config.h @@ -0,0 +1,191 @@ +/***************************************************************************//** + * @file ADF7023_Config.h + * @brief Configuration file of ADF7023 Driver. + * @author DBogdan (Dragos.Bogdan@analog.com) +******************************************************************************** + * Copyright 2013(c) Analog Devices, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * - The use of this software may or may not infringe the patent rights + * of one or more patent holders. This license does not release you + * from the requirement that you obtain separate licenses from these + * patent holders to use this software. + * - Use of the software either in source or binary form, must be run + * on or directly connected to an Analog Devices Inc. component. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +******************************************************************************** + * SVN Revision: $WCREV$ +*******************************************************************************/ +#ifndef __ADF7023_CONFIG_H__ +#define __ADF7023_CONFIG_H__ + +/******************************************************************************/ +/***************************** Include Files **********************************/ +/******************************************************************************/ +#include "ADF7023.h" + +/******************************************************************************/ +/************************* Variables Declarations *****************************/ +/******************************************************************************/ +struct ADF7023_BBRAM ADF7023_BBRAMDefault = +{ + /* interruptMask0 - 0x100 */ + BBRAM_INTERRUPT_MASK_0_INTERRUPT_TX_EOF | + BBRAM_INTERRUPT_MASK_0_INTERRUPT_CRC_CORRECT, + /* interruptMask1 - 0x101 */ + 0x00, + /* numberOfWakeups0 - 0x102 */ + 0x00, + /* numberOfWakeups1 - 0x103 */ + 0x00, + /* numberOfWakeupsIrqThreshold0 - 0x104 */ + 0xFF, + /* numberOfWakeupsIrqThreshold1 - 0x105 */ + 0xFF, + /* rxDwellTime - 0x106 */ + 0x00, + /* parmtimeDivider - 0x107 */ + 0x33, + /* swmRssiThresh - 0x108 */ + 0x31, + /* channelFreq0 - 0x109 */ + 0x3B, + /* channelFreq1 - 0x10A */ + 0x31, + /* channelFreq2 - 0x10B */ + 0x23, + /* radioCfg0 - 0x10C */ + BBRAM_RADIO_CFG_0_DATA_RATE_7_0(0xF4), + /* radioCfg1 - 0x10D */ + BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8(1) | + BBRAM_RADIO_CFG_1_DATA_RATE_11_8(1), + /* radioCfg2 - 0x10E */ + BBRAM_RADIO_CFG_2_FREQ_DEVIATION_7_0(0xF4), + /* radioCfg3 - 0x10F */ + 0x31, + /* radioCfg4 - 0x110 */ + 0x16, + /* radioCfg5 - 0x111 */ + 0x00, + /* radioCfg6 - 0x112 */ + BBRAM_RADIO_CFG_6_DISCRIM_PHASE(0x2), + /* radioCfg7 - 0x113 */ + BBRAM_RADIO_CFG_7_AGC_LOCK_MODE(3), + /* radioCfg8 - 0x114 */ + BBRAM_RADIO_CFG_8_PA_SINGLE_DIFF_SEL | + BBRAM_RADIO_CFG_8_PA_LEVEL(0xF) | + BBRAM_RADIO_CFG_8_PA_RAMP(1), + /* radioCfg9 - 0x115 */ + BBRAM_RADIO_CFG_9_IFBW(2), + /* radioCfg10 - 0x116 */ + BBRAM_RADIO_CFG_10_AFC_SCHEME(2) | + BBRAM_RADIO_CFG_10_AFC_LOCK_MODE(3), + /* radioCfg11 - 0x117 */ + BBRAM_RADIO_CFG_11_AFC_KP(3) | + BBRAM_RADIO_CFG_11_AFC_KI(7), + /* imageRejectCalPhase - 0x118 */ + 0x00, + /* imageRejectCalAmplitude - 0x119 */ + 0x00, + /* modeControl - 0x11A */ + BBRAM_MODE_CONTROL_BB_CAL, + /* preambleMatch - 0x11B */ + 0x0C, + /* symbolMode - 0x11C */ + BBRAM_SYMBOL_MODE_MANCHESTER_ENC, + /* preambleLen - 0x11D */ + 0x20, + /* crcPoly0 - 0x11E */ + 0x00, + /* crcPoly1 - 0x11F */ + 0x00, + /* syncControl - 0x120 */ + BBRAM_SYNC_CONTROL_SYNC_WORD_LENGTH(8), + /* syncByte0 - 0x121 */ + 0x00, + /* syncByte1 - 0x122 */ + 0x00, + /* syncByte2 - 0x123 */ + 0x12, + /* txBaseAdr - 0x124 */ + ADF7023_TX_BASE_ADR, + /* rxBaseAdr - 0x125 */ + ADF7023_RX_BASE_ADR, + /* packetLengthControl - 0x126 */ + 0x24, + /* packetLengthMax - 0x127 */ + 0xF0, + /* staticRegFix - 0x128 */ + 0x00, + /* addressMatchOffset - 0x129 */ + 0x01, + /* addressLength - 0x12A */ + 0x02, + /* addressFiltering0 - 0x12B */ + 0x01, + /* addressFiltering1 - 0x12C */ + 0xFF, + /* addressFiltering2 - 0x12D */ + 0xFF, + /* addressFiltering3 - 0x12E */ + 0xFF, + /* addressFiltering4 - 0x12F */ + 0x02, + /* addressFiltering5 - 0x130 */ + 0x0F, + /* addressFiltering6 - 0x131 */ + 0xFF, + /* addressFiltering7 - 0x132 */ + 0x0F, + /* addressFiltering8 - 0x133 */ + 0xFF, + /* addressFiltering9 - 0x134 */ + 0x00, + /* addressFiltering10 - 0x135 */ + 0x00, + /* addressFiltering11 - 0x136 */ + 0x00, + /* addressFiltering12 - 0x137 */ + 0x00, + /* rssiWaitTime - 0x138 */ + 0x00, + /* testmodes - 0x139 */ + 0x00, + /* transitionClockDiv - 0x13A */ + 0x00, + /* reserved0 - 0x13B */ + 0x00, + /* reserved1 - 0x13C */ + 0x00, + /* reserved2 - 0x13D */ + 0x00, + /* rxSynthLockTime - 0x13E */ + 0x00, + /* txSynthLockTime - 0x13F */ + 0x00, +}; + +#endif // __ADF7023_CONFIG_H__ From 3def9dc72e3233cc68c65f12ad17e3927d90c59f Mon Sep 17 00:00:00 2001 From: Dragos Bogdan Date: Thu, 9 May 2013 18:31:37 +0300 Subject: [PATCH 08/20] Added the PmodRF3 demo for Renesas RL78G14 board. --- Communication.c | 412 +++++++++++++++++++++++++++++++++++ Communication.h | 92 ++++++++ RDKRL78G14.c | 89 ++++++++ RDKRL78G14.h | 127 +++++++++++ ST7579.c | 568 ++++++++++++++++++++++++++++++++++++++++++++++++ ST7579.h | 100 +++++++++ 6 files changed, 1388 insertions(+) create mode 100644 Communication.c create mode 100644 Communication.h create mode 100644 RDKRL78G14.c create mode 100644 RDKRL78G14.h create mode 100644 ST7579.c create mode 100644 ST7579.h diff --git a/Communication.c b/Communication.c new file mode 100644 index 000000000..949edeb98 --- /dev/null +++ b/Communication.c @@ -0,0 +1,412 @@ +/***************************************************************************//** + * @file Communication.c + * @brief Implementation of the Communication Driver for RL78G14 processor. + * @author DBogdan (dragos.bogdan@analog.com) +******************************************************************************** + * Copyright 2012(c) Analog Devices, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * - The use of this software may or may not infringe the patent rights + * of one or more patent holders. This license does not release you + * from the requirement that you obtain separate licenses from these + * patent holders to use this software. + * - Use of the software either in source or binary form, must be run + * on or directly connected to an Analog Devices Inc. component. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +******************************************************************************** + * SVN Revision: $WCREV$ +*******************************************************************************/ + +/******************************************************************************/ +/***************************** Include Files **********************************/ +/******************************************************************************/ +#include "Communication.h" // Communication definitions +#include "RDKRL78G14.h" // RDKRL78G14 definitions + +char IICA0_Flag; + +/******************************************************************************/ +/************************ Functions Definitions *******************************/ +/******************************************************************************/ + +/***************************************************************************//** + * @brief I2C interrupt service routine. + * + * @return None. +*******************************************************************************/ +#pragma vector = INTIICA0_vect +__interrupt static void IICA0_Interrupt(void) +{ + IICA0_Flag = 1; +} + +/***************************************************************************//** + * @brief Initializes the SPI communication peripheral. + * + * @param lsbFirst - Transfer format (0 or 1). + * Example: 0x0 - MSB first. + * 0x1 - LSB first. + * @param clockFreq - SPI clock frequency (Hz). + * Example: 1000 - SPI clock frequency is 1 kHz. + * @param clockPol - SPI clock polarity (0 or 1). + * Example: 0x0 - Idle state for clock is a low level; active + * state is a high level; + * 0x1 - Idle state for clock is a high level; active + * state is a low level. + * @param clockEdg - SPI clock edge (0 or 1). + * Example: 0x0 - Serial output data changes on transition + * from idle clock state to active clock state; + * 0x1 - Serial output data changes on transition + * from active clock state to idle clock state. + * + * @return status - Result of the initialization procedure. + * Example: 1 - if initialization was successful; + * 0 - if initialization was unsuccessful. +*******************************************************************************/ +char SPI_Init(char lsbFirst, + long clockFreq, + char clockPol, + char clockEdg) +{ + long mckFreq = 32000000; + char sdrValue = 0; + + /* Configure the CS pins. */ + PMOD1_CS_OUT; + PMOD1_CS_HIGH; + PMOD2_CS_OUT; + PMOD2_CS_HIGH; + ST7579_CS_OUT; + ST7579_CS_HIGH; + + /* Enable input clock supply. */ + SAU1EN = 1; + + /* After setting the SAUmEN bit to 1, be sure to set serial clock select + register m (SPSm) after 4 or more fCLK clocks have elapsed. */ + NOP; + NOP; + NOP; + NOP; + + /* Select the fCLK as input clock. */ + SPS1 = 0x0000; + + /* Select the CSI operation mode. */ + SMR11 = 0x0020; + + clockPol = 1 - clockPol; + SCR11 = (clockEdg << 13) | + (clockPol << 12) | + 0xC000 | // Operation mode: Transmission/reception. + 0x0007; // 8-bit data length. + + /* clockFreq = mckFreq / (sdrValue * 2 + 2) */ + sdrValue = mckFreq / (2 * clockFreq) - 1; + SDR11 = sdrValue << 9; + + /* Set the clock and data initial level. */ + clockPol = 1 - clockPol; + SO1 &= ~0x0202; + SO1 |= (clockPol << 9) | + (clockPol << 1); + + /* Enable output for serial communication operation. */ + SOE1 |= 0x0002; + + /* Configure SCLK and MOSI pins as output. */ + PM7 &= ~0x05; + P7 |= 0x05; + + /* Configure the MISO pin as input. */ + PM7 |= 0x02; + + /* Set the SEmn bit to 1 and enter the communication wait status */ + SS1 |= 0x0002; + + return 1; +} + +/***************************************************************************//** + * @brief Writes data to SPI. + * + * @param slaveDeviceId - The ID of the selected slave device. + * @param data - Data represents the write buffer. + * @param bytesNumber - Number of bytes to write. + * + * @return Number of written bytes. +*******************************************************************************/ +char SPI_Write(char slaveDeviceId, + unsigned char* data, + char bytesNumber) +{ + char byte = 0; + unsigned char read = 0; + + if(slaveDeviceId == 1) + { + PMOD1_CS_LOW; + } + if(slaveDeviceId == 2) + { + PMOD2_CS_LOW; + } + if(slaveDeviceId == 3) + { + ST7579_CS_LOW; + } + for(byte = 0; byte < bytesNumber; byte++) + { + SIO21 = data[byte]; + NOP; + while(SSR11 & 0x0040); + read = SIO21; + } + if(slaveDeviceId == 1) + { + PMOD1_CS_HIGH; + } + if(slaveDeviceId == 2) + { + PMOD2_CS_HIGH; + } + if(slaveDeviceId == 3) + { + ST7579_CS_HIGH; + } + + return bytesNumber; +} + +/***************************************************************************//** + * @brief Reads data from SPI. + * + * @param slaveDeviceId - The ID of the selected slave device. + * @param data - Data represents the write buffer as an input parameter and the + * read buffer as an output parameter. + * @param bytesNumber - Number of bytes to read. + * + * @return Number of read bytes. +*******************************************************************************/ +char SPI_Read(char slaveDeviceId, + unsigned char* data, + char bytesNumber) +{ + char byte = 0; + + if(slaveDeviceId == 1) + { + PMOD1_CS_LOW; + } + if(slaveDeviceId == 2) + { + PMOD2_CS_LOW; + } + if(slaveDeviceId == 3) + { + ST7579_CS_LOW; + } + for(byte = 0; byte < bytesNumber; byte++) + { + SIO21 = data[byte]; + NOP; + while(SSR11 & 0x0040); + data[byte] = SIO21; + } + if(slaveDeviceId == 1) + { + PMOD1_CS_HIGH; + } + if(slaveDeviceId == 2) + { + PMOD2_CS_HIGH; + } + if(slaveDeviceId == 3) + { + ST7579_CS_HIGH; + } + + return bytesNumber; +} + +/***************************************************************************//** + * @brief Initializes the I2C communication peripheral. + * + * @param clockFreq - I2C clock frequency (Hz). + * Example: 100000 - SPI clock frequency is 100 kHz. + * @return status - Result of the initialization procedure. + * Example: 1 - if initialization was successful; + * 0 - if initialization was unsuccessful. +*******************************************************************************/ +char I2C_Init(long clockFreq) +{ + long fckFreq = 32000000; + unsigned char wlValue = 0; + unsigned char whValue = 0; + + /* Enable interrupts */ + EI; + + /* Enable input clock supply. */ + IICA0EN = 1; + + /* Set the fast mode plus operation. */ + SMC0 = 1; + + /* Set transfer rate. */ + wlValue = (unsigned char)((0.5 * fckFreq) / clockFreq); + whValue = (unsigned char)(wlValue - (fckFreq / (10 * clockFreq))); + IICWL0 = wlValue; + IICWH0 = whValue; + + STCEN0 = 1; // After operation is enabled, enable generation of a start + // condition without detecting a stop condition. + WTIM0 = 1; // Interrupt request is generated at the ninth clock’s + // falling edge. + + /* Enable I2C operation. */ + IICE0 = 1; + + /* Configure SCLA0 and SDAA0 pins as digital output. */ + P6 &= ~0x03; + PM6 &= ~0x03; + + return 1; +} + +/***************************************************************************//** + * @brief Writes data to a slave device. + * + * @param slaveAddress - Adress of the slave device. + * @param dataBuffer - Pointer to a buffer storing the transmission data. + * @param bytesNumber - Number of bytes to write. + * @param stopBit - Stop condition control. + * Example: 0 - A stop condition will not be sent; + * 1 - A stop condition will be sent. + * + * @return status - Number of read bytes or 0xFF if the slave address was not + * acknowledged by the device. +*******************************************************************************/ +char I2C_Write(char slaveAddress, + unsigned char* dataBuffer, + char bytesNumber, + char stopBit) +{ + char byte = 0; + char status = 0; + + IICAMK0 = 1; // Interrupt servicing disabled. + STT0 = 1; // Generate a start condition. + IICAMK0 = 0; // Interrupt servicing enabled. + + /* Send the first byte. */ + IICA0_Flag = 0; + IICA0 = (slaveAddress << 1); + while(IICA0_Flag == 0); + + if(ACKD0) // Acknowledge was detected. + { + for(byte = 0; byte < bytesNumber; byte++) + { + IICA0_Flag = 0; + IICA0 = *dataBuffer; + while(IICA0_Flag == 0); + dataBuffer++; + } + status = bytesNumber; + } + else // Acknowledge was not detected. + { + status = 0xFF; + } + if(stopBit) + { + SPT0 = 1; // Generate a stop condition. + while(IICBSY0); // Wait until the I2C bus status flag is cleared. + } + + return status; +} + +/***************************************************************************//** + * @brief Reads data from a slave device. + * + * @param slaveAddress - Adress of the slave device. + * @param dataBuffer - Pointer to a buffer that will store the received data. + * @param bytesNumber - Number of bytes to read. + * @param stopBit - Stop condition control. + * Example: 0 - A stop condition will not be sent; + * 1 - A stop condition will be sent. + * + * @return status - Number of read bytes or 0xFF if the slave address was not + * acknowledged by the device. +*******************************************************************************/ +char I2C_Read(char slaveAddress, + unsigned char* dataBuffer, + char bytesNumber, + char stopBit) +{ + char byte = 0; + char status = 0; + + IICAMK0 = 1; // Interrupt servicing disabled. + STT0 = 1; // Generate a start condition. + IICAMK0 = 0; // Interrupt servicing enabled. + + /* Send the first byte. */ + IICA0_Flag = 0; + IICA0 = (slaveAddress << 1) + 1; + while(IICA0_Flag == 0); + + if(ACKD0) // Acknowledge was detected. + { + ACKE0 = 1; // Enable acknowledgment. + for(byte = 0; byte < bytesNumber; byte++) + { + if(byte == (bytesNumber - 1)) + { + ACKE0 = 0U; // Disable acknowledgment. + } + WREL0 = 1U; // Cancel wait. + IICA0_Flag = 0; + while(IICA0_Flag == 0); + *dataBuffer = IICA0; + dataBuffer++; + } + status = bytesNumber; + } + else // Acknowledge was not detected. + { + status = 0xFF; + } + if(stopBit) + { + SPT0 = 1; // Generate a stop condition. + while(IICBSY0); // Wait until the I2C bus status flag is cleared. + } + + return status; +} diff --git a/Communication.h b/Communication.h new file mode 100644 index 000000000..268e5dfed --- /dev/null +++ b/Communication.h @@ -0,0 +1,92 @@ +/***************************************************************************//** + * @file Communication.h + * @brief Header file of the Communication Driver for RL78G14 processor. + * @author DBogdan (dragos.bogdan@analog.com) +******************************************************************************** + * Copyright 2012(c) Analog Devices, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * - The use of this software may or may not infringe the patent rights + * of one or more patent holders. This license does not release you + * from the requirement that you obtain separate licenses from these + * patent holders to use this software. + * - Use of the software either in source or binary form, must be run + * on or directly connected to an Analog Devices Inc. component. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +******************************************************************************** + * SVN Revision: $WCREV$ +*******************************************************************************/ +#ifndef __COMMUNICATION_H__ +#define __COMMUNICATION_H__ + +/******************************************************************************/ +/***************************** Include Files **********************************/ +/******************************************************************************/ +#include "RDKRL78G14.h" + +/******************************************************************************/ +/*************************** Macros Definitions *******************************/ +/******************************************************************************/ +#define CS_PIN_LOW PMOD1_CS_LOW +#define CS_PIN_HIGH PMOD1_CS_HIGH +#define MISO_PIN PMOD1_MISO + +/******************************************************************************/ +/************************ Functions Declarations ******************************/ +/******************************************************************************/ + +/*! Initializes the SPI communication peripheral. */ +char SPI_Init(char lsbFirst, + long clockFreq, + char clockPol, + char clockEdg); + +/*! Writes data to SPI. */ +char SPI_Write(char slaveDeviceId, + unsigned char* data, + char bytesNumber); + +/*! Reads data from SPI. */ +char SPI_Read(char slaveDeviceId, + unsigned char* data, + char bytesNumber); + +/*! Initializes the I2C communication peripheral. */ +char I2C_Init(long clockFreq); + +/*! Writes data to a slave device. */ +char I2C_Write(char slaveAddress, + unsigned char* dataBuffer, + char bytesNumber, + char stopBit); + +/*! Reads data from a slave device. */ +char I2C_Read(char slaveAddress, + unsigned char* dataBuffer, + char bytesNumber, + char stopBit); + +#endif // __COMMUNICATION_H__ diff --git a/RDKRL78G14.c b/RDKRL78G14.c new file mode 100644 index 000000000..8a874fcf0 --- /dev/null +++ b/RDKRL78G14.c @@ -0,0 +1,89 @@ +/***************************************************************************//** + * @file RDKRL78G14.c + * @brief Implementation of the RDKRL78G14 Driver. + * @author DBogdan (dragos.bogdan@analog.com) +******************************************************************************** + * Copyright 2012(c) Analog Devices, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * - The use of this software may or may not infringe the patent rights + * of one or more patent holders. This license does not release you + * from the requirement that you obtain separate licenses from these + * patent holders to use this software. + * - Use of the software either in source or binary form, must be run + * on or directly connected to an Analog Devices Inc. component. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +******************************************************************************** + * SVN Revision: 831 +*******************************************************************************/ + +/******************************************************************************/ +/***************************** Include Files **********************************/ +/******************************************************************************/ +#include "RDKRL78G14.h" // RDKRL78G14 definitions + +/******************************************************************************/ +/************************ Functions Definitions *******************************/ +/******************************************************************************/ + +/***************************************************************************//** + * @brief Resets the RDKRL78G14. + * + * @return None. +*******************************************************************************/ +void RDKRL78G14_Reset(void) +{ + short delay = 0; + + EXTRST_HIGH; + for(delay = 0; delay < 1000; delay++) + { + NOP; + } + EXTRST_LOW; +} + +/***************************************************************************//** + * @brief Initializes the RDKRL78G14. + * + * @return status - Result of the initialization procedure. + * Example: 0 - if initialization was successful; + * -1 - if initialization was unsuccessful. +*******************************************************************************/ +char RDKRL78G14_Init(void) +{ + long delay = 0; + char status = -1; + + for(delay = 0; delay < 4000000; delay++) + { + NOP; + } + RDKRL78G14_Reset(); + status = 0; + + return status; +} diff --git a/RDKRL78G14.h b/RDKRL78G14.h new file mode 100644 index 000000000..1ddb011fa --- /dev/null +++ b/RDKRL78G14.h @@ -0,0 +1,127 @@ +/***************************************************************************//** + * @file RDKRL78G14.h + * @brief Header file of the RDKRL78G14 Driver. + * @author DBogdan (dragos.bogdan@analog.com) +******************************************************************************** + * Copyright 2012(c) Analog Devices, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * - The use of this software may or may not infringe the patent rights + * of one or more patent holders. This license does not release you + * from the requirement that you obtain separate licenses from these + * patent holders to use this software. + * - Use of the software either in source or binary form, must be run + * on or directly connected to an Analog Devices Inc. component. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +******************************************************************************** + * SVN Revision: 831 +*******************************************************************************/ + +#ifndef __RDKRL78G14_H__ +#define __RDKRL78G14_H__ + +/******************************************************************************/ +/***************************** Include Files **********************************/ +/******************************************************************************/ + +#include // R5F104PJ definitions +#include // Declarations of extended SFR registers +#include // Declarations of intrinsic functions + +/******************************************************************************/ +/************************* Operations Definitions *****************************/ +/******************************************************************************/ + +#define NOP __no_operation(); // No operation +#define EI __enable_interrupt(); // Enable interrupts +#define DI __disable_interrupt(); // Disable interrupts + +/******************************************************************************/ +/**************************** GPIO Definitions ********************************/ +/******************************************************************************/ + +/* External Reset Pin - P130 */ +#define EXTRST_PIN (1 << 0) +#define EXTRST_LOW P13 &= ~EXTRST_PIN +#define EXTRST_HIGH P13 |= EXTRST_PIN + +/* ST7579 CS Pin - P145 */ +#define ST7579_CS_PIN (1 << 5) +#define ST7579_CS_OUT PM14 &= ~ST7579_CS_PIN +#define ST7579_CS_LOW P14 &= ~ST7579_CS_PIN +#define ST7579_CS_HIGH P14 |= ST7579_CS_PIN + +/* ST7579 RS Pin - P146 */ +#define ST7579_RS_PIN (1 << 6) +#define ST7579_RS_OUT PM14 &= ~ST7579_RS_PIN +#define ST7579_RS_LOW P14 &= ~ST7579_RS_PIN +#define ST7579_RS_HIGH P14 |= ST7579_RS_PIN + +/* PMOD1 CS Pin - P83 */ +#define PMOD1_CS_PIN (1 << 3) +#define PMOD1_CS_OUT PM8 &= ~PMOD1_CS_PIN +#define PMOD1_CS_LOW P8 &= ~PMOD1_CS_PIN +#define PMOD1_CS_HIGH P8 |= PMOD1_CS_PIN + +/* PMOD1 MISO Pin */ +#define PMOD1_MISO_PIN (1 << 1) +#define PMOD1_MISO ((P7 & PMOD1_MISO_PIN) >> 1) + +/* PMOD2 CS Pin - P82 */ +#define PMOD2_CS_PIN (1 << 2) +#define PMOD2_CS_OUT PM8 &= ~PMOD2_CS_PIN +#define PMOD2_CS_LOW P8 &= ~PMOD2_CS_PIN +#define PMOD2_CS_HIGH P8 |= PMOD2_CS_PIN + +/* GPIO1 Pin - P46 */ +#define GPIO1_PIN (1 << 6) +#define GPIO1_PIN_OUT PM4 &= ~GPIO1_PIN; +#define GPIO1_PIN_LOW P4 &= ~GPIO1_PIN; +#define GPIO1_PIN_HIGH P4 |= GPIO1_PIN; + +/* GPIO2 Pin - P110 */ +#define GPIO2_PIN (1 << 0) +#define GPIO2_PIN_OUT PM11 &= ~GPIO2_PIN; +#define GPIO2_PIN_LOW P11 &= ~GPIO2_PIN; +#define GPIO2_PIN_HIGH P11 |= GPIO2_PIN; + +/* GPIO3 Pin - P111 */ +#define GPIO3_PIN (1 << 1) +#define GPIO3_PIN_OUT PM11 &= ~GPIO3_PIN; +#define GPIO3_PIN_LOW P11 &= ~GPIO3_PIN; +#define GPIO3_PIN_HIGH P11 |= GPIO3_PIN; + +/******************************************************************************/ +/************************ Functions Declarations ******************************/ +/******************************************************************************/ + +/*! Resets the RDKRL78G14. */ +void RDKRL78G14_Reset(void); + +/*! Initializes the RDKRL78G14. */ +char RDKRL78G14_Init(void); + +#endif // __RDKRL78G14_H__ diff --git a/ST7579.c b/ST7579.c new file mode 100644 index 000000000..f80d5f0f7 --- /dev/null +++ b/ST7579.c @@ -0,0 +1,568 @@ +/***************************************************************************//** + * @file ST7579.c + * @brief Implementation of ST7579 Driver. + * @author DBogdan (dragos.bogdan@analog.com) +******************************************************************************** + * Copyright 2012(c) Analog Devices, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * - The use of this software may or may not infringe the patent rights + * of one or more patent holders. This license does not release you + * from the requirement that you obtain separate licenses from these + * patent holders to use this software. + * - Use of the software either in source or binary form, must be run + * on or directly connected to an Analog Devices Inc. component. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +******************************************************************************** + * SVN Revision: $WCREV$ +*******************************************************************************/ + +/******************************************************************************/ +/***************************** Include Files **********************************/ +/******************************************************************************/ +#include "ST7579.h" // ST7579 definitions +#include "RDKRL78G14.h" // YRDKRL78G14 definitions +#include "Communication.h" // Communication definitions + +/******************************************************************************/ +/************************* Variables Definitions ******************************/ +/******************************************************************************/ + +const unsigned char st7579Font[95][5] = +{ + {0x00, 0x00, 0x00, 0x00, 0x00}, // sp + {0x00, 0x00, 0x2f, 0x00, 0x00}, // ! + {0x00, 0x07, 0x00, 0x07, 0x00}, // " + {0x14, 0x7f, 0x14, 0x7f, 0x14}, // # + {0x24, 0x2a, 0x7f, 0x2a, 0x12}, // $ + {0xc4, 0xc8, 0x10, 0x26, 0x46}, // % + {0x36, 0x49, 0x55, 0x22, 0x50}, // & + {0x00, 0x05, 0x03, 0x00, 0x00}, // ' + {0x00, 0x1c, 0x22, 0x41, 0x00}, // ( + {0x00, 0x41, 0x22, 0x1c, 0x00}, // ) + {0x14, 0x08, 0x3E, 0x08, 0x14}, // * + {0x08, 0x08, 0x3E, 0x08, 0x08}, // + + {0x00, 0x00, 0x50, 0x30, 0x00}, // , + {0x10, 0x10, 0x10, 0x10, 0x10}, // - + {0x00, 0x60, 0x60, 0x00, 0x00}, // . + {0x20, 0x10, 0x08, 0x04, 0x02}, // / + {0x3E, 0x51, 0x49, 0x45, 0x3E}, // 0 + {0x00, 0x42, 0x7F, 0x40, 0x00}, // 1 + {0x42, 0x61, 0x51, 0x49, 0x46}, // 2 + {0x21, 0x41, 0x45, 0x4B, 0x31}, // 3 + {0x18, 0x14, 0x12, 0x7F, 0x10}, // 4 + {0x27, 0x45, 0x45, 0x45, 0x39}, // 5 + {0x3C, 0x4A, 0x49, 0x49, 0x30}, // 6 + {0x01, 0x71, 0x09, 0x05, 0x03}, // 7 + {0x36, 0x49, 0x49, 0x49, 0x36}, // 8 + {0x06, 0x49, 0x49, 0x29, 0x1E}, // 9 + {0x00, 0x36, 0x36, 0x00, 0x00}, // : + {0x00, 0x56, 0x36, 0x00, 0x00}, // ; + {0x08, 0x14, 0x22, 0x41, 0x00}, // < + {0x14, 0x14, 0x14, 0x14, 0x14}, // = + {0x00, 0x41, 0x22, 0x14, 0x08}, // > + {0x02, 0x01, 0x51, 0x09, 0x06}, // ? + {0x32, 0x49, 0x59, 0x51, 0x3E}, // @ + {0x7E, 0x11, 0x11, 0x11, 0x7E}, // A + {0x7F, 0x49, 0x49, 0x49, 0x36}, // B + {0x3E, 0x41, 0x41, 0x41, 0x22}, // C + {0x7F, 0x41, 0x41, 0x22, 0x1C}, // D + {0x7F, 0x49, 0x49, 0x49, 0x41}, // E + {0x7F, 0x09, 0x09, 0x09, 0x01}, // F + {0x3E, 0x41, 0x49, 0x49, 0x7A}, // G + {0x7F, 0x08, 0x08, 0x08, 0x7F}, // H + {0x00, 0x41, 0x7F, 0x41, 0x00}, // I + {0x20, 0x40, 0x41, 0x3F, 0x01}, // J + {0x7F, 0x08, 0x14, 0x22, 0x41}, // K + {0x7F, 0x40, 0x40, 0x40, 0x40}, // L + {0x7F, 0x02, 0x0C, 0x02, 0x7F}, // M + {0x7F, 0x04, 0x08, 0x10, 0x7F}, // N + {0x3E, 0x41, 0x41, 0x41, 0x3E}, // O + {0x7F, 0x09, 0x09, 0x09, 0x06}, // P + {0x3E, 0x41, 0x51, 0x21, 0x5E}, // Q + {0x7F, 0x09, 0x19, 0x29, 0x46}, // R + {0x46, 0x49, 0x49, 0x49, 0x31}, // S + {0x01, 0x01, 0x7F, 0x01, 0x01}, // T + {0x3F, 0x40, 0x40, 0x40, 0x3F}, // U + {0x1F, 0x20, 0x40, 0x20, 0x1F}, // V + {0x3F, 0x40, 0x38, 0x40, 0x3F}, // W + {0x63, 0x14, 0x08, 0x14, 0x63}, // X + {0x07, 0x08, 0x70, 0x08, 0x07}, // Y + {0x61, 0x51, 0x49, 0x45, 0x43}, // Z + {0x00, 0x7F, 0x41, 0x41, 0x00}, // [ + {0x55, 0x2A, 0x55, 0x2A, 0x55}, // / + {0x00, 0x41, 0x41, 0x7F, 0x00}, // ] + {0x04, 0x02, 0x01, 0x02, 0x04}, // ^ + {0x40, 0x40, 0x40, 0x40, 0x40}, // _ + {0x00, 0x01, 0x02, 0x04, 0x00}, // ' + {0x20, 0x54, 0x54, 0x54, 0x78}, // a + {0x7F, 0x48, 0x44, 0x44, 0x38}, // b + {0x38, 0x44, 0x44, 0x44, 0x20}, // c + {0x38, 0x44, 0x44, 0x48, 0x7F}, // d + {0x38, 0x54, 0x54, 0x54, 0x18}, // e + {0x08, 0x7E, 0x09, 0x01, 0x02}, // f + {0x0C, 0x52, 0x52, 0x52, 0x3E}, // g + {0x7F, 0x08, 0x04, 0x04, 0x78}, // h + {0x00, 0x44, 0x7D, 0x40, 0x00}, // i + {0x20, 0x40, 0x44, 0x3D, 0x00}, // j + {0x7F, 0x10, 0x28, 0x44, 0x00}, // k + {0x00, 0x41, 0x7F, 0x40, 0x00}, // l + {0x7C, 0x04, 0x18, 0x04, 0x78}, // m + {0x7C, 0x08, 0x04, 0x04, 0x78}, // n + {0x38, 0x44, 0x44, 0x44, 0x38}, // o + {0x7C, 0x14, 0x14, 0x14, 0x08}, // p + {0x08, 0x14, 0x14, 0x18, 0x7C}, // q + {0x7C, 0x08, 0x04, 0x04, 0x08}, // r + {0x48, 0x54, 0x54, 0x54, 0x20}, // s + {0x04, 0x3F, 0x44, 0x40, 0x20}, // t + {0x3C, 0x40, 0x40, 0x20, 0x7C}, // u + {0x1C, 0x20, 0x40, 0x20, 0x1C}, // v + {0x3C, 0x40, 0x30, 0x40, 0x3C}, // w + {0x44, 0x28, 0x10, 0x28, 0x44}, // x + {0x0C, 0x50, 0x50, 0x50, 0x3C}, // y + {0x44, 0x64, 0x54, 0x4C, 0x44}, // z + {0x08, 0x3e, 0x41, 0x41, 0x00}, // { + {0x00, 0x00, 0x77, 0x00, 0x00}, // | + {0x00, 0x41, 0x41, 0x3e, 0x08}, // } + {0x02, 0x01, 0x02, 0x01, 0x00} // ~ +}; + +/******************************************************************************/ +/************************ Functions Definitions *******************************/ +/******************************************************************************/ + +/***************************************************************************//** + * @brief Transmits 8 bits to ST7579 controller. + * + * @param data - Data to transmit. + * + * @return None. +*******************************************************************************/ +void ST7579_WriteByte(unsigned char data) +{ + SPI_Write(3, // The ID of the selected slave device. + &data, // Write buffer. + 1); // Number of bytes to write. +} + +/***************************************************************************//** + * @brief Sets X and Y adress of RAM. + * + * @param yPosition - Y address of RAM. + * @param xPosition - X address of RAM. + * + * @return None. +*******************************************************************************/ +void ST7579_GoTo(unsigned char yPosition, + unsigned char xPosition) +{ + ST7579_RS_LOW; + /* Set X address of RAM. */ + ST7579_WriteByte(0x28); + ST7579_WriteByte(0x80 + xPosition); + /* Set Y address of RAM. */ + ST7579_WriteByte(0x28); + ST7579_WriteByte(0x40 + yPosition); + ST7579_RS_HIGH; +} + +/***************************************************************************//** + * @brief Clears ST7579 RAM. + * + * @return None. +*******************************************************************************/ +void ST7579_Clear(void) +{ + unsigned short clearPosition = 0; + unsigned char yPosition = 0; + + for(clearPosition = 0; clearPosition < (8 * 96); clearPosition++) + { + if(!(clearPosition % 96)) + { + /* Set the X and Y address of RAM. */ + ST7579_GoTo(yPosition, 0); + yPosition++; + } + ST7579_WriteByte(0x00); + } +} + +/***************************************************************************//** + * @brief Initializes the ST7579 controller. + * + * @return status - Result of the initialization procedure. + * Example: 1 - if initialization was successful; + * 0 - if initialization was unsuccessful. +*******************************************************************************/ +unsigned char ST7579_Init(void) +{ + unsigned char status = 0; + unsigned short delay = 0; + + status = SPI_Init(0, // Transfer format. + 1000000, // SPI clock frequency. + 0, // SPI clock polarity. + 1); // SPI clock edge. + if(status != 1) + { + return status; + } + ST7579_RS_OUT; + ST7579_RS_LOW; + /* Select LCD bias ratio of the voltage required for driving the LCD. */ + ST7579_WriteByte(0x21); + ST7579_WriteByte(0x16); + /* Select Booster efficiency and Booster stage. */ + ST7579_WriteByte(0x23); + ST7579_WriteByte(0x99); + /* Set V0 Range. */ + ST7579_WriteByte(0x20); + ST7579_WriteByte(0x04); + /* 50 ms delay is recommended. */ + for(delay = 0; delay < 1000; delay++) + { + asm("NOP"); + } + /* Set the frame frequency */ + ST7579_WriteByte(0x23); + ST7579_WriteByte(0x0C); + /* Set V0. */ + ST7579_WriteByte(0x21); + ST7579_WriteByte(0xE7); + /* Select the display mode */ + ST7579_WriteByte(0x20); + ST7579_WriteByte(0x0C); + ST7579_RS_HIGH; + /* Clear RAM. */ + ST7579_Clear(); + + return status; +} + +/***************************************************************************//** + * @brief Sends a character to ST7579 controller. + * + * @param yPosition - Y address of RAM. + * @param xPosition - X address of RAM. + * @param character - The character. + * @param bigFont - Big font selection. + * + * @return None. +*******************************************************************************/ +void ST7579_Char(unsigned char yPosition, + unsigned char xPosition, + unsigned char character, + unsigned char bigFont) +{ + unsigned char column = 0; + unsigned char data = 0; + + if(bigFont) + { + /* Set the X and Y address of RAM. */ + ST7579_GoTo(yPosition, xPosition); + /* Send character data. */ + for(column = 0; column < 5; column++) + { + data = st7579Font[character - 32][column]; + data = ((data & 0x01) ? 0x03 : 0) | + ((data & 0x02) ? 0x0C : 0) | + ((data & 0x04) ? 0x30 : 0) | + ((data & 0x08) ? 0xC0 : 0); + ST7579_WriteByte(data); + ST7579_WriteByte(data); + ST7579_WriteByte(data); + } + ST7579_WriteByte(0); + ST7579_WriteByte(0); + ST7579_WriteByte(0); + yPosition++; + /* Set the X and Y address of RAM. */ + ST7579_GoTo(yPosition, xPosition); + /* Send character data. */ + for(column = 0; column < 5; column++) + { + data = st7579Font[character - 32][column]; + data = ((data & 0x10) ? 0x03 : 0) | + ((data & 0x20) ? 0x0C : 0) | + ((data & 0x40) ? 0x30 : 0) | + ((data & 0x80) ? 0xC0 : 0); + ST7579_WriteByte(data); + ST7579_WriteByte(data); + ST7579_WriteByte(data); + } + ST7579_WriteByte(0); + ST7579_WriteByte(0); + ST7579_WriteByte(0); + } + else + { + /* Set the X and Y address of RAM. */ + ST7579_GoTo(yPosition, xPosition); + /* Send character data. */ + for(column = 0; column < 5; column++) + { + ST7579_WriteByte(st7579Font[character - 32][column] << 1); + } + ST7579_WriteByte(0x00); + } +} + +/***************************************************************************//** + * @brief Sends a string to ST7579 controller. + * + * @param yPosition - Y address of RAM. + * @param xPosition - X address of RAM. + * @param string - The string. + * @param bigFont - Big font selection. + * + * @return None. +*******************************************************************************/ +void ST7579_String(unsigned char yPosition, + unsigned char xPosition, + unsigned char* string, + unsigned char bigFont) +{ + while(*string) + { + /* Send each character of the string. */ + ST7579_Char(yPosition, xPosition, *string++, bigFont); + xPosition += 6 + (bigFont * 12); + } +} + +/***************************************************************************//** + * @brief Sends an integer number to ST7579 controller. + * + * @param yPosition - Y address of RAM. + * @param xPosition - X address of RAM. + * @param number - The number. + * @param bigFont - Big font selection. + * + * @return None. +*******************************************************************************/ +void ST7579_Number(unsigned char yPosition, + unsigned char xPosition, + long number, + unsigned char bigFont) +{ + unsigned long mask = 1000000000; + unsigned char chNumber = 10; + unsigned char chIndex = 0; + + //bigFont = 0; + if(number < 0) + { + ST7579_Char(yPosition, xPosition, '-', bigFont); + xPosition += 6 + (bigFont * 12); + number *= -1; + } + else + { + if(number == 0) + { + ST7579_String(yPosition, xPosition, " 0", bigFont); + } + else + { + ST7579_Char(yPosition, xPosition, '+', bigFont); + xPosition += 6 + (bigFont * 12); + } + } + while(mask > number) + { + mask /= 10; + chNumber--; + } + for(chIndex = 0; chIndex < chNumber; chIndex++) + { + ST7579_Char(yPosition, xPosition, ((number / mask) % 10) + 0x30, bigFont); + mask /= 10; + xPosition += 6 + (bigFont * 12); + } +} + +/***************************************************************************//** + * @brief Sends a float number to ST7579 controller. + * + * @param yPosition - Y address of RAM. + * @param xPosition - X address of RAM. + * @param number - The number. + * @param resolution - Float resolution. + * @param bigFont - Big font selection. + * + * @return None. +*******************************************************************************/ +void ST7579_FloatNumber(unsigned char yPosition, + unsigned char xPosition, + float number, + unsigned char resolution, + unsigned char bigFont) +{ + unsigned long mask = 1000000000; + unsigned char chNumber = 10; + unsigned char index = 0; + long display = 1; + long multiplication = 1; + + + for(index = 0; index < resolution; index++) + { + multiplication *= 10; + } + display = (long)(number * multiplication); + if(display < 0) + { + ST7579_Char(yPosition, xPosition, '-', bigFont); + xPosition += 6 + (bigFont * 12); + number *= -1; + } + else + { + if(display == 0) + { + xPosition += 6 + (bigFont * 12); + ST7579_Char(yPosition, xPosition, '0', bigFont); + xPosition += 6 + (bigFont * 12); + if(resolution) + { + ST7579_Char(yPosition, xPosition, '.', bigFont); + xPosition += 6 + (bigFont * 12); + } + for(index = 0; index < resolution; index++) + { + ST7579_Char(yPosition, xPosition, '0', bigFont); + xPosition += 6 + (bigFont * 12); + } + } + else + { + ST7579_Char(yPosition, xPosition, '+', bigFont); + xPosition += 6 + (bigFont * 12); + } + } + while(mask > display) + { + mask /= 10; + chNumber--; + } + if((display > 0) && (display < multiplication)) + { + ST7579_String(yPosition, xPosition, "0.", bigFont); + xPosition += 12 + (bigFont * 24); + } + for(index = 0; index < chNumber; index++) + { + ST7579_Char(yPosition, xPosition, ((display / mask) % 10) + 0x30, bigFont); + mask /= 10; + xPosition += 6 + (bigFont * 12); + if((multiplication != 1) && (mask == (multiplication / 10))) + { + ST7579_Char(yPosition, xPosition, '.', bigFont); + xPosition += 6 + (bigFont * 12); + } + } +} + +/***************************************************************************//** + * @brief Sends an integer number in Hexa format to ST7579 controller. + * + * @param yPosition - Y address of RAM. + * @param xPosition - X address of RAM. + * @param number - The number. + * @param bigFont - Big font selection. + * + * @return None. +*******************************************************************************/ +void ST7579_HexNumber(unsigned char yPosition, + unsigned char xPosition, + long number, + unsigned char bigFont) +{ + unsigned long long mask = 268435456; + unsigned char chNumber = 8; + unsigned char chIndex = 0; + unsigned char display = 0; + + ST7579_String(yPosition, xPosition, "0x", bigFont); + xPosition += (6 + (bigFont * 12)) * 2; + if(number == 0) + { + ST7579_Char(yPosition, xPosition, '0', bigFont); + } + while(mask > number) + { + mask /= 16; + chNumber--; + } + for(chIndex = 0; chIndex < chNumber; chIndex++) + { + display = (number / mask) % 16; + mask /= 16; + if(display <= 9) + { + display += 0x30; + } + else + { + display += 0x37; + } + ST7579_Char(yPosition, xPosition, display, bigFont); + xPosition += 6 + (bigFont * 12); + } +} + +/***************************************************************************//** + * @brief Sends an image array to ST7579 controller. + * + * @param yPosition - Y address of RAM. + * @param xPosition - X address of RAM. + * @param image - The image array. + * @param width - The width of the image (pixels). + * @param height - The height of the image (pixels). + * + * @return None. +*******************************************************************************/ +void ST7579_Image(unsigned char yPosition, + unsigned char xPosition, + const unsigned char image[], + unsigned char width, + unsigned char height) +{ + unsigned short index = 0; + + for(index = 0; index < (width * height / 8); index++) + { + if(!(index % width)) + { + /* Set the X and Y address of RAM. */ + ST7579_GoTo(yPosition, xPosition); + yPosition ++; + } + ST7579_WriteByte(image[index]); + } +} diff --git a/ST7579.h b/ST7579.h new file mode 100644 index 000000000..75d13a70b --- /dev/null +++ b/ST7579.h @@ -0,0 +1,100 @@ +/***************************************************************************//** + * @file ST7579.h + * @brief Header file of ST7579 Driver. + * @author DBogdan (dragos.bogdan@analog.com) +******************************************************************************** + * Copyright 2012(c) Analog Devices, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * - The use of this software may or may not infringe the patent rights + * of one or more patent holders. This license does not release you + * from the requirement that you obtain separate licenses from these + * patent holders to use this software. + * - Use of the software either in source or binary form, must be run + * on or directly connected to an Analog Devices Inc. component. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +******************************************************************************** + * SVN Revision: $WCREV$ +*******************************************************************************/ +#ifndef __ST7579_H__ +#define __ST7579_H__ + +/******************************************************************************/ +/************************ Functions Declarations ******************************/ +/******************************************************************************/ + +/*! Transmits 8 bits to ST7579 controller. */ +void ST7579_WriteByte(unsigned char data); + +/*! Sets X and Y adress of RAM. */ +void ST7579_GoTo(unsigned char yPosition, + unsigned char xPosition); + +/*! Clears ST7579 RAM. */ +void ST7579_Clear(void); + +/*! Initializes the ST7579 controller. */ +unsigned char ST7579_Init(void); + +/*! Sends a character to ST7579 controller. */ +void ST7579_Char(unsigned char yPosition, + unsigned char xPosition, + unsigned char character, + unsigned char bigFont); + +/*! Sends a string to ST7579 controller. */ +void ST7579_String(unsigned char yPosition, + unsigned char xPosition, + unsigned char* string, + unsigned char bigFont); + +/*! Sends an integer number to ST7579 controller. */ +void ST7579_Number(unsigned char yPosition, + unsigned char xPosition, + long number, + unsigned char bigFont); + +/*! Sends a float number to ST7579 controller. */ +void ST7579_FloatNumber(unsigned char yPosition, + unsigned char xPosition, + float number, + unsigned char resolution, + unsigned char bigFont); + +/*! Sends an integer number in Hexa format to ST7579 controller. */ +void ST7579_HexNumber(unsigned char yPosition, + unsigned char xPosition, + long number, + unsigned char bigFont); + +/*! Sends an image array to ST7579 controller. */ +void ST7579_Image(unsigned char yPosition, + unsigned char xPosition, + const unsigned char image[], + unsigned char width, + unsigned char height); + +#endif // __ST7579_H__ From 68417a072878f8f56ba218a8eef777fddf005214 Mon Sep 17 00:00:00 2001 From: Dragos Bogdan Date: Mon, 20 May 2013 19:05:41 +0300 Subject: [PATCH 09/20] Added 3 more functions. --- ADF7023.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ ADF7023.h | 9 +++++++ ADF7023_Config.h | 14 +++++------ 3 files changed, 77 insertions(+), 7 deletions(-) diff --git a/ADF7023.c b/ADF7023.c index 4dfb4660c..f808198e1 100644 --- a/ADF7023.c +++ b/ADF7023.c @@ -282,3 +282,64 @@ void ADF7023_TransmitPacket(unsigned char* packet, unsigned char length) &interruptReg); } } + +/***************************************************************************//** + * @brief Sets the channel frequency. + * + * @param chFreq - Channel frequency. + * + * @return None. +*******************************************************************************/ +void ADF7023_SetChannelFrequency(unsigned long chFreq) +{ + chFreq = (unsigned long)(((float)chFreq / 26000000) * 65535); + ADF7023_BBRAMCurrent.channelFreq0 = (chFreq & 0x0000FF) >> 0; + ADF7023_BBRAMCurrent.channelFreq1 = (chFreq & 0x00FF00) >> 8; + ADF7023_BBRAMCurrent.channelFreq2 = (chFreq & 0xFF0000) >> 16; + ADF7023_SetRAM(0x100, 64, (unsigned char*)&ADF7023_BBRAMCurrent); +} + +/***************************************************************************//** + * @brief Sets the data rate. + * + * @param dataRate - Data rate. + * + * @return None. +*******************************************************************************/ +void ADF7023_SetDataRate(unsigned long dataRate) +{ + unsigned char status = 0; + + dataRate = (unsigned long)(dataRate / 100); + ADF7023_BBRAMCurrent.radioCfg0 = + BBRAM_RADIO_CFG_0_DATA_RATE_7_0((dataRate & 0x00FF) >> 0); + ADF7023_BBRAMCurrent.radioCfg1 &= ~BBRAM_RADIO_CFG_1_DATA_RATE_11_8(0xF); + ADF7023_BBRAMCurrent.radioCfg1 |= + BBRAM_RADIO_CFG_1_DATA_RATE_11_8((dataRate & 0x0F00) >> 8); + ADF7023_SetRAM(0x100, 64, (unsigned char*)&ADF7023_BBRAMCurrent); + ADF7023_SetFwState(FW_STATE_PHY_OFF); + ADF7023_SetCommand(CMD_CONFIG_DEV); +} + +/***************************************************************************//** + * @brief Sets the frequency deviation. + * + * @param freqDev - Frequency deviation. + * + * @return None. +*******************************************************************************/ +void ADF7023_SetFrequencyDeviation(unsigned long freqDev) +{ + unsigned char status = 0; + + freqDev = (unsigned long)(freqDev / 100); + ADF7023_BBRAMCurrent.radioCfg1 &= + ~BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8(0xF); + ADF7023_BBRAMCurrent.radioCfg1 |= + BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8((freqDev & 0x0F00) >> 8); + ADF7023_BBRAMCurrent.radioCfg2 = + BBRAM_RADIO_CFG_2_FREQ_DEVIATION_7_0((freqDev & 0x00FF) >> 0); + ADF7023_SetRAM(0x100, 64, (unsigned char*)&ADF7023_BBRAMCurrent); + ADF7023_SetFwState(FW_STATE_PHY_OFF); + ADF7023_SetCommand(CMD_CONFIG_DEV); +} diff --git a/ADF7023.h b/ADF7023.h index 26536647c..1bc9bced5 100644 --- a/ADF7023.h +++ b/ADF7023.h @@ -398,4 +398,13 @@ void ADF7023_ReceivePacket(unsigned char* packet, unsigned char* length); /* Transmits one packet. */ void ADF7023_TransmitPacket(unsigned char* packet, unsigned char length); +/* Sets the channel frequency. */ +void ADF7023_SetChannelFrequency(unsigned long chFreq); + +/* Sets the data rate. */ +void ADF7023_SetDataRate(unsigned long dataRate); + +/* Sets the frequency deviation. */ +void ADF7023_SetFrequencyDeviation(unsigned long freqDev); + #endif // __ADF7023_H__ diff --git a/ADF7023_Config.h b/ADF7023_Config.h index 3f97aaab3..bdcf8c07a 100644 --- a/ADF7023_Config.h +++ b/ADF7023_Config.h @@ -72,18 +72,18 @@ struct ADF7023_BBRAM ADF7023_BBRAMDefault = /* swmRssiThresh - 0x108 */ 0x31, /* channelFreq0 - 0x109 */ - 0x3B, + 0x51, // Channel Frequency: 433 MHz /* channelFreq1 - 0x10A */ - 0x31, + 0xA7, // Channel Frequency: 433 MHz /* channelFreq2 - 0x10B */ - 0x23, + 0x10, // Channel Frequency: 433 MHz /* radioCfg0 - 0x10C */ - BBRAM_RADIO_CFG_0_DATA_RATE_7_0(0xF4), + BBRAM_RADIO_CFG_0_DATA_RATE_7_0(0xE8), // Data rate: 100 kbps /* radioCfg1 - 0x10D */ - BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8(1) | - BBRAM_RADIO_CFG_1_DATA_RATE_11_8(1), + BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8(0x00) | // Frequency deviation: 25 Hz + BBRAM_RADIO_CFG_1_DATA_RATE_11_8(0x03), // Data rate: 100 kbps /* radioCfg2 - 0x10E */ - BBRAM_RADIO_CFG_2_FREQ_DEVIATION_7_0(0xF4), + BBRAM_RADIO_CFG_2_FREQ_DEVIATION_7_0(0xFA), // Frequency deviation: 25 Hz /* radioCfg3 - 0x10F */ 0x31, /* radioCfg4 - 0x110 */ From 97fb8b4a447ff9bbc50768904cc05f9cc2c953bb Mon Sep 17 00:00:00 2001 From: Dragos Bogdan Date: Thu, 23 May 2013 16:12:03 +0300 Subject: [PATCH 10/20] Added the TIME driver for RL78G14. --- Communication.c | 185 ++++++++++++++++++++++++++++-------------------- Communication.h | 23 +++++- RDKRL78G14.c | 4 +- RDKRL78G14.h | 46 ++++++------ ST7579.c | 44 ++++++------ ST7579.h | 2 +- TIME.c | 167 +++++++++++++++++++++++++++++++++++++++++++ TIME.h | 65 +++++++++++++++++ 8 files changed, 411 insertions(+), 125 deletions(-) create mode 100644 TIME.c create mode 100644 TIME.h diff --git a/Communication.c b/Communication.c index 949edeb98..104e3e556 100644 --- a/Communication.c +++ b/Communication.c @@ -66,25 +66,25 @@ __interrupt static void IICA0_Interrupt(void) /***************************************************************************//** * @brief Initializes the SPI communication peripheral. * - * @param lsbFirst - Transfer format (0 or 1). - * Example: 0x0 - MSB first. - * 0x1 - LSB first. + * @param lsbFirst - Transfer format (0 or 1). + * Example: 0x0 - MSB first. + * 0x1 - LSB first. * @param clockFreq - SPI clock frequency (Hz). * Example: 1000 - SPI clock frequency is 1 kHz. - * @param clockPol - SPI clock polarity (0 or 1). - * Example: 0x0 - Idle state for clock is a low level; active - * state is a high level; - * 0x1 - Idle state for clock is a high level; active - * state is a low level. - * @param clockEdg - SPI clock edge (0 or 1). - * Example: 0x0 - Serial output data changes on transition - * from idle clock state to active clock state; - * 0x1 - Serial output data changes on transition - * from active clock state to idle clock state. + * @param clockPol - SPI clock polarity (0 or 1). + * Example: 0x0 - Idle state for clock is a low level; active + * state is a high level; + * 0x1 - Idle state for clock is a high level; active + * state is a low level. + * @param clockEdg - SPI clock edge (0 or 1). + * Example: 0x0 - Serial output data changes on transition + * from idle clock state to active clock state; + * 0x1 - Serial output data changes on transition + * from active clock state to idle clock state. * - * @return status - Result of the initialization procedure. - * Example: 1 - if initialization was successful; - * 0 - if initialization was unsuccessful. + * @return status - Result of the initialization procedure. + * Example: 0 - if initialization was successful; + * -1 - if initialization was unsuccessful. *******************************************************************************/ char SPI_Init(char lsbFirst, long clockFreq, @@ -93,6 +93,7 @@ char SPI_Init(char lsbFirst, { long mckFreq = 32000000; char sdrValue = 0; + char delay = 0; /* Configure the CS pins. */ PMOD1_CS_OUT; @@ -119,43 +120,49 @@ char SPI_Init(char lsbFirst, SMR11 = 0x0020; clockPol = 1 - clockPol; - SCR11 = (clockEdg << 13) | - (clockPol << 12) | - 0xC000 | // Operation mode: Transmission/reception. - 0x0007; // 8-bit data length. + SCR11 = (clockEdg << 13) | + (clockPol << 12) | + 0xC000 | // Operation mode: Transmission/reception. + 0x0007; // 8-bit data length. /* clockFreq = mckFreq / (sdrValue * 2 + 2) */ sdrValue = mckFreq / (2 * clockFreq) - 1; - SDR11 = sdrValue << 9; + SDR11 = sdrValue << 9; /* Set the clock and data initial level. */ clockPol = 1 - clockPol; - SO1 &= ~0x0202; - SO1 |= (clockPol << 9) | + SO1 &= ~0x0202; + SO1 |= (clockPol << 9) | (clockPol << 1); /* Enable output for serial communication operation. */ SOE1 |= 0x0002; - /* Configure SCLK and MOSI pins as output. */ - PM7 &= ~0x05; - P7 |= 0x05; - /* Configure the MISO pin as input. */ - PM7 |= 0x02; - + PM7 |= 0x02; + + /* Configure SCLK and MOSI pins as output. */ + P7 |= 0x05; + PM7 &= ~0x05; + + /* Wait for the changes to take place. */ + for(delay = 0; delay < 50; delay++) + { + NOP; + } + /* Set the SEmn bit to 1 and enter the communication wait status */ SS1 |= 0x0002; - - return 1; + + return 0; } /***************************************************************************//** * @brief Writes data to SPI. * * @param slaveDeviceId - The ID of the selected slave device. - * @param data - Data represents the write buffer. - * @param bytesNumber - Number of bytes to write. + * @param data - Data represents the write buffer. + * @param bytesNumber - Number of bytes to write. * * @return Number of written bytes. *******************************************************************************/ @@ -163,8 +170,10 @@ char SPI_Write(char slaveDeviceId, unsigned char* data, char bytesNumber) { - char byte = 0; - unsigned char read = 0; + char byte = 0; + unsigned char read = 0; + unsigned short originalSCR = 0; + unsigned short originalSO1 = 0; if(slaveDeviceId == 1) { @@ -176,6 +185,12 @@ char SPI_Write(char slaveDeviceId, } if(slaveDeviceId == 3) { + ST1 |= 0x0002; + originalSO1 = SO1; + originalSCR = SCR11; + SO1 &= ~0x0202; + SCR11 &= ~0x3000; + SS1 |= 0x0002; ST7579_CS_LOW; } for(byte = 0; byte < bytesNumber; byte++) @@ -196,6 +211,10 @@ char SPI_Write(char slaveDeviceId, if(slaveDeviceId == 3) { ST7579_CS_HIGH; + ST1 |= 0x0002; + SO1 = originalSO1; + SCR11 = originalSCR; + SS1 |= 0x0002; } return bytesNumber; @@ -205,9 +224,9 @@ char SPI_Write(char slaveDeviceId, * @brief Reads data from SPI. * * @param slaveDeviceId - The ID of the selected slave device. - * @param data - Data represents the write buffer as an input parameter and the - * read buffer as an output parameter. - * @param bytesNumber - Number of bytes to read. + * @param data - Data represents the write buffer as an input parameter + * and the read buffer as an output parameter. + * @param bytesNumber - Number of bytes to read. * * @return Number of read bytes. *******************************************************************************/ @@ -215,7 +234,9 @@ char SPI_Read(char slaveDeviceId, unsigned char* data, char bytesNumber) { - char byte = 0; + char byte = 0; + unsigned short originalSCR = 0; + unsigned short originalSO1 = 0; if(slaveDeviceId == 1) { @@ -227,6 +248,12 @@ char SPI_Read(char slaveDeviceId, } if(slaveDeviceId == 3) { + ST1 |= 0x0002; + originalSO1 = SO1; + originalSCR = SCR11; + SO1 &= ~0x0202; + SCR11 &= ~0x3000; + SS1 |= 0x0002; ST7579_CS_LOW; } for(byte = 0; byte < bytesNumber; byte++) @@ -247,6 +274,10 @@ char SPI_Read(char slaveDeviceId, if(slaveDeviceId == 3) { ST7579_CS_HIGH; + ST1 |= 0x0002; + SO1 = originalSO1; + SCR11 = originalSCR; + SS1 |= 0x0002; } return bytesNumber; @@ -257,9 +288,9 @@ char SPI_Read(char slaveDeviceId, * * @param clockFreq - I2C clock frequency (Hz). * Example: 100000 - SPI clock frequency is 100 kHz. - * @return status - Result of the initialization procedure. - * Example: 1 - if initialization was successful; - * 0 - if initialization was unsuccessful. + * @return status - Result of the initialization procedure. + * Example: 0 - if initialization was successful; + * -1 - if initialization was unsuccessful. *******************************************************************************/ char I2C_Init(long clockFreq) { @@ -279,13 +310,13 @@ char I2C_Init(long clockFreq) /* Set transfer rate. */ wlValue = (unsigned char)((0.5 * fckFreq) / clockFreq); whValue = (unsigned char)(wlValue - (fckFreq / (10 * clockFreq))); - IICWL0 = wlValue; - IICWH0 = whValue; + IICWL0 = wlValue; + IICWH0 = whValue; - STCEN0 = 1; // After operation is enabled, enable generation of a start - // condition without detecting a stop condition. - WTIM0 = 1; // Interrupt request is generated at the ninth clock’s - // falling edge. + STCEN0 = 1; // After operation is enabled, enable generation of a start + // condition without detecting a stop condition. + WTIM0 = 1; // Interrupt request is generated at the ninth clock’s + // falling edge. /* Enable I2C operation. */ IICE0 = 1; @@ -294,21 +325,21 @@ char I2C_Init(long clockFreq) P6 &= ~0x03; PM6 &= ~0x03; - return 1; + return 0; } /***************************************************************************//** * @brief Writes data to a slave device. * * @param slaveAddress - Adress of the slave device. - * @param dataBuffer - Pointer to a buffer storing the transmission data. - * @param bytesNumber - Number of bytes to write. - * @param stopBit - Stop condition control. - * Example: 0 - A stop condition will not be sent; - * 1 - A stop condition will be sent. + * @param dataBuffer - Pointer to a buffer storing the transmission data. + * @param bytesNumber - Number of bytes to write. + * @param stopBit - Stop condition control. + * Example: 0 - A stop condition will not be sent; + * 1 - A stop condition will be sent. * - * @return status - Number of read bytes or 0xFF if the slave address was not - * acknowledged by the device. + * @return status - Number of read bytes or 0xFF if the slave address was + * not acknowledged by the device. *******************************************************************************/ char I2C_Write(char slaveAddress, unsigned char* dataBuffer, @@ -318,13 +349,13 @@ char I2C_Write(char slaveAddress, char byte = 0; char status = 0; - IICAMK0 = 1; // Interrupt servicing disabled. - STT0 = 1; // Generate a start condition. - IICAMK0 = 0; // Interrupt servicing enabled. + IICAMK0 = 1; // Interrupt servicing disabled. + STT0 = 1; // Generate a start condition. + IICAMK0 = 0; // Interrupt servicing enabled. /* Send the first byte. */ IICA0_Flag = 0; - IICA0 = (slaveAddress << 1); + IICA0 = (slaveAddress << 1); while(IICA0_Flag == 0); if(ACKD0) // Acknowledge was detected. @@ -332,7 +363,7 @@ char I2C_Write(char slaveAddress, for(byte = 0; byte < bytesNumber; byte++) { IICA0_Flag = 0; - IICA0 = *dataBuffer; + IICA0 = *dataBuffer; while(IICA0_Flag == 0); dataBuffer++; } @@ -355,14 +386,14 @@ char I2C_Write(char slaveAddress, * @brief Reads data from a slave device. * * @param slaveAddress - Adress of the slave device. - * @param dataBuffer - Pointer to a buffer that will store the received data. - * @param bytesNumber - Number of bytes to read. - * @param stopBit - Stop condition control. - * Example: 0 - A stop condition will not be sent; - * 1 - A stop condition will be sent. + * @param dataBuffer - Pointer to a buffer that will store the received data. + * @param bytesNumber - Number of bytes to read. + * @param stopBit - Stop condition control. + * Example: 0 - A stop condition will not be sent; + * 1 - A stop condition will be sent. * - * @return status - Number of read bytes or 0xFF if the slave address was not - * acknowledged by the device. + * @return status - Number of read bytes or 0xFF if the slave address was + * not acknowledged by the device. *******************************************************************************/ char I2C_Read(char slaveAddress, unsigned char* dataBuffer, @@ -373,12 +404,12 @@ char I2C_Read(char slaveAddress, char status = 0; IICAMK0 = 1; // Interrupt servicing disabled. - STT0 = 1; // Generate a start condition. + STT0 = 1; // Generate a start condition. IICAMK0 = 0; // Interrupt servicing enabled. /* Send the first byte. */ IICA0_Flag = 0; - IICA0 = (slaveAddress << 1) + 1; + IICA0 = (slaveAddress << 1) + 1; while(IICA0_Flag == 0); if(ACKD0) // Acknowledge was detected. @@ -388,24 +419,24 @@ char I2C_Read(char slaveAddress, { if(byte == (bytesNumber - 1)) { - ACKE0 = 0U; // Disable acknowledgment. + ACKE0 = 0U; // Disable acknowledgment. } - WREL0 = 1U; // Cancel wait. - IICA0_Flag = 0; + WREL0 = 1U; // Cancel wait. + IICA0_Flag = 0; while(IICA0_Flag == 0); *dataBuffer = IICA0; dataBuffer++; } status = bytesNumber; } - else // Acknowledge was not detected. + else // Acknowledge was not detected. { - status = 0xFF; + status = 0xFF; } if(stopBit) { - SPT0 = 1; // Generate a stop condition. - while(IICBSY0); // Wait until the I2C bus status flag is cleared. + SPT0 = 1; // Generate a stop condition. + while(IICBSY0); // Wait until the I2C bus status flag is cleared. } return status; diff --git a/Communication.h b/Communication.h index 268e5dfed..0d563bfad 100644 --- a/Communication.h +++ b/Communication.h @@ -50,9 +50,26 @@ /******************************************************************************/ /*************************** Macros Definitions *******************************/ /******************************************************************************/ -#define CS_PIN_LOW PMOD1_CS_LOW -#define CS_PIN_HIGH PMOD1_CS_HIGH -#define MISO_PIN PMOD1_MISO +#define SPI_CS_PIN_OUT PMOD1_CS_OUT +#define SPI_CS_LOW PMOD1_CS_LOW +#define SPI_CS_HIGH PMOD1_CS_HIGH +#define SPI_MISO PMOD1_MISO + +#define GPIO1_PIN_OUT PMOD1_GPIO1_PIN_OUT +#define GPIO1_LOW PMOD1_GPIO1_LOW +#define GPIO1_HIGH PMOD1_GPIO1_HIGH + +#define GPIO2_PIN_OUT PMOD1_GPIO2_PIN_OUT +#define GPIO2_LOW PMOD1_GPIO2_LOW +#define GPIO2_HIGH PMOD1_GPIO2_HIGH + +#define GPIO3_PIN_OUT PMOD1_GPIO3_PIN_OUT +#define GPIO3_LOW PMOD1_GPIO3_LOW +#define GPIO3_HIGH PMOD1_GPIO3_HIGH + +#define GPIO4_PIN_OUT PMOD1_GPIO4_PIN_OUT +#define GPIO4_LOW PMOD1_GPIO4_LOW +#define GPIO4_HIGH PMOD1_GPIO4_HIGH /******************************************************************************/ /************************ Functions Declarations ******************************/ diff --git a/RDKRL78G14.c b/RDKRL78G14.c index 8a874fcf0..5f77dfb69 100644 --- a/RDKRL78G14.c +++ b/RDKRL78G14.c @@ -37,7 +37,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ******************************************************************************** - * SVN Revision: 831 + * SVN Revision: $WCREV$ *******************************************************************************/ /******************************************************************************/ @@ -71,7 +71,7 @@ void RDKRL78G14_Reset(void) * * @return status - Result of the initialization procedure. * Example: 0 - if initialization was successful; - * -1 - if initialization was unsuccessful. + * -1 - if initialization was unsuccessful. *******************************************************************************/ char RDKRL78G14_Init(void) { diff --git a/RDKRL78G14.h b/RDKRL78G14.h index 1ddb011fa..c7eb230e2 100644 --- a/RDKRL78G14.h +++ b/RDKRL78G14.h @@ -37,7 +37,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ******************************************************************************** - * SVN Revision: 831 + * SVN Revision: $WCREV$ *******************************************************************************/ #ifndef __RDKRL78G14_H__ @@ -88,7 +88,31 @@ /* PMOD1 MISO Pin */ #define PMOD1_MISO_PIN (1 << 1) -#define PMOD1_MISO ((P7 & PMOD1_MISO_PIN) >> 1) +#define PMOD1_MISO ((P7 & PMOD1_MISO_PIN) >> 1) + +/* PMOD1 GPIO1 Pin - P47 */ +#define PMOD1_GPIO1_PIN (1 << 7) +#define PMOD1_GPIO1_PIN_OUT PM4 &= ~PMOD1_GPIO1_PIN; +#define PMOD1_GPIO1_LOW P4 &= ~PMOD1_GPIO1_PIN; +#define PMOD1_GPIO1_HIGH P4 |= PMOD1_GPIO1_PIN; + +/* PMOD1 GPIO2 Pin - P46 */ +#define PMOD1_GPIO2_PIN (1 << 6) +#define PMOD1_GPIO2_PIN_OUT PM4 &= ~PMOD1_GPIO2_PIN; +#define PMOD1_GPIO2_LOW P4 &= ~PMOD1_GPIO2_PIN; +#define PMOD1_GPIO2_HIGH P4 |= PMOD1_GPIO2_PIN; + +/* PMOD1 GPIO3 Pin - P110 */ +#define PMOD1_GPIO3_PIN (1 << 0) +#define PMOD1_GPIO3_PIN_OUT PM11 &= ~PMOD1_GPIO3_PIN; +#define PMOD1_GPIO3_LOW P11 &= ~PMOD1_GPIO3_PIN; +#define PMOD1_GPIO3_HIGH P11 |= PMOD1_GPIO3_PIN; + +/* PMOD1 GPIO4 Pin - P111 */ +#define PMOD1_GPIO4_PIN (1 << 1) +#define PMOD1_GPIO4_PIN_OUT PM11 &= ~PMOD1_GPIO4_PIN; +#define PMOD1_GPIO4_LOW P11 &= ~PMOD1_GPIO4_PIN; +#define PMOD1_GPIO4_HIGH P11 |= PMOD1_GPIO4_PIN; /* PMOD2 CS Pin - P82 */ #define PMOD2_CS_PIN (1 << 2) @@ -96,24 +120,6 @@ #define PMOD2_CS_LOW P8 &= ~PMOD2_CS_PIN #define PMOD2_CS_HIGH P8 |= PMOD2_CS_PIN -/* GPIO1 Pin - P46 */ -#define GPIO1_PIN (1 << 6) -#define GPIO1_PIN_OUT PM4 &= ~GPIO1_PIN; -#define GPIO1_PIN_LOW P4 &= ~GPIO1_PIN; -#define GPIO1_PIN_HIGH P4 |= GPIO1_PIN; - -/* GPIO2 Pin - P110 */ -#define GPIO2_PIN (1 << 0) -#define GPIO2_PIN_OUT PM11 &= ~GPIO2_PIN; -#define GPIO2_PIN_LOW P11 &= ~GPIO2_PIN; -#define GPIO2_PIN_HIGH P11 |= GPIO2_PIN; - -/* GPIO3 Pin - P111 */ -#define GPIO3_PIN (1 << 1) -#define GPIO3_PIN_OUT PM11 &= ~GPIO3_PIN; -#define GPIO3_PIN_LOW P11 &= ~GPIO3_PIN; -#define GPIO3_PIN_HIGH P11 |= GPIO3_PIN; - /******************************************************************************/ /************************ Functions Declarations ******************************/ /******************************************************************************/ diff --git a/ST7579.c b/ST7579.c index f80d5f0f7..eddc94660 100644 --- a/ST7579.c +++ b/ST7579.c @@ -215,19 +215,19 @@ void ST7579_Clear(void) * @brief Initializes the ST7579 controller. * * @return status - Result of the initialization procedure. - * Example: 1 - if initialization was successful; - * 0 - if initialization was unsuccessful. + * Example: 0 - if initialization was successful; + * -1 - if initialization was unsuccessful. *******************************************************************************/ -unsigned char ST7579_Init(void) +char ST7579_Init(void) { - unsigned char status = 0; + char status = -1; unsigned short delay = 0; status = SPI_Init(0, // Transfer format. 1000000, // SPI clock frequency. 0, // SPI clock polarity. 1); // SPI clock edge. - if(status != 1) + if(status != 0) { return status; } @@ -269,7 +269,7 @@ unsigned char ST7579_Init(void) * @param yPosition - Y address of RAM. * @param xPosition - X address of RAM. * @param character - The character. - * @param bigFont - Big font selection. + * @param bigFont - Big font selection. * * @return None. *******************************************************************************/ @@ -337,8 +337,8 @@ void ST7579_Char(unsigned char yPosition, * * @param yPosition - Y address of RAM. * @param xPosition - X address of RAM. - * @param string - The string. - * @param bigFont - Big font selection. + * @param string - The string. + * @param bigFont - Big font selection. * * @return None. *******************************************************************************/ @@ -360,8 +360,8 @@ void ST7579_String(unsigned char yPosition, * * @param yPosition - Y address of RAM. * @param xPosition - X address of RAM. - * @param number - The number. - * @param bigFont - Big font selection. + * @param number - The number. + * @param bigFont - Big font selection. * * @return None. *******************************************************************************/ @@ -374,7 +374,6 @@ void ST7579_Number(unsigned char yPosition, unsigned char chNumber = 10; unsigned char chIndex = 0; - //bigFont = 0; if(number < 0) { ST7579_Char(yPosition, xPosition, '-', bigFont); @@ -409,11 +408,11 @@ void ST7579_Number(unsigned char yPosition, /***************************************************************************//** * @brief Sends a float number to ST7579 controller. * - * @param yPosition - Y address of RAM. - * @param xPosition - X address of RAM. - * @param number - The number. + * @param yPosition - Y address of RAM. + * @param xPosition - X address of RAM. + * @param number - The number. * @param resolution - Float resolution. - * @param bigFont - Big font selection. + * @param bigFont - Big font selection. * * @return None. *******************************************************************************/ @@ -439,7 +438,7 @@ void ST7579_FloatNumber(unsigned char yPosition, { ST7579_Char(yPosition, xPosition, '-', bigFont); xPosition += 6 + (bigFont * 12); - number *= -1; + display *= -1; } else { @@ -458,6 +457,7 @@ void ST7579_FloatNumber(unsigned char yPosition, ST7579_Char(yPosition, xPosition, '0', bigFont); xPosition += 6 + (bigFont * 12); } + return; } else { @@ -465,7 +465,7 @@ void ST7579_FloatNumber(unsigned char yPosition, xPosition += 6 + (bigFont * 12); } } - while(mask > display) + while((mask > display) && (chNumber > resolution)) { mask /= 10; chNumber--; @@ -493,8 +493,8 @@ void ST7579_FloatNumber(unsigned char yPosition, * * @param yPosition - Y address of RAM. * @param xPosition - X address of RAM. - * @param number - The number. - * @param bigFont - Big font selection. + * @param number - The number. + * @param bigFont - Big font selection. * * @return None. *******************************************************************************/ @@ -541,9 +541,9 @@ void ST7579_HexNumber(unsigned char yPosition, * * @param yPosition - Y address of RAM. * @param xPosition - X address of RAM. - * @param image - The image array. - * @param width - The width of the image (pixels). - * @param height - The height of the image (pixels). + * @param image - The image array. + * @param width - The width of the image (pixels). + * @param height - The height of the image (pixels). * * @return None. *******************************************************************************/ diff --git a/ST7579.h b/ST7579.h index 75d13a70b..566b40d48 100644 --- a/ST7579.h +++ b/ST7579.h @@ -57,7 +57,7 @@ void ST7579_GoTo(unsigned char yPosition, void ST7579_Clear(void); /*! Initializes the ST7579 controller. */ -unsigned char ST7579_Init(void); +char ST7579_Init(void); /*! Sends a character to ST7579 controller. */ void ST7579_Char(unsigned char yPosition, diff --git a/TIME.c b/TIME.c new file mode 100644 index 000000000..c2c4a515f --- /dev/null +++ b/TIME.c @@ -0,0 +1,167 @@ +/***************************************************************************//** + * @file TIME.c + * @brief Implementation of TIME Driver for RENESAS RL78G14 Processor. + * @author Dan Nechita +******************************************************************************** + * Copyright 2012(c) Analog Devices, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * - The use of this software may or may not infringe the patent rights + * of one or more patent holders. This license does not release you + * from the requirement that you obtain separate licenses from these + * patent holders to use this software. + * - Use of the software either in source or binary form, must be run + * on or directly connected to an Analog Devices Inc. component. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +******************************************************************************** + * SVN Revision: $WCREV$ +*******************************************************************************/ + +/******************************************************************************/ +/***************************** Include Files **********************************/ +/******************************************************************************/ +#include "RDKRL78G14.h" // RDKRL78G14 definitions. +#include "TIME.h" // TIME definitions. + +/*****************************************************************************/ +/************************** Macros Definitions *******************************/ +/*****************************************************************************/ +#define TIMER_CNT_INTERVAL 65536 + +/*****************************************************************************/ +/************************ Variables Declarations *****************************/ +/*****************************************************************************/ +unsigned short overflowCounter = 0; + +/******************************************************************************/ +/************************ Functions Definitions *******************************/ +/******************************************************************************/ + +/***************************************************************************//** + * @brief INTTM00 interrupt service routine. + * + * @return None. +*******************************************************************************/ +#pragma vector = INTTM00_vect +__interrupt static void Timer0InterruptHandler(void) +{ + overflowCounter++; +} + +/***************************************************************************//** + * @brief Initializes the timer used in this driver. + * + * @return status - Result of the initialization procedure. + * Example: 0 - if initialization was successful; + * -1 - if initialization was unsuccessful. +*******************************************************************************/ +char TIME_Init(void) +{ + PER0 |= 0x0001; // Enable Supply for Unit 0 that contains timers 0..7. + TT0 |= 0x0001; // Stop channel 0(Timer 0). + TPS0 = 0x0005; // CK00 = FCLK / 32. + TMR00 |= 0x0000; // CK00 input clock for channel 0. + TMMK00 = 1; // Disable INTTM00 interrupt. + TMIF00 = 0; // Clear INTM00 interrupt flag. + /* Set INTTM00 low priority */ + TMPR100 = 1; + TMPR000 = 1; + /* Configure channel 0 as a interval timer. */ + TMR00 |= 0x0000; // Interval timer mode. + TO0 &= ~0x0001; // Timer 0 output value is "0". + TOE0 &= ~0x0001; // Disable output of timer 0. + TMMK00 = 0; // Enable INTTM00 interrupt. + + return 0; +} + +/***************************************************************************//** + * @brief The timer begins to count in steps of microseconds(us) until the user + * calls a stop measurement function. + * + * @return None. +*******************************************************************************/ +void TIME_StartMeasure(void) +{ + TDR00 = 0xFFFF; + overflowCounter = 0; + TS0 |= 0x0001; // Start timer 0. + TMIF00 = 0; // Clear INTM00 interrupt flag. +} + +/***************************************************************************//** + * @brief Stops the measurement process when the functions is called. + * + * @return Time(in microseconds) elapsed since the measurement began. +*******************************************************************************/ +unsigned long TIME_StopMeasure(void) +{ + unsigned long elapsedUs = 0; + unsigned short timerCnt = 0; + + timerCnt = TCR00; + TT0 |= 0x0001; // Stop Timer 0. + TMIF00 = 0; // Clear INTM00 interrupt flag. + overflowCounter = 0; + elapsedUs = ((unsigned long)overflowCounter * TIMER_CNT_INTERVAL) + + (0xFFFF - timerCnt); + + return elapsedUs; +} + +/***************************************************************************//** + * @brief Creates a delay of microseconds. + * + * @return None. +*******************************************************************************/ +void TIME_DelayUs(unsigned short usUnits) +{ + TDR00 = usUnits; + TS0 |= 0x0001; // Start timer 0. + while(!overflowCounter) + { + ; + } + overflowCounter = 0; + TT0 |= 0x0001; // Stop Timer 0. +} + +/***************************************************************************//** + * @brief Creates a delay of milliseconds. + * + * @return None. +*******************************************************************************/ +void TIME_DelayMs(unsigned short msUnits) +{ + TDR00 = 0x3E7; // 0x3E7 = 999(decimal). Timer will count down to 0. + TS0 |= 0x0001; // Start timer 0. + while(overflowCounter < msUnits) + { + ; + } + overflowCounter = 0; + TT0 |= 0x0001; // Stop Timer 0. +} diff --git a/TIME.h b/TIME.h new file mode 100644 index 000000000..cc60f09a5 --- /dev/null +++ b/TIME.h @@ -0,0 +1,65 @@ +/***************************************************************************//** + * @file TIME.h + * @brief Header file of TIME Driver for RENESAS RL78G14 Processor. + * @author Dan Nechita +******************************************************************************** + * Copyright 2012(c) Analog Devices, Inc. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Analog Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * - The use of this software may or may not infringe the patent rights + * of one or more patent holders. This license does not release you + * from the requirement that you obtain separate licenses from these + * patent holders to use this software. + * - Use of the software either in source or binary form, must be run + * on or directly connected to an Analog Devices Inc. component. + * + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +******************************************************************************** + * SVN Revision: $WCREV$ +*******************************************************************************/ +#ifndef __TIME_H__ +#define __TIME_H__ + +/******************************************************************************/ +/************************ Functions Declarations ******************************/ +/******************************************************************************/ + +/*! Initializes the timer used in this driver. */ +char TIME_Init(void); + +/*! The timer begins to count in steps of microseconds(us) until the user calls + a stop measurement function. */ +void TIME_StartMeasure(void); + +/*! Stops the measurement process when the functions is called. */ +unsigned long TIME_StopMeasure(void); + +/*! Creates a delay of microseconds. */ +void TIME_DelayUs(unsigned short usUnits); + +/*! Creates a delay of milliseconds. */ +void TIME_DelayMs(unsigned short msUnits); + +#endif /* __TIME_H__ */ From 51155542471c1c0f0d7f000f4b926c06696fa921 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Sat, 4 Jan 2014 17:27:23 -0500 Subject: [PATCH 11/20] Move/rename files. --- Makefile.in | 160 -- abort.S | 50 - argv.S | 35 - argvlen.S | 35 - chdir.S | 35 - chmod.S | 35 - close.S | 35 - configure | 3815 ----------------------------- configure.in | 55 - rl78.ld => cpu/rl78/R5F100xL.ld | 0 crt0.S => cpu/rl78/crt0.S | 0 rl78-sys.h => cpu/rl78/rl78-sys.h | 0 crtn.S | 47 - exit.S | 43 - fstat.S | 35 - gcrt0.S | 58 - getpid.S | 36 - gettimeofday.S | 35 - isatty.S | 36 - kill.S | 35 - link.S | 35 - lseek.S | 35 - mcount.c | 422 ---- open.S | 35 - read.S | 35 - rl78-sim.ld | 224 -- sbrk.c | 57 - stat.S | 35 - time.S | 35 - times.S | 35 - unlink.S | 35 - utime.S | 35 - write.c | 107 - 33 files changed, 5705 deletions(-) delete mode 100644 Makefile.in delete mode 100644 abort.S delete mode 100644 argv.S delete mode 100644 argvlen.S delete mode 100644 chdir.S delete mode 100644 chmod.S delete mode 100644 close.S delete mode 100644 configure delete mode 100644 configure.in rename rl78.ld => cpu/rl78/R5F100xL.ld (100%) rename crt0.S => cpu/rl78/crt0.S (100%) rename rl78-sys.h => cpu/rl78/rl78-sys.h (100%) delete mode 100644 crtn.S delete mode 100644 exit.S delete mode 100644 fstat.S delete mode 100644 gcrt0.S delete mode 100644 getpid.S delete mode 100644 gettimeofday.S delete mode 100644 isatty.S delete mode 100644 kill.S delete mode 100644 link.S delete mode 100644 lseek.S delete mode 100644 mcount.c delete mode 100644 open.S delete mode 100644 read.S delete mode 100644 rl78-sim.ld delete mode 100644 sbrk.c delete mode 100644 stat.S delete mode 100644 time.S delete mode 100644 times.S delete mode 100644 unlink.S delete mode 100644 utime.S delete mode 100644 write.c diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index bdb634032..000000000 --- a/Makefile.in +++ /dev/null @@ -1,160 +0,0 @@ -# Copyright (c) 2008, 2009, 2011 Red Hat Inc -# -# The authors hereby grant permission to use, copy, modify, distribute, -# and license this software and its documentation for any purpose, provided -# that existing copyright notices are retained in all copies and that this -# notice is included verbatim in any distributions. No written agreement, -# license, or royalty fee is required for any of the authorized uses. -# Modifications to this software may be copyrighted by their authors -# and need not follow the licensing terms described here, provided that -# the new terms are clearly indicated on the first page of each file where -# they apply. - -# Makefile for libgloss/rl78. - -VPATH = @srcdir@ -srcdir = @srcdir@ -objdir = . -srcroot = $(srcdir)/../.. -objroot = $(objdir)/../.. - -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -host_alias = @host_alias@ -target_alias = @target_alias@ - -bindir = @bindir@ -libdir = @libdir@ -tooldir = $(exec_prefix)/$(target_alias) - -# Multilib support variables. -# TOP is used instead of MULTI{BUILD,SRC}TOP. -MULTIDIRS = -MULTISUBDIR = -MULTIDO = true -MULTICLEAN = true - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ - -SHELL = /bin/sh - -CC = @CC@ - -AS = @AS@ -AR = @AR@ -LD = @LD@ -RANLIB = @RANLIB@ -AR_FLAGS = rc - -OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ - then echo ${objroot}/../binutils/objdump ; \ - else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` -OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ - then echo ${objroot}/../binutils/objcopy ; \ - else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` - -SCRIPTS = $(srcdir)/rl78.ld $(srcdir)/rl78-sim.ld -CRT = gcrt0.o crt0.o crtn.o -SIM_BSP = libsim.a -LIBNOSYS = ../libnosys/libnosys.a -SIM_OBJS = \ - sbrk.o \ - exit.o \ - open.o \ - close.o \ - read.o \ - write.o \ - lseek.o \ - unlink.o \ - getpid.o \ - kill.o \ - fstat.o \ - argvlen.o \ - argv.o \ - chdir.o \ - stat.o \ - chmod.o \ - utime.o \ - time.o \ - gettimeofday.o \ - times.o \ - link.o \ - isatty.o \ - abort.o \ - mcount.o - -#### Host specific Makefile fragment comes in here. -@host_makefile_frag@ - - -# Override .S.o rule to pass assembler debugging flags -.S.o: - $(CC) -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< - -all: $(CRT) $(SIM_BSP) copy_scripts_to_objdir - -$(SIM_BSP): $(SIM_OBJS) - $(AR) $(ARFLAGS) $@ $? - $(RANLIB) $@ - -copy_scripts_to_objdir: $(SCRIPTS) - cp $(SCRIPTS) $(objdir) - -# Dependencies - -SDEPS = $(srcdir)/rl78-sys.h $(srcdir)/../syscall.h - -abort.o : $(SDEPS) -argv.o : $(SDEPS) -argvlen.o : $(SDEPS) -chdir.o : $(SDEPS) -chmod.o : $(SDEPS) -close.o : $(SDEPS) -exit.o : $(SDEPS) -fstat.o : $(SDEPS) -getpid.o : $(SDEPS) -gettimeofday.o : $(SDEPS) -gcrt0.o: gcrt0.S crt0.S -kill.o : $(SDEPS) -link.o : $(SDEPS) -lseek.o : $(SDEPS) -mcount.o : $(SDEPS) -open.o : $(SDEPS) -read.o : $(SDEPS) -sigprocmask.o : $(SDEPS) -sleep.o : $(SDEPS) -stat.o : $(SDEPS) -time.o : $(SDEPS) -times.o : $(SDEPS) -unlink.o : $(SDEPS) -utime.o : $(SDEPS) -write.o : $(SDEPS) - -install: $(CRT) $(SIM_BSP) $(SCRIPTS) - for c in $(CRT) $(SIM_BSP); do \ - $(INSTALL_DATA) $$c $(tooldir)/lib${MULTISUBDIR}/$$c ;\ - done - for c in $(SCRIPTS); do \ - b=`basename $$c`; \ - $(INSTALL_DATA) $$c $(tooldir)/lib${MULTISUBDIR}/$$b ;\ - done - -clean mostlyclean: - rm -f *.o *.a - -distclean maintainer-clean realclean: clean - rm -f Makefile config.cache config.log config.status - -.PHONY: info dvi doc install-info clean-info -info doc dvi: -install-info: -clean-info: - -Makefile: Makefile.in config.status @host_makefile_frag_path@ - $(SHELL) config.status - -config.status: configure - $(SHELL) config.status --recheck diff --git a/abort.S b/abort.S deleted file mode 100644 index c39932db7..000000000 --- a/abort.S +++ /dev/null @@ -1,50 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - - .global _abort - .type _abort, @function -_abort: - /* This is for debuggers. The simulator stops here too. */ - brk - - movw ax, #42 - push ax - SYSCALL(SYS_kill) - pop ax - - /* Else, exit. */ - call !!__exit - - .size _abort, . - _abort - diff --git a/argv.S b/argv.S deleted file mode 100644 index 43be134a8..000000000 --- a/argv.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(argv) diff --git a/argvlen.S b/argvlen.S deleted file mode 100644 index 624b6bceb..000000000 --- a/argvlen.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(argvlen) diff --git a/chdir.S b/chdir.S deleted file mode 100644 index 8344a823e..000000000 --- a/chdir.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(chdir) diff --git a/chmod.S b/chmod.S deleted file mode 100644 index 6e6f338ae..000000000 --- a/chmod.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(chmod) diff --git a/close.S b/close.S deleted file mode 100644 index 5b213905e..000000000 --- a/close.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -OK(close) diff --git a/configure b/configure deleted file mode 100644 index 066c9a666..000000000 --- a/configure +++ /dev/null @@ -1,3815 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.66. -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="crt0.S" -ac_subst_vars='LTLIBOBJS -LIBOBJS -host_makefile_frag_path -CCASFLAGS -CCAS -RANLIB -LD -AR -AS -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -am__leading_dot -CC -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='host_makefile_frag' -ac_user_opts=' -enable_option_checking -enable_dependency_tracking -' - ac_precious_vars='build_alias -host_alias -target_alias -CCAS -CCASFLAGS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - -Some influential environment variables: - CCAS assembler compiler command (defaults to CC) - CCASFLAGS assembler compiler flags (defaults to CFLAGS) - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.66 - -Copyright (C) 2010 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.66. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -if test "${enable_shared}" = "yes" ; then - echo "Shared libraries not supported for cross compiling, ignored" -fi - -if test "$srcdir" = "." ; then - if test "${with_target_subdir}" != "." ; then - libgloss_topdir="${srcdir}/${with_multisrctop}../../.." - else - libgloss_topdir="${srcdir}/${with_multisrctop}../.." - fi -else - libgloss_topdir="${srcdir}/../.." -fi -ac_aux_dir= -for ac_dir in $libgloss_topdir "$srcdir"/$libgloss_topdir; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in $libgloss_topdir \"$srcdir\"/$libgloss_topdir" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if test "${ac_cv_target+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - - -if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -z "$CC" && as_fn_error $? "no acceptable cc found in \$PATH" "$LINENO" 5 -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using GNU C" >&5 -$as_echo_n "checking whether we are using GNU C... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.c <&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_c_compiler_gnu=yes -else - ac_cv_c_compiler_gnu=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } - -if test $ac_cv_c_compiler_gnu = yes; then - GCC=yes - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - - -AS=${AS-as} - -AR=${AR-ar} - -LD=${LD-ld} - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -# By default we simply use the C compiler to build assembly code. - -test "${CCAS+set}" = set || CCAS=$CC -test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS - - - - -host_makefile_frag=${srcdir}/../config/default.mh - -host_makefile_frag_path=$host_makefile_frag - - - -ac_config_files="$ac_config_files Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: ${CONFIG_STATUS=./config.status} -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.66. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Configuration commands: -$config_commands - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.66, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" -srcdir=${srcdir} -target=${target} -with_multisubdir=${with_multisubdir} -ac_configure_args="${ac_configure_args} --enable-multilib" -CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -libgloss_topdir=${libgloss_topdir} - - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - -if $AWK 'BEGIN { getline <"/dev/null" }' /dev/null; then - ac_cs_awk_getline=: - ac_cs_awk_pipe_init= - ac_cs_awk_read_file=' - while ((getline aline < (F[key])) > 0) - print(aline) - close(F[key])' - ac_cs_awk_pipe_fini= -else - ac_cs_awk_getline=false - ac_cs_awk_pipe_init="print \"cat <<'|#_!!_#|' &&\"" - ac_cs_awk_read_file=' - print "|#_!!_#|" - print "cat " F[key] " &&" - '$ac_cs_awk_pipe_init - # The final `:' finishes the AND list. - ac_cs_awk_pipe_fini='END { print "|#_!!_#|"; print ":" }' -fi -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$tmp/subs1.awk" && -_ACEOF - -# Create commands to substitute file output variables. -{ - echo "cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1" && - echo 'cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&' && - echo "$ac_subst_files" | sed 's/.*/F["&"]="$&"/' && - echo "_ACAWK" && - echo "_ACEOF" -} >conf$$files.sh && -. ./conf$$files.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -rm -f conf$$files.sh - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - \$ac_cs_awk_pipe_init -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - if (nfields == 3 && !substed) { - key = field[2] - if (F[key] != "" && line ~ /^[ ]*@.*@[ ]*$/) { - \$ac_cs_awk_read_file - next - } - } - print line -} -\$ac_cs_awk_pipe_fini -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | -if $ac_cs_awk_getline; then - $AWK -f "$tmp/subs.awk" -else - $AWK -f "$tmp/subs.awk" | $SHELL -fi >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - "Makefile":F) . ${libgloss_topdir}/config-ml.in ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/configure.in b/configure.in deleted file mode 100644 index 04169f1b5..000000000 --- a/configure.in +++ /dev/null @@ -1,55 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.59) -AC_INIT(crt0.S) - -if test "${enable_shared}" = "yes" ; then - echo "Shared libraries not supported for cross compiling, ignored" -fi - -if test "$srcdir" = "." ; then - if test "${with_target_subdir}" != "." ; then - libgloss_topdir="${srcdir}/${with_multisrctop}../../.." - else - libgloss_topdir="${srcdir}/${with_multisrctop}../.." - fi -else - libgloss_topdir="${srcdir}/../.." -fi -AC_CONFIG_AUX_DIR($libgloss_topdir) - -AC_CANONICAL_SYSTEM -AC_ARG_PROGRAM - -AC_PROG_INSTALL - -LIB_AC_PROG_CC - -AS=${AS-as} -AC_SUBST(AS) -AR=${AR-ar} -AC_SUBST(AR) -LD=${LD-ld} -AC_SUBST(LD) -AC_PROG_RANLIB -LIB_AM_PROG_AS - -host_makefile_frag=${srcdir}/../config/default.mh - -dnl We have to assign the same value to other variables because autoconf -dnl doesn't provide a mechanism to substitute a replacement keyword with -dnl arbitrary data or pathnames. -dnl -host_makefile_frag_path=$host_makefile_frag -AC_SUBST(host_makefile_frag_path) -AC_SUBST_FILE(host_makefile_frag) - -AC_CONFIG_FILES(Makefile, -. ${libgloss_topdir}/config-ml.in, -srcdir=${srcdir} -target=${target} -with_multisubdir=${with_multisubdir} -ac_configure_args="${ac_configure_args} --enable-multilib" -CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -libgloss_topdir=${libgloss_topdir} -) -AC_OUTPUT diff --git a/rl78.ld b/cpu/rl78/R5F100xL.ld similarity index 100% rename from rl78.ld rename to cpu/rl78/R5F100xL.ld diff --git a/crt0.S b/cpu/rl78/crt0.S similarity index 100% rename from crt0.S rename to cpu/rl78/crt0.S diff --git a/rl78-sys.h b/cpu/rl78/rl78-sys.h similarity index 100% rename from rl78-sys.h rename to cpu/rl78/rl78-sys.h diff --git a/crtn.S b/crtn.S deleted file mode 100644 index 8b3002c2d..000000000 --- a/crtn.S +++ /dev/null @@ -1,47 +0,0 @@ -/* - -Copyright (c) 2005,2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - - .section .init,"ax" - call !!_rl78_run_preinit_array - call !!_rl78_run_init_array - ret - .global __rl78_init_end -__rl78_init_end: - - .section .fini,"ax" - - ret - .global __rl78_fini_end -__rl78_fini_end: - - .text - diff --git a/exit.S b/exit.S deleted file mode 100644 index e394315ef..000000000 --- a/exit.S +++ /dev/null @@ -1,43 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - - .global __exit - .type __exit, @function -__exit: - call !!__rl78_fini - mov a, [sp+4] - halt - SYSCALL(SYS_exit) - .size __exit, . - __exit - diff --git a/fstat.S b/fstat.S deleted file mode 100644 index 1f68e6f37..000000000 --- a/fstat.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(fstat) diff --git a/gcrt0.S b/gcrt0.S deleted file mode 100644 index a75614f89..000000000 --- a/gcrt0.S +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (c) 2011 Red Hat Incorporated. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - - This software is provided by the copyright holders and contributors - "AS IS" and any express or implied warranties, including, but not - limited to, the implied warranties of merchantability and fitness for - a particular purpose are disclaimed. In no event shall Red Hat - incorporated be liable for any direct, indirect, incidental, special, - exemplary, or consequential damages (including, but not limited to, - procurement of substitute goods or services; loss of use, data, or - profits; or business interruption) however caused and on any theory of - liability, whether in contract, strict liability, or tort (including - negligence or otherwise) arising in any way out of the use of this - software, even if advised of the possibility of such damage. */ - -#define PROFILE_SUPPORT 1 - -#include "crt0.S" - - .global __mcount - .type __mcount, @function -__mcount: - ;; When a function is compiled for profiling, gcc creates code - ;; like this at the start of each profiled function: - ;; - ;; .global - ;; : - ;; bsr __mcount - ;; <...function's prologue...> - ;; <...function's body...> - ;; - ;; We must save all of the argument registers, extract the - ;; address of , call _mcount_internal to do the - ;; real work and then restore the argument registers before - ;; returning. - - movw ax, [sp] - push ax - call !!__mcount_internal - pop ax - ret - - .size __mcount, . - __mcount diff --git a/getpid.S b/getpid.S deleted file mode 100644 index 58e75ba15..000000000 --- a/getpid.S +++ /dev/null @@ -1,36 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -RET(getpid,42) - diff --git a/gettimeofday.S b/gettimeofday.S deleted file mode 100644 index 1611e7db8..000000000 --- a/gettimeofday.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(gettimeofday) diff --git a/isatty.S b/isatty.S deleted file mode 100644 index a77b3754a..000000000 --- a/isatty.S +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2011 Red Hat Incorporated. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -#include "rl78-sys.h" - - .global _isatty - .weak _isatty -_isatty: - -RET(_isatty,1) - diff --git a/kill.S b/kill.S deleted file mode 100644 index 111b1114a..000000000 --- a/kill.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(kill) diff --git a/link.S b/link.S deleted file mode 100644 index 152e65f07..000000000 --- a/link.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(link) diff --git a/lseek.S b/lseek.S deleted file mode 100644 index 8aa58cfa5..000000000 --- a/lseek.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(lseek) diff --git a/mcount.c b/mcount.c deleted file mode 100644 index 567abd0e5..000000000 --- a/mcount.c +++ /dev/null @@ -1,422 +0,0 @@ -/*- - * Copyright (c) 1983, 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* This file implements a subset of the profiling support functions. - It has been copied and adapted from mcount.c, gmon.c and gmon.h in - the glibc sources. - Since we do not have access to a timer interrupt in the simulator - the histogram and basic block information is not generated. */ - -#include -#include -#include -#include -#include - -/* Fraction of text space to allocate for histogram counters here, 1/2. */ -#define HISTFRACTION 2 - -/* Fraction of text space to allocate for from hash buckets. - The value of HASHFRACTION is based on the minimum number of bytes - of separation between two subroutine call points in the object code. - Given MIN_SUBR_SEPARATION bytes of separation the value of - HASHFRACTION is calculated as: - - HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof (short) - 1); - - For example, on the VAX, the shortest two call sequence is: - - calls $0,(r0) - calls $0,(r0) - - which is separated by only three bytes, thus HASHFRACTION is - calculated as: - - HASHFRACTION = 3 / (2 * 2 - 1) = 1 - - Note that the division above rounds down, thus if MIN_SUBR_FRACTION - is less than three, this algorithm will not work! - - In practice, however, call instructions are rarely at a minimal - distance. Hence, we will define HASHFRACTION to be 2 across all - architectures. This saves a reasonable amount of space for - profiling data structures without (in practice) sacrificing - any granularity. */ -#define HASHFRACTION 2 - -/* Percent of text space to allocate for tostructs. - This is a heuristic; we will fail with a warning when profiling - programs with a very large number of very small functions, but - that's normally OK. - 2 is probably still a good value for normal programs. - Profiling a test case with 64000 small functions will work if - you raise this value to 3 and link statically (which bloats the - text size, thus raising the number of arcs expected by the heuristic). */ -#define ARCDENSITY 3 - -/* Always allocate at least this many tostructs. This hides the - inadequacy of the ARCDENSITY heuristic, at least for small programs. */ -#define MINARCS 50 - -/* Maximum number of arcs we want to allow. - Used to be max representable value of ARCINDEX minus 2, but now - that ARCINDEX is a long, that's too large; we don't really want - to allow a 48 gigabyte table. - The old value of 1<<16 wasn't high enough in practice for large C++ - programs; will 1<<20 be adequate for long? FIXME */ -#define MAXARCS (1L << 20) - -#define SCALE_1_TO_1 0x10000L - -#define GMON_MAGIC "gmon" /* Magic cookie. */ -#define GMON_VERSION 1 /* Version number. */ - - -/* General rounding functions. */ -#define ROUNDDOWN(x ,y) (((x) / (y)) * (y)) -#define ROUNDUP(x, y) ((((x) + (y) - 1) / (y)) * (y)) - -struct tostruct -{ - unsigned long selfpc; - unsigned long count; - unsigned long link; -}; - -/* Possible states of profiling. */ -enum profiling_state -{ - GMON_PROF_OFF, - GMON_PROF_ON, - GMON_PROF_BUSY, - GMON_PROF_ERROR -}; - -/* The profiling data structures are housed in this structure. */ -struct gmonparam -{ - enum profiling_state state; - unsigned short * kcount; - unsigned long kcountsize; - unsigned long * froms; - unsigned long fromssize; - struct tostruct * tos; - unsigned long tossize; - long tolimit; - unsigned long lowpc; - unsigned long highpc; - unsigned long textsize; - unsigned long hashfraction; - long log_hashfraction; -}; - -/* Raw header as it appears in the gmon.out file (without padding). - This header always comes first and is then followed by a series - records defined below. */ -struct gmon_hdr -{ - char cookie[4]; - char version[4]; - char spare[3 * 4]; -}; - -/* Types of records in this file. */ -typedef enum -{ - GMON_TAG_TIME_HIST = 0, - GMON_TAG_CG_ARC = 1, -} GMON_Record_Tag; - -struct gmon_cg_arc_record -{ - char tag; /* Set to GMON_TAG_CG_ARC. */ - char from_pc[sizeof (char *)]; /* Address within caller's body. */ - char self_pc[sizeof (char *)]; /* Address within callee's body. */ - char count[4]; /* Number of arc traversals. */ -}; - - -/* Forward declarations. */ -void _mcount_internal (unsigned long); -void _monstartup (unsigned long, unsigned long); -void _mcleanup (void); - -static struct gmonparam _gmonparam; - -void -_mcount_internal (unsigned long frompc) -{ - unsigned long selfpc = frompc; - unsigned long * frompcindex; - struct tostruct * top; - struct tostruct * prevtop; - struct gmonparam * p; - unsigned long toindex; - int i; - - p = & _gmonparam; - - /* Check that we are profiling and that we aren't recursively invoked. - NB/ This version is not thread-safe. */ - if (p->state != GMON_PROF_ON) - return; - p->state = GMON_PROF_BUSY; - - /* Check that frompcindex is a reasonable pc value. - For example: signal catchers get called from the stack, - not from text space. Too bad. */ - frompc -= p->lowpc; - if (frompc > p->textsize) - goto done; - - i = frompc >> p->log_hashfraction; - - frompcindex = p->froms + i; - toindex = * frompcindex; - - if (toindex == 0) - { - /* First time traversing this arc. */ - toindex = ++ p->tos[0].link; - if (toindex >= p->tolimit) - /* Halt further profiling. */ - goto overflow; - - * frompcindex = toindex; - top = p->tos + toindex; - top->selfpc = selfpc; - top->count = 1; - top->link = 0; - goto done; - } - - top = p->tos + toindex; - - if (top->selfpc == selfpc) - { - /* Arc at front of chain: usual case. */ - top->count ++; - goto done; - } - - /* Have to go looking down chain for it. - Top points to what we are looking at, - prevtop points to previous top. - We know it is not at the head of the chain. */ - for (;;) - { - if (top->link == 0) - { - /* Top is end of the chain and none of the chain - had top->selfpc == selfpc. So we allocate a - new tostruct and link it to the head of the - chain. */ - toindex = ++ p->tos[0].link; - if (toindex >= p->tolimit) - goto overflow; - - top = p->tos + toindex; - top->selfpc = selfpc; - top->count = 1; - top->link = * frompcindex; - * frompcindex = toindex; - goto done; - } - - /* Otherwise, check the next arc on the chain. */ - prevtop = top; - top = p->tos + top->link; - - if (top->selfpc == selfpc) - { - /* There it is. Increment its count - move it to the head of the chain. */ - top->count ++; - toindex = prevtop->link; - prevtop->link = top->link; - top->link = * frompcindex; - * frompcindex = toindex; - goto done; - } - } - - done: - p->state = GMON_PROF_ON; - return; - - overflow: - p->state = GMON_PROF_ERROR; - return; -} - -void -_monstartup (unsigned long lowpc, unsigned long highpc) -{ - char * cp; - struct gmonparam * p = & _gmonparam; - - /* If the calloc() function has been instrumented we must make sure - that it is not profiled until we are ready. */ - p->state = GMON_PROF_BUSY; - - /* Round lowpc and highpc to multiples of the density we're using - so the rest of the scaling (here and in gprof) stays in ints. */ - p->lowpc = ROUNDDOWN (lowpc, HISTFRACTION * sizeof (* p->kcount)); - p->highpc = ROUNDUP (highpc, HISTFRACTION * sizeof (* p->kcount)); - p->textsize = p->highpc - p->lowpc; - p->kcountsize = ROUNDUP (p->textsize / HISTFRACTION, sizeof (*p->froms)); - p->hashfraction = HASHFRACTION; - p->log_hashfraction = -1; - p->log_hashfraction = ffs (p->hashfraction * sizeof (*p->froms)) - 1; - p->fromssize = p->textsize / HASHFRACTION; - p->tolimit = p->textsize * ARCDENSITY / 100; - - if (p->tolimit < MINARCS) - p->tolimit = MINARCS; - else if (p->tolimit > MAXARCS) - p->tolimit = MAXARCS; - - p->tossize = p->tolimit * sizeof (struct tostruct); - - cp = calloc (p->kcountsize + p->fromssize + p->tossize, 1); - if (cp == NULL) - { - write (2, "monstartup: out of memory\n", 26); - p->tos = NULL; - p->state = GMON_PROF_ERROR; - return; - } - - p->tos = (struct tostruct *) cp; - cp += p->tossize; - p->kcount = (unsigned short *) cp; - cp += p->kcountsize; - p->froms = (unsigned long *) cp; - - p->tos[0].link = 0; - p->state = GMON_PROF_ON; -} - - -static void -write_call_graph (int fd) -{ -#define NARCS_PER_WRITE 32 - - struct gmon_cg_arc_record raw_arc[NARCS_PER_WRITE] - __attribute__ ((aligned (__alignof__ (char *)))); - unsigned long from_index; - unsigned long to_index; - unsigned long from_len; - unsigned long frompc; - int nfilled; - - for (nfilled = 0; nfilled < NARCS_PER_WRITE; ++ nfilled) - raw_arc[nfilled].tag = GMON_TAG_CG_ARC; - - nfilled = 0; - from_len = _gmonparam.fromssize / sizeof (*_gmonparam.froms); - - for (from_index = 0; from_index < from_len; ++from_index) - { - if (_gmonparam.froms[from_index] == 0) - continue; - - frompc = _gmonparam.lowpc; - frompc += (from_index * _gmonparam.hashfraction - * sizeof (*_gmonparam.froms)); - - for (to_index = _gmonparam.froms[from_index]; - to_index != 0; - to_index = _gmonparam.tos[to_index].link) - { - struct gmon_cg_arc_record * arc = raw_arc + nfilled; - - memcpy (arc->from_pc, & frompc, sizeof (arc->from_pc)); - memcpy (arc->self_pc, & _gmonparam.tos[to_index].selfpc, sizeof (arc->self_pc)); - memcpy (arc->count, & _gmonparam.tos[to_index].count, sizeof (arc->count)); - - if (++ nfilled == NARCS_PER_WRITE) - { - write (fd, raw_arc, sizeof raw_arc); - nfilled = 0; - } - } - } - - if (nfilled > 0) - write (fd, raw_arc, nfilled * sizeof (raw_arc[0])); -} - -#include - -static void -write_gmon (void) -{ - struct gmon_hdr ghdr __attribute__ ((aligned (__alignof__ (int)))); - int fd; - - fd = open ("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666); - if (fd < 0) - { - write (2, "_mcleanup: could not create gmon.out\n", 37); - return; - } - - /* Write gmon.out header: */ - memset (& ghdr, '\0', sizeof (ghdr)); - memcpy (ghdr.cookie, GMON_MAGIC, sizeof (ghdr.cookie)); - * (unsigned long *) ghdr.version = GMON_VERSION; - write (fd, & ghdr, sizeof (ghdr)); - - /* We do not have histogram or basic block information, - so we do not generate these parts of the gmon.out file. */ - - /* Write call-graph. */ - write_call_graph (fd); - - close (fd); -} - -void -_mcleanup (void) -{ - if (_gmonparam.state != GMON_PROF_ERROR) - { - _gmonparam.state = GMON_PROF_OFF; - write_gmon (); - } - - /* Free the memory. */ - if (_gmonparam.tos != NULL) - { - free (_gmonparam.tos); - _gmonparam.tos = NULL; - } -} diff --git a/open.S b/open.S deleted file mode 100644 index ae83e0ba9..000000000 --- a/open.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(open) diff --git a/read.S b/read.S deleted file mode 100644 index 9cbea1dfd..000000000 --- a/read.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(read) diff --git a/rl78-sim.ld b/rl78-sim.ld deleted file mode 100644 index f69fb95d5..000000000 --- a/rl78-sim.ld +++ /dev/null @@ -1,224 +0,0 @@ -/* - -Copyright (c) 2005,2008,2009,2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -/* Default linker script, for normal executables */ -OUTPUT_ARCH(rl78) -ENTRY(_start) - -/* Do we need any of these for elf? - __DYNAMIC = 0; */ - -/* This is for the simulator - 512k flash, 32k ram, no data flash */ -MEMORY { - VEC (r) : ORIGIN = 0x00000, LENGTH = 0x00002 - IVEC (r) : ORIGIN = 0x00004, LENGTH = 0x0007c - OPT (r) : ORIGIN = 0x000c0, LENGTH = 0x00004 - ROM (r) : ORIGIN = 0x000d8, LENGTH = 0x7ff28 - RAM (w) : ORIGIN = 0xf8000, LENGTH = 0x07ee0 - STACK (w) : ORIGIN = 0xffee0, LENGTH = 0x00002 -} - -SECTIONS -{ - .vec : - { - *(.vec) - } > VEC - .ivec : - { - *(.ivec) - } > IVEC - .opt : - { - *(.opt) - } > OPT - - /* CubeSuite always starts at 0xd8. */ - .csstart : { - *(.csstart) - } > ROM - - /* For code that must be in the first 64k, or could fill unused - space below .rodata. */ - .lowtext : { - *(.plt) - *(.lowtext) - } > ROM - - .data : { - . = ALIGN(2); - PROVIDE (__datastart = .); - - KEEP (*(.jcr)) - *(.data.rel.ro.local) *(.data.rel.ro*) - *(.dynamic) - - *(.data D .data.* .gnu.linkonce.d.*) - KEEP (*(.gnu.linkonce.d.*personality*)) - SORT(CONSTRUCTORS) - *(.data1) - *(.got.plt) *(.got) - - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - . = ALIGN(2); - *(.sdata .sdata.* .gnu.linkonce.s.* D_2 D_1) - - . = ALIGN(2); - _edata = .; - PROVIDE (edata = .); - PROVIDE (__dataend = .); - } > RAM AT> ROM - - /* Note that crt0 assumes this is a multiple of two; all the - start/stop symbols are also assumed word-aligned. */ - PROVIDE(__romdatastart = LOADADDR(.data)); - PROVIDE (__romdatacopysize = SIZEOF(.data)); - - .bss : { - . = ALIGN(2); - PROVIDE (__bssstart = .); - *(.dynbss) - *(.sbss .sbss.*) - *(.bss B B_2 B_1 .bss.* .gnu.linkonce.b.*) - . = ALIGN(2); - *(COMMON) - . = ALIGN(2); - PROVIDE (__bssend = .); - _end = .; - PROVIDE (end = .); - } > RAM - PROVIDE (__bsssize = SIZEOF(.bss)); - - .stack (ORIGIN (STACK)) : - { - PROVIDE (__stack = .); - *(.stack) - } - - .rodata (MAX(__romdatastart + __romdatacopysize, 0x1000)) : { - . = ALIGN(2); - *(.plt) - *(.rodata C C_2 C_1 .rodata.* .gnu.linkonce.r.*) - *(.rodata1) - *(.eh_frame_hdr) - KEEP (*(.eh_frame)) - KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) - PROVIDE (__preinit_array_start = .); - KEEP (*(.preinit_array)) - PROVIDE (__preinit_array_end = .); - PROVIDE (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - PROVIDE (__init_array_end = .); - PROVIDE (__fini_array_start = .); - KEEP (*(.fini_array)) - KEEP (*(SORT(.fini_array.*))) - PROVIDE (__fini_array_end = .); - LONG(0); /* Sentinel. */ - - /* gcc uses crtbegin.o to find the start of the constructors, so - we make sure it is first. Because this is a wildcard, it - doesn't matter if the user does not actually link against - crtbegin.o; the linker won't look for a file to match a - wildcard. The wildcard also means that it doesn't matter which - directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) - - /* We don't want to include the .ctor section from from the - crtend.o file until after the sorted ctors. The .ctor section - from the crtend file contains the end of ctors marker and it - must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - } > ROM - - .text : - { - PROVIDE (_start = .); - *(.text P .stub .text.* .gnu.linkonce.t.*) - KEEP (*(.text.*personality*)) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.interp .hash .dynsym .dynstr .gnu.version*) - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - . = ALIGN(2); - KEEP (*(.init)) - KEEP (*(.fini)) - } > ROM - - /* The rest are all not normally part of the runtime image. */ - - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /DISCARD/ : { *(.note.GNU-stack) } -} diff --git a/sbrk.c b/sbrk.c deleted file mode 100644 index acff713fb..000000000 --- a/sbrk.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - -Copyright (c) 2005, 2009 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include - -char * -_sbrk (int adj) -{ - extern char end; - static char * heap = & end; - char * rv = heap; - char * heaptop = (char *) &adj; - - heap += adj; - - /* The allocated chunk spans our stack? */ - if (rv < heaptop && heap > heaptop - /* The allocated chunk spans our address space? */ - || heap < rv) - { - errno = ENOMEM; - return (char *) -1; - } - - return rv; -} - -char * sbrk (int) __attribute__((weak, alias ("_sbrk"))); diff --git a/stat.S b/stat.S deleted file mode 100644 index 1726ffca5..000000000 --- a/stat.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(stat) diff --git a/time.S b/time.S deleted file mode 100644 index a07a0d3f3..000000000 --- a/time.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(time) diff --git a/times.S b/times.S deleted file mode 100644 index e034929d6..000000000 --- a/times.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(times) diff --git a/unlink.S b/unlink.S deleted file mode 100644 index 4feab0f6a..000000000 --- a/unlink.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(unlink) diff --git a/utime.S b/utime.S deleted file mode 100644 index f72a5951f..000000000 --- a/utime.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - -Copyright (c) 2011 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include "rl78-sys.h" - -ERR(utime) diff --git a/write.c b/write.c deleted file mode 100644 index 2adeb94f1..000000000 --- a/write.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - -Copyright (c) 2010 Red Hat Incorporated. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - The name of Red Hat Incorporated may not be used to endorse - or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -/* These definitions are for the RL78/G13, which the simulator - simulates. */ - -typedef unsigned char UQI __attribute__((mode(QI))); -typedef unsigned int UHI __attribute__((mode(HI))); - -#define s8(x) (*(volatile UQI *)(x)) -#define s16(x) (*(volatile UHI *)(x)) - -#define P(x) s8(0xfff00+(x)) -#define PM(x) s8(0xfff20+(x)) - -#define PER0 s8(0xf00f0) - -#define SSR00 s16(0xf0100) -#define SMR00 s16(0xf0110) -#define SCR00 s16(0xf0118) -#define SS0 s16(0xf0122) -#define SPS0 s16(0xf0126) -#define SO0 s16(0xf0128) -#define SOE0 s16(0xf012a) -#define SOL0 s16(0xf0134) - -#define SDR00 s16(0xfff10) - -static int initted = 0; - -static void -init_uart0 () -{ - initted = 1; - - PER0 = 0xff; - SPS0 = 0x0011; /* 16 MHz */ - SMR00 = 0x0022; /* uart mode */ - SCR00 = 0x8097; /* 8-N-1 */ - SDR00 = 0x8a00; /* baud in MSB - 115200 */ - SOL0 = 0x0000; /* not inverted */ - SO0 = 0x000f; /* initial value */ - SOE0 = 0x0001; /* enable TxD0 */ - P(1) |= 0b00000100; - PM(1) &= 0b11111011; - SS0 = 0x0001; -} - -static void -tputc (char c) -{ - /* Wait for transmit buffer to be empty. */ - while (SSR00 & 0x0020) - asm(""); - /* Transmit that byte. */ - SDR00 = c; -} - -int -_write(int fd, char *ptr, int len) -{ - int rv = len; - - if (!initted) - init_uart0 (); - - while (len != 0) - { - if (*ptr == '\n') - tputc ('\r'); - tputc (*ptr); - ptr ++; - len --; - } - return rv; -} - -char * write (int) __attribute__((weak, alias ("_write"))); From 096ff72bd9333741d3a23ca316d8109106ea5a7c Mon Sep 17 00:00:00 2001 From: Maxim Salov Date: Sat, 4 Jan 2014 17:27:24 -0500 Subject: [PATCH 12/20] Uncrustify. --- main.c | 91 ++++++++++++++++++------------------ uart0.c | 142 ++++++++++++++++++++++++++++---------------------------- uart0.h | 4 +- 3 files changed, 118 insertions(+), 119 deletions(-) diff --git a/main.c b/main.c index ca249c544..4d7ea8c4a 100644 --- a/main.c +++ b/main.c @@ -5,57 +5,56 @@ volatile unsigned char ticks = 0; volatile unsigned char flag_1hz = 0; __attribute__((interrupt)) -void wdti_handler(void) +void +wdti_handler(void) { } - __attribute__((interrupt)) -void it_handler(void) +void +it_handler(void) { - ++ticks; - LED1 ^= 1; - if (0 == (0x07 & ticks)) - { - flag_1hz = 1; - } + ++ticks; + LED1 ^= 1; + if(0 == (0x07 & ticks)) { + flag_1hz = 1; + } } - -int main(void) +int +main(void) { - asm("di"); - /* Setup LEDs */ - LED1 = 1; - LED2 = 1; - LED1_PIN = 0; - LED2_PIN = 0; - /* Setup clocks */ - CMC.cmc = 0x11U; /* Enable XT1, disable X1 */ - CSC.csc = 0x80U; /* Start XT1 and HOCO, stop X1 */ - CKC.ckc = 0x00U; - /* Delay 1 second */ - register unsigned long int i; - for (i = 0x000FFFFFUL; i; --i) - asm("nop"); - OSMC.osmc = 0x00; /* Supply fsub to peripherals, including Interval Timer */ - uart0_init(); - /* Setup 12-bit interval timer */ - RTCEN = 1; /* Enable 12-bit interval timer and RTC */ - ITMK = 1; /* Disable IT interrupt */ - ITPR0 = 0; /* Set interrupt priority - highest */ - ITPR1 = 0; - ITMC.itmc = 0x8FFFU; /* Set maximum period 4096/32768Hz = 1/8 s, and start timer */ - ITIF = 0; /* Clear interrupt request flag */ - ITMK = 0; /* Enable IT interrupt */ - asm ("ei"); /* Enable interrupts */ - for(;;) - { - if (flag_1hz) - { - LED2 = 0; - flag_1hz = 0; - uart0_puts("Hello, RL78! [:"); - LED2 = 1; - } - asm("halt"); + asm ("di"); + /* Setup LEDs */ + LED1 = 1; + LED2 = 1; + LED1_PIN = 0; + LED2_PIN = 0; + /* Setup clocks */ + CMC.cmc = 0x11U; /* Enable XT1, disable X1 */ + CSC.csc = 0x80U; /* Start XT1 and HOCO, stop X1 */ + CKC.ckc = 0x00U; + /* Delay 1 second */ + register unsigned long int i; + for(i = 0x000FFFFFUL; i; --i) { + asm ("nop"); + } + OSMC.osmc = 0x00; /* Supply fsub to peripherals, including Interval Timer */ + uart0_init(); + /* Setup 12-bit interval timer */ + RTCEN = 1; /* Enable 12-bit interval timer and RTC */ + ITMK = 1; /* Disable IT interrupt */ + ITPR0 = 0; /* Set interrupt priority - highest */ + ITPR1 = 0; + ITMC.itmc = 0x8FFFU; /* Set maximum period 4096/32768Hz = 1/8 s, and start timer */ + ITIF = 0; /* Clear interrupt request flag */ + ITMK = 0; /* Enable IT interrupt */ + asm ("ei"); /* Enable interrupts */ + for(;;) { + if(flag_1hz) { + LED2 = 0; + flag_1hz = 0; + uart0_puts("Hello, RL78! [:"); + LED2 = 1; } + asm ("halt"); + } } diff --git a/uart0.c b/uart0.c index d58fa787b..1521b0493 100644 --- a/uart0.c +++ b/uart0.c @@ -2,115 +2,115 @@ #include #include -void uart0_init(void) +void +uart0_init(void) { - /* Reference R01AN0459EJ0100 or hardware manual for details */ - PIOR.pior = 0U; /* Disable IO redirection */ - PM1.pm1 |= 0x06U; /* Set P11 and P12 as inputs */ - SAU0EN = 1; /* Supply clock to serial array unit 0 */ - SPS0.sps0 = 0x44U; /* Set input clock (CK00 and CK01) to fclk/16 = 2MHz */ - ST0.st0 = 0x03U; /* Stop operation of channel 0 and 1 */ - /* Setup interrupts (disable) */ - STMK0 = 1; /* Disable INTST0 interrupt */ - STIF0 = 0; /* Clear INTST0 interrupt request flag */ - STPR10 = 1; /* Set INTST0 priority: lowest */ - STPR00 = 1; - SRMK0 = 1; /* Disable INTSR0 interrupt */ - SRIF0 = 0; /* Clear INTSR0 interrupt request flag */ - SRPR10 = 1; /* Set INTSR0 priority: lowest */ - SRPR00 = 1; - SREMK0 = 1; /* Disable INTSRE0 interrupt */ - SREIF0 = 0; /* Clear INTSRE0 interrupt request flag */ - SREPR10 = 1; /* Set INTSRE0 priority: lowest */ - SREPR00 = 1; - /* Setup operation mode for transmitter (channel 0) */ - SMR00.smr00 = 0x0023U; /* Operation clock : CK00, + /* Reference R01AN0459EJ0100 or hardware manual for details */ + PIOR.pior = 0U; /* Disable IO redirection */ + PM1.pm1 |= 0x06U; /* Set P11 and P12 as inputs */ + SAU0EN = 1; /* Supply clock to serial array unit 0 */ + SPS0.sps0 = 0x44U; /* Set input clock (CK00 and CK01) to fclk/16 = 2MHz */ + ST0.st0 = 0x03U; /* Stop operation of channel 0 and 1 */ + /* Setup interrupts (disable) */ + STMK0 = 1; /* Disable INTST0 interrupt */ + STIF0 = 0; /* Clear INTST0 interrupt request flag */ + STPR10 = 1; /* Set INTST0 priority: lowest */ + STPR00 = 1; + SRMK0 = 1; /* Disable INTSR0 interrupt */ + SRIF0 = 0; /* Clear INTSR0 interrupt request flag */ + SRPR10 = 1; /* Set INTSR0 priority: lowest */ + SRPR00 = 1; + SREMK0 = 1; /* Disable INTSRE0 interrupt */ + SREIF0 = 0; /* Clear INTSRE0 interrupt request flag */ + SREPR10 = 1; /* Set INTSRE0 priority: lowest */ + SREPR00 = 1; + /* Setup operation mode for transmitter (channel 0) */ + SMR00.smr00 = 0x0023U; /* Operation clock : CK00, Transfer clock : division of CK00 Start trigger : software Detect falling edge as start bit Operation mode : UART Interrupt source : buffer empty - */ - SCR00.scr00 = 0x8097U; /* Transmission only + */ + SCR00.scr00 = 0x8097U; /* Transmission only Reception error interrupt masked Phase clock : type 1 No parity LSB first 1 stop bit 8-bit data length - */ - SDR00.sdr00 = 0xCE00U; /* transfer clock : operation clock divided by 208 + */ + SDR00.sdr00 = 0xCE00U; /* transfer clock : operation clock divided by 208 2 MHz / 208 = ~9600 bps - */ - /* Setup operation mode for receiver (channel 1) */ - NFEN0.nfen0 |= 1; /* Enable noise filter on RxD0 pin */ - SIR01.sir01 = 0x0007U; /* Clear error flags */ - SMR01.smr01 = 0x0122U; /* Operation clock : CK00 + */ + /* Setup operation mode for receiver (channel 1) */ + NFEN0.nfen0 |= 1; /* Enable noise filter on RxD0 pin */ + SIR01.sir01 = 0x0007U; /* Clear error flags */ + SMR01.smr01 = 0x0122U; /* Operation clock : CK00 Transfer clock : division of CK00 Start trigger : valid edge on RxD pin Detect falling edge as start bit Operation mode : UART Interrupt source : transfer end - */ - SCR01.scr01 = 0x4097U; /* Reception only + */ + SCR01.scr01 = 0x4097U; /* Reception only Reception error interrupt masked Phase clock : type 1 No parity LSB first 1 stop bit 8-bit data length - */ - SDR01.sdr01 = 0xCE00U; /* transfer clock : operation clock divided by 208 + */ + SDR01.sdr01 = 0xCE00U; /* transfer clock : operation clock divided by 208 2 MHz / 208 = ~9600 bps - */ - SO0.so0 |= 1; /* Prepare for use of channel 0 */ - SOE0.soe0 |= 1; - P1.p1 |= (1 << 2); /* Set TxD0 high */ - PM1.pm1 &= ~(1 << 2); /* Set output mode for TxD0 */ - PM1.pm1 |= (1 << 1); /* Set input mode for RxD0 */ - SS0.ss0 |= 0x03U; /* Enable UART0 operation (both channels) */ - STIF0 = 1; /* Set buffer empty interrupt request flag */ + */ + SO0.so0 |= 1; /* Prepare for use of channel 0 */ + SOE0.soe0 |= 1; + P1.p1 |= (1 << 2); /* Set TxD0 high */ + PM1.pm1 &= ~(1 << 2); /* Set output mode for TxD0 */ + PM1.pm1 |= (1 << 1); /* Set input mode for RxD0 */ + SS0.ss0 |= 0x03U; /* Enable UART0 operation (both channels) */ + STIF0 = 1; /* Set buffer empty interrupt request flag */ } - -int uart0_puts(const char __far * s) +int +uart0_puts(const char __far *s) { - int len = 0; - SMR00.smr00 |= 0x0001U; /* Set buffer empty interrupt */ - while ('\0' != *s) - { - while (0 == STIF0); - STIF0 = 0; - SDR00.sdr00 = *s++; - ++len; - } -#if 0 - while (0 == STIF0); + int len = 0; + SMR00.smr00 |= 0x0001U; /* Set buffer empty interrupt */ + while('\0' != *s) { + while(0 == STIF0) ; STIF0 = 0; - SDR00.sdr00 = '\r'; -#endif - while (0 == STIF0); - STIF0 = 0; - SMR00.smr00 &= ~0x0001U; - SDR00.sdr00 = '\n'; - while (0 == STIF0); + SDR00.sdr00 = *s++; + ++len; + } #if 0 - while (0 != SSR00.BIT.bit6); /* Wait until TSF00 == 0 */ + while(0 == STIF0) ; + STIF0 = 0; + SDR00.sdr00 = '\r'; #endif - return len; + while(0 == STIF0) ; + STIF0 = 0; + SMR00.smr00 &= ~0x0001U; + SDR00.sdr00 = '\n'; + while(0 == STIF0) ; +#if 0 + while(0 != SSR00.BIT.bit6) ; /* Wait until TSF00 == 0 */ +#endif + return len; } - __attribute__((interrupt)) -void st0_handler(void) +void +st0_handler(void) { } - __attribute__((interrupt)) -void sr0_handler(void) +void +sr0_handler(void) { } - /* This is actually INTSRE0 interrupt handler */ __attribute__((interrupt)) -void tm01h_handler(void) +void +tm01h_handler(void) { } diff --git a/uart0.h b/uart0.h index 9512eacfb..b1ef1237a 100644 --- a/uart0.h +++ b/uart0.h @@ -2,6 +2,6 @@ #define UART0_H__ void uart0_init(void); -int uart0_puts(const char __far * s); +int uart0_puts(const char __far *s); -#endif // UART0_H__ +#endif /* UART0_H__ */ From 2668b17f52801c66bb3a87062468a05ac27a111b Mon Sep 17 00:00:00 2001 From: Maxim Salov Date: Sat, 4 Jan 2014 17:27:24 -0500 Subject: [PATCH 13/20] Move files. --- Makefile | 59 ------------------------------------ uart0.c => cpu/rl78/uart0.c | 0 uart0.h => cpu/rl78/uart0.h | 0 main.c | 60 ------------------------------------- 4 files changed, 119 deletions(-) delete mode 100644 Makefile rename uart0.c => cpu/rl78/uart0.c (100%) rename uart0.h => cpu/rl78/uart0.h (100%) delete mode 100644 main.c diff --git a/Makefile b/Makefile deleted file mode 100644 index 3b183d6e8..000000000 --- a/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -PROJECT_ELF=uart.elf -PROJECT_MOT=$(PROJECT_ELF:.elf=.mot) -PROJECT_MAP=$(PROJECT_ELF:.elf=.map) -PROJECT_LST=$(PROJECT_ELF:.elf=.lst) - -# Find latest installed GNURL78 toolchain. If your toolchain is already in PATH, just comment next line. -TOOL_PATH:=$(shell find /usr/share -maxdepth 1 -type d -iname "gnurl78*" | sort | tail -n 1)/bin - -PREFIX:=$(TOOL_PATH)/rl78-elf - -LD = $(PREFIX)-gcc -CC = $(PREFIX)-gcc -AS = $(PREFIX)-gcc -OBJCOPY = $(PREFIX)-objcopy -OBJDUMP = $(PREFIX)-objdump -SIZE = $(PREFIX)-size - -COMMON_PATH = ../common -PROJECT_PATH = . - -PROJECT_LNK = $(COMMON_PATH)/rl78-R5F100SL.ld - -CFLAGS = -Wall -Wextra -Os -ggdb -ffunction-sections -fdata-sections -I$(PROJECT_PATH) -I$(COMMON_PATH) -mmul=g13 -LDFLAGS = -Wl,--gc-sections -Wl,-Map=$(PROJECT_MAP) -T $(PROJECT_LNK) -nostartfiles - -SOURCES = \ - $(PROJECT_PATH)/main.c \ - $(PROJECT_PATH)/uart0.c \ - $(END) - -OBJS = $(SOURCES:.c=.o) $(COMMON_PATH)/crt0.o - -.PHONY: all - -all: $(PROJECT_MOT) $(PROJECT_LST) - $(SIZE) $(PROJECT_ELF) - -rom: $(PROJECT_MOT) - -$(PROJECT_MOT): $(PROJECT_ELF) - $(OBJCOPY) -O srec $^ $@ - -$(PROJECT_LST): $(PROJECT_ELF) - $(OBJDUMP) -DS $^ > $@ - -$(PROJECT_ELF): $(OBJS) - $(LD) $(LDFLAGS) -o $@ $^ - -flash: $(PROJECT_MOT) - rl78flash -m2 -b500000 -vvwri /dev/ttyUSB0 $^ - -erase: - rl78flash -m2 -b500000 -vveri /dev/ttyUSB0 - -terminal: - rl78flash -rt9600 /dev/ttyUSB0 - -clean: - -rm -f $(OBJS) $(PROJECT_ELF) $(PROJECT_MOT) $(PROJECT_MAP) $(PROJECT_LST) diff --git a/uart0.c b/cpu/rl78/uart0.c similarity index 100% rename from uart0.c rename to cpu/rl78/uart0.c diff --git a/uart0.h b/cpu/rl78/uart0.h similarity index 100% rename from uart0.h rename to cpu/rl78/uart0.h diff --git a/main.c b/main.c deleted file mode 100644 index 4d7ea8c4a..000000000 --- a/main.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "QB-R5F100SL-TB.h" -#include "uart0.h" - -volatile unsigned char ticks = 0; -volatile unsigned char flag_1hz = 0; - -__attribute__((interrupt)) -void -wdti_handler(void) -{ -} -__attribute__((interrupt)) -void -it_handler(void) -{ - ++ticks; - LED1 ^= 1; - if(0 == (0x07 & ticks)) { - flag_1hz = 1; - } -} -int -main(void) -{ - asm ("di"); - /* Setup LEDs */ - LED1 = 1; - LED2 = 1; - LED1_PIN = 0; - LED2_PIN = 0; - /* Setup clocks */ - CMC.cmc = 0x11U; /* Enable XT1, disable X1 */ - CSC.csc = 0x80U; /* Start XT1 and HOCO, stop X1 */ - CKC.ckc = 0x00U; - /* Delay 1 second */ - register unsigned long int i; - for(i = 0x000FFFFFUL; i; --i) { - asm ("nop"); - } - OSMC.osmc = 0x00; /* Supply fsub to peripherals, including Interval Timer */ - uart0_init(); - /* Setup 12-bit interval timer */ - RTCEN = 1; /* Enable 12-bit interval timer and RTC */ - ITMK = 1; /* Disable IT interrupt */ - ITPR0 = 0; /* Set interrupt priority - highest */ - ITPR1 = 0; - ITMC.itmc = 0x8FFFU; /* Set maximum period 4096/32768Hz = 1/8 s, and start timer */ - ITIF = 0; /* Clear interrupt request flag */ - ITMK = 0; /* Enable IT interrupt */ - asm ("ei"); /* Enable interrupts */ - for(;;) { - if(flag_1hz) { - LED2 = 0; - flag_1hz = 0; - uart0_puts("Hello, RL78! [:"); - LED2 = 1; - } - asm ("halt"); - } -} From 1667c4f0de3710a141892bb61ae2f1bfbc93f750 Mon Sep 17 00:00:00 2001 From: Dragos Bogdan Date: Sat, 4 Jan 2014 17:27:29 -0500 Subject: [PATCH 14/20] Uncrustify. --- ADF7023.c | 355 +++++++++++++++++++++++------------------------ ADF7023.h | 197 +++++++++++++------------- ADF7023_Config.h | 276 ++++++++++++++++++------------------ 3 files changed, 409 insertions(+), 419 deletions(-) diff --git a/ADF7023.c b/ADF7023.c index f808198e1..2e5501ce6 100644 --- a/ADF7023.c +++ b/ADF7023.c @@ -2,7 +2,7 @@ * @file ADF7023.c * @brief Implementation of ADF7023 Driver. * @author DBogdan (Dragos.Bogdan@analog.com) -******************************************************************************** + ******************************************************************************** * Copyright 2013(c) Analog Devices, Inc. * * All rights reserved. @@ -36,9 +36,9 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * -******************************************************************************** + ******************************************************************************** * SVN Revision: $WCREV$ -*******************************************************************************/ + *******************************************************************************/ /******************************************************************************/ /***************************** Include Files **********************************/ @@ -66,122 +66,116 @@ struct ADF7023_BBRAM ADF7023_BBRAMCurrent; * @param readByte - Read data. * * @return None. -*******************************************************************************/ -void ADF7023_WriteReadByte(unsigned char writeByte, - unsigned char* readByte) + *******************************************************************************/ +void +ADF7023_WriteReadByte(unsigned char writeByte, + unsigned char *readByte) { - unsigned char data = 0; - - data = writeByte; - SPI_Read(0, &data, 1); - if(readByte) - { - *readByte = data; - } -} + unsigned char data = 0; + data = writeByte; + SPI_Read(0, &data, 1); + if(readByte) { + *readByte = data; + } +} /***************************************************************************//** * @brief Initializes the ADF7023. * * @return retVal - Result of the initialization procedure. * Example: 0 - if initialization was successful; * -1 - if initialization was unsuccessful. -*******************************************************************************/ -char ADF7023_Init(void) + *******************************************************************************/ +char +ADF7023_Init(void) { - char retVal = 0; - unsigned char miso = 0; - unsigned short timeout = 0; - unsigned char status = 0; - - ADF7023_BBRAMCurrent = ADF7023_BBRAMDefault; - SPI_Init(0, // MSB first. - 1000000, // Clock frequency. - 0, // Idle state for clock is a high level; active state is a low level. - 1); // Serial output data changes on transition from idle clock state to active clock state. - ADF7023_CS_ASSERT; - while ((miso == 0) && (timeout < 1000)) - { - miso = ADF7023_MISO; - timeout++; - } - if(timeout == 1000) - { - retVal = -1; - } - while(!(status & STATUS_CMD_READY)) - { - ADF7023_GetStatus(&status); - } - ADF7023_SetRAM(0x100, 64, (unsigned char*)&ADF7023_BBRAMCurrent); - ADF7023_SetCommand(CMD_CONFIG_DEV); - - return retVal; -} + char retVal = 0; + unsigned char miso = 0; + unsigned short timeout = 0; + unsigned char status = 0; + ADF7023_BBRAMCurrent = ADF7023_BBRAMDefault; + SPI_Init(0, /* MSB first. */ + 1000000, /* Clock frequency. */ + 0, /* Idle state for clock is a high level; active state is a low level. */ + 1); /* Serial output data changes on transition from idle clock state to active clock state. */ + ADF7023_CS_ASSERT; + while((miso == 0) && (timeout < 1000)) { + miso = ADF7023_MISO; + timeout++; + } + if(timeout == 1000) { + retVal = -1; + } + while(!(status & STATUS_CMD_READY)) { + ADF7023_GetStatus(&status); + } + ADF7023_SetRAM(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); + ADF7023_SetCommand(CMD_CONFIG_DEV); + + return retVal; +} /***************************************************************************//** * @brief Reads the status word of the ADF7023. * * @param status - Status word. * * @return None. -*******************************************************************************/ -void ADF7023_GetStatus(unsigned char* status) + *******************************************************************************/ +void +ADF7023_GetStatus(unsigned char *status) { - ADF7023_CS_ASSERT; - ADF7023_WriteReadByte(SPI_NOP, 0); - ADF7023_WriteReadByte(SPI_NOP, status); - ADF7023_CS_DEASSERT; + ADF7023_CS_ASSERT; + ADF7023_WriteReadByte(SPI_NOP, 0); + ADF7023_WriteReadByte(SPI_NOP, status); + ADF7023_CS_DEASSERT; } - /***************************************************************************//** * @brief Initiates a command. * * @param command - Command. * * @return None. -*******************************************************************************/ -void ADF7023_SetCommand(unsigned char command) + *******************************************************************************/ +void +ADF7023_SetCommand(unsigned char command) { - ADF7023_CS_ASSERT; - ADF7023_WriteReadByte(command, 0); - ADF7023_CS_DEASSERT; + ADF7023_CS_ASSERT; + ADF7023_WriteReadByte(command, 0); + ADF7023_CS_DEASSERT; } - /***************************************************************************//** * @brief Sets a FW state and waits until the device enters in that state. * * @param fwState - FW state. * * @return None. -*******************************************************************************/ -void ADF7023_SetFwState(unsigned char fwState) + *******************************************************************************/ +void +ADF7023_SetFwState(unsigned char fwState) { - unsigned char status = 0; - - switch(fwState) - { - case FW_STATE_PHY_OFF: - ADF7023_SetCommand(CMD_PHY_OFF); - break; - case FW_STATE_PHY_ON: - ADF7023_SetCommand(CMD_PHY_ON); - break; - case FW_STATE_PHY_RX: - ADF7023_SetCommand(CMD_PHY_RX); - break; - case FW_STATE_PHY_TX: - ADF7023_SetCommand(CMD_PHY_TX); - break; - default: - ADF7023_SetCommand(CMD_PHY_SLEEP); - } - while((status & STATUS_FW_STATE) != fwState) - { - ADF7023_GetStatus(&status); - } -} + unsigned char status = 0; + switch(fwState) { + case FW_STATE_PHY_OFF: + ADF7023_SetCommand(CMD_PHY_OFF); + break; + case FW_STATE_PHY_ON: + ADF7023_SetCommand(CMD_PHY_ON); + break; + case FW_STATE_PHY_RX: + ADF7023_SetCommand(CMD_PHY_RX); + break; + case FW_STATE_PHY_TX: + ADF7023_SetCommand(CMD_PHY_TX); + break; + default: + ADF7023_SetCommand(CMD_PHY_SLEEP); + } + while((status & STATUS_FW_STATE) != fwState) { + ADF7023_GetStatus(&status); + } +} /***************************************************************************//** * @brief Reads data from the RAM. * @@ -190,22 +184,21 @@ void ADF7023_SetFwState(unsigned char fwState) * @param data - Read buffer. * * @return None. -*******************************************************************************/ -void ADF7023_GetRAM(unsigned long address, - unsigned long length, - unsigned char* data) + *******************************************************************************/ +void +ADF7023_GetRAM(unsigned long address, + unsigned long length, + unsigned char *data) { - ADF7023_CS_ASSERT; - ADF7023_WriteReadByte(SPI_MEM_RD | ((address & 0x700) >> 8), 0); - ADF7023_WriteReadByte(address & 0xFF, 0); - ADF7023_WriteReadByte(SPI_NOP, 0); - while(length--) - { - ADF7023_WriteReadByte(SPI_NOP, data++); - } - ADF7023_CS_DEASSERT; + ADF7023_CS_ASSERT; + ADF7023_WriteReadByte(SPI_MEM_RD | ((address & 0x700) >> 8), 0); + ADF7023_WriteReadByte(address & 0xFF, 0); + ADF7023_WriteReadByte(SPI_NOP, 0); + while(length--) { + ADF7023_WriteReadByte(SPI_NOP, data++); + } + ADF7023_CS_DEASSERT; } - /***************************************************************************//** * @brief Writes data to RAM. * @@ -214,21 +207,20 @@ void ADF7023_GetRAM(unsigned long address, * @param data - Write buffer. * * @return None. -*******************************************************************************/ -void ADF7023_SetRAM(unsigned long address, - unsigned long length, - unsigned char* data) + *******************************************************************************/ +void +ADF7023_SetRAM(unsigned long address, + unsigned long length, + unsigned char *data) { - ADF7023_CS_ASSERT; - ADF7023_WriteReadByte(SPI_MEM_WR | ((address & 0x700) >> 8), 0); - ADF7023_WriteReadByte(address & 0xFF, 0); - while(length--) - { - ADF7023_WriteReadByte(*(data++), 0); - } - ADF7023_CS_DEASSERT; + ADF7023_CS_ASSERT; + ADF7023_WriteReadByte(SPI_MEM_WR | ((address & 0x700) >> 8), 0); + ADF7023_WriteReadByte(address & 0xFF, 0); + while(length--) { + ADF7023_WriteReadByte(*(data++), 0); + } + ADF7023_CS_DEASSERT; } - /***************************************************************************//** * @brief Receives one packet. * @@ -236,26 +228,25 @@ void ADF7023_SetRAM(unsigned long address, * @param length - Number of received bytes. * * @return None. -*******************************************************************************/ -void ADF7023_ReceivePacket(unsigned char* packet, unsigned char* length) + *******************************************************************************/ +void +ADF7023_ReceivePacket(unsigned char *packet, unsigned char *length) { - unsigned char interruptReg = 0; - - ADF7023_SetFwState(FW_STATE_PHY_ON); - ADF7023_SetFwState(FW_STATE_PHY_RX); - while(!(interruptReg & BBRAM_INTERRUPT_MASK_0_INTERRUPT_CRC_CORRECT)) - { - ADF7023_GetRAM(MCR_REG_INTERRUPT_SOURCE_0, - 0x1, - &interruptReg); - } - ADF7023_SetRAM(MCR_REG_INTERRUPT_SOURCE_0, + unsigned char interruptReg = 0; + + ADF7023_SetFwState(FW_STATE_PHY_ON); + ADF7023_SetFwState(FW_STATE_PHY_RX); + while(!(interruptReg & BBRAM_INTERRUPT_MASK_0_INTERRUPT_CRC_CORRECT)) { + ADF7023_GetRAM(MCR_REG_INTERRUPT_SOURCE_0, 0x1, &interruptReg); - ADF7023_GetRAM(0x10, 1, length); - ADF7023_GetRAM(0x12, *length - 2, packet); + } + ADF7023_SetRAM(MCR_REG_INTERRUPT_SOURCE_0, + 0x1, + &interruptReg); + ADF7023_GetRAM(0x10, 1, length); + ADF7023_GetRAM(0x12, *length - 2, packet); } - /***************************************************************************//** * @brief Transmits one packet. * @@ -263,83 +254,83 @@ void ADF7023_ReceivePacket(unsigned char* packet, unsigned char* length) * @param length - Number of bytes to transmit. * * @return None. -*******************************************************************************/ -void ADF7023_TransmitPacket(unsigned char* packet, unsigned char length) + *******************************************************************************/ +void +ADF7023_TransmitPacket(unsigned char *packet, unsigned char length) { - unsigned char interruptReg = 0; - unsigned char header[2] = {0, 0}; - - header[0] = 2 + length; - header[1] = ADF7023_BBRAMCurrent.addressMatchOffset; - ADF7023_SetRAM(0x10, 2, header); - ADF7023_SetRAM(0x12, length, packet); - ADF7023_SetFwState(FW_STATE_PHY_ON); - ADF7023_SetFwState(FW_STATE_PHY_TX); - while(!(interruptReg & BBRAM_INTERRUPT_MASK_0_INTERRUPT_TX_EOF)) - { - ADF7023_GetRAM(MCR_REG_INTERRUPT_SOURCE_0, - 0x1, - &interruptReg); - } -} + unsigned char interruptReg = 0; + unsigned char header[2] = { 0, 0 }; + header[0] = 2 + length; + header[1] = ADF7023_BBRAMCurrent.addressMatchOffset; + ADF7023_SetRAM(0x10, 2, header); + ADF7023_SetRAM(0x12, length, packet); + ADF7023_SetFwState(FW_STATE_PHY_ON); + ADF7023_SetFwState(FW_STATE_PHY_TX); + while(!(interruptReg & BBRAM_INTERRUPT_MASK_0_INTERRUPT_TX_EOF)) { + ADF7023_GetRAM(MCR_REG_INTERRUPT_SOURCE_0, + 0x1, + &interruptReg); + } +} /***************************************************************************//** * @brief Sets the channel frequency. * * @param chFreq - Channel frequency. * * @return None. -*******************************************************************************/ -void ADF7023_SetChannelFrequency(unsigned long chFreq) + *******************************************************************************/ +void +ADF7023_SetChannelFrequency(unsigned long chFreq) { - chFreq = (unsigned long)(((float)chFreq / 26000000) * 65535); - ADF7023_BBRAMCurrent.channelFreq0 = (chFreq & 0x0000FF) >> 0; - ADF7023_BBRAMCurrent.channelFreq1 = (chFreq & 0x00FF00) >> 8; - ADF7023_BBRAMCurrent.channelFreq2 = (chFreq & 0xFF0000) >> 16; - ADF7023_SetRAM(0x100, 64, (unsigned char*)&ADF7023_BBRAMCurrent); + chFreq = (unsigned long)(((float)chFreq / 26000000) * 65535); + ADF7023_BBRAMCurrent.channelFreq0 = (chFreq & 0x0000FF) >> 0; + ADF7023_BBRAMCurrent.channelFreq1 = (chFreq & 0x00FF00) >> 8; + ADF7023_BBRAMCurrent.channelFreq2 = (chFreq & 0xFF0000) >> 16; + ADF7023_SetRAM(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); } - /***************************************************************************//** * @brief Sets the data rate. * * @param dataRate - Data rate. * * @return None. -*******************************************************************************/ -void ADF7023_SetDataRate(unsigned long dataRate) + *******************************************************************************/ +void +ADF7023_SetDataRate(unsigned long dataRate) { - unsigned char status = 0; - - dataRate = (unsigned long)(dataRate / 100); - ADF7023_BBRAMCurrent.radioCfg0 = - BBRAM_RADIO_CFG_0_DATA_RATE_7_0((dataRate & 0x00FF) >> 0); - ADF7023_BBRAMCurrent.radioCfg1 &= ~BBRAM_RADIO_CFG_1_DATA_RATE_11_8(0xF); - ADF7023_BBRAMCurrent.radioCfg1 |= - BBRAM_RADIO_CFG_1_DATA_RATE_11_8((dataRate & 0x0F00) >> 8); - ADF7023_SetRAM(0x100, 64, (unsigned char*)&ADF7023_BBRAMCurrent); - ADF7023_SetFwState(FW_STATE_PHY_OFF); - ADF7023_SetCommand(CMD_CONFIG_DEV); -} + unsigned char status = 0; + dataRate = (unsigned long)(dataRate / 100); + ADF7023_BBRAMCurrent.radioCfg0 = + BBRAM_RADIO_CFG_0_DATA_RATE_7_0((dataRate & 0x00FF) >> 0); + ADF7023_BBRAMCurrent.radioCfg1 &= ~BBRAM_RADIO_CFG_1_DATA_RATE_11_8(0xF); + ADF7023_BBRAMCurrent.radioCfg1 |= + BBRAM_RADIO_CFG_1_DATA_RATE_11_8((dataRate & 0x0F00) >> 8); + ADF7023_SetRAM(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); + ADF7023_SetFwState(FW_STATE_PHY_OFF); + ADF7023_SetCommand(CMD_CONFIG_DEV); +} /***************************************************************************//** * @brief Sets the frequency deviation. * * @param freqDev - Frequency deviation. * * @return None. -*******************************************************************************/ -void ADF7023_SetFrequencyDeviation(unsigned long freqDev) + *******************************************************************************/ +void +ADF7023_SetFrequencyDeviation(unsigned long freqDev) { - unsigned char status = 0; - - freqDev = (unsigned long)(freqDev / 100); - ADF7023_BBRAMCurrent.radioCfg1 &= - ~BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8(0xF); - ADF7023_BBRAMCurrent.radioCfg1 |= - BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8((freqDev & 0x0F00) >> 8); - ADF7023_BBRAMCurrent.radioCfg2 = - BBRAM_RADIO_CFG_2_FREQ_DEVIATION_7_0((freqDev & 0x00FF) >> 0); - ADF7023_SetRAM(0x100, 64, (unsigned char*)&ADF7023_BBRAMCurrent); - ADF7023_SetFwState(FW_STATE_PHY_OFF); - ADF7023_SetCommand(CMD_CONFIG_DEV); + unsigned char status = 0; + + freqDev = (unsigned long)(freqDev / 100); + ADF7023_BBRAMCurrent.radioCfg1 &= + ~BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8(0xF); + ADF7023_BBRAMCurrent.radioCfg1 |= + BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8((freqDev & 0x0F00) >> 8); + ADF7023_BBRAMCurrent.radioCfg2 = + BBRAM_RADIO_CFG_2_FREQ_DEVIATION_7_0((freqDev & 0x00FF) >> 0); + ADF7023_SetRAM(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); + ADF7023_SetFwState(FW_STATE_PHY_OFF); + ADF7023_SetCommand(CMD_CONFIG_DEV); } diff --git a/ADF7023.h b/ADF7023.h index 1bc9bced5..45985b7e7 100644 --- a/ADF7023.h +++ b/ADF7023.h @@ -2,7 +2,7 @@ * @file ADF7023.h * @brief Header file of ADF7023 Driver. * @author DBogdan (Dragos.Bogdan@analog.com) -******************************************************************************** + ******************************************************************************** * Copyright 2013(c) Analog Devices, Inc. * * All rights reserved. @@ -36,9 +36,9 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * -******************************************************************************** + ******************************************************************************** * SVN Revision: $WCREV$ -*******************************************************************************/ + *******************************************************************************/ #ifndef __ADF7023_H__ #define __ADF7023_H__ @@ -63,32 +63,32 @@ #define FW_STATE_AES_ENCRYPT 0x0A /* SPI Memory Access Commands */ -#define SPI_MEM_WR 0x18 // Write data to packet RAM sequentially. -#define SPI_MEM_RD 0x38 // Read data from packet RAM sequentially. -#define SPI_MEMR_WR 0x08 // Write data to packet RAM nonsequentially. -#define SPI_MEMR_RD 0x28 // Read data from packet RAM nonsequentially. -#define SPI_NOP 0xFF // No operation. +#define SPI_MEM_WR 0x18 /* Write data to packet RAM sequentially. */ +#define SPI_MEM_RD 0x38 /* Read data from packet RAM sequentially. */ +#define SPI_MEMR_WR 0x08 /* Write data to packet RAM nonsequentially. */ +#define SPI_MEMR_RD 0x28 /* Read data from packet RAM nonsequentially. */ +#define SPI_NOP 0xFF /* No operation. */ /* Radio Controller Commands */ -#define CMD_SYNC 0xA2 // This is an optional command. It is not necessary to use it during device initialization -#define CMD_PHY_OFF 0xB0 // Performs a transition of the device into the PHY_OFF state. -#define CMD_PHY_ON 0xB1 // Performs a transition of the device into the PHY_ON state. -#define CMD_PHY_RX 0xB2 // Performs a transition of the device into the PHY_RX state. -#define CMD_PHY_TX 0xB5 // Performs a transition of the device into the PHY_TX state. -#define CMD_PHY_SLEEP 0xBA // Performs a transition of the device into the PHY_SLEEP state. -#define CMD_CONFIG_DEV 0xBB // Configures the radio parameters based on the BBRAM values. -#define CMD_GET_RSSI 0xBC // Performs an RSSI measurement. -#define CMD_BB_CAL 0xBE // Performs a calibration of the IF filter. -#define CMD_HW_RESET 0xC8 // Performs a full hardware reset. The device enters the PHY_SLEEP state. -#define CMD_RAM_LOAD_INIT 0xBF // Prepares the program RAM for a firmware module download. -#define CMD_RAM_LOAD_DONE 0xC7 // Performs a reset of the communications processor after download of a firmware module to program RAM. -#define CMD_IR_CAL 0xBD // Initiates an image rejection calibration routine. -#define CMD_AES_ENCRYPT 0xD0 // Performs an AES encryption on the transmit payload data stored in packet RAM. -#define CMD_AES_DECRYPT 0xD2 // Performs an AES decryption on the received payload data stored in packet RAM. -#define CMD_AES_DECRYPT_INIT 0xD1 // Initializes the internal variables required for AES decryption. -#define CMD_RS_ENCODE_INIT 0xD1 // Initializes the internal variables required for the Reed Solomon encoding. -#define CMD_RS_ENCODE 0xD0 // Calculates and appends the Reed Solomon check bytes to the transmit payload data stored in packet RAM. -#define CMD_RS_DECODE 0xD2 // Performs a Reed Solomon error correction on the received payload data stored in packet RAM. +#define CMD_SYNC 0xA2 /* This is an optional command. It is not necessary to use it during device initialization */ +#define CMD_PHY_OFF 0xB0 /* Performs a transition of the device into the PHY_OFF state. */ +#define CMD_PHY_ON 0xB1 /* Performs a transition of the device into the PHY_ON state. */ +#define CMD_PHY_RX 0xB2 /* Performs a transition of the device into the PHY_RX state. */ +#define CMD_PHY_TX 0xB5 /* Performs a transition of the device into the PHY_TX state. */ +#define CMD_PHY_SLEEP 0xBA /* Performs a transition of the device into the PHY_SLEEP state. */ +#define CMD_CONFIG_DEV 0xBB /* Configures the radio parameters based on the BBRAM values. */ +#define CMD_GET_RSSI 0xBC /* Performs an RSSI measurement. */ +#define CMD_BB_CAL 0xBE /* Performs a calibration of the IF filter. */ +#define CMD_HW_RESET 0xC8 /* Performs a full hardware reset. The device enters the PHY_SLEEP state. */ +#define CMD_RAM_LOAD_INIT 0xBF /* Prepares the program RAM for a firmware module download. */ +#define CMD_RAM_LOAD_DONE 0xC7 /* Performs a reset of the communications processor after download of a firmware module to program RAM. */ +#define CMD_IR_CAL 0xBD /* Initiates an image rejection calibration routine. */ +#define CMD_AES_ENCRYPT 0xD0 /* Performs an AES encryption on the transmit payload data stored in packet RAM. */ +#define CMD_AES_DECRYPT 0xD2 /* Performs an AES decryption on the received payload data stored in packet RAM. */ +#define CMD_AES_DECRYPT_INIT 0xD1 /* Initializes the internal variables required for AES decryption. */ +#define CMD_RS_ENCODE_INIT 0xD1 /* Initializes the internal variables required for the Reed Solomon encoding. */ +#define CMD_RS_ENCODE 0xD0 /* Calculates and appends the Reed Solomon check bytes to the transmit payload data stored in packet RAM. */ +#define CMD_RS_DECODE 0xD2 /* Performs a Reed Solomon error correction on the received payload data stored in packet RAM. */ /* Battery Backup Memory (BBRAM) */ #define BBRAM_REG_INTERRUPT_MASK_0 0x100 @@ -295,72 +295,71 @@ #define MCR_REG_GPIO_CONFIGURE 0x3FA #define MCR_REG_TEST_DAC_GAIN 0x3FD -struct ADF7023_BBRAM -{ - unsigned char interruptMask0; // 0x100 - unsigned char interruptMask1; // 0x101 - unsigned char numberOfWakeups0; // 0x102 - unsigned char numberOfWakeups1; // 0x103 - unsigned char numberOfWakeupsIrqThreshold0; // 0x104 - unsigned char numberOfWakeupsIrqThreshold1; // 0x105 - unsigned char rxDwellTime; // 0x106 - unsigned char parmtimeDivider; // 0x107 - unsigned char swmRssiThresh; // 0x108 - unsigned char channelFreq0; // 0x109 - unsigned char channelFreq1; // 0x10A - unsigned char channelFreq2; // 0x10B - unsigned char radioCfg0; // 0x10C - unsigned char radioCfg1; // 0x10D - unsigned char radioCfg2; // 0x10E - unsigned char radioCfg3; // 0x10F - unsigned char radioCfg4; // 0x110 - unsigned char radioCfg5; // 0x111 - unsigned char radioCfg6; // 0x112 - unsigned char radioCfg7; // 0x113 - unsigned char radioCfg8; // 0x114 - unsigned char radioCfg9; // 0x115 - unsigned char radioCfg10; // 0x116 - unsigned char radioCfg11; // 0x117 - unsigned char imageRejectCalPhase; // 0x118 - unsigned char imageRejectCalAmplitude; // 0x119 - unsigned char modeControl; // 0x11A - unsigned char preambleMatch; // 0x11B - unsigned char symbolMode; // 0x11C - unsigned char preambleLen; // 0x11D - unsigned char crcPoly0; // 0x11E - unsigned char crcPoly1; // 0x11F - unsigned char syncControl; // 0x120 - unsigned char syncByte0; // 0x121 - unsigned char syncByte1; // 0x122 - unsigned char syncByte2; // 0x123 - unsigned char txBaseAdr; // 0x124 - unsigned char rxBaseAdr; // 0x125 - unsigned char packetLengthControl; // 0x126 - unsigned char packetLengthMax; // 0x127 - unsigned char staticRegFix; // 0x128 - unsigned char addressMatchOffset; // 0x129 - unsigned char addressLength; // 0x12A - unsigned char addressFiltering0; // 0x12B - unsigned char addressFiltering1; // 0x12C - unsigned char addressFiltering2; // 0x12D - unsigned char addressFiltering3; // 0x12E - unsigned char addressFiltering4; // 0x12F - unsigned char addressFiltering5; // 0x130 - unsigned char addressFiltering6; // 0x131 - unsigned char addressFiltering7; // 0x132 - unsigned char addressFiltering8; // 0x133 - unsigned char addressFiltering9; // 0x134 - unsigned char addressFiltering10; // 0x135 - unsigned char addressFiltering11; // 0x136 - unsigned char addressFiltering12; // 0x137 - unsigned char rssiWaitTime; // 0x138 - unsigned char testmodes; // 0x139 - unsigned char transitionClockDiv; // 0x13A - unsigned char reserved0; // 0x13B - unsigned char reserved1; // 0x13C - unsigned char reserved2; // 0x13D - unsigned char rxSynthLockTime; // 0x13E - unsigned char txSynthLockTime; // 0x13F +struct ADF7023_BBRAM { + unsigned char interruptMask0; /* 0x100 */ + unsigned char interruptMask1; /* 0x101 */ + unsigned char numberOfWakeups0; /* 0x102 */ + unsigned char numberOfWakeups1; /* 0x103 */ + unsigned char numberOfWakeupsIrqThreshold0; /* 0x104 */ + unsigned char numberOfWakeupsIrqThreshold1; /* 0x105 */ + unsigned char rxDwellTime; /* 0x106 */ + unsigned char parmtimeDivider; /* 0x107 */ + unsigned char swmRssiThresh; /* 0x108 */ + unsigned char channelFreq0; /* 0x109 */ + unsigned char channelFreq1; /* 0x10A */ + unsigned char channelFreq2; /* 0x10B */ + unsigned char radioCfg0; /* 0x10C */ + unsigned char radioCfg1; /* 0x10D */ + unsigned char radioCfg2; /* 0x10E */ + unsigned char radioCfg3; /* 0x10F */ + unsigned char radioCfg4; /* 0x110 */ + unsigned char radioCfg5; /* 0x111 */ + unsigned char radioCfg6; /* 0x112 */ + unsigned char radioCfg7; /* 0x113 */ + unsigned char radioCfg8; /* 0x114 */ + unsigned char radioCfg9; /* 0x115 */ + unsigned char radioCfg10; /* 0x116 */ + unsigned char radioCfg11; /* 0x117 */ + unsigned char imageRejectCalPhase; /* 0x118 */ + unsigned char imageRejectCalAmplitude; /* 0x119 */ + unsigned char modeControl; /* 0x11A */ + unsigned char preambleMatch; /* 0x11B */ + unsigned char symbolMode; /* 0x11C */ + unsigned char preambleLen; /* 0x11D */ + unsigned char crcPoly0; /* 0x11E */ + unsigned char crcPoly1; /* 0x11F */ + unsigned char syncControl; /* 0x120 */ + unsigned char syncByte0; /* 0x121 */ + unsigned char syncByte1; /* 0x122 */ + unsigned char syncByte2; /* 0x123 */ + unsigned char txBaseAdr; /* 0x124 */ + unsigned char rxBaseAdr; /* 0x125 */ + unsigned char packetLengthControl; /* 0x126 */ + unsigned char packetLengthMax; /* 0x127 */ + unsigned char staticRegFix; /* 0x128 */ + unsigned char addressMatchOffset; /* 0x129 */ + unsigned char addressLength; /* 0x12A */ + unsigned char addressFiltering0; /* 0x12B */ + unsigned char addressFiltering1; /* 0x12C */ + unsigned char addressFiltering2; /* 0x12D */ + unsigned char addressFiltering3; /* 0x12E */ + unsigned char addressFiltering4; /* 0x12F */ + unsigned char addressFiltering5; /* 0x130 */ + unsigned char addressFiltering6; /* 0x131 */ + unsigned char addressFiltering7; /* 0x132 */ + unsigned char addressFiltering8; /* 0x133 */ + unsigned char addressFiltering9; /* 0x134 */ + unsigned char addressFiltering10; /* 0x135 */ + unsigned char addressFiltering11; /* 0x136 */ + unsigned char addressFiltering12; /* 0x137 */ + unsigned char rssiWaitTime; /* 0x138 */ + unsigned char testmodes; /* 0x139 */ + unsigned char transitionClockDiv; /* 0x13A */ + unsigned char reserved0; /* 0x13B */ + unsigned char reserved1; /* 0x13C */ + unsigned char reserved2; /* 0x13D */ + unsigned char rxSynthLockTime; /* 0x13E */ + unsigned char txSynthLockTime; /* 0x13F */ }; #define ADF7023_TX_BASE_ADR 0x10 @@ -374,7 +373,7 @@ struct ADF7023_BBRAM char ADF7023_Init(void); /* Reads the status word of the ADF7023. */ -void ADF7023_GetStatus(unsigned char* status); +void ADF7023_GetStatus(unsigned char *status); /* Initiates a command. */ void ADF7023_SetCommand(unsigned char command); @@ -385,18 +384,18 @@ void ADF7023_SetFwState(unsigned char fwState); /* Reads data from the RAM. */ void ADF7023_GetRAM(unsigned long address, unsigned long length, - unsigned char* data); + unsigned char *data); /* Writes data to RAM. */ void ADF7023_SetRAM(unsigned long address, unsigned long length, - unsigned char* data); + unsigned char *data); /* Receives one packet. */ -void ADF7023_ReceivePacket(unsigned char* packet, unsigned char* length); +void ADF7023_ReceivePacket(unsigned char *packet, unsigned char *length); /* Transmits one packet. */ -void ADF7023_TransmitPacket(unsigned char* packet, unsigned char length); +void ADF7023_TransmitPacket(unsigned char *packet, unsigned char length); /* Sets the channel frequency. */ void ADF7023_SetChannelFrequency(unsigned long chFreq); @@ -407,4 +406,4 @@ void ADF7023_SetDataRate(unsigned long dataRate); /* Sets the frequency deviation. */ void ADF7023_SetFrequencyDeviation(unsigned long freqDev); -#endif // __ADF7023_H__ +#endif /* __ADF7023_H__ */ diff --git a/ADF7023_Config.h b/ADF7023_Config.h index bdcf8c07a..0202d945e 100644 --- a/ADF7023_Config.h +++ b/ADF7023_Config.h @@ -2,7 +2,7 @@ * @file ADF7023_Config.h * @brief Configuration file of ADF7023 Driver. * @author DBogdan (Dragos.Bogdan@analog.com) -******************************************************************************** + ******************************************************************************** * Copyright 2013(c) Analog Devices, Inc. * * All rights reserved. @@ -36,9 +36,9 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * -******************************************************************************** + ******************************************************************************** * SVN Revision: $WCREV$ -*******************************************************************************/ + *******************************************************************************/ #ifndef __ADF7023_CONFIG_H__ #define __ADF7023_CONFIG_H__ @@ -52,140 +52,140 @@ /******************************************************************************/ struct ADF7023_BBRAM ADF7023_BBRAMDefault = { - /* interruptMask0 - 0x100 */ - BBRAM_INTERRUPT_MASK_0_INTERRUPT_TX_EOF | - BBRAM_INTERRUPT_MASK_0_INTERRUPT_CRC_CORRECT, - /* interruptMask1 - 0x101 */ - 0x00, - /* numberOfWakeups0 - 0x102 */ - 0x00, - /* numberOfWakeups1 - 0x103 */ - 0x00, - /* numberOfWakeupsIrqThreshold0 - 0x104 */ - 0xFF, - /* numberOfWakeupsIrqThreshold1 - 0x105 */ - 0xFF, - /* rxDwellTime - 0x106 */ - 0x00, - /* parmtimeDivider - 0x107 */ - 0x33, - /* swmRssiThresh - 0x108 */ - 0x31, - /* channelFreq0 - 0x109 */ - 0x51, // Channel Frequency: 433 MHz - /* channelFreq1 - 0x10A */ - 0xA7, // Channel Frequency: 433 MHz - /* channelFreq2 - 0x10B */ - 0x10, // Channel Frequency: 433 MHz - /* radioCfg0 - 0x10C */ - BBRAM_RADIO_CFG_0_DATA_RATE_7_0(0xE8), // Data rate: 100 kbps - /* radioCfg1 - 0x10D */ - BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8(0x00) | // Frequency deviation: 25 Hz - BBRAM_RADIO_CFG_1_DATA_RATE_11_8(0x03), // Data rate: 100 kbps - /* radioCfg2 - 0x10E */ - BBRAM_RADIO_CFG_2_FREQ_DEVIATION_7_0(0xFA), // Frequency deviation: 25 Hz - /* radioCfg3 - 0x10F */ - 0x31, - /* radioCfg4 - 0x110 */ - 0x16, - /* radioCfg5 - 0x111 */ - 0x00, - /* radioCfg6 - 0x112 */ - BBRAM_RADIO_CFG_6_DISCRIM_PHASE(0x2), - /* radioCfg7 - 0x113 */ - BBRAM_RADIO_CFG_7_AGC_LOCK_MODE(3), - /* radioCfg8 - 0x114 */ - BBRAM_RADIO_CFG_8_PA_SINGLE_DIFF_SEL | - BBRAM_RADIO_CFG_8_PA_LEVEL(0xF) | - BBRAM_RADIO_CFG_8_PA_RAMP(1), - /* radioCfg9 - 0x115 */ - BBRAM_RADIO_CFG_9_IFBW(2), - /* radioCfg10 - 0x116 */ - BBRAM_RADIO_CFG_10_AFC_SCHEME(2) | - BBRAM_RADIO_CFG_10_AFC_LOCK_MODE(3), - /* radioCfg11 - 0x117 */ - BBRAM_RADIO_CFG_11_AFC_KP(3) | - BBRAM_RADIO_CFG_11_AFC_KI(7), - /* imageRejectCalPhase - 0x118 */ - 0x00, - /* imageRejectCalAmplitude - 0x119 */ - 0x00, - /* modeControl - 0x11A */ - BBRAM_MODE_CONTROL_BB_CAL, - /* preambleMatch - 0x11B */ - 0x0C, - /* symbolMode - 0x11C */ - BBRAM_SYMBOL_MODE_MANCHESTER_ENC, - /* preambleLen - 0x11D */ - 0x20, - /* crcPoly0 - 0x11E */ - 0x00, - /* crcPoly1 - 0x11F */ - 0x00, - /* syncControl - 0x120 */ - BBRAM_SYNC_CONTROL_SYNC_WORD_LENGTH(8), - /* syncByte0 - 0x121 */ - 0x00, - /* syncByte1 - 0x122 */ - 0x00, - /* syncByte2 - 0x123 */ - 0x12, - /* txBaseAdr - 0x124 */ - ADF7023_TX_BASE_ADR, - /* rxBaseAdr - 0x125 */ - ADF7023_RX_BASE_ADR, - /* packetLengthControl - 0x126 */ - 0x24, - /* packetLengthMax - 0x127 */ - 0xF0, - /* staticRegFix - 0x128 */ - 0x00, - /* addressMatchOffset - 0x129 */ - 0x01, - /* addressLength - 0x12A */ - 0x02, - /* addressFiltering0 - 0x12B */ - 0x01, - /* addressFiltering1 - 0x12C */ - 0xFF, - /* addressFiltering2 - 0x12D */ - 0xFF, - /* addressFiltering3 - 0x12E */ - 0xFF, - /* addressFiltering4 - 0x12F */ - 0x02, - /* addressFiltering5 - 0x130 */ - 0x0F, - /* addressFiltering6 - 0x131 */ - 0xFF, - /* addressFiltering7 - 0x132 */ - 0x0F, - /* addressFiltering8 - 0x133 */ - 0xFF, - /* addressFiltering9 - 0x134 */ - 0x00, - /* addressFiltering10 - 0x135 */ - 0x00, - /* addressFiltering11 - 0x136 */ - 0x00, - /* addressFiltering12 - 0x137 */ - 0x00, - /* rssiWaitTime - 0x138 */ - 0x00, - /* testmodes - 0x139 */ - 0x00, - /* transitionClockDiv - 0x13A */ - 0x00, - /* reserved0 - 0x13B */ - 0x00, - /* reserved1 - 0x13C */ - 0x00, - /* reserved2 - 0x13D */ - 0x00, - /* rxSynthLockTime - 0x13E */ - 0x00, - /* txSynthLockTime - 0x13F */ - 0x00, + /* interruptMask0 - 0x100 */ + BBRAM_INTERRUPT_MASK_0_INTERRUPT_TX_EOF | + BBRAM_INTERRUPT_MASK_0_INTERRUPT_CRC_CORRECT, + /* interruptMask1 - 0x101 */ + 0x00, + /* numberOfWakeups0 - 0x102 */ + 0x00, + /* numberOfWakeups1 - 0x103 */ + 0x00, + /* numberOfWakeupsIrqThreshold0 - 0x104 */ + 0xFF, + /* numberOfWakeupsIrqThreshold1 - 0x105 */ + 0xFF, + /* rxDwellTime - 0x106 */ + 0x00, + /* parmtimeDivider - 0x107 */ + 0x33, + /* swmRssiThresh - 0x108 */ + 0x31, + /* channelFreq0 - 0x109 */ + 0x51, /* Channel Frequency: 433 MHz */ + /* channelFreq1 - 0x10A */ + 0xA7, /* Channel Frequency: 433 MHz */ + /* channelFreq2 - 0x10B */ + 0x10, /* Channel Frequency: 433 MHz */ + /* radioCfg0 - 0x10C */ + BBRAM_RADIO_CFG_0_DATA_RATE_7_0(0xE8), /* Data rate: 100 kbps */ + /* radioCfg1 - 0x10D */ + BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8(0x00) | /* Frequency deviation: 25 Hz */ + BBRAM_RADIO_CFG_1_DATA_RATE_11_8(0x03), /* Data rate: 100 kbps */ + /* radioCfg2 - 0x10E */ + BBRAM_RADIO_CFG_2_FREQ_DEVIATION_7_0(0xFA), /* Frequency deviation: 25 Hz */ + /* radioCfg3 - 0x10F */ + 0x31, + /* radioCfg4 - 0x110 */ + 0x16, + /* radioCfg5 - 0x111 */ + 0x00, + /* radioCfg6 - 0x112 */ + BBRAM_RADIO_CFG_6_DISCRIM_PHASE(0x2), + /* radioCfg7 - 0x113 */ + BBRAM_RADIO_CFG_7_AGC_LOCK_MODE(3), + /* radioCfg8 - 0x114 */ + BBRAM_RADIO_CFG_8_PA_SINGLE_DIFF_SEL | + BBRAM_RADIO_CFG_8_PA_LEVEL(0xF) | + BBRAM_RADIO_CFG_8_PA_RAMP(1), + /* radioCfg9 - 0x115 */ + BBRAM_RADIO_CFG_9_IFBW(2), + /* radioCfg10 - 0x116 */ + BBRAM_RADIO_CFG_10_AFC_SCHEME(2) | + BBRAM_RADIO_CFG_10_AFC_LOCK_MODE(3), + /* radioCfg11 - 0x117 */ + BBRAM_RADIO_CFG_11_AFC_KP(3) | + BBRAM_RADIO_CFG_11_AFC_KI(7), + /* imageRejectCalPhase - 0x118 */ + 0x00, + /* imageRejectCalAmplitude - 0x119 */ + 0x00, + /* modeControl - 0x11A */ + BBRAM_MODE_CONTROL_BB_CAL, + /* preambleMatch - 0x11B */ + 0x0C, + /* symbolMode - 0x11C */ + BBRAM_SYMBOL_MODE_MANCHESTER_ENC, + /* preambleLen - 0x11D */ + 0x20, + /* crcPoly0 - 0x11E */ + 0x00, + /* crcPoly1 - 0x11F */ + 0x00, + /* syncControl - 0x120 */ + BBRAM_SYNC_CONTROL_SYNC_WORD_LENGTH(8), + /* syncByte0 - 0x121 */ + 0x00, + /* syncByte1 - 0x122 */ + 0x00, + /* syncByte2 - 0x123 */ + 0x12, + /* txBaseAdr - 0x124 */ + ADF7023_TX_BASE_ADR, + /* rxBaseAdr - 0x125 */ + ADF7023_RX_BASE_ADR, + /* packetLengthControl - 0x126 */ + 0x24, + /* packetLengthMax - 0x127 */ + 0xF0, + /* staticRegFix - 0x128 */ + 0x00, + /* addressMatchOffset - 0x129 */ + 0x01, + /* addressLength - 0x12A */ + 0x02, + /* addressFiltering0 - 0x12B */ + 0x01, + /* addressFiltering1 - 0x12C */ + 0xFF, + /* addressFiltering2 - 0x12D */ + 0xFF, + /* addressFiltering3 - 0x12E */ + 0xFF, + /* addressFiltering4 - 0x12F */ + 0x02, + /* addressFiltering5 - 0x130 */ + 0x0F, + /* addressFiltering6 - 0x131 */ + 0xFF, + /* addressFiltering7 - 0x132 */ + 0x0F, + /* addressFiltering8 - 0x133 */ + 0xFF, + /* addressFiltering9 - 0x134 */ + 0x00, + /* addressFiltering10 - 0x135 */ + 0x00, + /* addressFiltering11 - 0x136 */ + 0x00, + /* addressFiltering12 - 0x137 */ + 0x00, + /* rssiWaitTime - 0x138 */ + 0x00, + /* testmodes - 0x139 */ + 0x00, + /* transitionClockDiv - 0x13A */ + 0x00, + /* reserved0 - 0x13B */ + 0x00, + /* reserved1 - 0x13C */ + 0x00, + /* reserved2 - 0x13D */ + 0x00, + /* rxSynthLockTime - 0x13E */ + 0x00, + /* txSynthLockTime - 0x13F */ + 0x00, }; -#endif // __ADF7023_CONFIG_H__ +#endif /* __ADF7023_CONFIG_H__ */ From 94d5d384e0fc16e5979a2a7583889953127496a8 Mon Sep 17 00:00:00 2001 From: Dragos Bogdan Date: Sat, 4 Jan 2014 17:27:29 -0500 Subject: [PATCH 15/20] Move files. --- ADF7023.c => cpu/rl78/adf7023/ADF7023.c | 0 ADF7023.h => cpu/rl78/adf7023/ADF7023.h | 0 ADF7023_Config.h => cpu/rl78/adf7023/ADF7023_Config.h | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename ADF7023.c => cpu/rl78/adf7023/ADF7023.c (100%) rename ADF7023.h => cpu/rl78/adf7023/ADF7023.h (100%) rename ADF7023_Config.h => cpu/rl78/adf7023/ADF7023_Config.h (100%) diff --git a/ADF7023.c b/cpu/rl78/adf7023/ADF7023.c similarity index 100% rename from ADF7023.c rename to cpu/rl78/adf7023/ADF7023.c diff --git a/ADF7023.h b/cpu/rl78/adf7023/ADF7023.h similarity index 100% rename from ADF7023.h rename to cpu/rl78/adf7023/ADF7023.h diff --git a/ADF7023_Config.h b/cpu/rl78/adf7023/ADF7023_Config.h similarity index 100% rename from ADF7023_Config.h rename to cpu/rl78/adf7023/ADF7023_Config.h From fb64cb5e4cfb7277c29c8575842d629a96a0b2fd Mon Sep 17 00:00:00 2001 From: Dragos Bogdan Date: Sat, 4 Jan 2014 17:27:51 -0500 Subject: [PATCH 16/20] Uncrustify. --- Communication.c | 533 ++++++++++++++++------------------ Communication.h | 16 +- RDKRL78G14.c | 49 ++-- RDKRL78G14.h | 76 ++--- ST7579.c | 754 +++++++++++++++++++++++------------------------- ST7579.h | 10 +- TIME.c | 137 +++++---- TIME.h | 8 +- 8 files changed, 757 insertions(+), 826 deletions(-) diff --git a/Communication.c b/Communication.c index 104e3e556..48140964a 100644 --- a/Communication.c +++ b/Communication.c @@ -2,7 +2,7 @@ * @file Communication.c * @brief Implementation of the Communication Driver for RL78G14 processor. * @author DBogdan (dragos.bogdan@analog.com) -******************************************************************************** + ******************************************************************************** * Copyright 2012(c) Analog Devices, Inc. * * All rights reserved. @@ -36,15 +36,15 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * -******************************************************************************** + ******************************************************************************** * SVN Revision: $WCREV$ -*******************************************************************************/ + *******************************************************************************/ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "Communication.h" // Communication definitions -#include "RDKRL78G14.h" // RDKRL78G14 definitions +#include "Communication.h" /* Communication definitions */ +#include "RDKRL78G14.h" /* RDKRL78G14 definitions */ char IICA0_Flag; @@ -56,13 +56,13 @@ char IICA0_Flag; * @brief I2C interrupt service routine. * * @return None. -*******************************************************************************/ + *******************************************************************************/ #pragma vector = INTIICA0_vect -__interrupt static void IICA0_Interrupt(void) +__interrupt static void +IICA0_Interrupt(void) { - IICA0_Flag = 1; + IICA0_Flag = 1; } - /***************************************************************************//** * @brief Initializes the SPI communication peripheral. * @@ -85,78 +85,77 @@ __interrupt static void IICA0_Interrupt(void) * @return status - Result of the initialization procedure. * Example: 0 - if initialization was successful; * -1 - if initialization was unsuccessful. -*******************************************************************************/ -char SPI_Init(char lsbFirst, - long clockFreq, - char clockPol, - char clockEdg) + *******************************************************************************/ +char +SPI_Init(char lsbFirst, + long clockFreq, + char clockPol, + char clockEdg) { - long mckFreq = 32000000; - char sdrValue = 0; - char delay = 0; + long mckFreq = 32000000; + char sdrValue = 0; + char delay = 0; - /* Configure the CS pins. */ - PMOD1_CS_OUT; - PMOD1_CS_HIGH; - PMOD2_CS_OUT; - PMOD2_CS_HIGH; - ST7579_CS_OUT; - ST7579_CS_HIGH; + /* Configure the CS pins. */ + PMOD1_CS_OUT; + PMOD1_CS_HIGH; + PMOD2_CS_OUT; + PMOD2_CS_HIGH; + ST7579_CS_OUT; + ST7579_CS_HIGH; - /* Enable input clock supply. */ - SAU1EN = 1; + /* Enable input clock supply. */ + SAU1EN = 1; - /* After setting the SAUmEN bit to 1, be sure to set serial clock select - register m (SPSm) after 4 or more fCLK clocks have elapsed. */ - NOP; - NOP; - NOP; + /* After setting the SAUmEN bit to 1, be sure to set serial clock select + register m (SPSm) after 4 or more fCLK clocks have elapsed. */ + NOP; + NOP; + NOP; + NOP; + + /* Select the fCLK as input clock. */ + SPS1 = 0x0000; + + /* Select the CSI operation mode. */ + SMR11 = 0x0020; + + clockPol = 1 - clockPol; + SCR11 = (clockEdg << 13) | + (clockPol << 12) | + 0xC000 | /* Operation mode: Transmission/reception. */ + 0x0007; /* 8-bit data length. */ + + /* clockFreq = mckFreq / (sdrValue * 2 + 2) */ + sdrValue = mckFreq / (2 * clockFreq) - 1; + SDR11 = sdrValue << 9; + + /* Set the clock and data initial level. */ + clockPol = 1 - clockPol; + SO1 &= ~0x0202; + SO1 |= (clockPol << 9) | + (clockPol << 1); + + /* Enable output for serial communication operation. */ + SOE1 |= 0x0002; + + /* Configure the MISO pin as input. */ + PM7 |= 0x02; + + /* Configure SCLK and MOSI pins as output. */ + P7 |= 0x05; + PM7 &= ~0x05; + + /* Wait for the changes to take place. */ + for(delay = 0; delay < 50; delay++) { NOP; + } - /* Select the fCLK as input clock. */ - SPS1 = 0x0000; + /* Set the SEmn bit to 1 and enter the communication wait status */ + SS1 |= 0x0002; - /* Select the CSI operation mode. */ - SMR11 = 0x0020; - - clockPol = 1 - clockPol; - SCR11 = (clockEdg << 13) | - (clockPol << 12) | - 0xC000 | // Operation mode: Transmission/reception. - 0x0007; // 8-bit data length. - - /* clockFreq = mckFreq / (sdrValue * 2 + 2) */ - sdrValue = mckFreq / (2 * clockFreq) - 1; - SDR11 = sdrValue << 9; - - /* Set the clock and data initial level. */ - clockPol = 1 - clockPol; - SO1 &= ~0x0202; - SO1 |= (clockPol << 9) | - (clockPol << 1); - - /* Enable output for serial communication operation. */ - SOE1 |= 0x0002; - - /* Configure the MISO pin as input. */ - PM7 |= 0x02; - - /* Configure SCLK and MOSI pins as output. */ - P7 |= 0x05; - PM7 &= ~0x05; - - /* Wait for the changes to take place. */ - for(delay = 0; delay < 50; delay++) - { - NOP; - } - - /* Set the SEmn bit to 1 and enter the communication wait status */ - SS1 |= 0x0002; - - return 0; + return 0; } - /***************************************************************************//** * @brief Writes data to SPI. * @@ -165,124 +164,110 @@ char SPI_Init(char lsbFirst, * @param bytesNumber - Number of bytes to write. * * @return Number of written bytes. -*******************************************************************************/ -char SPI_Write(char slaveDeviceId, - unsigned char* data, - char bytesNumber) + *******************************************************************************/ +char +SPI_Write(char slaveDeviceId, + unsigned char *data, + char bytesNumber) { - char byte = 0; - unsigned char read = 0; - unsigned short originalSCR = 0; - unsigned short originalSO1 = 0; + char byte = 0; + unsigned char read = 0; + unsigned short originalSCR = 0; + unsigned short originalSO1 = 0; - if(slaveDeviceId == 1) - { - PMOD1_CS_LOW; - } - if(slaveDeviceId == 2) - { - PMOD2_CS_LOW; - } - if(slaveDeviceId == 3) - { - ST1 |= 0x0002; - originalSO1 = SO1; - originalSCR = SCR11; - SO1 &= ~0x0202; - SCR11 &= ~0x3000; - SS1 |= 0x0002; - ST7579_CS_LOW; - } - for(byte = 0; byte < bytesNumber; byte++) - { - SIO21 = data[byte]; - NOP; - while(SSR11 & 0x0040); - read = SIO21; - } - if(slaveDeviceId == 1) - { - PMOD1_CS_HIGH; - } - if(slaveDeviceId == 2) - { - PMOD2_CS_HIGH; - } - if(slaveDeviceId == 3) - { - ST7579_CS_HIGH; - ST1 |= 0x0002; - SO1 = originalSO1; - SCR11 = originalSCR; - SS1 |= 0x0002; - } + if(slaveDeviceId == 1) { + PMOD1_CS_LOW; + } + if(slaveDeviceId == 2) { + PMOD2_CS_LOW; + } + if(slaveDeviceId == 3) { + ST1 |= 0x0002; + originalSO1 = SO1; + originalSCR = SCR11; + SO1 &= ~0x0202; + SCR11 &= ~0x3000; + SS1 |= 0x0002; + ST7579_CS_LOW; + } + for(byte = 0; byte < bytesNumber; byte++) { + SIO21 = data[byte]; + NOP; + while(SSR11 & 0x0040) ; + read = SIO21; + } + if(slaveDeviceId == 1) { + PMOD1_CS_HIGH; + } + if(slaveDeviceId == 2) { + PMOD2_CS_HIGH; + } + if(slaveDeviceId == 3) { + ST7579_CS_HIGH; + ST1 |= 0x0002; + SO1 = originalSO1; + SCR11 = originalSCR; + SS1 |= 0x0002; + } - return bytesNumber; + return bytesNumber; } - /***************************************************************************//** * @brief Reads data from SPI. * * @param slaveDeviceId - The ID of the selected slave device. - * @param data - Data represents the write buffer as an input parameter + * @param data - Data represents the write buffer as an input parameter * and the read buffer as an output parameter. * @param bytesNumber - Number of bytes to read. * * @return Number of read bytes. -*******************************************************************************/ -char SPI_Read(char slaveDeviceId, - unsigned char* data, - char bytesNumber) + *******************************************************************************/ +char +SPI_Read(char slaveDeviceId, + unsigned char *data, + char bytesNumber) { - char byte = 0; - unsigned short originalSCR = 0; - unsigned short originalSO1 = 0; + char byte = 0; + unsigned short originalSCR = 0; + unsigned short originalSO1 = 0; - if(slaveDeviceId == 1) - { - PMOD1_CS_LOW; - } - if(slaveDeviceId == 2) - { - PMOD2_CS_LOW; - } - if(slaveDeviceId == 3) - { - ST1 |= 0x0002; - originalSO1 = SO1; - originalSCR = SCR11; - SO1 &= ~0x0202; - SCR11 &= ~0x3000; - SS1 |= 0x0002; - ST7579_CS_LOW; - } - for(byte = 0; byte < bytesNumber; byte++) - { - SIO21 = data[byte]; - NOP; - while(SSR11 & 0x0040); - data[byte] = SIO21; - } - if(slaveDeviceId == 1) - { - PMOD1_CS_HIGH; - } - if(slaveDeviceId == 2) - { - PMOD2_CS_HIGH; - } - if(slaveDeviceId == 3) - { - ST7579_CS_HIGH; - ST1 |= 0x0002; - SO1 = originalSO1; - SCR11 = originalSCR; - SS1 |= 0x0002; - } + if(slaveDeviceId == 1) { + PMOD1_CS_LOW; + } + if(slaveDeviceId == 2) { + PMOD2_CS_LOW; + } + if(slaveDeviceId == 3) { + ST1 |= 0x0002; + originalSO1 = SO1; + originalSCR = SCR11; + SO1 &= ~0x0202; + SCR11 &= ~0x3000; + SS1 |= 0x0002; + ST7579_CS_LOW; + } + for(byte = 0; byte < bytesNumber; byte++) { + SIO21 = data[byte]; + NOP; + while(SSR11 & 0x0040) ; + data[byte] = SIO21; + } + if(slaveDeviceId == 1) { + PMOD1_CS_HIGH; + } + if(slaveDeviceId == 2) { + PMOD2_CS_HIGH; + } + if(slaveDeviceId == 3) { + ST7579_CS_HIGH; + ST1 |= 0x0002; + SO1 = originalSO1; + SCR11 = originalSCR; + SS1 |= 0x0002; + } - return bytesNumber; + return bytesNumber; } - /***************************************************************************//** * @brief Initializes the I2C communication peripheral. * @@ -291,43 +276,43 @@ char SPI_Read(char slaveDeviceId, * @return status - Result of the initialization procedure. * Example: 0 - if initialization was successful; * -1 - if initialization was unsuccessful. -*******************************************************************************/ -char I2C_Init(long clockFreq) + *******************************************************************************/ +char +I2C_Init(long clockFreq) { - long fckFreq = 32000000; - unsigned char wlValue = 0; - unsigned char whValue = 0; + long fckFreq = 32000000; + unsigned char wlValue = 0; + unsigned char whValue = 0; - /* Enable interrupts */ - EI; + /* Enable interrupts */ + EI; - /* Enable input clock supply. */ - IICA0EN = 1; + /* Enable input clock supply. */ + IICA0EN = 1; - /* Set the fast mode plus operation. */ - SMC0 = 1; + /* Set the fast mode plus operation. */ + SMC0 = 1; - /* Set transfer rate. */ - wlValue = (unsigned char)((0.5 * fckFreq) / clockFreq); - whValue = (unsigned char)(wlValue - (fckFreq / (10 * clockFreq))); - IICWL0 = wlValue; - IICWH0 = whValue; + /* Set transfer rate. */ + wlValue = (unsigned char)((0.5 * fckFreq) / clockFreq); + whValue = (unsigned char)(wlValue - (fckFreq / (10 * clockFreq))); + IICWL0 = wlValue; + IICWH0 = whValue; - STCEN0 = 1; // After operation is enabled, enable generation of a start - // condition without detecting a stop condition. - WTIM0 = 1; // Interrupt request is generated at the ninth clock’s - // falling edge. + STCEN0 = 1; /* After operation is enabled, enable generation of a start */ + /* condition without detecting a stop condition. */ + WTIM0 = 1; /* Interrupt request is generated at the ninth clock’s */ + /* falling edge. */ - /* Enable I2C operation. */ - IICE0 = 1; + /* Enable I2C operation. */ + IICE0 = 1; - /* Configure SCLA0 and SDAA0 pins as digital output. */ - P6 &= ~0x03; - PM6 &= ~0x03; + /* Configure SCLA0 and SDAA0 pins as digital output. */ + P6 &= ~0x03; + PM6 &= ~0x03; - return 0; + return 0; } - /***************************************************************************//** * @brief Writes data to a slave device. * @@ -338,50 +323,45 @@ char I2C_Init(long clockFreq) * Example: 0 - A stop condition will not be sent; * 1 - A stop condition will be sent. * - * @return status - Number of read bytes or 0xFF if the slave address was + * @return status - Number of read bytes or 0xFF if the slave address was * not acknowledged by the device. -*******************************************************************************/ -char I2C_Write(char slaveAddress, - unsigned char* dataBuffer, - char bytesNumber, - char stopBit) + *******************************************************************************/ +char +I2C_Write(char slaveAddress, + unsigned char *dataBuffer, + char bytesNumber, + char stopBit) { - char byte = 0; - char status = 0; + char byte = 0; + char status = 0; - IICAMK0 = 1; // Interrupt servicing disabled. - STT0 = 1; // Generate a start condition. - IICAMK0 = 0; // Interrupt servicing enabled. + IICAMK0 = 1; /* Interrupt servicing disabled. */ + STT0 = 1; /* Generate a start condition. */ + IICAMK0 = 0; /* Interrupt servicing enabled. */ - /* Send the first byte. */ - IICA0_Flag = 0; - IICA0 = (slaveAddress << 1); - while(IICA0_Flag == 0); + /* Send the first byte. */ + IICA0_Flag = 0; + IICA0 = (slaveAddress << 1); + while(IICA0_Flag == 0) ; - if(ACKD0) // Acknowledge was detected. - { - for(byte = 0; byte < bytesNumber; byte++) - { - IICA0_Flag = 0; - IICA0 = *dataBuffer; - while(IICA0_Flag == 0); - dataBuffer++; - } - status = bytesNumber; - } - else // Acknowledge was not detected. - { - status = 0xFF; - } - if(stopBit) - { - SPT0 = 1; // Generate a stop condition. - while(IICBSY0); // Wait until the I2C bus status flag is cleared. + if(ACKD0) { /* Acknowledge was detected. */ + for(byte = 0; byte < bytesNumber; byte++) { + IICA0_Flag = 0; + IICA0 = *dataBuffer; + while(IICA0_Flag == 0) ; + dataBuffer++; } + status = bytesNumber; + } else { /* Acknowledge was not detected. */ + status = 0xFF; + } + if(stopBit) { + SPT0 = 1; /* Generate a stop condition. */ + while(IICBSY0) ; /* Wait until the I2C bus status flag is cleared. */ + } - return status; + return status; } - /***************************************************************************//** * @brief Reads data from a slave device. * @@ -392,52 +372,47 @@ char I2C_Write(char slaveAddress, * Example: 0 - A stop condition will not be sent; * 1 - A stop condition will be sent. * - * @return status - Number of read bytes or 0xFF if the slave address was + * @return status - Number of read bytes or 0xFF if the slave address was * not acknowledged by the device. -*******************************************************************************/ -char I2C_Read(char slaveAddress, - unsigned char* dataBuffer, - char bytesNumber, - char stopBit) + *******************************************************************************/ +char +I2C_Read(char slaveAddress, + unsigned char *dataBuffer, + char bytesNumber, + char stopBit) { - char byte = 0; - char status = 0; + char byte = 0; + char status = 0; - IICAMK0 = 1; // Interrupt servicing disabled. - STT0 = 1; // Generate a start condition. - IICAMK0 = 0; // Interrupt servicing enabled. + IICAMK0 = 1; /* Interrupt servicing disabled. */ + STT0 = 1; /* Generate a start condition. */ + IICAMK0 = 0; /* Interrupt servicing enabled. */ - /* Send the first byte. */ - IICA0_Flag = 0; - IICA0 = (slaveAddress << 1) + 1; - while(IICA0_Flag == 0); + /* Send the first byte. */ + IICA0_Flag = 0; + IICA0 = (slaveAddress << 1) + 1; + while(IICA0_Flag == 0) ; - if(ACKD0) // Acknowledge was detected. - { - ACKE0 = 1; // Enable acknowledgment. - for(byte = 0; byte < bytesNumber; byte++) - { - if(byte == (bytesNumber - 1)) - { - ACKE0 = 0U; // Disable acknowledgment. - } - WREL0 = 1U; // Cancel wait. - IICA0_Flag = 0; - while(IICA0_Flag == 0); - *dataBuffer = IICA0; - dataBuffer++; - } - status = bytesNumber; - } - else // Acknowledge was not detected. - { - status = 0xFF; - } - if(stopBit) - { - SPT0 = 1; // Generate a stop condition. - while(IICBSY0); // Wait until the I2C bus status flag is cleared. + if(ACKD0) { /* Acknowledge was detected. */ + ACKE0 = 1; /* Enable acknowledgment. */ + for(byte = 0; byte < bytesNumber; byte++) { + if(byte == (bytesNumber - 1)) { + ACKE0 = 0U; /* Disable acknowledgment. */ + } + WREL0 = 1U; /* Cancel wait. */ + IICA0_Flag = 0; + while(IICA0_Flag == 0) ; + *dataBuffer = IICA0; + dataBuffer++; } + status = bytesNumber; + } else { /* Acknowledge was not detected. */ + status = 0xFF; + } + if(stopBit) { + SPT0 = 1; /* Generate a stop condition. */ + while(IICBSY0) ; /* Wait until the I2C bus status flag is cleared. */ + } - return status; + return status; } diff --git a/Communication.h b/Communication.h index 0d563bfad..c14bcbdeb 100644 --- a/Communication.h +++ b/Communication.h @@ -2,7 +2,7 @@ * @file Communication.h * @brief Header file of the Communication Driver for RL78G14 processor. * @author DBogdan (dragos.bogdan@analog.com) -******************************************************************************** + ******************************************************************************** * Copyright 2012(c) Analog Devices, Inc. * * All rights reserved. @@ -36,9 +36,9 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * -******************************************************************************** + ******************************************************************************** * SVN Revision: $WCREV$ -*******************************************************************************/ + *******************************************************************************/ #ifndef __COMMUNICATION_H__ #define __COMMUNICATION_H__ @@ -83,12 +83,12 @@ char SPI_Init(char lsbFirst, /*! Writes data to SPI. */ char SPI_Write(char slaveDeviceId, - unsigned char* data, + unsigned char *data, char bytesNumber); /*! Reads data from SPI. */ char SPI_Read(char slaveDeviceId, - unsigned char* data, + unsigned char *data, char bytesNumber); /*! Initializes the I2C communication peripheral. */ @@ -96,14 +96,14 @@ char I2C_Init(long clockFreq); /*! Writes data to a slave device. */ char I2C_Write(char slaveAddress, - unsigned char* dataBuffer, + unsigned char *dataBuffer, char bytesNumber, char stopBit); /*! Reads data from a slave device. */ char I2C_Read(char slaveAddress, - unsigned char* dataBuffer, + unsigned char *dataBuffer, char bytesNumber, char stopBit); -#endif // __COMMUNICATION_H__ +#endif /* __COMMUNICATION_H__ */ diff --git a/RDKRL78G14.c b/RDKRL78G14.c index 5f77dfb69..3be586c51 100644 --- a/RDKRL78G14.c +++ b/RDKRL78G14.c @@ -2,7 +2,7 @@ * @file RDKRL78G14.c * @brief Implementation of the RDKRL78G14 Driver. * @author DBogdan (dragos.bogdan@analog.com) -******************************************************************************** + ******************************************************************************** * Copyright 2012(c) Analog Devices, Inc. * * All rights reserved. @@ -36,14 +36,14 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * -******************************************************************************** + ******************************************************************************** * SVN Revision: $WCREV$ -*******************************************************************************/ + *******************************************************************************/ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "RDKRL78G14.h" // RDKRL78G14 definitions +#include "RDKRL78G14.h" /* RDKRL78G14 definitions */ /******************************************************************************/ /************************ Functions Definitions *******************************/ @@ -53,37 +53,36 @@ * @brief Resets the RDKRL78G14. * * @return None. -*******************************************************************************/ -void RDKRL78G14_Reset(void) + *******************************************************************************/ +void +RDKRL78G14_Reset(void) { - short delay = 0; + short delay = 0; - EXTRST_HIGH; - for(delay = 0; delay < 1000; delay++) - { - NOP; - } - EXTRST_LOW; + EXTRST_HIGH; + for(delay = 0; delay < 1000; delay++) { + NOP; + } + EXTRST_LOW; } - /***************************************************************************//** * @brief Initializes the RDKRL78G14. * * @return status - Result of the initialization procedure. * Example: 0 - if initialization was successful; * -1 - if initialization was unsuccessful. -*******************************************************************************/ -char RDKRL78G14_Init(void) + *******************************************************************************/ +char +RDKRL78G14_Init(void) { - long delay = 0; - char status = -1; + long delay = 0; + char status = -1; - for(delay = 0; delay < 4000000; delay++) - { - NOP; - } - RDKRL78G14_Reset(); - status = 0; + for(delay = 0; delay < 4000000; delay++) { + NOP; + } + RDKRL78G14_Reset(); + status = 0; - return status; + return status; } diff --git a/RDKRL78G14.h b/RDKRL78G14.h index c7eb230e2..75242bab1 100644 --- a/RDKRL78G14.h +++ b/RDKRL78G14.h @@ -2,7 +2,7 @@ * @file RDKRL78G14.h * @brief Header file of the RDKRL78G14 Driver. * @author DBogdan (dragos.bogdan@analog.com) -******************************************************************************** + ******************************************************************************** * Copyright 2012(c) Analog Devices, Inc. * * All rights reserved. @@ -36,9 +36,9 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * -******************************************************************************** + ******************************************************************************** * SVN Revision: $WCREV$ -*******************************************************************************/ + *******************************************************************************/ #ifndef __RDKRL78G14_H__ #define __RDKRL78G14_H__ @@ -47,78 +47,78 @@ /***************************** Include Files **********************************/ /******************************************************************************/ -#include // R5F104PJ definitions -#include // Declarations of extended SFR registers -#include // Declarations of intrinsic functions +#include /* R5F104PJ definitions */ +#include /* Declarations of extended SFR registers */ +#include /* Declarations of intrinsic functions */ /******************************************************************************/ /************************* Operations Definitions *****************************/ /******************************************************************************/ -#define NOP __no_operation(); // No operation -#define EI __enable_interrupt(); // Enable interrupts -#define DI __disable_interrupt(); // Disable interrupts +#define NOP __no_operation(); /* No operation */ +#define EI __enable_interrupt(); /* Enable interrupts */ +#define DI __disable_interrupt(); /* Disable interrupts */ /******************************************************************************/ /**************************** GPIO Definitions ********************************/ /******************************************************************************/ /* External Reset Pin - P130 */ -#define EXTRST_PIN (1 << 0) -#define EXTRST_LOW P13 &= ~EXTRST_PIN -#define EXTRST_HIGH P13 |= EXTRST_PIN +#define EXTRST_PIN (1 << 0) +#define EXTRST_LOW P13 &= ~EXTRST_PIN +#define EXTRST_HIGH P13 |= EXTRST_PIN /* ST7579 CS Pin - P145 */ -#define ST7579_CS_PIN (1 << 5) -#define ST7579_CS_OUT PM14 &= ~ST7579_CS_PIN -#define ST7579_CS_LOW P14 &= ~ST7579_CS_PIN -#define ST7579_CS_HIGH P14 |= ST7579_CS_PIN +#define ST7579_CS_PIN (1 << 5) +#define ST7579_CS_OUT PM14 &= ~ST7579_CS_PIN +#define ST7579_CS_LOW P14 &= ~ST7579_CS_PIN +#define ST7579_CS_HIGH P14 |= ST7579_CS_PIN /* ST7579 RS Pin - P146 */ -#define ST7579_RS_PIN (1 << 6) -#define ST7579_RS_OUT PM14 &= ~ST7579_RS_PIN -#define ST7579_RS_LOW P14 &= ~ST7579_RS_PIN -#define ST7579_RS_HIGH P14 |= ST7579_RS_PIN +#define ST7579_RS_PIN (1 << 6) +#define ST7579_RS_OUT PM14 &= ~ST7579_RS_PIN +#define ST7579_RS_LOW P14 &= ~ST7579_RS_PIN +#define ST7579_RS_HIGH P14 |= ST7579_RS_PIN /* PMOD1 CS Pin - P83 */ -#define PMOD1_CS_PIN (1 << 3) -#define PMOD1_CS_OUT PM8 &= ~PMOD1_CS_PIN -#define PMOD1_CS_LOW P8 &= ~PMOD1_CS_PIN -#define PMOD1_CS_HIGH P8 |= PMOD1_CS_PIN +#define PMOD1_CS_PIN (1 << 3) +#define PMOD1_CS_OUT PM8 &= ~PMOD1_CS_PIN +#define PMOD1_CS_LOW P8 &= ~PMOD1_CS_PIN +#define PMOD1_CS_HIGH P8 |= PMOD1_CS_PIN /* PMOD1 MISO Pin */ -#define PMOD1_MISO_PIN (1 << 1) +#define PMOD1_MISO_PIN (1 << 1) #define PMOD1_MISO ((P7 & PMOD1_MISO_PIN) >> 1) /* PMOD1 GPIO1 Pin - P47 */ #define PMOD1_GPIO1_PIN (1 << 7) #define PMOD1_GPIO1_PIN_OUT PM4 &= ~PMOD1_GPIO1_PIN; -#define PMOD1_GPIO1_LOW P4 &= ~PMOD1_GPIO1_PIN; -#define PMOD1_GPIO1_HIGH P4 |= PMOD1_GPIO1_PIN; +#define PMOD1_GPIO1_LOW P4 &= ~PMOD1_GPIO1_PIN; +#define PMOD1_GPIO1_HIGH P4 |= PMOD1_GPIO1_PIN; /* PMOD1 GPIO2 Pin - P46 */ #define PMOD1_GPIO2_PIN (1 << 6) #define PMOD1_GPIO2_PIN_OUT PM4 &= ~PMOD1_GPIO2_PIN; -#define PMOD1_GPIO2_LOW P4 &= ~PMOD1_GPIO2_PIN; -#define PMOD1_GPIO2_HIGH P4 |= PMOD1_GPIO2_PIN; +#define PMOD1_GPIO2_LOW P4 &= ~PMOD1_GPIO2_PIN; +#define PMOD1_GPIO2_HIGH P4 |= PMOD1_GPIO2_PIN; /* PMOD1 GPIO3 Pin - P110 */ #define PMOD1_GPIO3_PIN (1 << 0) #define PMOD1_GPIO3_PIN_OUT PM11 &= ~PMOD1_GPIO3_PIN; -#define PMOD1_GPIO3_LOW P11 &= ~PMOD1_GPIO3_PIN; -#define PMOD1_GPIO3_HIGH P11 |= PMOD1_GPIO3_PIN; +#define PMOD1_GPIO3_LOW P11 &= ~PMOD1_GPIO3_PIN; +#define PMOD1_GPIO3_HIGH P11 |= PMOD1_GPIO3_PIN; /* PMOD1 GPIO4 Pin - P111 */ #define PMOD1_GPIO4_PIN (1 << 1) #define PMOD1_GPIO4_PIN_OUT PM11 &= ~PMOD1_GPIO4_PIN; -#define PMOD1_GPIO4_LOW P11 &= ~PMOD1_GPIO4_PIN; -#define PMOD1_GPIO4_HIGH P11 |= PMOD1_GPIO4_PIN; +#define PMOD1_GPIO4_LOW P11 &= ~PMOD1_GPIO4_PIN; +#define PMOD1_GPIO4_HIGH P11 |= PMOD1_GPIO4_PIN; /* PMOD2 CS Pin - P82 */ -#define PMOD2_CS_PIN (1 << 2) -#define PMOD2_CS_OUT PM8 &= ~PMOD2_CS_PIN -#define PMOD2_CS_LOW P8 &= ~PMOD2_CS_PIN -#define PMOD2_CS_HIGH P8 |= PMOD2_CS_PIN +#define PMOD2_CS_PIN (1 << 2) +#define PMOD2_CS_OUT PM8 &= ~PMOD2_CS_PIN +#define PMOD2_CS_LOW P8 &= ~PMOD2_CS_PIN +#define PMOD2_CS_HIGH P8 |= PMOD2_CS_PIN /******************************************************************************/ /************************ Functions Declarations ******************************/ @@ -130,4 +130,4 @@ void RDKRL78G14_Reset(void); /*! Initializes the RDKRL78G14. */ char RDKRL78G14_Init(void); -#endif // __RDKRL78G14_H__ +#endif /* __RDKRL78G14_H__ */ diff --git a/ST7579.c b/ST7579.c index eddc94660..4e8b85a4f 100644 --- a/ST7579.c +++ b/ST7579.c @@ -2,7 +2,7 @@ * @file ST7579.c * @brief Implementation of ST7579 Driver. * @author DBogdan (dragos.bogdan@analog.com) -******************************************************************************** + ******************************************************************************** * Copyright 2012(c) Analog Devices, Inc. * * All rights reserved. @@ -36,16 +36,16 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * -******************************************************************************** + ******************************************************************************** * SVN Revision: $WCREV$ -*******************************************************************************/ + *******************************************************************************/ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "ST7579.h" // ST7579 definitions -#include "RDKRL78G14.h" // YRDKRL78G14 definitions -#include "Communication.h" // Communication definitions +#include "ST7579.h" /* ST7579 definitions */ +#include "RDKRL78G14.h" /* YRDKRL78G14 definitions */ +#include "Communication.h" /* Communication definitions */ /******************************************************************************/ /************************* Variables Definitions ******************************/ @@ -53,101 +53,101 @@ const unsigned char st7579Font[95][5] = { - {0x00, 0x00, 0x00, 0x00, 0x00}, // sp - {0x00, 0x00, 0x2f, 0x00, 0x00}, // ! - {0x00, 0x07, 0x00, 0x07, 0x00}, // " - {0x14, 0x7f, 0x14, 0x7f, 0x14}, // # - {0x24, 0x2a, 0x7f, 0x2a, 0x12}, // $ - {0xc4, 0xc8, 0x10, 0x26, 0x46}, // % - {0x36, 0x49, 0x55, 0x22, 0x50}, // & - {0x00, 0x05, 0x03, 0x00, 0x00}, // ' - {0x00, 0x1c, 0x22, 0x41, 0x00}, // ( - {0x00, 0x41, 0x22, 0x1c, 0x00}, // ) - {0x14, 0x08, 0x3E, 0x08, 0x14}, // * - {0x08, 0x08, 0x3E, 0x08, 0x08}, // + - {0x00, 0x00, 0x50, 0x30, 0x00}, // , - {0x10, 0x10, 0x10, 0x10, 0x10}, // - - {0x00, 0x60, 0x60, 0x00, 0x00}, // . - {0x20, 0x10, 0x08, 0x04, 0x02}, // / - {0x3E, 0x51, 0x49, 0x45, 0x3E}, // 0 - {0x00, 0x42, 0x7F, 0x40, 0x00}, // 1 - {0x42, 0x61, 0x51, 0x49, 0x46}, // 2 - {0x21, 0x41, 0x45, 0x4B, 0x31}, // 3 - {0x18, 0x14, 0x12, 0x7F, 0x10}, // 4 - {0x27, 0x45, 0x45, 0x45, 0x39}, // 5 - {0x3C, 0x4A, 0x49, 0x49, 0x30}, // 6 - {0x01, 0x71, 0x09, 0x05, 0x03}, // 7 - {0x36, 0x49, 0x49, 0x49, 0x36}, // 8 - {0x06, 0x49, 0x49, 0x29, 0x1E}, // 9 - {0x00, 0x36, 0x36, 0x00, 0x00}, // : - {0x00, 0x56, 0x36, 0x00, 0x00}, // ; - {0x08, 0x14, 0x22, 0x41, 0x00}, // < - {0x14, 0x14, 0x14, 0x14, 0x14}, // = - {0x00, 0x41, 0x22, 0x14, 0x08}, // > - {0x02, 0x01, 0x51, 0x09, 0x06}, // ? - {0x32, 0x49, 0x59, 0x51, 0x3E}, // @ - {0x7E, 0x11, 0x11, 0x11, 0x7E}, // A - {0x7F, 0x49, 0x49, 0x49, 0x36}, // B - {0x3E, 0x41, 0x41, 0x41, 0x22}, // C - {0x7F, 0x41, 0x41, 0x22, 0x1C}, // D - {0x7F, 0x49, 0x49, 0x49, 0x41}, // E - {0x7F, 0x09, 0x09, 0x09, 0x01}, // F - {0x3E, 0x41, 0x49, 0x49, 0x7A}, // G - {0x7F, 0x08, 0x08, 0x08, 0x7F}, // H - {0x00, 0x41, 0x7F, 0x41, 0x00}, // I - {0x20, 0x40, 0x41, 0x3F, 0x01}, // J - {0x7F, 0x08, 0x14, 0x22, 0x41}, // K - {0x7F, 0x40, 0x40, 0x40, 0x40}, // L - {0x7F, 0x02, 0x0C, 0x02, 0x7F}, // M - {0x7F, 0x04, 0x08, 0x10, 0x7F}, // N - {0x3E, 0x41, 0x41, 0x41, 0x3E}, // O - {0x7F, 0x09, 0x09, 0x09, 0x06}, // P - {0x3E, 0x41, 0x51, 0x21, 0x5E}, // Q - {0x7F, 0x09, 0x19, 0x29, 0x46}, // R - {0x46, 0x49, 0x49, 0x49, 0x31}, // S - {0x01, 0x01, 0x7F, 0x01, 0x01}, // T - {0x3F, 0x40, 0x40, 0x40, 0x3F}, // U - {0x1F, 0x20, 0x40, 0x20, 0x1F}, // V - {0x3F, 0x40, 0x38, 0x40, 0x3F}, // W - {0x63, 0x14, 0x08, 0x14, 0x63}, // X - {0x07, 0x08, 0x70, 0x08, 0x07}, // Y - {0x61, 0x51, 0x49, 0x45, 0x43}, // Z - {0x00, 0x7F, 0x41, 0x41, 0x00}, // [ - {0x55, 0x2A, 0x55, 0x2A, 0x55}, // / - {0x00, 0x41, 0x41, 0x7F, 0x00}, // ] - {0x04, 0x02, 0x01, 0x02, 0x04}, // ^ - {0x40, 0x40, 0x40, 0x40, 0x40}, // _ - {0x00, 0x01, 0x02, 0x04, 0x00}, // ' - {0x20, 0x54, 0x54, 0x54, 0x78}, // a - {0x7F, 0x48, 0x44, 0x44, 0x38}, // b - {0x38, 0x44, 0x44, 0x44, 0x20}, // c - {0x38, 0x44, 0x44, 0x48, 0x7F}, // d - {0x38, 0x54, 0x54, 0x54, 0x18}, // e - {0x08, 0x7E, 0x09, 0x01, 0x02}, // f - {0x0C, 0x52, 0x52, 0x52, 0x3E}, // g - {0x7F, 0x08, 0x04, 0x04, 0x78}, // h - {0x00, 0x44, 0x7D, 0x40, 0x00}, // i - {0x20, 0x40, 0x44, 0x3D, 0x00}, // j - {0x7F, 0x10, 0x28, 0x44, 0x00}, // k - {0x00, 0x41, 0x7F, 0x40, 0x00}, // l - {0x7C, 0x04, 0x18, 0x04, 0x78}, // m - {0x7C, 0x08, 0x04, 0x04, 0x78}, // n - {0x38, 0x44, 0x44, 0x44, 0x38}, // o - {0x7C, 0x14, 0x14, 0x14, 0x08}, // p - {0x08, 0x14, 0x14, 0x18, 0x7C}, // q - {0x7C, 0x08, 0x04, 0x04, 0x08}, // r - {0x48, 0x54, 0x54, 0x54, 0x20}, // s - {0x04, 0x3F, 0x44, 0x40, 0x20}, // t - {0x3C, 0x40, 0x40, 0x20, 0x7C}, // u - {0x1C, 0x20, 0x40, 0x20, 0x1C}, // v - {0x3C, 0x40, 0x30, 0x40, 0x3C}, // w - {0x44, 0x28, 0x10, 0x28, 0x44}, // x - {0x0C, 0x50, 0x50, 0x50, 0x3C}, // y - {0x44, 0x64, 0x54, 0x4C, 0x44}, // z - {0x08, 0x3e, 0x41, 0x41, 0x00}, // { - {0x00, 0x00, 0x77, 0x00, 0x00}, // | - {0x00, 0x41, 0x41, 0x3e, 0x08}, // } - {0x02, 0x01, 0x02, 0x01, 0x00} // ~ + { 0x00, 0x00, 0x00, 0x00, 0x00 }, /* sp */ + { 0x00, 0x00, 0x2f, 0x00, 0x00 }, /* ! */ + { 0x00, 0x07, 0x00, 0x07, 0x00 }, /* " */ + { 0x14, 0x7f, 0x14, 0x7f, 0x14 }, /* # */ + { 0x24, 0x2a, 0x7f, 0x2a, 0x12 }, /* $ */ + { 0xc4, 0xc8, 0x10, 0x26, 0x46 }, /* % */ + { 0x36, 0x49, 0x55, 0x22, 0x50 }, /* & */ + { 0x00, 0x05, 0x03, 0x00, 0x00 }, /* ' */ + { 0x00, 0x1c, 0x22, 0x41, 0x00 }, /* ( */ + { 0x00, 0x41, 0x22, 0x1c, 0x00 }, /* ) */ + { 0x14, 0x08, 0x3E, 0x08, 0x14 }, /* * */ + { 0x08, 0x08, 0x3E, 0x08, 0x08 }, /* + */ + { 0x00, 0x00, 0x50, 0x30, 0x00 }, /* , */ + { 0x10, 0x10, 0x10, 0x10, 0x10 }, /* - */ + { 0x00, 0x60, 0x60, 0x00, 0x00 }, /* . */ + { 0x20, 0x10, 0x08, 0x04, 0x02 }, /* / */ + { 0x3E, 0x51, 0x49, 0x45, 0x3E }, /* 0 */ + { 0x00, 0x42, 0x7F, 0x40, 0x00 }, /* 1 */ + { 0x42, 0x61, 0x51, 0x49, 0x46 }, /* 2 */ + { 0x21, 0x41, 0x45, 0x4B, 0x31 }, /* 3 */ + { 0x18, 0x14, 0x12, 0x7F, 0x10 }, /* 4 */ + { 0x27, 0x45, 0x45, 0x45, 0x39 }, /* 5 */ + { 0x3C, 0x4A, 0x49, 0x49, 0x30 }, /* 6 */ + { 0x01, 0x71, 0x09, 0x05, 0x03 }, /* 7 */ + { 0x36, 0x49, 0x49, 0x49, 0x36 }, /* 8 */ + { 0x06, 0x49, 0x49, 0x29, 0x1E }, /* 9 */ + { 0x00, 0x36, 0x36, 0x00, 0x00 }, /* : */ + { 0x00, 0x56, 0x36, 0x00, 0x00 }, /* ; */ + { 0x08, 0x14, 0x22, 0x41, 0x00 }, /* < */ + { 0x14, 0x14, 0x14, 0x14, 0x14 }, /* = */ + { 0x00, 0x41, 0x22, 0x14, 0x08 }, /* > */ + { 0x02, 0x01, 0x51, 0x09, 0x06 }, /* ? */ + { 0x32, 0x49, 0x59, 0x51, 0x3E }, /* @ */ + { 0x7E, 0x11, 0x11, 0x11, 0x7E }, /* A */ + { 0x7F, 0x49, 0x49, 0x49, 0x36 }, /* B */ + { 0x3E, 0x41, 0x41, 0x41, 0x22 }, /* C */ + { 0x7F, 0x41, 0x41, 0x22, 0x1C }, /* D */ + { 0x7F, 0x49, 0x49, 0x49, 0x41 }, /* E */ + { 0x7F, 0x09, 0x09, 0x09, 0x01 }, /* F */ + { 0x3E, 0x41, 0x49, 0x49, 0x7A }, /* G */ + { 0x7F, 0x08, 0x08, 0x08, 0x7F }, /* H */ + { 0x00, 0x41, 0x7F, 0x41, 0x00 }, /* I */ + { 0x20, 0x40, 0x41, 0x3F, 0x01 }, /* J */ + { 0x7F, 0x08, 0x14, 0x22, 0x41 }, /* K */ + { 0x7F, 0x40, 0x40, 0x40, 0x40 }, /* L */ + { 0x7F, 0x02, 0x0C, 0x02, 0x7F }, /* M */ + { 0x7F, 0x04, 0x08, 0x10, 0x7F }, /* N */ + { 0x3E, 0x41, 0x41, 0x41, 0x3E }, /* O */ + { 0x7F, 0x09, 0x09, 0x09, 0x06 }, /* P */ + { 0x3E, 0x41, 0x51, 0x21, 0x5E }, /* Q */ + { 0x7F, 0x09, 0x19, 0x29, 0x46 }, /* R */ + { 0x46, 0x49, 0x49, 0x49, 0x31 }, /* S */ + { 0x01, 0x01, 0x7F, 0x01, 0x01 }, /* T */ + { 0x3F, 0x40, 0x40, 0x40, 0x3F }, /* U */ + { 0x1F, 0x20, 0x40, 0x20, 0x1F }, /* V */ + { 0x3F, 0x40, 0x38, 0x40, 0x3F }, /* W */ + { 0x63, 0x14, 0x08, 0x14, 0x63 }, /* X */ + { 0x07, 0x08, 0x70, 0x08, 0x07 }, /* Y */ + { 0x61, 0x51, 0x49, 0x45, 0x43 }, /* Z */ + { 0x00, 0x7F, 0x41, 0x41, 0x00 }, /* [ */ + { 0x55, 0x2A, 0x55, 0x2A, 0x55 }, /* / */ + { 0x00, 0x41, 0x41, 0x7F, 0x00 }, /* ] */ + { 0x04, 0x02, 0x01, 0x02, 0x04 }, /* ^ */ + { 0x40, 0x40, 0x40, 0x40, 0x40 }, /* _ */ + { 0x00, 0x01, 0x02, 0x04, 0x00 }, /* ' */ + { 0x20, 0x54, 0x54, 0x54, 0x78 }, /* a */ + { 0x7F, 0x48, 0x44, 0x44, 0x38 }, /* b */ + { 0x38, 0x44, 0x44, 0x44, 0x20 }, /* c */ + { 0x38, 0x44, 0x44, 0x48, 0x7F }, /* d */ + { 0x38, 0x54, 0x54, 0x54, 0x18 }, /* e */ + { 0x08, 0x7E, 0x09, 0x01, 0x02 }, /* f */ + { 0x0C, 0x52, 0x52, 0x52, 0x3E }, /* g */ + { 0x7F, 0x08, 0x04, 0x04, 0x78 }, /* h */ + { 0x00, 0x44, 0x7D, 0x40, 0x00 }, /* i */ + { 0x20, 0x40, 0x44, 0x3D, 0x00 }, /* j */ + { 0x7F, 0x10, 0x28, 0x44, 0x00 }, /* k */ + { 0x00, 0x41, 0x7F, 0x40, 0x00 }, /* l */ + { 0x7C, 0x04, 0x18, 0x04, 0x78 }, /* m */ + { 0x7C, 0x08, 0x04, 0x04, 0x78 }, /* n */ + { 0x38, 0x44, 0x44, 0x44, 0x38 }, /* o */ + { 0x7C, 0x14, 0x14, 0x14, 0x08 }, /* p */ + { 0x08, 0x14, 0x14, 0x18, 0x7C }, /* q */ + { 0x7C, 0x08, 0x04, 0x04, 0x08 }, /* r */ + { 0x48, 0x54, 0x54, 0x54, 0x20 }, /* s */ + { 0x04, 0x3F, 0x44, 0x40, 0x20 }, /* t */ + { 0x3C, 0x40, 0x40, 0x20, 0x7C }, /* u */ + { 0x1C, 0x20, 0x40, 0x20, 0x1C }, /* v */ + { 0x3C, 0x40, 0x30, 0x40, 0x3C }, /* w */ + { 0x44, 0x28, 0x10, 0x28, 0x44 }, /* x */ + { 0x0C, 0x50, 0x50, 0x50, 0x3C }, /* y */ + { 0x44, 0x64, 0x54, 0x4C, 0x44 }, /* z */ + { 0x08, 0x3e, 0x41, 0x41, 0x00 }, /* { */ + { 0x00, 0x00, 0x77, 0x00, 0x00 }, /* | */ + { 0x00, 0x41, 0x41, 0x3e, 0x08 }, /* } */ + { 0x02, 0x01, 0x02, 0x01, 0x00 } /* ~ */ }; /******************************************************************************/ @@ -160,14 +160,14 @@ const unsigned char st7579Font[95][5] = * @param data - Data to transmit. * * @return None. -*******************************************************************************/ -void ST7579_WriteByte(unsigned char data) + *******************************************************************************/ +void +ST7579_WriteByte(unsigned char data) { - SPI_Write(3, // The ID of the selected slave device. - &data, // Write buffer. - 1); // Number of bytes to write. + SPI_Write(3, /* The ID of the selected slave device. */ + &data, /* Write buffer. */ + 1); /* Number of bytes to write. */ } - /***************************************************************************//** * @brief Sets X and Y adress of RAM. * @@ -175,94 +175,90 @@ void ST7579_WriteByte(unsigned char data) * @param xPosition - X address of RAM. * * @return None. -*******************************************************************************/ -void ST7579_GoTo(unsigned char yPosition, - unsigned char xPosition) + *******************************************************************************/ +void +ST7579_GoTo(unsigned char yPosition, + unsigned char xPosition) { - ST7579_RS_LOW; - /* Set X address of RAM. */ - ST7579_WriteByte(0x28); - ST7579_WriteByte(0x80 + xPosition); - /* Set Y address of RAM. */ - ST7579_WriteByte(0x28); - ST7579_WriteByte(0x40 + yPosition); - ST7579_RS_HIGH; + ST7579_RS_LOW; + /* Set X address of RAM. */ + ST7579_WriteByte(0x28); + ST7579_WriteByte(0x80 + xPosition); + /* Set Y address of RAM. */ + ST7579_WriteByte(0x28); + ST7579_WriteByte(0x40 + yPosition); + ST7579_RS_HIGH; } - /***************************************************************************//** * @brief Clears ST7579 RAM. * * @return None. -*******************************************************************************/ -void ST7579_Clear(void) + *******************************************************************************/ +void +ST7579_Clear(void) { - unsigned short clearPosition = 0; - unsigned char yPosition = 0; + unsigned short clearPosition = 0; + unsigned char yPosition = 0; - for(clearPosition = 0; clearPosition < (8 * 96); clearPosition++) - { - if(!(clearPosition % 96)) - { - /* Set the X and Y address of RAM. */ - ST7579_GoTo(yPosition, 0); - yPosition++; - } - ST7579_WriteByte(0x00); + for(clearPosition = 0; clearPosition < (8 * 96); clearPosition++) { + if(!(clearPosition % 96)) { + /* Set the X and Y address of RAM. */ + ST7579_GoTo(yPosition, 0); + yPosition++; } + ST7579_WriteByte(0x00); + } } - /***************************************************************************//** * @brief Initializes the ST7579 controller. * * @return status - Result of the initialization procedure. * Example: 0 - if initialization was successful; * -1 - if initialization was unsuccessful. -*******************************************************************************/ -char ST7579_Init(void) + *******************************************************************************/ +char +ST7579_Init(void) { - char status = -1; - unsigned short delay = 0; - - status = SPI_Init(0, // Transfer format. - 1000000, // SPI clock frequency. - 0, // SPI clock polarity. - 1); // SPI clock edge. - if(status != 0) - { - return status; - } - ST7579_RS_OUT; - ST7579_RS_LOW; - /* Select LCD bias ratio of the voltage required for driving the LCD. */ - ST7579_WriteByte(0x21); - ST7579_WriteByte(0x16); - /* Select Booster efficiency and Booster stage. */ - ST7579_WriteByte(0x23); - ST7579_WriteByte(0x99); - /* Set V0 Range. */ - ST7579_WriteByte(0x20); - ST7579_WriteByte(0x04); - /* 50 ms delay is recommended. */ - for(delay = 0; delay < 1000; delay++) - { - asm("NOP"); - } - /* Set the frame frequency */ - ST7579_WriteByte(0x23); - ST7579_WriteByte(0x0C); - /* Set V0. */ - ST7579_WriteByte(0x21); - ST7579_WriteByte(0xE7); - /* Select the display mode */ - ST7579_WriteByte(0x20); - ST7579_WriteByte(0x0C); - ST7579_RS_HIGH; - /* Clear RAM. */ - ST7579_Clear(); + char status = -1; + unsigned short delay = 0; + status = SPI_Init(0, /* Transfer format. */ + 1000000, /* SPI clock frequency. */ + 0, /* SPI clock polarity. */ + 1); /* SPI clock edge. */ + if(status != 0) { return status; -} + } + ST7579_RS_OUT; + ST7579_RS_LOW; + /* Select LCD bias ratio of the voltage required for driving the LCD. */ + ST7579_WriteByte(0x21); + ST7579_WriteByte(0x16); + /* Select Booster efficiency and Booster stage. */ + ST7579_WriteByte(0x23); + ST7579_WriteByte(0x99); + /* Set V0 Range. */ + ST7579_WriteByte(0x20); + ST7579_WriteByte(0x04); + /* 50 ms delay is recommended. */ + for(delay = 0; delay < 1000; delay++) { + asm ("NOP"); + } + /* Set the frame frequency */ + ST7579_WriteByte(0x23); + ST7579_WriteByte(0x0C); + /* Set V0. */ + ST7579_WriteByte(0x21); + ST7579_WriteByte(0xE7); + /* Select the display mode */ + ST7579_WriteByte(0x20); + ST7579_WriteByte(0x0C); + ST7579_RS_HIGH; + /* Clear RAM. */ + ST7579_Clear(); + return status; +} /***************************************************************************//** * @brief Sends a character to ST7579 controller. * @@ -272,66 +268,60 @@ char ST7579_Init(void) * @param bigFont - Big font selection. * * @return None. -*******************************************************************************/ -void ST7579_Char(unsigned char yPosition, - unsigned char xPosition, - unsigned char character, - unsigned char bigFont) + *******************************************************************************/ +void +ST7579_Char(unsigned char yPosition, + unsigned char xPosition, + unsigned char character, + unsigned char bigFont) { - unsigned char column = 0; - unsigned char data = 0; + unsigned char column = 0; + unsigned char data = 0; - if(bigFont) - { - /* Set the X and Y address of RAM. */ - ST7579_GoTo(yPosition, xPosition); - /* Send character data. */ - for(column = 0; column < 5; column++) - { - data = st7579Font[character - 32][column]; - data = ((data & 0x01) ? 0x03 : 0) | - ((data & 0x02) ? 0x0C : 0) | - ((data & 0x04) ? 0x30 : 0) | - ((data & 0x08) ? 0xC0 : 0); - ST7579_WriteByte(data); - ST7579_WriteByte(data); - ST7579_WriteByte(data); - } - ST7579_WriteByte(0); - ST7579_WriteByte(0); - ST7579_WriteByte(0); - yPosition++; - /* Set the X and Y address of RAM. */ - ST7579_GoTo(yPosition, xPosition); - /* Send character data. */ - for(column = 0; column < 5; column++) - { - data = st7579Font[character - 32][column]; - data = ((data & 0x10) ? 0x03 : 0) | - ((data & 0x20) ? 0x0C : 0) | - ((data & 0x40) ? 0x30 : 0) | - ((data & 0x80) ? 0xC0 : 0); - ST7579_WriteByte(data); - ST7579_WriteByte(data); - ST7579_WriteByte(data); - } - ST7579_WriteByte(0); - ST7579_WriteByte(0); - ST7579_WriteByte(0); + if(bigFont) { + /* Set the X and Y address of RAM. */ + ST7579_GoTo(yPosition, xPosition); + /* Send character data. */ + for(column = 0; column < 5; column++) { + data = st7579Font[character - 32][column]; + data = ((data & 0x01) ? 0x03 : 0) | + ((data & 0x02) ? 0x0C : 0) | + ((data & 0x04) ? 0x30 : 0) | + ((data & 0x08) ? 0xC0 : 0); + ST7579_WriteByte(data); + ST7579_WriteByte(data); + ST7579_WriteByte(data); } - else - { - /* Set the X and Y address of RAM. */ - ST7579_GoTo(yPosition, xPosition); - /* Send character data. */ - for(column = 0; column < 5; column++) - { - ST7579_WriteByte(st7579Font[character - 32][column] << 1); - } - ST7579_WriteByte(0x00); + ST7579_WriteByte(0); + ST7579_WriteByte(0); + ST7579_WriteByte(0); + yPosition++; + /* Set the X and Y address of RAM. */ + ST7579_GoTo(yPosition, xPosition); + /* Send character data. */ + for(column = 0; column < 5; column++) { + data = st7579Font[character - 32][column]; + data = ((data & 0x10) ? 0x03 : 0) | + ((data & 0x20) ? 0x0C : 0) | + ((data & 0x40) ? 0x30 : 0) | + ((data & 0x80) ? 0xC0 : 0); + ST7579_WriteByte(data); + ST7579_WriteByte(data); + ST7579_WriteByte(data); } + ST7579_WriteByte(0); + ST7579_WriteByte(0); + ST7579_WriteByte(0); + } else { + /* Set the X and Y address of RAM. */ + ST7579_GoTo(yPosition, xPosition); + /* Send character data. */ + for(column = 0; column < 5; column++) { + ST7579_WriteByte(st7579Font[character - 32][column] << 1); + } + ST7579_WriteByte(0x00); + } } - /***************************************************************************//** * @brief Sends a string to ST7579 controller. * @@ -341,20 +331,19 @@ void ST7579_Char(unsigned char yPosition, * @param bigFont - Big font selection. * * @return None. -*******************************************************************************/ -void ST7579_String(unsigned char yPosition, - unsigned char xPosition, - unsigned char* string, - unsigned char bigFont) + *******************************************************************************/ +void +ST7579_String(unsigned char yPosition, + unsigned char xPosition, + unsigned char *string, + unsigned char bigFont) { - while(*string) - { - /* Send each character of the string. */ - ST7579_Char(yPosition, xPosition, *string++, bigFont); - xPosition += 6 + (bigFont * 12); - } + while(*string) { + /* Send each character of the string. */ + ST7579_Char(yPosition, xPosition, *string++, bigFont); + xPosition += 6 + (bigFont * 12); + } } - /***************************************************************************//** * @brief Sends an integer number to ST7579 controller. * @@ -364,47 +353,39 @@ void ST7579_String(unsigned char yPosition, * @param bigFont - Big font selection. * * @return None. -*******************************************************************************/ -void ST7579_Number(unsigned char yPosition, - unsigned char xPosition, - long number, - unsigned char bigFont) + *******************************************************************************/ +void +ST7579_Number(unsigned char yPosition, + unsigned char xPosition, + long number, + unsigned char bigFont) { - unsigned long mask = 1000000000; - unsigned char chNumber = 10; - unsigned char chIndex = 0; + unsigned long mask = 1000000000; + unsigned char chNumber = 10; + unsigned char chIndex = 0; - if(number < 0) - { - ST7579_Char(yPosition, xPosition, '-', bigFont); - xPosition += 6 + (bigFont * 12); - number *= -1; - } - else - { - if(number == 0) - { - ST7579_String(yPosition, xPosition, " 0", bigFont); - } - else - { - ST7579_Char(yPosition, xPosition, '+', bigFont); - xPosition += 6 + (bigFont * 12); - } - } - while(mask > number) - { - mask /= 10; - chNumber--; - } - for(chIndex = 0; chIndex < chNumber; chIndex++) - { - ST7579_Char(yPosition, xPosition, ((number / mask) % 10) + 0x30, bigFont); - mask /= 10; - xPosition += 6 + (bigFont * 12); + if(number < 0) { + ST7579_Char(yPosition, xPosition, '-', bigFont); + xPosition += 6 + (bigFont * 12); + number *= -1; + } else { + if(number == 0) { + ST7579_String(yPosition, xPosition, " 0", bigFont); + } else { + ST7579_Char(yPosition, xPosition, '+', bigFont); + xPosition += 6 + (bigFont * 12); } + } + while(mask > number) { + mask /= 10; + chNumber--; + } + for(chIndex = 0; chIndex < chNumber; chIndex++) { + ST7579_Char(yPosition, xPosition, ((number / mask) % 10) + 0x30, bigFont); + mask /= 10; + xPosition += 6 + (bigFont * 12); + } } - /***************************************************************************//** * @brief Sends a float number to ST7579 controller. * @@ -415,79 +396,65 @@ void ST7579_Number(unsigned char yPosition, * @param bigFont - Big font selection. * * @return None. -*******************************************************************************/ -void ST7579_FloatNumber(unsigned char yPosition, - unsigned char xPosition, - float number, - unsigned char resolution, - unsigned char bigFont) + *******************************************************************************/ +void +ST7579_FloatNumber(unsigned char yPosition, + unsigned char xPosition, + float number, + unsigned char resolution, + unsigned char bigFont) { - unsigned long mask = 1000000000; - unsigned char chNumber = 10; - unsigned char index = 0; - long display = 1; - long multiplication = 1; + unsigned long mask = 1000000000; + unsigned char chNumber = 10; + unsigned char index = 0; + long display = 1; + long multiplication = 1; - - for(index = 0; index < resolution; index++) - { - multiplication *= 10; - } - display = (long)(number * multiplication); - if(display < 0) - { - ST7579_Char(yPosition, xPosition, '-', bigFont); + for(index = 0; index < resolution; index++) { + multiplication *= 10; + } + display = (long)(number * multiplication); + if(display < 0) { + ST7579_Char(yPosition, xPosition, '-', bigFont); + xPosition += 6 + (bigFont * 12); + display *= -1; + } else { + if(display == 0) { + xPosition += 6 + (bigFont * 12); + ST7579_Char(yPosition, xPosition, '0', bigFont); + xPosition += 6 + (bigFont * 12); + if(resolution) { + ST7579_Char(yPosition, xPosition, '.', bigFont); xPosition += 6 + (bigFont * 12); - display *= -1; - } - else - { - if(display == 0) - { - xPosition += 6 + (bigFont * 12); - ST7579_Char(yPosition, xPosition, '0', bigFont); - xPosition += 6 + (bigFont * 12); - if(resolution) - { - ST7579_Char(yPosition, xPosition, '.', bigFont); - xPosition += 6 + (bigFont * 12); - } - for(index = 0; index < resolution; index++) - { - ST7579_Char(yPosition, xPosition, '0', bigFont); - xPosition += 6 + (bigFont * 12); - } - return; - } - else - { - ST7579_Char(yPosition, xPosition, '+', bigFont); - xPosition += 6 + (bigFont * 12); - } - } - while((mask > display) && (chNumber > resolution)) - { - mask /= 10; - chNumber--; - } - if((display > 0) && (display < multiplication)) - { - ST7579_String(yPosition, xPosition, "0.", bigFont); - xPosition += 12 + (bigFont * 24); - } - for(index = 0; index < chNumber; index++) - { - ST7579_Char(yPosition, xPosition, ((display / mask) % 10) + 0x30, bigFont); - mask /= 10; + } + for(index = 0; index < resolution; index++) { + ST7579_Char(yPosition, xPosition, '0', bigFont); xPosition += 6 + (bigFont * 12); - if((multiplication != 1) && (mask == (multiplication / 10))) - { - ST7579_Char(yPosition, xPosition, '.', bigFont); - xPosition += 6 + (bigFont * 12); - } + } + return; + } else { + ST7579_Char(yPosition, xPosition, '+', bigFont); + xPosition += 6 + (bigFont * 12); } + } + while((mask > display) && (chNumber > resolution)) { + mask /= 10; + chNumber--; + } + if((display > 0) && (display < multiplication)) { + ST7579_String(yPosition, xPosition, "0.", bigFont); + xPosition += 12 + (bigFont * 24); + } + for(index = 0; index < chNumber; index++) { + ST7579_Char(yPosition, xPosition, ((display / mask) % 10) + 0x30, bigFont); + mask /= 10; + xPosition += 6 + (bigFont * 12); + if((multiplication != 1) && (mask == (multiplication / 10))) { + ST7579_Char(yPosition, xPosition, '.', bigFont); + xPosition += 6 + (bigFont * 12); + } + } } - /***************************************************************************//** * @brief Sends an integer number in Hexa format to ST7579 controller. * @@ -497,45 +464,39 @@ void ST7579_FloatNumber(unsigned char yPosition, * @param bigFont - Big font selection. * * @return None. -*******************************************************************************/ -void ST7579_HexNumber(unsigned char yPosition, - unsigned char xPosition, - long number, - unsigned char bigFont) + *******************************************************************************/ +void +ST7579_HexNumber(unsigned char yPosition, + unsigned char xPosition, + long number, + unsigned char bigFont) { - unsigned long long mask = 268435456; - unsigned char chNumber = 8; - unsigned char chIndex = 0; - unsigned char display = 0; + unsigned long long mask = 268435456; + unsigned char chNumber = 8; + unsigned char chIndex = 0; + unsigned char display = 0; - ST7579_String(yPosition, xPosition, "0x", bigFont); - xPosition += (6 + (bigFont * 12)) * 2; - if(number == 0) - { - ST7579_Char(yPosition, xPosition, '0', bigFont); - } - while(mask > number) - { - mask /= 16; - chNumber--; - } - for(chIndex = 0; chIndex < chNumber; chIndex++) - { - display = (number / mask) % 16; - mask /= 16; - if(display <= 9) - { - display += 0x30; - } - else - { - display += 0x37; - } - ST7579_Char(yPosition, xPosition, display, bigFont); - xPosition += 6 + (bigFont * 12); + ST7579_String(yPosition, xPosition, "0x", bigFont); + xPosition += (6 + (bigFont * 12)) * 2; + if(number == 0) { + ST7579_Char(yPosition, xPosition, '0', bigFont); + } + while(mask > number) { + mask /= 16; + chNumber--; + } + for(chIndex = 0; chIndex < chNumber; chIndex++) { + display = (number / mask) % 16; + mask /= 16; + if(display <= 9) { + display += 0x30; + } else { + display += 0x37; } + ST7579_Char(yPosition, xPosition, display, bigFont); + xPosition += 6 + (bigFont * 12); + } } - /***************************************************************************//** * @brief Sends an image array to ST7579 controller. * @@ -546,23 +507,22 @@ void ST7579_HexNumber(unsigned char yPosition, * @param height - The height of the image (pixels). * * @return None. -*******************************************************************************/ -void ST7579_Image(unsigned char yPosition, - unsigned char xPosition, - const unsigned char image[], - unsigned char width, - unsigned char height) + *******************************************************************************/ +void +ST7579_Image(unsigned char yPosition, + unsigned char xPosition, + const unsigned char image[], + unsigned char width, + unsigned char height) { - unsigned short index = 0; + unsigned short index = 0; - for(index = 0; index < (width * height / 8); index++) - { - if(!(index % width)) - { - /* Set the X and Y address of RAM. */ - ST7579_GoTo(yPosition, xPosition); - yPosition ++; - } - ST7579_WriteByte(image[index]); + for(index = 0; index < (width * height / 8); index++) { + if(!(index % width)) { + /* Set the X and Y address of RAM. */ + ST7579_GoTo(yPosition, xPosition); + yPosition++; } + ST7579_WriteByte(image[index]); + } } diff --git a/ST7579.h b/ST7579.h index 566b40d48..92a47bfde 100644 --- a/ST7579.h +++ b/ST7579.h @@ -2,7 +2,7 @@ * @file ST7579.h * @brief Header file of ST7579 Driver. * @author DBogdan (dragos.bogdan@analog.com) -******************************************************************************** + ******************************************************************************** * Copyright 2012(c) Analog Devices, Inc. * * All rights reserved. @@ -36,9 +36,9 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * -******************************************************************************** + ******************************************************************************** * SVN Revision: $WCREV$ -*******************************************************************************/ + *******************************************************************************/ #ifndef __ST7579_H__ #define __ST7579_H__ @@ -68,7 +68,7 @@ void ST7579_Char(unsigned char yPosition, /*! Sends a string to ST7579 controller. */ void ST7579_String(unsigned char yPosition, unsigned char xPosition, - unsigned char* string, + unsigned char *string, unsigned char bigFont); /*! Sends an integer number to ST7579 controller. */ @@ -97,4 +97,4 @@ void ST7579_Image(unsigned char yPosition, unsigned char width, unsigned char height); -#endif // __ST7579_H__ +#endif /* __ST7579_H__ */ diff --git a/TIME.c b/TIME.c index c2c4a515f..30c352b5d 100644 --- a/TIME.c +++ b/TIME.c @@ -2,7 +2,7 @@ * @file TIME.c * @brief Implementation of TIME Driver for RENESAS RL78G14 Processor. * @author Dan Nechita -******************************************************************************** + ******************************************************************************** * Copyright 2012(c) Analog Devices, Inc. * * All rights reserved. @@ -36,15 +36,15 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * -******************************************************************************** + ******************************************************************************** * SVN Revision: $WCREV$ -*******************************************************************************/ + *******************************************************************************/ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "RDKRL78G14.h" // RDKRL78G14 definitions. -#include "TIME.h" // TIME definitions. +#include "RDKRL78G14.h" /* RDKRL78G14 definitions. */ +#include "TIME.h" /* TIME definitions. */ /*****************************************************************************/ /************************** Macros Definitions *******************************/ @@ -64,104 +64,101 @@ unsigned short overflowCounter = 0; * @brief INTTM00 interrupt service routine. * * @return None. -*******************************************************************************/ + *******************************************************************************/ #pragma vector = INTTM00_vect -__interrupt static void Timer0InterruptHandler(void) +__interrupt static void +Timer0InterruptHandler(void) { - overflowCounter++; + overflowCounter++; } - /***************************************************************************//** * @brief Initializes the timer used in this driver. * * @return status - Result of the initialization procedure. * Example: 0 - if initialization was successful; * -1 - if initialization was unsuccessful. -*******************************************************************************/ -char TIME_Init(void) + *******************************************************************************/ +char +TIME_Init(void) { - PER0 |= 0x0001; // Enable Supply for Unit 0 that contains timers 0..7. - TT0 |= 0x0001; // Stop channel 0(Timer 0). - TPS0 = 0x0005; // CK00 = FCLK / 32. - TMR00 |= 0x0000; // CK00 input clock for channel 0. - TMMK00 = 1; // Disable INTTM00 interrupt. - TMIF00 = 0; // Clear INTM00 interrupt flag. - /* Set INTTM00 low priority */ - TMPR100 = 1; - TMPR000 = 1; - /* Configure channel 0 as a interval timer. */ - TMR00 |= 0x0000; // Interval timer mode. - TO0 &= ~0x0001; // Timer 0 output value is "0". - TOE0 &= ~0x0001; // Disable output of timer 0. - TMMK00 = 0; // Enable INTTM00 interrupt. - - return 0; -} + PER0 |= 0x0001; /* Enable Supply for Unit 0 that contains timers 0..7. */ + TT0 |= 0x0001; /* Stop channel 0(Timer 0). */ + TPS0 = 0x0005; /* CK00 = FCLK / 32. */ + TMR00 |= 0x0000; /* CK00 input clock for channel 0. */ + TMMK00 = 1; /* Disable INTTM00 interrupt. */ + TMIF00 = 0; /* Clear INTM00 interrupt flag. */ + /* Set INTTM00 low priority */ + TMPR100 = 1; + TMPR000 = 1; + /* Configure channel 0 as a interval timer. */ + TMR00 |= 0x0000; /* Interval timer mode. */ + TO0 &= ~0x0001; /* Timer 0 output value is "0". */ + TOE0 &= ~0x0001; /* Disable output of timer 0. */ + TMMK00 = 0; /* Enable INTTM00 interrupt. */ + return 0; +} /***************************************************************************//** * @brief The timer begins to count in steps of microseconds(us) until the user * calls a stop measurement function. * * @return None. -*******************************************************************************/ -void TIME_StartMeasure(void) + *******************************************************************************/ +void +TIME_StartMeasure(void) { - TDR00 = 0xFFFF; - overflowCounter = 0; - TS0 |= 0x0001; // Start timer 0. - TMIF00 = 0; // Clear INTM00 interrupt flag. + TDR00 = 0xFFFF; + overflowCounter = 0; + TS0 |= 0x0001; /* Start timer 0. */ + TMIF00 = 0; /* Clear INTM00 interrupt flag. */ } - /***************************************************************************//** * @brief Stops the measurement process when the functions is called. * * @return Time(in microseconds) elapsed since the measurement began. -*******************************************************************************/ -unsigned long TIME_StopMeasure(void) + *******************************************************************************/ +unsigned long +TIME_StopMeasure(void) { - unsigned long elapsedUs = 0; - unsigned short timerCnt = 0; - - timerCnt = TCR00; - TT0 |= 0x0001; // Stop Timer 0. - TMIF00 = 0; // Clear INTM00 interrupt flag. - overflowCounter = 0; - elapsedUs = ((unsigned long)overflowCounter * TIMER_CNT_INTERVAL) + - (0xFFFF - timerCnt); - - return elapsedUs; -} + unsigned long elapsedUs = 0; + unsigned short timerCnt = 0; + timerCnt = TCR00; + TT0 |= 0x0001; /* Stop Timer 0. */ + TMIF00 = 0; /* Clear INTM00 interrupt flag. */ + overflowCounter = 0; + elapsedUs = ((unsigned long)overflowCounter * TIMER_CNT_INTERVAL) + + (0xFFFF - timerCnt); + + return elapsedUs; +} /***************************************************************************//** * @brief Creates a delay of microseconds. * * @return None. -*******************************************************************************/ -void TIME_DelayUs(unsigned short usUnits) + *******************************************************************************/ +void +TIME_DelayUs(unsigned short usUnits) { - TDR00 = usUnits; - TS0 |= 0x0001; // Start timer 0. - while(!overflowCounter) - { - ; - } - overflowCounter = 0; - TT0 |= 0x0001; // Stop Timer 0. + TDR00 = usUnits; + TS0 |= 0x0001; /* Start timer 0. */ + while(!overflowCounter) { + } + overflowCounter = 0; + TT0 |= 0x0001; /* Stop Timer 0. */ } - /***************************************************************************//** * @brief Creates a delay of milliseconds. * * @return None. -*******************************************************************************/ -void TIME_DelayMs(unsigned short msUnits) + *******************************************************************************/ +void +TIME_DelayMs(unsigned short msUnits) { - TDR00 = 0x3E7; // 0x3E7 = 999(decimal). Timer will count down to 0. - TS0 |= 0x0001; // Start timer 0. - while(overflowCounter < msUnits) - { - ; - } - overflowCounter = 0; - TT0 |= 0x0001; // Stop Timer 0. + TDR00 = 0x3E7; /* 0x3E7 = 999(decimal). Timer will count down to 0. */ + TS0 |= 0x0001; /* Start timer 0. */ + while(overflowCounter < msUnits) { + } + overflowCounter = 0; + TT0 |= 0x0001; /* Stop Timer 0. */ } diff --git a/TIME.h b/TIME.h index cc60f09a5..8b3037701 100644 --- a/TIME.h +++ b/TIME.h @@ -2,7 +2,7 @@ * @file TIME.h * @brief Header file of TIME Driver for RENESAS RL78G14 Processor. * @author Dan Nechita -******************************************************************************** + ******************************************************************************** * Copyright 2012(c) Analog Devices, Inc. * * All rights reserved. @@ -36,9 +36,9 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * -******************************************************************************** + ******************************************************************************** * SVN Revision: $WCREV$ -*******************************************************************************/ + *******************************************************************************/ #ifndef __TIME_H__ #define __TIME_H__ @@ -49,7 +49,7 @@ /*! Initializes the timer used in this driver. */ char TIME_Init(void); -/*! The timer begins to count in steps of microseconds(us) until the user calls +/*! The timer begins to count in steps of microseconds(us) until the user calls a stop measurement function. */ void TIME_StartMeasure(void); From cfd554dc24d1d98a350862adc7a2f1bd8674550e Mon Sep 17 00:00:00 2001 From: Dragos Bogdan Date: Sat, 4 Jan 2014 17:27:52 -0500 Subject: [PATCH 17/20] Move files. --- RDKRL78G14.c | 88 ---- RDKRL78G14.h | 133 ----- ST7579.c | 528 -------------------- ST7579.h | 100 ---- TIME.c | 164 ------ TIME.h | 65 --- Communication.c => cpu/rl78/Communication.c | 0 Communication.h => cpu/rl78/Communication.h | 0 8 files changed, 1078 deletions(-) delete mode 100644 RDKRL78G14.c delete mode 100644 RDKRL78G14.h delete mode 100644 ST7579.c delete mode 100644 ST7579.h delete mode 100644 TIME.c delete mode 100644 TIME.h rename Communication.c => cpu/rl78/Communication.c (100%) rename Communication.h => cpu/rl78/Communication.h (100%) diff --git a/RDKRL78G14.c b/RDKRL78G14.c deleted file mode 100644 index 3be586c51..000000000 --- a/RDKRL78G14.c +++ /dev/null @@ -1,88 +0,0 @@ -/***************************************************************************//** - * @file RDKRL78G14.c - * @brief Implementation of the RDKRL78G14 Driver. - * @author DBogdan (dragos.bogdan@analog.com) - ******************************************************************************** - * Copyright 2012(c) Analog Devices, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - Neither the name of Analog Devices, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - The use of this software may or may not infringe the patent rights - * of one or more patent holders. This license does not release you - * from the requirement that you obtain separate licenses from these - * patent holders to use this software. - * - Use of the software either in source or binary form, must be run - * on or directly connected to an Analog Devices Inc. component. - * - * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ******************************************************************************** - * SVN Revision: $WCREV$ - *******************************************************************************/ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#include "RDKRL78G14.h" /* RDKRL78G14 definitions */ - -/******************************************************************************/ -/************************ Functions Definitions *******************************/ -/******************************************************************************/ - -/***************************************************************************//** - * @brief Resets the RDKRL78G14. - * - * @return None. - *******************************************************************************/ -void -RDKRL78G14_Reset(void) -{ - short delay = 0; - - EXTRST_HIGH; - for(delay = 0; delay < 1000; delay++) { - NOP; - } - EXTRST_LOW; -} -/***************************************************************************//** - * @brief Initializes the RDKRL78G14. - * - * @return status - Result of the initialization procedure. - * Example: 0 - if initialization was successful; - * -1 - if initialization was unsuccessful. - *******************************************************************************/ -char -RDKRL78G14_Init(void) -{ - long delay = 0; - char status = -1; - - for(delay = 0; delay < 4000000; delay++) { - NOP; - } - RDKRL78G14_Reset(); - status = 0; - - return status; -} diff --git a/RDKRL78G14.h b/RDKRL78G14.h deleted file mode 100644 index 75242bab1..000000000 --- a/RDKRL78G14.h +++ /dev/null @@ -1,133 +0,0 @@ -/***************************************************************************//** - * @file RDKRL78G14.h - * @brief Header file of the RDKRL78G14 Driver. - * @author DBogdan (dragos.bogdan@analog.com) - ******************************************************************************** - * Copyright 2012(c) Analog Devices, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - Neither the name of Analog Devices, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - The use of this software may or may not infringe the patent rights - * of one or more patent holders. This license does not release you - * from the requirement that you obtain separate licenses from these - * patent holders to use this software. - * - Use of the software either in source or binary form, must be run - * on or directly connected to an Analog Devices Inc. component. - * - * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ******************************************************************************** - * SVN Revision: $WCREV$ - *******************************************************************************/ - -#ifndef __RDKRL78G14_H__ -#define __RDKRL78G14_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ - -#include /* R5F104PJ definitions */ -#include /* Declarations of extended SFR registers */ -#include /* Declarations of intrinsic functions */ - -/******************************************************************************/ -/************************* Operations Definitions *****************************/ -/******************************************************************************/ - -#define NOP __no_operation(); /* No operation */ -#define EI __enable_interrupt(); /* Enable interrupts */ -#define DI __disable_interrupt(); /* Disable interrupts */ - -/******************************************************************************/ -/**************************** GPIO Definitions ********************************/ -/******************************************************************************/ - -/* External Reset Pin - P130 */ -#define EXTRST_PIN (1 << 0) -#define EXTRST_LOW P13 &= ~EXTRST_PIN -#define EXTRST_HIGH P13 |= EXTRST_PIN - -/* ST7579 CS Pin - P145 */ -#define ST7579_CS_PIN (1 << 5) -#define ST7579_CS_OUT PM14 &= ~ST7579_CS_PIN -#define ST7579_CS_LOW P14 &= ~ST7579_CS_PIN -#define ST7579_CS_HIGH P14 |= ST7579_CS_PIN - -/* ST7579 RS Pin - P146 */ -#define ST7579_RS_PIN (1 << 6) -#define ST7579_RS_OUT PM14 &= ~ST7579_RS_PIN -#define ST7579_RS_LOW P14 &= ~ST7579_RS_PIN -#define ST7579_RS_HIGH P14 |= ST7579_RS_PIN - -/* PMOD1 CS Pin - P83 */ -#define PMOD1_CS_PIN (1 << 3) -#define PMOD1_CS_OUT PM8 &= ~PMOD1_CS_PIN -#define PMOD1_CS_LOW P8 &= ~PMOD1_CS_PIN -#define PMOD1_CS_HIGH P8 |= PMOD1_CS_PIN - -/* PMOD1 MISO Pin */ -#define PMOD1_MISO_PIN (1 << 1) -#define PMOD1_MISO ((P7 & PMOD1_MISO_PIN) >> 1) - -/* PMOD1 GPIO1 Pin - P47 */ -#define PMOD1_GPIO1_PIN (1 << 7) -#define PMOD1_GPIO1_PIN_OUT PM4 &= ~PMOD1_GPIO1_PIN; -#define PMOD1_GPIO1_LOW P4 &= ~PMOD1_GPIO1_PIN; -#define PMOD1_GPIO1_HIGH P4 |= PMOD1_GPIO1_PIN; - -/* PMOD1 GPIO2 Pin - P46 */ -#define PMOD1_GPIO2_PIN (1 << 6) -#define PMOD1_GPIO2_PIN_OUT PM4 &= ~PMOD1_GPIO2_PIN; -#define PMOD1_GPIO2_LOW P4 &= ~PMOD1_GPIO2_PIN; -#define PMOD1_GPIO2_HIGH P4 |= PMOD1_GPIO2_PIN; - -/* PMOD1 GPIO3 Pin - P110 */ -#define PMOD1_GPIO3_PIN (1 << 0) -#define PMOD1_GPIO3_PIN_OUT PM11 &= ~PMOD1_GPIO3_PIN; -#define PMOD1_GPIO3_LOW P11 &= ~PMOD1_GPIO3_PIN; -#define PMOD1_GPIO3_HIGH P11 |= PMOD1_GPIO3_PIN; - -/* PMOD1 GPIO4 Pin - P111 */ -#define PMOD1_GPIO4_PIN (1 << 1) -#define PMOD1_GPIO4_PIN_OUT PM11 &= ~PMOD1_GPIO4_PIN; -#define PMOD1_GPIO4_LOW P11 &= ~PMOD1_GPIO4_PIN; -#define PMOD1_GPIO4_HIGH P11 |= PMOD1_GPIO4_PIN; - -/* PMOD2 CS Pin - P82 */ -#define PMOD2_CS_PIN (1 << 2) -#define PMOD2_CS_OUT PM8 &= ~PMOD2_CS_PIN -#define PMOD2_CS_LOW P8 &= ~PMOD2_CS_PIN -#define PMOD2_CS_HIGH P8 |= PMOD2_CS_PIN - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ - -/*! Resets the RDKRL78G14. */ -void RDKRL78G14_Reset(void); - -/*! Initializes the RDKRL78G14. */ -char RDKRL78G14_Init(void); - -#endif /* __RDKRL78G14_H__ */ diff --git a/ST7579.c b/ST7579.c deleted file mode 100644 index 4e8b85a4f..000000000 --- a/ST7579.c +++ /dev/null @@ -1,528 +0,0 @@ -/***************************************************************************//** - * @file ST7579.c - * @brief Implementation of ST7579 Driver. - * @author DBogdan (dragos.bogdan@analog.com) - ******************************************************************************** - * Copyright 2012(c) Analog Devices, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - Neither the name of Analog Devices, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - The use of this software may or may not infringe the patent rights - * of one or more patent holders. This license does not release you - * from the requirement that you obtain separate licenses from these - * patent holders to use this software. - * - Use of the software either in source or binary form, must be run - * on or directly connected to an Analog Devices Inc. component. - * - * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ******************************************************************************** - * SVN Revision: $WCREV$ - *******************************************************************************/ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#include "ST7579.h" /* ST7579 definitions */ -#include "RDKRL78G14.h" /* YRDKRL78G14 definitions */ -#include "Communication.h" /* Communication definitions */ - -/******************************************************************************/ -/************************* Variables Definitions ******************************/ -/******************************************************************************/ - -const unsigned char st7579Font[95][5] = -{ - { 0x00, 0x00, 0x00, 0x00, 0x00 }, /* sp */ - { 0x00, 0x00, 0x2f, 0x00, 0x00 }, /* ! */ - { 0x00, 0x07, 0x00, 0x07, 0x00 }, /* " */ - { 0x14, 0x7f, 0x14, 0x7f, 0x14 }, /* # */ - { 0x24, 0x2a, 0x7f, 0x2a, 0x12 }, /* $ */ - { 0xc4, 0xc8, 0x10, 0x26, 0x46 }, /* % */ - { 0x36, 0x49, 0x55, 0x22, 0x50 }, /* & */ - { 0x00, 0x05, 0x03, 0x00, 0x00 }, /* ' */ - { 0x00, 0x1c, 0x22, 0x41, 0x00 }, /* ( */ - { 0x00, 0x41, 0x22, 0x1c, 0x00 }, /* ) */ - { 0x14, 0x08, 0x3E, 0x08, 0x14 }, /* * */ - { 0x08, 0x08, 0x3E, 0x08, 0x08 }, /* + */ - { 0x00, 0x00, 0x50, 0x30, 0x00 }, /* , */ - { 0x10, 0x10, 0x10, 0x10, 0x10 }, /* - */ - { 0x00, 0x60, 0x60, 0x00, 0x00 }, /* . */ - { 0x20, 0x10, 0x08, 0x04, 0x02 }, /* / */ - { 0x3E, 0x51, 0x49, 0x45, 0x3E }, /* 0 */ - { 0x00, 0x42, 0x7F, 0x40, 0x00 }, /* 1 */ - { 0x42, 0x61, 0x51, 0x49, 0x46 }, /* 2 */ - { 0x21, 0x41, 0x45, 0x4B, 0x31 }, /* 3 */ - { 0x18, 0x14, 0x12, 0x7F, 0x10 }, /* 4 */ - { 0x27, 0x45, 0x45, 0x45, 0x39 }, /* 5 */ - { 0x3C, 0x4A, 0x49, 0x49, 0x30 }, /* 6 */ - { 0x01, 0x71, 0x09, 0x05, 0x03 }, /* 7 */ - { 0x36, 0x49, 0x49, 0x49, 0x36 }, /* 8 */ - { 0x06, 0x49, 0x49, 0x29, 0x1E }, /* 9 */ - { 0x00, 0x36, 0x36, 0x00, 0x00 }, /* : */ - { 0x00, 0x56, 0x36, 0x00, 0x00 }, /* ; */ - { 0x08, 0x14, 0x22, 0x41, 0x00 }, /* < */ - { 0x14, 0x14, 0x14, 0x14, 0x14 }, /* = */ - { 0x00, 0x41, 0x22, 0x14, 0x08 }, /* > */ - { 0x02, 0x01, 0x51, 0x09, 0x06 }, /* ? */ - { 0x32, 0x49, 0x59, 0x51, 0x3E }, /* @ */ - { 0x7E, 0x11, 0x11, 0x11, 0x7E }, /* A */ - { 0x7F, 0x49, 0x49, 0x49, 0x36 }, /* B */ - { 0x3E, 0x41, 0x41, 0x41, 0x22 }, /* C */ - { 0x7F, 0x41, 0x41, 0x22, 0x1C }, /* D */ - { 0x7F, 0x49, 0x49, 0x49, 0x41 }, /* E */ - { 0x7F, 0x09, 0x09, 0x09, 0x01 }, /* F */ - { 0x3E, 0x41, 0x49, 0x49, 0x7A }, /* G */ - { 0x7F, 0x08, 0x08, 0x08, 0x7F }, /* H */ - { 0x00, 0x41, 0x7F, 0x41, 0x00 }, /* I */ - { 0x20, 0x40, 0x41, 0x3F, 0x01 }, /* J */ - { 0x7F, 0x08, 0x14, 0x22, 0x41 }, /* K */ - { 0x7F, 0x40, 0x40, 0x40, 0x40 }, /* L */ - { 0x7F, 0x02, 0x0C, 0x02, 0x7F }, /* M */ - { 0x7F, 0x04, 0x08, 0x10, 0x7F }, /* N */ - { 0x3E, 0x41, 0x41, 0x41, 0x3E }, /* O */ - { 0x7F, 0x09, 0x09, 0x09, 0x06 }, /* P */ - { 0x3E, 0x41, 0x51, 0x21, 0x5E }, /* Q */ - { 0x7F, 0x09, 0x19, 0x29, 0x46 }, /* R */ - { 0x46, 0x49, 0x49, 0x49, 0x31 }, /* S */ - { 0x01, 0x01, 0x7F, 0x01, 0x01 }, /* T */ - { 0x3F, 0x40, 0x40, 0x40, 0x3F }, /* U */ - { 0x1F, 0x20, 0x40, 0x20, 0x1F }, /* V */ - { 0x3F, 0x40, 0x38, 0x40, 0x3F }, /* W */ - { 0x63, 0x14, 0x08, 0x14, 0x63 }, /* X */ - { 0x07, 0x08, 0x70, 0x08, 0x07 }, /* Y */ - { 0x61, 0x51, 0x49, 0x45, 0x43 }, /* Z */ - { 0x00, 0x7F, 0x41, 0x41, 0x00 }, /* [ */ - { 0x55, 0x2A, 0x55, 0x2A, 0x55 }, /* / */ - { 0x00, 0x41, 0x41, 0x7F, 0x00 }, /* ] */ - { 0x04, 0x02, 0x01, 0x02, 0x04 }, /* ^ */ - { 0x40, 0x40, 0x40, 0x40, 0x40 }, /* _ */ - { 0x00, 0x01, 0x02, 0x04, 0x00 }, /* ' */ - { 0x20, 0x54, 0x54, 0x54, 0x78 }, /* a */ - { 0x7F, 0x48, 0x44, 0x44, 0x38 }, /* b */ - { 0x38, 0x44, 0x44, 0x44, 0x20 }, /* c */ - { 0x38, 0x44, 0x44, 0x48, 0x7F }, /* d */ - { 0x38, 0x54, 0x54, 0x54, 0x18 }, /* e */ - { 0x08, 0x7E, 0x09, 0x01, 0x02 }, /* f */ - { 0x0C, 0x52, 0x52, 0x52, 0x3E }, /* g */ - { 0x7F, 0x08, 0x04, 0x04, 0x78 }, /* h */ - { 0x00, 0x44, 0x7D, 0x40, 0x00 }, /* i */ - { 0x20, 0x40, 0x44, 0x3D, 0x00 }, /* j */ - { 0x7F, 0x10, 0x28, 0x44, 0x00 }, /* k */ - { 0x00, 0x41, 0x7F, 0x40, 0x00 }, /* l */ - { 0x7C, 0x04, 0x18, 0x04, 0x78 }, /* m */ - { 0x7C, 0x08, 0x04, 0x04, 0x78 }, /* n */ - { 0x38, 0x44, 0x44, 0x44, 0x38 }, /* o */ - { 0x7C, 0x14, 0x14, 0x14, 0x08 }, /* p */ - { 0x08, 0x14, 0x14, 0x18, 0x7C }, /* q */ - { 0x7C, 0x08, 0x04, 0x04, 0x08 }, /* r */ - { 0x48, 0x54, 0x54, 0x54, 0x20 }, /* s */ - { 0x04, 0x3F, 0x44, 0x40, 0x20 }, /* t */ - { 0x3C, 0x40, 0x40, 0x20, 0x7C }, /* u */ - { 0x1C, 0x20, 0x40, 0x20, 0x1C }, /* v */ - { 0x3C, 0x40, 0x30, 0x40, 0x3C }, /* w */ - { 0x44, 0x28, 0x10, 0x28, 0x44 }, /* x */ - { 0x0C, 0x50, 0x50, 0x50, 0x3C }, /* y */ - { 0x44, 0x64, 0x54, 0x4C, 0x44 }, /* z */ - { 0x08, 0x3e, 0x41, 0x41, 0x00 }, /* { */ - { 0x00, 0x00, 0x77, 0x00, 0x00 }, /* | */ - { 0x00, 0x41, 0x41, 0x3e, 0x08 }, /* } */ - { 0x02, 0x01, 0x02, 0x01, 0x00 } /* ~ */ -}; - -/******************************************************************************/ -/************************ Functions Definitions *******************************/ -/******************************************************************************/ - -/***************************************************************************//** - * @brief Transmits 8 bits to ST7579 controller. - * - * @param data - Data to transmit. - * - * @return None. - *******************************************************************************/ -void -ST7579_WriteByte(unsigned char data) -{ - SPI_Write(3, /* The ID of the selected slave device. */ - &data, /* Write buffer. */ - 1); /* Number of bytes to write. */ -} -/***************************************************************************//** - * @brief Sets X and Y adress of RAM. - * - * @param yPosition - Y address of RAM. - * @param xPosition - X address of RAM. - * - * @return None. - *******************************************************************************/ -void -ST7579_GoTo(unsigned char yPosition, - unsigned char xPosition) -{ - ST7579_RS_LOW; - /* Set X address of RAM. */ - ST7579_WriteByte(0x28); - ST7579_WriteByte(0x80 + xPosition); - /* Set Y address of RAM. */ - ST7579_WriteByte(0x28); - ST7579_WriteByte(0x40 + yPosition); - ST7579_RS_HIGH; -} -/***************************************************************************//** - * @brief Clears ST7579 RAM. - * - * @return None. - *******************************************************************************/ -void -ST7579_Clear(void) -{ - unsigned short clearPosition = 0; - unsigned char yPosition = 0; - - for(clearPosition = 0; clearPosition < (8 * 96); clearPosition++) { - if(!(clearPosition % 96)) { - /* Set the X and Y address of RAM. */ - ST7579_GoTo(yPosition, 0); - yPosition++; - } - ST7579_WriteByte(0x00); - } -} -/***************************************************************************//** - * @brief Initializes the ST7579 controller. - * - * @return status - Result of the initialization procedure. - * Example: 0 - if initialization was successful; - * -1 - if initialization was unsuccessful. - *******************************************************************************/ -char -ST7579_Init(void) -{ - char status = -1; - unsigned short delay = 0; - - status = SPI_Init(0, /* Transfer format. */ - 1000000, /* SPI clock frequency. */ - 0, /* SPI clock polarity. */ - 1); /* SPI clock edge. */ - if(status != 0) { - return status; - } - ST7579_RS_OUT; - ST7579_RS_LOW; - /* Select LCD bias ratio of the voltage required for driving the LCD. */ - ST7579_WriteByte(0x21); - ST7579_WriteByte(0x16); - /* Select Booster efficiency and Booster stage. */ - ST7579_WriteByte(0x23); - ST7579_WriteByte(0x99); - /* Set V0 Range. */ - ST7579_WriteByte(0x20); - ST7579_WriteByte(0x04); - /* 50 ms delay is recommended. */ - for(delay = 0; delay < 1000; delay++) { - asm ("NOP"); - } - /* Set the frame frequency */ - ST7579_WriteByte(0x23); - ST7579_WriteByte(0x0C); - /* Set V0. */ - ST7579_WriteByte(0x21); - ST7579_WriteByte(0xE7); - /* Select the display mode */ - ST7579_WriteByte(0x20); - ST7579_WriteByte(0x0C); - ST7579_RS_HIGH; - /* Clear RAM. */ - ST7579_Clear(); - - return status; -} -/***************************************************************************//** - * @brief Sends a character to ST7579 controller. - * - * @param yPosition - Y address of RAM. - * @param xPosition - X address of RAM. - * @param character - The character. - * @param bigFont - Big font selection. - * - * @return None. - *******************************************************************************/ -void -ST7579_Char(unsigned char yPosition, - unsigned char xPosition, - unsigned char character, - unsigned char bigFont) -{ - unsigned char column = 0; - unsigned char data = 0; - - if(bigFont) { - /* Set the X and Y address of RAM. */ - ST7579_GoTo(yPosition, xPosition); - /* Send character data. */ - for(column = 0; column < 5; column++) { - data = st7579Font[character - 32][column]; - data = ((data & 0x01) ? 0x03 : 0) | - ((data & 0x02) ? 0x0C : 0) | - ((data & 0x04) ? 0x30 : 0) | - ((data & 0x08) ? 0xC0 : 0); - ST7579_WriteByte(data); - ST7579_WriteByte(data); - ST7579_WriteByte(data); - } - ST7579_WriteByte(0); - ST7579_WriteByte(0); - ST7579_WriteByte(0); - yPosition++; - /* Set the X and Y address of RAM. */ - ST7579_GoTo(yPosition, xPosition); - /* Send character data. */ - for(column = 0; column < 5; column++) { - data = st7579Font[character - 32][column]; - data = ((data & 0x10) ? 0x03 : 0) | - ((data & 0x20) ? 0x0C : 0) | - ((data & 0x40) ? 0x30 : 0) | - ((data & 0x80) ? 0xC0 : 0); - ST7579_WriteByte(data); - ST7579_WriteByte(data); - ST7579_WriteByte(data); - } - ST7579_WriteByte(0); - ST7579_WriteByte(0); - ST7579_WriteByte(0); - } else { - /* Set the X and Y address of RAM. */ - ST7579_GoTo(yPosition, xPosition); - /* Send character data. */ - for(column = 0; column < 5; column++) { - ST7579_WriteByte(st7579Font[character - 32][column] << 1); - } - ST7579_WriteByte(0x00); - } -} -/***************************************************************************//** - * @brief Sends a string to ST7579 controller. - * - * @param yPosition - Y address of RAM. - * @param xPosition - X address of RAM. - * @param string - The string. - * @param bigFont - Big font selection. - * - * @return None. - *******************************************************************************/ -void -ST7579_String(unsigned char yPosition, - unsigned char xPosition, - unsigned char *string, - unsigned char bigFont) -{ - while(*string) { - /* Send each character of the string. */ - ST7579_Char(yPosition, xPosition, *string++, bigFont); - xPosition += 6 + (bigFont * 12); - } -} -/***************************************************************************//** - * @brief Sends an integer number to ST7579 controller. - * - * @param yPosition - Y address of RAM. - * @param xPosition - X address of RAM. - * @param number - The number. - * @param bigFont - Big font selection. - * - * @return None. - *******************************************************************************/ -void -ST7579_Number(unsigned char yPosition, - unsigned char xPosition, - long number, - unsigned char bigFont) -{ - unsigned long mask = 1000000000; - unsigned char chNumber = 10; - unsigned char chIndex = 0; - - if(number < 0) { - ST7579_Char(yPosition, xPosition, '-', bigFont); - xPosition += 6 + (bigFont * 12); - number *= -1; - } else { - if(number == 0) { - ST7579_String(yPosition, xPosition, " 0", bigFont); - } else { - ST7579_Char(yPosition, xPosition, '+', bigFont); - xPosition += 6 + (bigFont * 12); - } - } - while(mask > number) { - mask /= 10; - chNumber--; - } - for(chIndex = 0; chIndex < chNumber; chIndex++) { - ST7579_Char(yPosition, xPosition, ((number / mask) % 10) + 0x30, bigFont); - mask /= 10; - xPosition += 6 + (bigFont * 12); - } -} -/***************************************************************************//** - * @brief Sends a float number to ST7579 controller. - * - * @param yPosition - Y address of RAM. - * @param xPosition - X address of RAM. - * @param number - The number. - * @param resolution - Float resolution. - * @param bigFont - Big font selection. - * - * @return None. - *******************************************************************************/ -void -ST7579_FloatNumber(unsigned char yPosition, - unsigned char xPosition, - float number, - unsigned char resolution, - unsigned char bigFont) -{ - unsigned long mask = 1000000000; - unsigned char chNumber = 10; - unsigned char index = 0; - long display = 1; - long multiplication = 1; - - for(index = 0; index < resolution; index++) { - multiplication *= 10; - } - display = (long)(number * multiplication); - if(display < 0) { - ST7579_Char(yPosition, xPosition, '-', bigFont); - xPosition += 6 + (bigFont * 12); - display *= -1; - } else { - if(display == 0) { - xPosition += 6 + (bigFont * 12); - ST7579_Char(yPosition, xPosition, '0', bigFont); - xPosition += 6 + (bigFont * 12); - if(resolution) { - ST7579_Char(yPosition, xPosition, '.', bigFont); - xPosition += 6 + (bigFont * 12); - } - for(index = 0; index < resolution; index++) { - ST7579_Char(yPosition, xPosition, '0', bigFont); - xPosition += 6 + (bigFont * 12); - } - return; - } else { - ST7579_Char(yPosition, xPosition, '+', bigFont); - xPosition += 6 + (bigFont * 12); - } - } - while((mask > display) && (chNumber > resolution)) { - mask /= 10; - chNumber--; - } - if((display > 0) && (display < multiplication)) { - ST7579_String(yPosition, xPosition, "0.", bigFont); - xPosition += 12 + (bigFont * 24); - } - for(index = 0; index < chNumber; index++) { - ST7579_Char(yPosition, xPosition, ((display / mask) % 10) + 0x30, bigFont); - mask /= 10; - xPosition += 6 + (bigFont * 12); - if((multiplication != 1) && (mask == (multiplication / 10))) { - ST7579_Char(yPosition, xPosition, '.', bigFont); - xPosition += 6 + (bigFont * 12); - } - } -} -/***************************************************************************//** - * @brief Sends an integer number in Hexa format to ST7579 controller. - * - * @param yPosition - Y address of RAM. - * @param xPosition - X address of RAM. - * @param number - The number. - * @param bigFont - Big font selection. - * - * @return None. - *******************************************************************************/ -void -ST7579_HexNumber(unsigned char yPosition, - unsigned char xPosition, - long number, - unsigned char bigFont) -{ - unsigned long long mask = 268435456; - unsigned char chNumber = 8; - unsigned char chIndex = 0; - unsigned char display = 0; - - ST7579_String(yPosition, xPosition, "0x", bigFont); - xPosition += (6 + (bigFont * 12)) * 2; - if(number == 0) { - ST7579_Char(yPosition, xPosition, '0', bigFont); - } - while(mask > number) { - mask /= 16; - chNumber--; - } - for(chIndex = 0; chIndex < chNumber; chIndex++) { - display = (number / mask) % 16; - mask /= 16; - if(display <= 9) { - display += 0x30; - } else { - display += 0x37; - } - ST7579_Char(yPosition, xPosition, display, bigFont); - xPosition += 6 + (bigFont * 12); - } -} -/***************************************************************************//** - * @brief Sends an image array to ST7579 controller. - * - * @param yPosition - Y address of RAM. - * @param xPosition - X address of RAM. - * @param image - The image array. - * @param width - The width of the image (pixels). - * @param height - The height of the image (pixels). - * - * @return None. - *******************************************************************************/ -void -ST7579_Image(unsigned char yPosition, - unsigned char xPosition, - const unsigned char image[], - unsigned char width, - unsigned char height) -{ - unsigned short index = 0; - - for(index = 0; index < (width * height / 8); index++) { - if(!(index % width)) { - /* Set the X and Y address of RAM. */ - ST7579_GoTo(yPosition, xPosition); - yPosition++; - } - ST7579_WriteByte(image[index]); - } -} diff --git a/ST7579.h b/ST7579.h deleted file mode 100644 index 92a47bfde..000000000 --- a/ST7579.h +++ /dev/null @@ -1,100 +0,0 @@ -/***************************************************************************//** - * @file ST7579.h - * @brief Header file of ST7579 Driver. - * @author DBogdan (dragos.bogdan@analog.com) - ******************************************************************************** - * Copyright 2012(c) Analog Devices, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - Neither the name of Analog Devices, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - The use of this software may or may not infringe the patent rights - * of one or more patent holders. This license does not release you - * from the requirement that you obtain separate licenses from these - * patent holders to use this software. - * - Use of the software either in source or binary form, must be run - * on or directly connected to an Analog Devices Inc. component. - * - * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ******************************************************************************** - * SVN Revision: $WCREV$ - *******************************************************************************/ -#ifndef __ST7579_H__ -#define __ST7579_H__ - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ - -/*! Transmits 8 bits to ST7579 controller. */ -void ST7579_WriteByte(unsigned char data); - -/*! Sets X and Y adress of RAM. */ -void ST7579_GoTo(unsigned char yPosition, - unsigned char xPosition); - -/*! Clears ST7579 RAM. */ -void ST7579_Clear(void); - -/*! Initializes the ST7579 controller. */ -char ST7579_Init(void); - -/*! Sends a character to ST7579 controller. */ -void ST7579_Char(unsigned char yPosition, - unsigned char xPosition, - unsigned char character, - unsigned char bigFont); - -/*! Sends a string to ST7579 controller. */ -void ST7579_String(unsigned char yPosition, - unsigned char xPosition, - unsigned char *string, - unsigned char bigFont); - -/*! Sends an integer number to ST7579 controller. */ -void ST7579_Number(unsigned char yPosition, - unsigned char xPosition, - long number, - unsigned char bigFont); - -/*! Sends a float number to ST7579 controller. */ -void ST7579_FloatNumber(unsigned char yPosition, - unsigned char xPosition, - float number, - unsigned char resolution, - unsigned char bigFont); - -/*! Sends an integer number in Hexa format to ST7579 controller. */ -void ST7579_HexNumber(unsigned char yPosition, - unsigned char xPosition, - long number, - unsigned char bigFont); - -/*! Sends an image array to ST7579 controller. */ -void ST7579_Image(unsigned char yPosition, - unsigned char xPosition, - const unsigned char image[], - unsigned char width, - unsigned char height); - -#endif /* __ST7579_H__ */ diff --git a/TIME.c b/TIME.c deleted file mode 100644 index 30c352b5d..000000000 --- a/TIME.c +++ /dev/null @@ -1,164 +0,0 @@ -/***************************************************************************//** - * @file TIME.c - * @brief Implementation of TIME Driver for RENESAS RL78G14 Processor. - * @author Dan Nechita - ******************************************************************************** - * Copyright 2012(c) Analog Devices, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - Neither the name of Analog Devices, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - The use of this software may or may not infringe the patent rights - * of one or more patent holders. This license does not release you - * from the requirement that you obtain separate licenses from these - * patent holders to use this software. - * - Use of the software either in source or binary form, must be run - * on or directly connected to an Analog Devices Inc. component. - * - * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ******************************************************************************** - * SVN Revision: $WCREV$ - *******************************************************************************/ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#include "RDKRL78G14.h" /* RDKRL78G14 definitions. */ -#include "TIME.h" /* TIME definitions. */ - -/*****************************************************************************/ -/************************** Macros Definitions *******************************/ -/*****************************************************************************/ -#define TIMER_CNT_INTERVAL 65536 - -/*****************************************************************************/ -/************************ Variables Declarations *****************************/ -/*****************************************************************************/ -unsigned short overflowCounter = 0; - -/******************************************************************************/ -/************************ Functions Definitions *******************************/ -/******************************************************************************/ - -/***************************************************************************//** - * @brief INTTM00 interrupt service routine. - * - * @return None. - *******************************************************************************/ -#pragma vector = INTTM00_vect -__interrupt static void -Timer0InterruptHandler(void) -{ - overflowCounter++; -} -/***************************************************************************//** - * @brief Initializes the timer used in this driver. - * - * @return status - Result of the initialization procedure. - * Example: 0 - if initialization was successful; - * -1 - if initialization was unsuccessful. - *******************************************************************************/ -char -TIME_Init(void) -{ - PER0 |= 0x0001; /* Enable Supply for Unit 0 that contains timers 0..7. */ - TT0 |= 0x0001; /* Stop channel 0(Timer 0). */ - TPS0 = 0x0005; /* CK00 = FCLK / 32. */ - TMR00 |= 0x0000; /* CK00 input clock for channel 0. */ - TMMK00 = 1; /* Disable INTTM00 interrupt. */ - TMIF00 = 0; /* Clear INTM00 interrupt flag. */ - /* Set INTTM00 low priority */ - TMPR100 = 1; - TMPR000 = 1; - /* Configure channel 0 as a interval timer. */ - TMR00 |= 0x0000; /* Interval timer mode. */ - TO0 &= ~0x0001; /* Timer 0 output value is "0". */ - TOE0 &= ~0x0001; /* Disable output of timer 0. */ - TMMK00 = 0; /* Enable INTTM00 interrupt. */ - - return 0; -} -/***************************************************************************//** - * @brief The timer begins to count in steps of microseconds(us) until the user - * calls a stop measurement function. - * - * @return None. - *******************************************************************************/ -void -TIME_StartMeasure(void) -{ - TDR00 = 0xFFFF; - overflowCounter = 0; - TS0 |= 0x0001; /* Start timer 0. */ - TMIF00 = 0; /* Clear INTM00 interrupt flag. */ -} -/***************************************************************************//** - * @brief Stops the measurement process when the functions is called. - * - * @return Time(in microseconds) elapsed since the measurement began. - *******************************************************************************/ -unsigned long -TIME_StopMeasure(void) -{ - unsigned long elapsedUs = 0; - unsigned short timerCnt = 0; - - timerCnt = TCR00; - TT0 |= 0x0001; /* Stop Timer 0. */ - TMIF00 = 0; /* Clear INTM00 interrupt flag. */ - overflowCounter = 0; - elapsedUs = ((unsigned long)overflowCounter * TIMER_CNT_INTERVAL) + - (0xFFFF - timerCnt); - - return elapsedUs; -} -/***************************************************************************//** - * @brief Creates a delay of microseconds. - * - * @return None. - *******************************************************************************/ -void -TIME_DelayUs(unsigned short usUnits) -{ - TDR00 = usUnits; - TS0 |= 0x0001; /* Start timer 0. */ - while(!overflowCounter) { - } - overflowCounter = 0; - TT0 |= 0x0001; /* Stop Timer 0. */ -} -/***************************************************************************//** - * @brief Creates a delay of milliseconds. - * - * @return None. - *******************************************************************************/ -void -TIME_DelayMs(unsigned short msUnits) -{ - TDR00 = 0x3E7; /* 0x3E7 = 999(decimal). Timer will count down to 0. */ - TS0 |= 0x0001; /* Start timer 0. */ - while(overflowCounter < msUnits) { - } - overflowCounter = 0; - TT0 |= 0x0001; /* Stop Timer 0. */ -} diff --git a/TIME.h b/TIME.h deleted file mode 100644 index 8b3037701..000000000 --- a/TIME.h +++ /dev/null @@ -1,65 +0,0 @@ -/***************************************************************************//** - * @file TIME.h - * @brief Header file of TIME Driver for RENESAS RL78G14 Processor. - * @author Dan Nechita - ******************************************************************************** - * Copyright 2012(c) Analog Devices, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - Neither the name of Analog Devices, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - The use of this software may or may not infringe the patent rights - * of one or more patent holders. This license does not release you - * from the requirement that you obtain separate licenses from these - * patent holders to use this software. - * - Use of the software either in source or binary form, must be run - * on or directly connected to an Analog Devices Inc. component. - * - * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ******************************************************************************** - * SVN Revision: $WCREV$ - *******************************************************************************/ -#ifndef __TIME_H__ -#define __TIME_H__ - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ - -/*! Initializes the timer used in this driver. */ -char TIME_Init(void); - -/*! The timer begins to count in steps of microseconds(us) until the user calls - a stop measurement function. */ -void TIME_StartMeasure(void); - -/*! Stops the measurement process when the functions is called. */ -unsigned long TIME_StopMeasure(void); - -/*! Creates a delay of microseconds. */ -void TIME_DelayUs(unsigned short usUnits); - -/*! Creates a delay of milliseconds. */ -void TIME_DelayMs(unsigned short msUnits); - -#endif /* __TIME_H__ */ diff --git a/Communication.c b/cpu/rl78/Communication.c similarity index 100% rename from Communication.c rename to cpu/rl78/Communication.c diff --git a/Communication.h b/cpu/rl78/Communication.h similarity index 100% rename from Communication.h rename to cpu/rl78/Communication.h From 174d4dd80c09b7086e449e16d1606066bf395035 Mon Sep 17 00:00:00 2001 From: Ian Martin Date: Sat, 4 Jan 2014 18:56:51 -0500 Subject: [PATCH 18/20] Adds support for ADF7023 sub-GHz radio from Analog Devices and RL78 series MCU from Renesas. This example platform for this port is the EVAL-ADF7XXXMB4Z w/ radio daughter cards: http://www.analog.com/en/evaluation/eval-adf7023/eb.html See the platform readme for usage and platform information: https://github.com/contiki-os/contiki/tree/master/platform/eval-adf7xxxmb4z/readme.md All files provided by Analog Devices for this port are released under the same license as Contiki and copyright Analog Devices Inc. per agreement between Redwire Consulting, LLC and Analog Devices Inc. (SOW 08122013) --- .gitignore | 4 + .travis.yml | 7 +- cpu/rl78/Communication.c | 537 ++- cpu/rl78/Communication.h | 89 +- cpu/rl78/Makefile.rl78 | 190 + cpu/rl78/R5F100xL.ld | 20 +- cpu/rl78/adf7023/ADF7023.c | 611 ++- cpu/rl78/adf7023/ADF7023.h | 73 +- cpu/rl78/adf7023/ADF7023_Config.h | 98 +- cpu/rl78/adf7023/adf7023-contiki.c | 160 + cpu/rl78/adf7023/adf7023-contiki.h | 67 + cpu/rl78/contiki-uart.c | 41 + cpu/rl78/contiki-uart.h | 40 + cpu/rl78/crt0.S | 2 +- cpu/rl78/mtarch.h | 52 + cpu/rl78/rl78-sys.h | 5 +- cpu/rl78/rl78.h | 50 + cpu/rl78/rtimer-arch.h | 48 + cpu/rl78/sfrs-ext.h | 5290 +++++++++++++++++++++ cpu/rl78/sfrs.h | 3277 +++++++++++++ cpu/rl78/slip-arch.c | 59 + cpu/rl78/slip-arch.h | 35 + cpu/rl78/sys/clock.c | 126 + cpu/rl78/uart0.c | 145 +- cpu/rl78/uart0.h | 40 +- cpu/rl78/watchdog.c | 42 + cpu/rl78/write.c | 50 + cpu/rl78/write.h | 35 + platform/eval-adf7xxxmb4z/README.md | 128 + platform/eval-adf7xxxmb4z/button-sensor.c | 74 + platform/eval-adf7xxxmb4z/contiki-conf.h | 195 + platform/eval-adf7xxxmb4z/contiki-main.c | 258 + platform/eval-adf7xxxmb4z/platform-conf.h | 58 + regression-tests/01-compile-base/Makefile | 2 + 34 files changed, 11483 insertions(+), 425 deletions(-) create mode 100755 cpu/rl78/Makefile.rl78 create mode 100644 cpu/rl78/adf7023/adf7023-contiki.c create mode 100644 cpu/rl78/adf7023/adf7023-contiki.h create mode 100644 cpu/rl78/contiki-uart.c create mode 100644 cpu/rl78/contiki-uart.h create mode 100644 cpu/rl78/mtarch.h create mode 100755 cpu/rl78/rl78.h create mode 100644 cpu/rl78/rtimer-arch.h create mode 100644 cpu/rl78/sfrs-ext.h create mode 100644 cpu/rl78/sfrs.h create mode 100644 cpu/rl78/slip-arch.c create mode 100644 cpu/rl78/slip-arch.h create mode 100644 cpu/rl78/sys/clock.c create mode 100644 cpu/rl78/watchdog.c create mode 100644 cpu/rl78/write.c create mode 100644 cpu/rl78/write.h create mode 100644 platform/eval-adf7xxxmb4z/README.md create mode 100644 platform/eval-adf7xxxmb4z/button-sensor.c create mode 100644 platform/eval-adf7xxxmb4z/contiki-conf.h create mode 100644 platform/eval-adf7xxxmb4z/contiki-main.c create mode 100644 platform/eval-adf7xxxmb4z/platform-conf.h diff --git a/.gitignore b/.gitignore index 1641ceb39..2f8a3d89e 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,7 @@ contiki-cc2530dk.lib #regression tests artifacts *.testlog + +# rl78 build artifacts +*.eval-adf7xxxmb4z +*.eval-adf7xxxmb4z.srec diff --git a/.travis.yml b/.travis.yml index 9e4112ad4..c6de5449d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,12 +16,17 @@ before_script: https://raw.github.com/wiki/malvira/libmc1322x/files/arm-2008q3-66-arm-none-eabi-i686-pc-linux-gnu.tar.bz2 \ | tar xjf - -C /tmp/ && sudo cp -f -r /tmp/arm-2008q3/* /usr/ && rm -rf /tmp/arm-2008q3 && arm-none-eabi-gcc --version || true" + ## Install RL78 GCC chain (following the instructions in platform/eval-adf7xxxmb4z/README.md) + - "sudo apt-get install git make gcc libc-dev multiarch-support libncurses5:i386 zlib1g:i386" + - "wget https://dl.dropboxusercontent.com/u/60522916/gnurl78-v13.02-elf_1-2_i386.deb" + - "sudo dpkg -i gnurl78*.deb" + ## Install SDCC from a purpose-built bundle - "[ ${BUILD_ARCH:-0} = 8051 ] && curl -s \ https://raw.github.com/wiki/g-oikonomou/contiki-sensinode/files/sdcc.tar.gz \ | tar xzf - -C /tmp/ && sudo cp -f -r /tmp/sdcc/* /usr/local/ && rm -rf /tmp/sdcc && sdcc --version || true" - "[ ${BUILD_ARCH:-0} = 8051 ] && sudo apt-get -qq install srecord || true" - + ## Clone and build cc65 when testing 6502 ports - "[ ${BUILD_ARCH:-0} = 6502 ] && git clone \ https://github.com/oliverschmidt/cc65 /tmp/cc65 && \ diff --git a/cpu/rl78/Communication.c b/cpu/rl78/Communication.c index 48140964a..a33140ffe 100644 --- a/cpu/rl78/Communication.c +++ b/cpu/rl78/Communication.c @@ -1,50 +1,66 @@ -/***************************************************************************//** - * @file Communication.c - * @brief Implementation of the Communication Driver for RL78G14 processor. - * @author DBogdan (dragos.bogdan@analog.com) - ******************************************************************************** - * Copyright 2012(c) Analog Devices, Inc. - * +/* + * Copyright (c) 2014, Analog Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - Neither the name of Analog Devices, Inc. nor the names of its + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * - The use of this software may or may not infringe the patent rights - * of one or more patent holders. This license does not release you - * from the requirement that you obtain separate licenses from these - * patent holders to use this software. - * - Use of the software either in source or binary form, must be run - * on or directly connected to an Analog Devices Inc. component. * - * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ******************************************************************************** - * SVN Revision: $WCREV$ - *******************************************************************************/ + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Dragos Bogdan , Ian Martin + */ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ + +#include + +#include "rl78.h" + #include "Communication.h" /* Communication definitions */ -#include "RDKRL78G14.h" /* RDKRL78G14 definitions */ + +#ifndef NOP +#define NOP asm ("nop") +#endif + +/* Enable interrupts: */ +#ifndef EI +#ifdef __GNUC__ +#define EI asm ("ei"); +#else +#define EI __enable_interrupt(); +#endif +#endif + +#undef BIT +#define BIT(n) (1 << (n)) + +#define CLK_SCALER (0x4) +#define SCALED_CLK (f_CLK / (1 << CLK_SCALER)) +#define BITBANG_SPI 1 char IICA0_Flag; @@ -57,8 +73,7 @@ char IICA0_Flag; * * @return None. *******************************************************************************/ -#pragma vector = INTIICA0_vect -__interrupt static void +/*__interrupt */ static void IICA0_Interrupt(void) { IICA0_Flag = 1; @@ -87,25 +102,40 @@ IICA0_Interrupt(void) * -1 - if initialization was unsuccessful. *******************************************************************************/ char -SPI_Init(char lsbFirst, +SPI_Init(enum CSI_Bus bus, + char lsbFirst, long clockFreq, char clockPol, char clockEdg) { - long mckFreq = 32000000; +#if BITBANG_SPI + PIOR5 = 1; /* Move SPI/I2C/UART functions from Port 0 pins 2-4 to Port 8. */ + + /* Configure SCLK as an output. */ + PM0 &= ~BIT(4); + POM0 &= ~BIT(4); + + /* Configure MOSI as an output: */ + PM0 &= ~BIT(2); + POM0 &= ~BIT(2); + PMC0 &= ~BIT(2); + + /* Configure MISO as an input: */ + PM0 |= BIT(3); + PMC0 &= ~BIT(3); +#else char sdrValue = 0; char delay = 0; + uint16_t scr; + uint8_t shift; - /* Configure the CS pins. */ - PMOD1_CS_OUT; - PMOD1_CS_HIGH; - PMOD2_CS_OUT; - PMOD2_CS_HIGH; - ST7579_CS_OUT; - ST7579_CS_HIGH; + PIOR5 = 0; /* Keep SPI functions on Port 0 pins 2-4. */ /* Enable input clock supply. */ - SAU1EN = 1; + if(bus <= CSI11) { + SAU0EN = 1; + } else { SAU1EN = 1; + } /* After setting the SAUmEN bit to 1, be sure to set serial clock select register m (SPSm) after 4 or more fCLK clocks have elapsed. */ @@ -115,36 +145,195 @@ SPI_Init(char lsbFirst, NOP; /* Select the fCLK as input clock. */ - SPS1 = 0x0000; - + if(bus <= CSI11) { + SPS0 = (CLK_SCALER << 4) | CLK_SCALER; /* TODO: kludge */ + } else { SPS1 = (CLK_SCALER << 4) | CLK_SCALER; /* TODO: kludge */ + } /* Select the CSI operation mode. */ - SMR11 = 0x0020; + switch(bus) { + case CSI00: SMR00 = 0x0020; + break; + case CSI01: SMR01 = 0x0020; + break; + case CSI10: SMR02 = 0x0020; + break; + case CSI11: SMR03 = 0x0020; + break; + case CSI20: SMR10 = 0x0020; + break; + case CSI21: SMR11 = 0x0020; + break; + case CSI30: SMR12 = 0x0020; + break; + case CSI31: SMR13 = 0x0020; + break; + } clockPol = 1 - clockPol; - SCR11 = (clockEdg << 13) | + scr = (clockEdg << 13) | (clockPol << 12) | 0xC000 | /* Operation mode: Transmission/reception. */ 0x0007; /* 8-bit data length. */ + switch(bus) { + case CSI00: SCR00 = scr; + break; + case CSI01: SCR01 = scr; + break; + case CSI10: SCR02 = scr; + break; + case CSI11: SCR03 = scr; + break; + case CSI20: SCR10 = scr; + break; + case CSI21: SCR11 = scr; + break; + case CSI30: SCR12 = scr; + break; + case CSI31: SCR13 = scr; + break; + } /* clockFreq = mckFreq / (sdrValue * 2 + 2) */ - sdrValue = mckFreq / (2 * clockFreq) - 1; - SDR11 = sdrValue << 9; + sdrValue = SCALED_CLK / (2 * clockFreq) - 1; + sdrValue <<= 9; + switch(bus) { + case CSI00: SDR00 = sdrValue; + break; + case CSI01: SDR01 = sdrValue; + break; + case CSI10: SDR02 = sdrValue; + break; + case CSI11: SDR03 = sdrValue; + break; + case CSI20: SDR10 = sdrValue; + break; + case CSI21: SDR11 = sdrValue; + break; + case CSI30: SDR12 = sdrValue; + break; + case CSI31: SDR13 = sdrValue; + break; + } /* Set the clock and data initial level. */ clockPol = 1 - clockPol; - SO1 &= ~0x0202; - SO1 |= (clockPol << 9) | - (clockPol << 1); + shift = bus & 0x3; + if(bus <= CSI11) { + SO0 &= ~(0x0101 << shift); + SO0 |= ((clockPol << 8) | clockPol) << shift; + } else { + SO1 &= ~(0x0101 << shift); + SO1 |= ((clockPol << 8) | clockPol) << shift; + } /* Enable output for serial communication operation. */ - SOE1 |= 0x0002; + switch(bus) { + case CSI00: SOE0 |= BIT(0); + break; + case CSI01: SOE0 |= BIT(1); + break; + case CSI10: SOE0 |= BIT(2); + break; + case CSI11: SOE0 |= BIT(3); + break; + case CSI20: SOE1 |= BIT(0); + break; + case CSI21: SOE1 |= BIT(1); + break; + case CSI30: SOE1 |= BIT(2); + break; + case CSI31: SOE1 |= BIT(3); + break; + } - /* Configure the MISO pin as input. */ - PM7 |= 0x02; + switch(bus) { + case CSI00: + /* SO00 output: */ + P1 |= BIT(2); + PM1 &= ~BIT(2); - /* Configure SCLK and MOSI pins as output. */ - P7 |= 0x05; - PM7 &= ~0x05; + /* SI00 input: */ + PM1 |= BIT(1); + + /* SCK00N output: */ + P1 |= BIT(0); + PM1 &= ~BIT(0); + break; + + case CSI01: + /* SO01 output: */ + P7 |= BIT(3); + PM7 &= ~BIT(3); + + /* SI01 input: */ + PM7 |= BIT(4); + + /* SCK01 output: */ + P7 |= BIT(5); + PM7 &= ~BIT(5); + break; + + case CSI10: + PMC0 &= ~BIT(2); /* Disable analog input on SO10. */ + + /* SO10 output: */ + P0 |= BIT(2); + PM0 &= ~BIT(2); + + /* SI10 input: */ + PM0 |= BIT(3); + + /* SCK10N output: */ + P0 |= BIT(4); + PM0 &= ~BIT(4); + break; + + case CSI11: + /* SO11 output: */ + P5 |= BIT(1); + PM5 &= ~BIT(1); + + /* SI11 input: */ + PM5 |= BIT(0); + + /* SCK11 output: */ + P3 |= BIT(0); + PM3 &= ~BIT(0); + break; + + case CSI20: + /* SO20 output: */ + P1 |= BIT(3); + PM1 &= ~BIT(3); + + /* SI20 input: */ + PM1 |= BIT(4); + + /* SCK20 output: */ + P1 |= BIT(5); + PM1 &= ~BIT(5); + break; + + case CSI21: + /* SO21 output: */ + P7 |= BIT(2); + PM7 &= ~BIT(2); + + /* SI21 input: */ + PM7 |= BIT(1); + + /* SCK21 output: */ + P7 |= BIT(0); + PM7 &= ~BIT(0); + break; + + case CSI30: + /* TODO: not supported */ + break; + case CSI31: + /* TODO: not supported */ + break; + } /* Wait for the changes to take place. */ for(delay = 0; delay < 50; delay++) { @@ -152,7 +341,44 @@ SPI_Init(char lsbFirst, } /* Set the SEmn bit to 1 and enter the communication wait status */ - SS1 |= 0x0002; + switch(bus) { + case CSI00: SS0 = BIT(0); + break; + case CSI01: SS0 = BIT(1); + break; + case CSI10: SS0 = BIT(2); + break; + case CSI11: SS0 = BIT(3); + break; + case CSI20: SS1 = BIT(0); + break; + case CSI21: SS1 = BIT(1); + break; + case CSI30: SS1 = BIT(2); + break; + case CSI31: SS1 = BIT(3); + break; + } + + /* Sanity check: */ + if(bus == CSI10) { + /* MOSI: */ + PIOR5 = 0; + PMC02 = 0; + PM02 = 0; + P02 = 1; + + /* MISO: */ + PIOR5 = 0; + PMC03 = 0; + PM03 = 1; + + /* SCLK: */ + PIOR5 = 0; + PM04 = 0; + P04 = 1; + } +#endif return 0; } @@ -165,8 +391,10 @@ SPI_Init(char lsbFirst, * * @return Number of written bytes. *******************************************************************************/ +#if 0 char -SPI_Write(char slaveDeviceId, +SPI_Write(enum CSI_Bus bus, + char slaveDeviceId, unsigned char *data, char bytesNumber) { @@ -175,43 +403,84 @@ SPI_Write(char slaveDeviceId, unsigned short originalSCR = 0; unsigned short originalSO1 = 0; - if(slaveDeviceId == 1) { - PMOD1_CS_LOW; - } - if(slaveDeviceId == 2) { - PMOD2_CS_LOW; - } - if(slaveDeviceId == 3) { - ST1 |= 0x0002; - originalSO1 = SO1; - originalSCR = SCR11; - SO1 &= ~0x0202; - SCR11 &= ~0x3000; - SS1 |= 0x0002; - ST7579_CS_LOW; + volatile uint8_t *sio; + volatile uint16_t *ssr; + + switch(bus) { + default: + case CSI00: sio = &SIO00; + ssr = &SSR00; + break; + case CSI01: sio = &SIO01; + ssr = &SSR01; + break; + case CSI10: sio = &SIO10; + ssr = &SSR02; + break; + case CSI11: sio = &SIO11; + ssr = &SSR03; + break; + case CSI20: sio = &SIO20; + ssr = &SSR10; + break; + case CSI21: sio = &SIO21; + ssr = &SSR11; + break; + case CSI30: sio = &SIO30; + ssr = &SSR12; + break; + case CSI31: sio = &SIO31; + ssr = &SSR13; + break; } + for(byte = 0; byte < bytesNumber; byte++) { - SIO21 = data[byte]; + *sio = data[byte]; NOP; - while(SSR11 & 0x0040) ; - read = SIO21; - } - if(slaveDeviceId == 1) { - PMOD1_CS_HIGH; - } - if(slaveDeviceId == 2) { - PMOD2_CS_HIGH; - } - if(slaveDeviceId == 3) { - ST7579_CS_HIGH; - ST1 |= 0x0002; - SO1 = originalSO1; - SCR11 = originalSCR; - SS1 |= 0x0002; + while(*ssr & 0x0040) ; + read = *sio; } return bytesNumber; } +#endif + +#if BITBANG_SPI +#define sclk_low() (P0 &= ~BIT(4)) +#define sclk_high() (P0 |= BIT(4)) +#define mosi_low() (P0 &= ~BIT(2)) +#define mosi_high() (P0 |= BIT(2)) +#define read_miso() (P0bits.bit3) + +static unsigned char +spi_byte_exchange(unsigned char tx) +{ + unsigned char rx = 0, n = 0; + + sclk_low(); + + for(n = 0; n < 8; n++) { + if(tx & 0x80) { + mosi_high(); + } else { mosi_low(); + } + + /* The slave samples MOSI at the rising-edge of SCLK. */ + sclk_high(); + + rx <<= 1; + rx |= read_miso(); + + tx <<= 1; + + /* The slave changes the value of MISO at the falling-edge of SCLK. */ + sclk_low(); + } + + return rx; +} +#endif + /***************************************************************************//** * @brief Reads data from SPI. * @@ -223,48 +492,64 @@ SPI_Write(char slaveDeviceId, * @return Number of read bytes. *******************************************************************************/ char -SPI_Read(char slaveDeviceId, +SPI_Read(enum CSI_Bus bus, + char slaveDeviceId, unsigned char *data, char bytesNumber) { +#if BITBANG_SPI + unsigned char n = 0; + for(n = 0; n < bytesNumber; n++) { + data[n] = spi_byte_exchange(data[n]); + } +#else char byte = 0; unsigned short originalSCR = 0; unsigned short originalSO1 = 0; - if(slaveDeviceId == 1) { - PMOD1_CS_LOW; - } - if(slaveDeviceId == 2) { - PMOD2_CS_LOW; - } - if(slaveDeviceId == 3) { - ST1 |= 0x0002; - originalSO1 = SO1; - originalSCR = SCR11; - SO1 &= ~0x0202; - SCR11 &= ~0x3000; - SS1 |= 0x0002; - ST7579_CS_LOW; + volatile uint8_t *sio; + volatile uint16_t *ssr; + char dummy; + + switch(bus) { + default: + case CSI00: sio = &SIO00; + ssr = &SSR00; + break; + case CSI01: sio = &SIO01; + ssr = &SSR01; + break; + case CSI10: sio = &SIO10; + ssr = &SSR02; + break; + case CSI11: sio = &SIO11; + ssr = &SSR03; + break; + case CSI20: sio = &SIO20; + ssr = &SSR10; + break; + case CSI21: sio = &SIO21; + ssr = &SSR11; + break; + case CSI30: sio = &SIO30; + ssr = &SSR12; + break; + case CSI31: sio = &SIO31; + ssr = &SSR13; + break; } + + /* Flush the receive buffer: */ + while(*ssr & 0x0020) dummy = *sio; + (void)dummy; + for(byte = 0; byte < bytesNumber; byte++) { - SIO21 = data[byte]; + *sio = data[byte]; NOP; - while(SSR11 & 0x0040) ; - data[byte] = SIO21; - } - if(slaveDeviceId == 1) { - PMOD1_CS_HIGH; - } - if(slaveDeviceId == 2) { - PMOD2_CS_HIGH; - } - if(slaveDeviceId == 3) { - ST7579_CS_HIGH; - ST1 |= 0x0002; - SO1 = originalSO1; - SCR11 = originalSCR; - SS1 |= 0x0002; + while(*ssr & 0x0040) ; + data[byte] = *sio; } +#endif return bytesNumber; } @@ -284,6 +569,8 @@ I2C_Init(long clockFreq) unsigned char wlValue = 0; unsigned char whValue = 0; + (void)IICA0_Interrupt; /* Prevent an unused-function warning. */ + /* Enable interrupts */ EI; diff --git a/cpu/rl78/Communication.h b/cpu/rl78/Communication.h index c14bcbdeb..9e3141d50 100644 --- a/cpu/rl78/Communication.h +++ b/cpu/rl78/Communication.h @@ -1,58 +1,43 @@ -/***************************************************************************//** - * @file Communication.h - * @brief Header file of the Communication Driver for RL78G14 processor. - * @author DBogdan (dragos.bogdan@analog.com) - ******************************************************************************** - * Copyright 2012(c) Analog Devices, Inc. - * +/* + * Copyright (c) 2014, Analog Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - Neither the name of Analog Devices, Inc. nor the names of its + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * - The use of this software may or may not infringe the patent rights - * of one or more patent holders. This license does not release you - * from the requirement that you obtain separate licenses from these - * patent holders to use this software. - * - Use of the software either in source or binary form, must be run - * on or directly connected to an Analog Devices Inc. component. * - * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ******************************************************************************** - * SVN Revision: $WCREV$ - *******************************************************************************/ + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Dragos Bogdan + */ + #ifndef __COMMUNICATION_H__ #define __COMMUNICATION_H__ -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#include "RDKRL78G14.h" - /******************************************************************************/ /*************************** Macros Definitions *******************************/ /******************************************************************************/ -#define SPI_CS_PIN_OUT PMOD1_CS_OUT -#define SPI_CS_LOW PMOD1_CS_LOW -#define SPI_CS_HIGH PMOD1_CS_HIGH #define SPI_MISO PMOD1_MISO #define GPIO1_PIN_OUT PMOD1_GPIO1_PIN_OUT @@ -75,19 +60,33 @@ /************************ Functions Declarations ******************************/ /******************************************************************************/ +enum CSI_Bus { + CSI00, + CSI01, + CSI10, + CSI11, + CSI20, + CSI21, + CSI30, + CSI31, +}; + /*! Initializes the SPI communication peripheral. */ -char SPI_Init(char lsbFirst, +char SPI_Init(enum CSI_Bus bus, + char lsbFirst, long clockFreq, char clockPol, char clockEdg); /*! Writes data to SPI. */ -char SPI_Write(char slaveDeviceId, +char SPI_Write(enum CSI_Bus bus, + char slaveDeviceId, unsigned char *data, char bytesNumber); /*! Reads data from SPI. */ -char SPI_Read(char slaveDeviceId, +char SPI_Read(enum CSI_Bus bus, + char slaveDeviceId, unsigned char *data, char bytesNumber); diff --git a/cpu/rl78/Makefile.rl78 b/cpu/rl78/Makefile.rl78 new file mode 100755 index 000000000..62853e42d --- /dev/null +++ b/cpu/rl78/Makefile.rl78 @@ -0,0 +1,190 @@ +# Copyright (c) 2014, Analog Devices, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Author: Ian Martin + +CONTIKI_CPU=$(CONTIKI)/cpu/rl78 + +### Compiler definitions +ifdef IAR + # Use IAR compiler. + + # Default code and data models (n = near, f = far): + CODE_MODEL ?= n + DATA_MODEL ?= n + + DEVICE ?= r5f100ll + + # According to "rl78/config/devices/RL78 - G13/r5f100ll.menu", the R5F100LLA has core 1. + CORE ?= 1 + + # Default library configuration (n = normal, f = full): + LIB_CONFIG ?= n + + IAR_PATH ?= C:\\Program\ Files\\IAR\ Systems\\Embedded\ Workbench\ 6.5\\rl78 + + CC = $(IAR_PATH)\\bin\\iccrl78 + LD = $(IAR_PATH)\\bin\\xlink + AR = $(IAR_PATH)\\bin\\xar + + CFLAGS += --silent + CFLAGS += --debug + CFLAGS += --core rl78_$(CORE) + CFLAGS += --code_model $(CODE_MODEL) + CFLAGS += --data_model $(DATA_MODEL) + CFLAGS += -I$(IAR_PATH)\\lib + + LDFLAGS += -S + LDFLAGS += -D_NEAR_CONST_LOCATION=0 + LDFLAGS += -D_NEAR_CONST_LOCATION_START=03000 + LDFLAGS += -D_NEAR_CONST_LOCATION_END=07EFF + LDFLAGS += -D_NEAR_HEAP_SIZE=400 + LDFLAGS += -D_FAR_HEAP_SIZE=4000 + LDFLAGS += -D_CSTACK_SIZE=400 + LDFLAGS += -s __program_start + LDFLAGS += -f $(IAR_PATH)\\config\\lnk$(DEVICE).xcl + LDFLAGS += -Felf + + AROPTS ?= -S + + TARGET_LIBFILES += $(IAR_PATH)\\lib\\dlrl78$(CODE_MODEL)$(DATA_MODEL)$(CORE)$(LIB_CONFIG).r87 + +CUSTOM_RULE_C_TO_O = 1 +%.o: %.c + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) $< -o $@ + +CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 +$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR) + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) $< --dependencies=m $(@:.o=.P) -o $@ + +CUSTOM_RULE_C_TO_CO = 1 +%.co: %.c + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@ + +# The only reason we use a custom link rule here is to simultaneously produce an srec file. +CUSTOM_RULE_LINK = 1 +%.$(TARGET) %.$(TARGET).srec: %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a + $(TRACE_LD) + $(Q)$(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} \ + ${filter %.a,$^} $(TARGET_LIBFILES) -o $@ -Omotorola=$@.srec +else + # Use the GNU RL78 toolchain. + + ifndef CROSS_COMPILE + ifeq ($(shell which rl78-elf-gcc),) + # The RL78 toolchain is not in the path. Try finding it in /usr/share: + CROSS_COMPILE := $(shell echo /usr/share/*rl78*/bin | tail -1)/rl78-elf- + else + # The RL78 toolchain is in the path. Use it directly: + CROSS_COMPILE := rl78-elf- + endif + endif + + CC = $(CROSS_COMPILE)gcc + LD = $(CROSS_COMPILE)gcc + AS = $(CROSS_COMPILE)gcc + AR = $(CROSS_COMPILE)ar + NM = $(CROSS_COMPILE)nm + OBJCOPY = $(CROSS_COMPILE)objcopy + OBJDUMP = $(CROSS_COMPILE)objdump + STRIP = $(CROSS_COMPILE)strip + + ifdef WERROR + CFLAGSWERROR ?= -Werror -pedantic -std=c99 -Werror + endif + + CFLAGSNO ?= -Wall -g $(CFLAGSWERROR) + CFLAGS += $(CFLAGSNO) -O + + CFLAGS += -mmul=g13 + CFLAGS += -Os -ggdb -ffunction-sections -fdata-sections + CFLAGS += -fno-strict-aliasing + + # Enable override of write() function: + CFLAGS += -fno-builtin + LDFLAGS += -fno-builtin + + LDFLAGS += -Wl,--gc-sections -T $(CONTIKI_CPU)/R5F100xL.ld -nostartfiles + + ASFLAGS += -c + + # C runtime assembly: + CONTIKI_ASMFILES += crt0.S + CONTIKI_OBJECTFILES += $(OBJECTDIR)/crt0.o +endif + +ifdef SERIAL_ID + CFLAGS += -DSERIAL_ID='$(SERIAL_ID)' +endif + +### CPU-dependent directories +CONTIKI_CPU_DIRS += . +CONTIKI_CPU_DIRS += sys +CONTIKI_CPU_DIRS += adf7023 + +### CPU-dependent source files +CONTIKI_SOURCEFILES += uart0.c +CONTIKI_SOURCEFILES += clock.c +CONTIKI_SOURCEFILES += write.c + +CONTIKI_SOURCEFILES += Communication.c +CONTIKI_SOURCEFILES += ADF7023.c +CONTIKI_SOURCEFILES += assert.c +CONTIKI_SOURCEFILES += slip-arch.c +CONTIKI_SOURCEFILES += contiki-uart.c +CONTIKI_SOURCEFILES += watchdog.c + +### Compilation rules + +%.so: $(OBJECTDIR)/%.o + $(LD) -shared -o $@ $^ + +ifdef CORE +.PHONY: symbols.c symbols.h +symbols.c symbols.h: + $(NM) -C $(CORE) | grep -v @ | grep -v dll_crt0 | awk -f $(CONTIKI)/tools/mknmlist > symbols.c +else +symbols.c symbols.h: + cp ${CONTIKI}/tools/empty-symbols.c symbols.c + cp ${CONTIKI}/tools/empty-symbols.h symbols.h +endif + +contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} + +%.srec: % + $(OBJCOPY) -O srec $^ $@ + +%.lst: %.elf + $(OBJDUMP) -DS $^ > $@ + +%.lst: % + $(OBJDUMP) -DS $^ > $@ diff --git a/cpu/rl78/R5F100xL.ld b/cpu/rl78/R5F100xL.ld index f062e2c90..f643faed6 100644 --- a/cpu/rl78/R5F100xL.ld +++ b/cpu/rl78/R5F100xL.ld @@ -29,6 +29,9 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/** + * \author DJ Delorie , Ian Martin + */ /* Default linker script, for normal executables */ OUTPUT_ARCH(rl78) @@ -37,13 +40,14 @@ ENTRY(_start) /* Do we need any of these for elf? __DYNAMIC = 0; */ -/* This is for an RL78/G13, 64k flash, 4k ram */ +/* This is for an R5F100xL, 512k flash, 32k ram, 8k data flash */ MEMORY { VEC (r) : ORIGIN = 0x00000, LENGTH = 0x00002 IVEC (r) : ORIGIN = 0x00004, LENGTH = 0x0007c OPT (r) : ORIGIN = 0x000c0, LENGTH = 0x00004 - ROM (r) : ORIGIN = 0x000d8, LENGTH = 0x0ff28 - RAM (w) : ORIGIN = 0xfef00, LENGTH = 0x00fe0 + MIRROR (r): ORIGIN = 0x03000, LENGTH = 0x04f00 + ROM (r) : ORIGIN = 0x07F00, LENGTH = 0x78100 + RAM (w) : ORIGIN = 0xf8000, LENGTH = 0x07ee0 STACK (w) : ORIGIN = 0xffee0, LENGTH = 0x00002 } @@ -51,15 +55,15 @@ SECTIONS { .vec : { - *(.vec) + KEEP(*(.vec)) } > VEC .ivec : { - *(.ivec) + KEEP(*(.ivec)) } > IVEC .opt : { - *(.opt) + KEEP(*(.opt)) } > OPT /* CubeSuite always starts at 0xd8. */ @@ -98,7 +102,7 @@ SECTIONS _edata = .; PROVIDE (edata = .); PROVIDE (__dataend = .); - } > RAM AT> ROM + } > RAM AT> MIRROR /* Note that crt0 assumes this is a multiple of two; all the start/stop symbols are also assumed word-aligned. */ @@ -167,7 +171,7 @@ SECTIONS KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) - } > ROM + } > MIRROR .text : { diff --git a/cpu/rl78/adf7023/ADF7023.c b/cpu/rl78/adf7023/ADF7023.c index 2e5501ce6..c8f30be38 100644 --- a/cpu/rl78/adf7023/ADF7023.c +++ b/cpu/rl78/adf7023/ADF7023.c @@ -1,64 +1,201 @@ -/***************************************************************************//** - * @file ADF7023.c - * @brief Implementation of ADF7023 Driver. - * @author DBogdan (Dragos.Bogdan@analog.com) - ******************************************************************************** - * Copyright 2013(c) Analog Devices, Inc. - * +/* + * Copyright (c) 2014, Analog Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - Neither the name of Analog Devices, Inc. nor the names of its + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * - The use of this software may or may not infringe the patent rights - * of one or more patent holders. This license does not release you - * from the requirement that you obtain separate licenses from these - * patent holders to use this software. - * - Use of the software either in source or binary form, must be run - * on or directly connected to an Analog Devices Inc. component. * - * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ******************************************************************************** - * SVN Revision: $WCREV$ - *******************************************************************************/ + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Dragos Bogdan , Ian Martin + */ + +#include +#include +#include /* for memcmp(). */ +#include -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ #include "ADF7023.h" #include "ADF7023_Config.h" #include "Communication.h" +#include "sfrs.h" +#include "sfrs-ext.h" + +#include "contiki.h" /* for clock_wait() and CLOCK_SECOND. */ + /******************************************************************************/ /*************************** Macros Definitions *******************************/ /******************************************************************************/ -#define ADF7023_CS_ASSERT CS_PIN_LOW -#define ADF7023_CS_DEASSERT CS_PIN_HIGH -#define ADF7023_MISO MISO_PIN +/* + #define ADF7023_CS_ASSERT CS_PIN_LOW + #define ADF7023_CS_DEASSERT CS_PIN_HIGH + #define ADF7023_MISO MISO_PIN + */ + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#endif + +#undef BIT +#define BIT(n) (1 << (n)) + +#define ADF7023_CS_ASSERT (P2 &= ~BIT(2)) +#define ADF7023_CS_DEASSERT (P2 |= BIT(2)) +#define ADF7023_MISO (P0 & BIT(3)) + +#define ADF7023_SPI_BUS (CSI10) + +#define LOOP_LIMIT 100 + +#ifndef ADF7023_VERBOSE +/* ADF7023_VERBOSE Values: */ +/* 2 = Inidicate when breaking stuck while loops. */ +/* 5 = Dump all received and transmitted packets. */ +/* 7 = Dump the ADF7023 commands, interrupt and status words. */ +/* 10 = Dump all SPI transactions. */ + +#define ADF7023_VERBOSE 0 +#endif + +#if (ADF7023_VERBOSE >= 2) +#define break_loop() if(++counter >= LOOP_LIMIT) { printf("Breaking stuck while loop at %s line %u." NEWLINE, __FILE__, __LINE__); break; } +#else +#define break_loop() if(++counter >= LOOP_LIMIT) break +#endif + +#define ADF7023_While(condition, body) do { \ + int counter = 0; \ + while(condition) { body; break_loop(); } \ +} while(0) + +#undef MIN +#define MIN(x, y) (((x) < (y)) ? (x) : (y)) /******************************************************************************/ /************************ Variables Definitions *******************************/ /******************************************************************************/ struct ADF7023_BBRAM ADF7023_BBRAMCurrent; +#if (ADF7023_VERBOSE >= 7) +static unsigned char status_old = 0xff; +static unsigned char int0_old = 0xff; +#endif + +const char *ADF7023_state_lookup[] = { + /* 0x00 */ "Busy, performing a state transition", + /* 0x01 */ "(unknown)", + /* 0x02 */ "(unknown)", + /* 0x03 */ "(unknown)", + /* 0x04 */ "(unknown)", + /* 0x05 */ "Performing CMD_GET_RSSI", + /* 0x06 */ "PHY_SLEEP", + /* 0x07 */ "Performing CMD_IR_CAL", + /* 0x08 */ "Performing CMD_AES_DECRYPT_INIT", + /* 0x09 */ "Performing CMD_AES_DECRYPT", + /* 0x0A */ "Performing CMD_AES_ENCRYPT", + /* 0x0B */ "(unknown)", + /* 0x0C */ "(unknown)", + /* 0x0D */ "(unknown)", + /* 0x0E */ "(unknown)", + /* 0x0F */ "Initializing", + /* 0x10 */ "(unknown)", + /* 0x11 */ "PHY_OFF", + /* 0x12 */ "PHY_ON", + /* 0x13 */ "PHY_RX", + /* 0x14 */ "PHY_TX", +}; + +const char *ADF7023_cmd_lookup[] = { + [CMD_SYNC] = "CMD_SYNC", + [CMD_PHY_OFF] = "CMD_PHY_OFF", + [CMD_PHY_ON] = "CMD_PHY_ON", + [CMD_PHY_RX] = "CMD_PHY_RX", + [CMD_PHY_TX] = "CMD_PHY_TX", + [CMD_PHY_SLEEP] = "CMD_PHY_SLEEP", + [CMD_CONFIG_DEV] = "CMD_CONFIG_DEV", + [CMD_GET_RSSI] = "CMD_GET_RSSI", + [CMD_BB_CAL] = "CMD_BB_CAL", + [CMD_HW_RESET] = "CMD_HW_RESET", + [CMD_RAM_LOAD_INIT] = "CMD_RAM_LOAD_INIT", + [CMD_RAM_LOAD_DONE] = "CMD_RAM_LOAD_DONE", + [CMD_IR_CAL] = "CMD_IR_CAL", + [CMD_AES_ENCRYPT] = "CMD_AES_ENCRYPT", + [CMD_AES_DECRYPT] = "CMD_AES_DECRYPT", + [CMD_AES_DECRYPT_INIT] = "CMD_AES_DECRYPT_INIT", + [CMD_RS_ENCODE_INIT] = "CMD_RS_ENCODE_INIT", + [CMD_RS_ENCODE] = "CMD_RS_ENCODE", + [CMD_RS_DECODE] = "CMD_RS_DECODE", +}; + +static int spi_busy = 0; +static uint8_t tx_rec[255]; +static uint8_t rx_rec[255]; +static uint8_t tx_pos; +static uint8_t rx_pos; + +static void ADF7023_SetCommand_Assume_CMD_READY(unsigned char command); + +void +hexdump(const void *data, size_t len) +{ + size_t n; + if(len <= 0) { + return; + } + printf("%02x", ((const unsigned char *)data)[0]); + for(n = 1; n < len; n++) { + printf(" %02x", ((const unsigned char *)data)[n]); + } +} +void +ADF7023_SPI_Begin(void) +{ + assert(spi_busy == 0); + spi_busy++; + + tx_pos = 0; + rx_pos = 0; + + ADF7023_CS_ASSERT; +} +void +ADF7023_SPI_End(void) +{ + assert(spi_busy > 0); + spi_busy--; + ADF7023_CS_DEASSERT; + +#if (ADF7023_VERBOSE >= 10) + printf("ADF7023_SPI_End(): wrote \""); + hexdump(tx_rec, tx_pos); + printf("\", read \""); + hexdump(rx_rec, rx_pos); + printf("\"." NEWLINE); +#endif +} /***************************************************************************//** * @brief Transfers one byte of data. * @@ -74,10 +211,54 @@ ADF7023_WriteReadByte(unsigned char writeByte, unsigned char data = 0; data = writeByte; - SPI_Read(0, &data, 1); + SPI_Read(ADF7023_SPI_BUS, 0, &data, 1); if(readByte) { *readByte = data; } + + assert(tx_pos < ARRAY_SIZE(tx_rec)); + tx_rec[tx_pos] = writeByte; + tx_pos++; + + assert(rx_pos < ARRAY_SIZE(rx_rec)); + rx_rec[rx_pos] = data; + rx_pos++; +} +void +ADF7023_Wait_for_CMD_READY(void) +{ + unsigned char status; + int counter = 0; + + for(;;) { + break_loop(); + + ADF7023_GetStatus(&status); + + if((status & STATUS_SPI_READY) == 0) { + /* The SPI bus is not ready. Continue polling the status word. */ + continue; + } + + if(status & STATUS_CMD_READY) { + /* The SPI bus is ready and CMD_READY == 1. This is the state we want. */ + break; + } + + if((status & STATUS_FW_STATE) == FW_STATE_PHY_OFF) { + /* SPI is ready, but CMD_READY == 0 and the radio is in state PHY_OFF. */ + /* It seems that the ADF7023 gets stuck in this state sometimes (errata?), so transition to PHY_ON: */ + ADF7023_SetCommand_Assume_CMD_READY(CMD_PHY_ON); + } + } +} +static void +ADF7023_Init_Procedure(void) +{ + ADF7023_SPI_Begin(); + ADF7023_While(!ADF7023_MISO, (void)0); + ADF7023_SPI_End(); + ADF7023_Wait_for_CMD_READY(); } /***************************************************************************//** * @brief Initializes the ADF7023. @@ -90,27 +271,24 @@ char ADF7023_Init(void) { char retVal = 0; - unsigned char miso = 0; - unsigned short timeout = 0; - unsigned char status = 0; + + ADF7023_CS_DEASSERT; + PM2 &= ~BIT(2); /* Configure ADF7023_CS as an output. */ ADF7023_BBRAMCurrent = ADF7023_BBRAMDefault; - SPI_Init(0, /* MSB first. */ + SPI_Init(ADF7023_SPI_BUS, + 0, /* MSB first. */ 1000000, /* Clock frequency. */ 0, /* Idle state for clock is a high level; active state is a low level. */ 1); /* Serial output data changes on transition from idle clock state to active clock state. */ - ADF7023_CS_ASSERT; - while((miso == 0) && (timeout < 1000)) { - miso = ADF7023_MISO; - timeout++; - } - if(timeout == 1000) { - retVal = -1; - } - while(!(status & STATUS_CMD_READY)) { - ADF7023_GetStatus(&status); - } - ADF7023_SetRAM(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); + + ADF7023_Init_Procedure(); + + ADF7023_SetCommand(CMD_HW_RESET); + clock_wait(MIN(CLOCK_SECOND / 1000, 1)); + ADF7023_Init_Procedure(); + + ADF7023_SetRAM_And_Verify(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); ADF7023_SetCommand(CMD_CONFIG_DEV); return retVal; @@ -125,10 +303,37 @@ ADF7023_Init(void) void ADF7023_GetStatus(unsigned char *status) { - ADF7023_CS_ASSERT; + ADF7023_SPI_Begin(); ADF7023_WriteReadByte(SPI_NOP, 0); ADF7023_WriteReadByte(SPI_NOP, status); - ADF7023_CS_DEASSERT; + ADF7023_SPI_End(); + +#if (ADF7023_VERBOSE >= 7) + if(*status != status_old) { + printf("ADF7023_GetStatus: SPI_READY=%u, IRQ_STATUS=%u, CMD_READY=%u, FW_STATE=0x%02x", + (*status >> 7) & 1, + (*status >> 6) & 1, + (*status >> 5) & 1, + *status & STATUS_FW_STATE + ); + if((*status & STATUS_FW_STATE) < ARRAY_SIZE(ADF7023_state_lookup)) { + printf("=\"%s\"", ADF7023_state_lookup[*status & STATUS_FW_STATE]); + } + printf("." NEWLINE); + status_old = *status; + } +#endif +} +static void +ADF7023_SetCommand_Assume_CMD_READY(unsigned char command) +{ +#if (ADF7023_VERBOSE >= 7) + assert(ADF7023_cmd_lookup[command] != NULL); + printf("Sending command 0x%02x = \"%s\"." NEWLINE, command, ADF7023_cmd_lookup[command]); +#endif + ADF7023_SPI_Begin(); + ADF7023_WriteReadByte(command, 0); + ADF7023_SPI_End(); } /***************************************************************************//** * @brief Initiates a command. @@ -140,22 +345,12 @@ ADF7023_GetStatus(unsigned char *status) void ADF7023_SetCommand(unsigned char command) { - ADF7023_CS_ASSERT; - ADF7023_WriteReadByte(command, 0); - ADF7023_CS_DEASSERT; + ADF7023_Wait_for_CMD_READY(); + ADF7023_SetCommand_Assume_CMD_READY(command); } -/***************************************************************************//** - * @brief Sets a FW state and waits until the device enters in that state. - * - * @param fwState - FW state. - * - * @return None. - *******************************************************************************/ void -ADF7023_SetFwState(unsigned char fwState) +ADF7023_SetFwState_NoWait(unsigned char fwState) { - unsigned char status = 0; - switch(fwState) { case FW_STATE_PHY_OFF: ADF7023_SetCommand(CMD_PHY_OFF); @@ -172,9 +367,20 @@ ADF7023_SetFwState(unsigned char fwState) default: ADF7023_SetCommand(CMD_PHY_SLEEP); } - while((status & STATUS_FW_STATE) != fwState) { - ADF7023_GetStatus(&status); - } +} +/***************************************************************************//** + * @brief Sets a FW state and waits until the device enters in that state. + * + * @param fwState - FW state. + * + * @return None. + *******************************************************************************/ +void +ADF7023_SetFwState(unsigned char fwState) +{ + unsigned char status = 0; + ADF7023_SetFwState_NoWait(fwState); + ADF7023_While((status & STATUS_FW_STATE) != fwState, ADF7023_GetStatus(&status)); } /***************************************************************************//** * @brief Reads data from the RAM. @@ -190,14 +396,14 @@ ADF7023_GetRAM(unsigned long address, unsigned long length, unsigned char *data) { - ADF7023_CS_ASSERT; + ADF7023_SPI_Begin(); ADF7023_WriteReadByte(SPI_MEM_RD | ((address & 0x700) >> 8), 0); ADF7023_WriteReadByte(address & 0xFF, 0); ADF7023_WriteReadByte(SPI_NOP, 0); while(length--) { ADF7023_WriteReadByte(SPI_NOP, data++); } - ADF7023_CS_DEASSERT; + ADF7023_SPI_End(); } /***************************************************************************//** * @brief Writes data to RAM. @@ -213,13 +419,176 @@ ADF7023_SetRAM(unsigned long address, unsigned long length, unsigned char *data) { - ADF7023_CS_ASSERT; + ADF7023_Wait_for_CMD_READY(); + + ADF7023_SPI_Begin(); ADF7023_WriteReadByte(SPI_MEM_WR | ((address & 0x700) >> 8), 0); ADF7023_WriteReadByte(address & 0xFF, 0); while(length--) { ADF7023_WriteReadByte(*(data++), 0); } - ADF7023_CS_DEASSERT; + ADF7023_SPI_End(); +} +void +ADF7023_SetRAM_And_Verify(unsigned long address, unsigned long length, unsigned char *data) +{ + unsigned char readback[256]; + + ADF7023_SetRAM(address, length, data); + + assert(length <= sizeof(readback)); + if(length > sizeof(readback)) { + return; + } + ADF7023_GetRAM(address, length, readback); + + if(memcmp(data, readback, length)) { + printf("ADF7023_SetRAM_And_Verify failed. Wrote:" NEWLINE); + hexdump(data, length); + printf(NEWLINE "Read:" NEWLINE); + hexdump(readback, length); + printf(NEWLINE); + } +} +unsigned char +ADF7023_Wait_for_SPI_READY(void) +{ + unsigned char status = 0; + ADF7023_While((status & STATUS_SPI_READY) == 0, ADF7023_GetStatus(&status)); + return status; /* Return the status -- why not? */ +} +void +ADF7023_PHY_ON(void) +{ + unsigned char status; + unsigned int counter = 0; + + for(;;) { + status = ADF7023_Wait_for_SPI_READY(); + + switch(status & STATUS_FW_STATE) { + default: + ADF7023_SetCommand(CMD_PHY_ON); + break; + + case FW_STATE_BUSY: + /* Wait! */ + break; + + case FW_STATE_PHY_ON: + /* This is the desired state. */ + return; + } + + break_loop(); + } +} +void +ADF7023_PHY_RX(void) +{ + unsigned char status; + unsigned int counter = 0; + + for(;;) { + status = ADF7023_Wait_for_SPI_READY(); + + switch(status & STATUS_FW_STATE) { + default: + /* Need to turn the PHY_ON. */ + ADF7023_PHY_ON(); + break; + + case FW_STATE_BUSY: + /* Wait! */ + break; + + case FW_STATE_PHY_ON: + case FW_STATE_PHY_TX: + ADF7023_While((status & STATUS_CMD_READY) == 0, ADF7023_GetStatus(&status)); + ADF7023_SetCommand(CMD_PHY_RX); + return; + + case FW_STATE_PHY_RX: + /* This is the desired state. */ + return; + } + + break_loop(); + } +} +void +ADF7023_PHY_TX(void) +{ + unsigned char status; + unsigned int counter = 0; + + for(;;) { + status = ADF7023_Wait_for_SPI_READY(); + + switch(status & STATUS_FW_STATE) { + default: + /* Need to turn the PHY_ON. */ + ADF7023_PHY_ON(); + break; + + case FW_STATE_BUSY: + /* Wait! */ + break; + + case FW_STATE_PHY_ON: + case FW_STATE_PHY_RX: + ADF7023_While((status & STATUS_CMD_READY) == 0, ADF7023_GetStatus(&status)); + ADF7023_SetCommand(CMD_PHY_TX); + return; + } + + break_loop(); + } +} +static unsigned char +ADF7023_ReadInterruptSource(void) +{ + unsigned char interruptReg; + + ADF7023_GetRAM(MCR_REG_INTERRUPT_SOURCE_0, 0x1, &interruptReg); + +#if (ADF7023_VERBOSE >= 7) + if(interruptReg != int0_old) { + printf("ADF7023_ReadInterruptSource: %u%u%u%u%u%u%u%u." NEWLINE, + (interruptReg >> 7) & 1, + (interruptReg >> 6) & 1, + (interruptReg >> 5) & 1, + (interruptReg >> 4) & 1, + (interruptReg >> 3) & 1, + (interruptReg >> 2) & 1, + (interruptReg >> 1) & 1, + (interruptReg >> 0) & 1 + ); + int0_old = interruptReg; + } +#endif + return interruptReg; +} +unsigned char +ADF7023_ReceivePacketAvailable(void) +{ + unsigned char status; + + ADF7023_GetStatus(&status); + if((status & STATUS_SPI_READY) == 0) { + return false; + } + + if((status & STATUS_FW_STATE) != FW_STATE_PHY_RX) { + ADF7023_PHY_RX(); + return false; + } + + if((status & STATUS_IRQ_STATUS) == 0) { + return false; + } + + return ADF7023_ReadInterruptSource() & BBRAM_INTERRUPT_MASK_0_INTERRUPT_CRC_CORRECT; } /***************************************************************************//** * @brief Receives one packet. @@ -230,22 +599,34 @@ ADF7023_SetRAM(unsigned long address, * @return None. *******************************************************************************/ void -ADF7023_ReceivePacket(unsigned char *packet, unsigned char *length) +ADF7023_ReceivePacket(unsigned char *packet, unsigned char *payload_length) { + unsigned char length; unsigned char interruptReg = 0; - ADF7023_SetFwState(FW_STATE_PHY_ON); - ADF7023_SetFwState(FW_STATE_PHY_RX); - while(!(interruptReg & BBRAM_INTERRUPT_MASK_0_INTERRUPT_CRC_CORRECT)) { - ADF7023_GetRAM(MCR_REG_INTERRUPT_SOURCE_0, - 0x1, - &interruptReg); - } + ADF7023_While(!(interruptReg & BBRAM_INTERRUPT_MASK_0_INTERRUPT_CRC_CORRECT), + interruptReg = ADF7023_ReadInterruptSource()); + + interruptReg = BBRAM_INTERRUPT_MASK_0_INTERRUPT_CRC_CORRECT; + ADF7023_SetRAM(MCR_REG_INTERRUPT_SOURCE_0, 0x1, &interruptReg); - ADF7023_GetRAM(0x10, 1, length); - ADF7023_GetRAM(0x12, *length - 2, packet); + + ADF7023_GetRAM(ADF7023_RX_BASE_ADR, 1, &length); + + *payload_length = length - 1 + LENGTH_OFFSET - 4; + + ADF7023_GetRAM(ADF7023_RX_BASE_ADR + 1, *payload_length, packet); + +#if (ADF7023_VERBOSE >= 5) + do { + unsigned char n; + printf("ADF7023_ReceivePacket, length=%u: ", *payload_length); + hexdump(packet, *payload_length); + printf(NEWLINE); + } while(false); +#endif } /***************************************************************************//** * @brief Transmits one packet. @@ -259,19 +640,39 @@ void ADF7023_TransmitPacket(unsigned char *packet, unsigned char length) { unsigned char interruptReg = 0; - unsigned char header[2] = { 0, 0 }; + unsigned char status; + unsigned char length_plus_one; - header[0] = 2 + length; - header[1] = ADF7023_BBRAMCurrent.addressMatchOffset; - ADF7023_SetRAM(0x10, 2, header); - ADF7023_SetRAM(0x12, length, packet); - ADF7023_SetFwState(FW_STATE_PHY_ON); - ADF7023_SetFwState(FW_STATE_PHY_TX); - while(!(interruptReg & BBRAM_INTERRUPT_MASK_0_INTERRUPT_TX_EOF)) { - ADF7023_GetRAM(MCR_REG_INTERRUPT_SOURCE_0, - 0x1, - &interruptReg); + for(;;) { + ADF7023_GetStatus(&status); + if((status & STATUS_SPI_READY) == 0) { + continue; + } + if((status & STATUS_CMD_READY) == 0) { + continue; + } + break; } + + length_plus_one = length + 1; + ADF7023_SetRAM_And_Verify(ADF7023_TX_BASE_ADR, 1, &length_plus_one); + ADF7023_SetRAM_And_Verify(ADF7023_TX_BASE_ADR + 1, length, packet); + +#if (ADF7023_VERBOSE >= 5) + do { + unsigned char n; + printf("ADF7023_TransmitPacket, length=%u: ", length); + hexdump(packet, length); + printf(NEWLINE); + } while(false); +#endif + + ADF7023_PHY_TX(); + + ADF7023_While(!(interruptReg & BBRAM_INTERRUPT_MASK_0_INTERRUPT_TX_EOF), + ADF7023_GetRAM(MCR_REG_INTERRUPT_SOURCE_0, 0x1, &interruptReg)); + + ADF7023_PHY_RX(); } /***************************************************************************//** * @brief Sets the channel frequency. @@ -287,7 +688,7 @@ ADF7023_SetChannelFrequency(unsigned long chFreq) ADF7023_BBRAMCurrent.channelFreq0 = (chFreq & 0x0000FF) >> 0; ADF7023_BBRAMCurrent.channelFreq1 = (chFreq & 0x00FF00) >> 8; ADF7023_BBRAMCurrent.channelFreq2 = (chFreq & 0xFF0000) >> 16; - ADF7023_SetRAM(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); + ADF7023_SetRAM_And_Verify(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); } /***************************************************************************//** * @brief Sets the data rate. @@ -299,15 +700,13 @@ ADF7023_SetChannelFrequency(unsigned long chFreq) void ADF7023_SetDataRate(unsigned long dataRate) { - unsigned char status = 0; - dataRate = (unsigned long)(dataRate / 100); ADF7023_BBRAMCurrent.radioCfg0 = BBRAM_RADIO_CFG_0_DATA_RATE_7_0((dataRate & 0x00FF) >> 0); ADF7023_BBRAMCurrent.radioCfg1 &= ~BBRAM_RADIO_CFG_1_DATA_RATE_11_8(0xF); ADF7023_BBRAMCurrent.radioCfg1 |= BBRAM_RADIO_CFG_1_DATA_RATE_11_8((dataRate & 0x0F00) >> 8); - ADF7023_SetRAM(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); + ADF7023_SetRAM_And_Verify(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); ADF7023_SetFwState(FW_STATE_PHY_OFF); ADF7023_SetCommand(CMD_CONFIG_DEV); } @@ -321,8 +720,6 @@ ADF7023_SetDataRate(unsigned long dataRate) void ADF7023_SetFrequencyDeviation(unsigned long freqDev) { - unsigned char status = 0; - freqDev = (unsigned long)(freqDev / 100); ADF7023_BBRAMCurrent.radioCfg1 &= ~BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8(0xF); @@ -330,7 +727,7 @@ ADF7023_SetFrequencyDeviation(unsigned long freqDev) BBRAM_RADIO_CFG_1_FREQ_DEVIATION_11_8((freqDev & 0x0F00) >> 8); ADF7023_BBRAMCurrent.radioCfg2 = BBRAM_RADIO_CFG_2_FREQ_DEVIATION_7_0((freqDev & 0x00FF) >> 0); - ADF7023_SetRAM(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); + ADF7023_SetRAM_And_Verify(0x100, 64, (unsigned char *)&ADF7023_BBRAMCurrent); ADF7023_SetFwState(FW_STATE_PHY_OFF); ADF7023_SetCommand(CMD_CONFIG_DEV); } diff --git a/cpu/rl78/adf7023/ADF7023.h b/cpu/rl78/adf7023/ADF7023.h index 45985b7e7..d6e0d82e1 100644 --- a/cpu/rl78/adf7023/ADF7023.h +++ b/cpu/rl78/adf7023/ADF7023.h @@ -1,44 +1,38 @@ -/***************************************************************************//** - * @file ADF7023.h - * @brief Header file of ADF7023 Driver. - * @author DBogdan (Dragos.Bogdan@analog.com) - ******************************************************************************** - * Copyright 2013(c) Analog Devices, Inc. - * +/* + * Copyright (c) 2014, Analog Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - Neither the name of Analog Devices, Inc. nor the names of its + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * - The use of this software may or may not infringe the patent rights - * of one or more patent holders. This license does not release you - * from the requirement that you obtain separate licenses from these - * patent holders to use this software. - * - Use of the software either in source or binary form, must be run - * on or directly connected to an Analog Devices Inc. component. * - * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ******************************************************************************** - * SVN Revision: $WCREV$ - *******************************************************************************/ + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Dragos Bogdan + * Contributors: Ian Martin + */ + #ifndef __ADF7023_H__ #define __ADF7023_H__ @@ -362,8 +356,10 @@ struct ADF7023_BBRAM { unsigned char txSynthLockTime; /* 0x13F */ }; +#define ADF7023_RAM_SIZE 256 + #define ADF7023_TX_BASE_ADR 0x10 -#define ADF7023_RX_BASE_ADR 0x10 +#define ADF7023_RX_BASE_ADR ((ADF7023_TX_BASE_ADR + ADF7023_RAM_SIZE) / 2) /******************************************************************************/ /************************ Functions Declarations ******************************/ @@ -391,8 +387,13 @@ void ADF7023_SetRAM(unsigned long address, unsigned long length, unsigned char *data); +void ADF7023_SetRAM_And_Verify(unsigned long address, unsigned long length, unsigned char *data); + +/* Indicates if an incoming packet is available. */ +unsigned char ADF7023_ReceivePacketAvailable(void); + /* Receives one packet. */ -void ADF7023_ReceivePacket(unsigned char *packet, unsigned char *length); +void ADF7023_ReceivePacket(unsigned char *packet, unsigned char *payload_length); /* Transmits one packet. */ void ADF7023_TransmitPacket(unsigned char *packet, unsigned char length); diff --git a/cpu/rl78/adf7023/ADF7023_Config.h b/cpu/rl78/adf7023/ADF7023_Config.h index 0202d945e..1f17bba2b 100644 --- a/cpu/rl78/adf7023/ADF7023_Config.h +++ b/cpu/rl78/adf7023/ADF7023_Config.h @@ -1,52 +1,64 @@ -/***************************************************************************//** - * @file ADF7023_Config.h - * @brief Configuration file of ADF7023 Driver. - * @author DBogdan (Dragos.Bogdan@analog.com) - ******************************************************************************** - * Copyright 2013(c) Analog Devices, Inc. - * +/* + * Copyright (c) 2014, Analog Devices, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - Neither the name of Analog Devices, Inc. nor the names of its + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * - The use of this software may or may not infringe the patent rights - * of one or more patent holders. This license does not release you - * from the requirement that you obtain separate licenses from these - * patent holders to use this software. - * - Use of the software either in source or binary form, must be run - * on or directly connected to an Analog Devices Inc. component. * - * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ******************************************************************************** - * SVN Revision: $WCREV$ - *******************************************************************************/ + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Dragos Bogdan + * Contributors: Ian Martin + */ + #ifndef __ADF7023_CONFIG_H__ #define __ADF7023_CONFIG_H__ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ + +#include + #include "ADF7023.h" +#define LENGTH_OFFSET 4 +#define PACKET_LENGTH_MAX 240 +#define ADDRESS_MATCH_OFFSET 0 +#define ADDRESS_LENGTH 0 + +#define F_PFD 26 /* MHz */ + +#ifndef CHANNEL_FREQ_MHZ +/* #define CHANNEL_FREQ_MHZ 433 // Wrong antenna (432993072 Hz) */ +/* #define CHANNEL_FREQ_MHZ 868 // Europe */ +#define CHANNEL_FREQ_MHZ 915 /* ISM band center frequency for the Americas, Greenland and some of the eastern Pacific Islands. */ +#endif + +#define CHANNEL_FREQ (((uint32_t)CHANNEL_FREQ_MHZ << 16) / F_PFD) + /******************************************************************************/ /************************* Variables Declarations *****************************/ /******************************************************************************/ @@ -72,11 +84,11 @@ struct ADF7023_BBRAM ADF7023_BBRAMDefault = /* swmRssiThresh - 0x108 */ 0x31, /* channelFreq0 - 0x109 */ - 0x51, /* Channel Frequency: 433 MHz */ + (CHANNEL_FREQ >> 0) & 0xff, /* channelFreq1 - 0x10A */ - 0xA7, /* Channel Frequency: 433 MHz */ + (CHANNEL_FREQ >> 8) & 0xff, /* channelFreq2 - 0x10B */ - 0x10, /* Channel Frequency: 433 MHz */ + (CHANNEL_FREQ >> 16) & 0xff, /* radioCfg0 - 0x10C */ BBRAM_RADIO_CFG_0_DATA_RATE_7_0(0xE8), /* Data rate: 100 kbps */ /* radioCfg1 - 0x10D */ @@ -134,16 +146,12 @@ struct ADF7023_BBRAM ADF7023_BBRAMDefault = ADF7023_TX_BASE_ADR, /* rxBaseAdr - 0x125 */ ADF7023_RX_BASE_ADR, - /* packetLengthControl - 0x126 */ - 0x24, - /* packetLengthMax - 0x127 */ - 0xF0, + /* 0x126 (PACKET_LENGTH_CONTROL) = */ 0x20 | LENGTH_OFFSET, + /* 0x127 (PACKET_LENGTH_MAX) = */ PACKET_LENGTH_MAX, /* staticRegFix - 0x128 */ 0x00, - /* addressMatchOffset - 0x129 */ - 0x01, - /* addressLength - 0x12A */ - 0x02, + /* 0x129 (ADDRESS_MATCH_OFFSET) = */ ADDRESS_MATCH_OFFSET, + /* 0x12a (ADDRESS_LENGTH) = */ ADDRESS_LENGTH, /* addressFiltering0 - 0x12B */ 0x01, /* addressFiltering1 - 0x12C */ diff --git a/cpu/rl78/adf7023/adf7023-contiki.c b/cpu/rl78/adf7023/adf7023-contiki.c new file mode 100644 index 000000000..cf9b7d068 --- /dev/null +++ b/cpu/rl78/adf7023/adf7023-contiki.c @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#include /* for memcpy(). */ + +#include "radio.h" + +#include "ADF7023.h" +#include "adf7023-contiki.h" +#include "contiki.h" /* for LED definitions. */ + +#define ADF7023_MAX_PACKET_SIZE 255 + +static unsigned char tx_buf[ADF7023_MAX_PACKET_SIZE]; +static unsigned char rx_buf[ADF7023_MAX_PACKET_SIZE]; + +const struct radio_driver adf7023_driver = { + + .init = adf7023_init, + + /** Prepare the radio with a packet to be sent. */ + .prepare = adf7023_prepare, + + /** Send the packet that has previously been prepared. */ + .transmit = adf7023_transmit, + + /** Prepare & transmit a packet. */ + .send = adf7023_send, + + /** Read a received packet into a buffer. */ + .read = adf7023_read, + + /** Perform a Clear-Channel Assessment (CCA) to find out if there is + a packet in the air or not. */ + .channel_clear = adf7023_channel_clear, + + /** Check if the radio driver is currently receiving a packet */ + .receiving_packet = adf7023_receiving_packet, + + /** Check if the radio driver has just received a packet */ + .pending_packet = adf7023_pending_packet, + + /** Turn the radio on. */ + .on = adf7023_on, + + /** Turn the radio off. */ + .off = adf7023_off, +}; + +int +adf7023_init(void) +{ + ADF7023_Init(); + return 1; +} +int +adf7023_prepare(const void *payload, unsigned short payload_len) +{ + /* Prepare the radio with a packet to be sent. */ + memcpy(tx_buf, payload, (payload_len <= sizeof(tx_buf)) ? payload_len : sizeof(tx_buf)); + return 0; +} +int +adf7023_transmit(unsigned short transmit_len) +{ + /* Send the packet that has previously been prepared. */ + + RADIO_TX_LED = 1; + ADF7023_TransmitPacket(tx_buf, transmit_len); + RADIO_TX_LED = 0; + + /* TODO: Error conditions (RADIO_TX_ERR, RADIO_TX_COLLISION, RADIO_TX_NOACK)? */ + return RADIO_TX_OK; +} +int +adf7023_send(const void *payload, unsigned short payload_len) +{ + /* Prepare & transmit a packet. */ + + RADIO_TX_LED = 1; + ADF7023_TransmitPacket((void *)payload, payload_len); + RADIO_TX_LED = 0; + + /* TODO: Error conditions (RADIO_TX_ERR, RADIO_TX_COLLISION, RADIO_TX_NOACK)? */ + return RADIO_TX_OK; +} +int +adf7023_read(void *buf, unsigned short buf_len) +{ + unsigned char num_bytes; + /* Read a received packet into a buffer. */ + + RADIO_RX_LED = 1; + ADF7023_ReceivePacket(rx_buf, &num_bytes); + RADIO_RX_LED = 0; + + memcpy(buf, rx_buf, (num_bytes <= buf_len) ? num_bytes : buf_len); + return num_bytes; +} +int +adf7023_channel_clear(void) +{ + /* Perform a Clear-Channel Assessment (CCA) to find out if there is a packet in the air or not. */ + return 1; +} +int +adf7023_receiving_packet(void) +{ + /* Check if the radio driver is currently receiving a packet. */ + return 0; +} +int +adf7023_pending_packet(void) +{ + /* Check if the radio driver has just received a packet. */ + return ADF7023_ReceivePacketAvailable(); +} +int +adf7023_on(void) +{ + /* Turn the radio on. */ + return 1; +} +int +adf7023_off(void) +{ + /* Turn the radio off. */ + return 0; +} diff --git a/cpu/rl78/adf7023/adf7023-contiki.h b/cpu/rl78/adf7023/adf7023-contiki.h new file mode 100644 index 000000000..6443e4533 --- /dev/null +++ b/cpu/rl78/adf7023/adf7023-contiki.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#ifndef __ADF7023-contiki_H__ +#define __ADF7023-conitki_H__ + +int adf7023_init(void); + +/* Prepare the radio with a packet to be sent. */ +int adf7023_prepare(const void *payload, unsigned short payload_len); + +/* Send the packet that has previously been prepared. */ +int adf7023_transmit(unsigned short transmit_len); + +/* Prepare & transmit a packet. */ +int adf7023_send(const void *payload, unsigned short payload_len); + +/* Prepare & transmit a packet. */ +int adf7023_read(void *buf, unsigned short buf_len); + +/* Perform a Clear-Channel Assessment (CCA) to find out if there is a packet in the air or not. */ +int adf7023_channel_clear(void); + +/* Check if the radio driver is currently receiving a packet. */ +int adf7023_receiving_packet(void); + +/* Check if the radio driver has just received a packet. */ +int adf7023_pending_packet(void); + +/* Turn the radio on. */ +int adf7023_on(void); + +/* Turn the radio off. */ +int adf7023_off(void); + +#endif /* __ADF7023-contiki_H__ */ diff --git a/cpu/rl78/contiki-uart.c b/cpu/rl78/contiki-uart.c new file mode 100644 index 000000000..cd96e8725 --- /dev/null +++ b/cpu/rl78/contiki-uart.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +int (*uart0_input_handler)(unsigned char c) = 0; + +void +uart0_set_input(int (*input)(unsigned char c)) +{ + uart0_input_handler = input; +} diff --git a/cpu/rl78/contiki-uart.h b/cpu/rl78/contiki-uart.h new file mode 100644 index 000000000..8d218d799 --- /dev/null +++ b/cpu/rl78/contiki-uart.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#ifndef CONTIKI_UART_H +#define CONTIKI_UART_H + +extern int (*uart0_input_handler)(unsigned char c); + +#endif diff --git a/cpu/rl78/crt0.S b/cpu/rl78/crt0.S index d5a07df90..14d4f680c 100644 --- a/cpu/rl78/crt0.S +++ b/cpu/rl78/crt0.S @@ -197,7 +197,7 @@ _start: - call !!__rl78_init +; call !!__rl78_init #ifdef PROFILE_SUPPORT /* Defined in gcrt0.S. */ movw ax, # _start diff --git a/cpu/rl78/mtarch.h b/cpu/rl78/mtarch.h new file mode 100644 index 000000000..f0102ee4d --- /dev/null +++ b/cpu/rl78/mtarch.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#ifndef __MTARCH_H__ +#define __MTARCH_H__ + +#include "contiki-conf.h" + +#ifdef MTARCH_CONF_STACKSIZE +#define MTARCH_STACKSIZE MTARCH_CONF_STACKSIZE +#else +#define MTARCH_STACKSIZE 128 +#endif + +struct mtarch_thread { + unsigned char stack[MTARCH_STACKSIZE]; + unsigned char *sp; +}; + +#endif /* __MTARCH_H__ */ + diff --git a/cpu/rl78/rl78-sys.h b/cpu/rl78/rl78-sys.h index 281dad07f..537f2f2b9 100644 --- a/cpu/rl78/rl78-sys.h +++ b/cpu/rl78/rl78-sys.h @@ -29,8 +29,9 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -#include "syscall.h" +/** + * \author DJ Delorie + */ r8 = 0xffef0 r9 = 0xffef1 diff --git a/cpu/rl78/rl78.h b/cpu/rl78/rl78.h new file mode 100755 index 000000000..cc496aa66 --- /dev/null +++ b/cpu/rl78/rl78.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#ifndef RL78_H +#define RL78_H + +#include + +#include "sfrs.h" +#include "sfrs-ext.h" + +#define f_CLK 32000000 // 32 MHz. +#define CLOCK_CHANNEL 0 +#define CLOCK_SCALER 15 // Use f_CLK / 2^15. + +typedef uint32_t clock_time_t; +typedef unsigned short uip_stats_t; + +#endif // RL78_H diff --git a/cpu/rl78/rtimer-arch.h b/cpu/rl78/rtimer-arch.h new file mode 100644 index 000000000..46a339354 --- /dev/null +++ b/cpu/rl78/rtimer-arch.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#ifndef __RTIMER_ARCH_H__ +#define __RTIMER_ARCH_H__ + +#include "contiki-conf.h" +#include "rl78.h" + +#define RTIMER_ARCH_SECOND (15625U) + +/* #define rtimer_arch_now() (TCR00) */ +#define rtimer_arch_now() (0) + +/* void rtimer_isr(void) __interrupt(T1_VECTOR); */ + +#endif /* __RTIMER_ARCH_H__ */ diff --git a/cpu/rl78/sfrs-ext.h b/cpu/rl78/sfrs-ext.h new file mode 100644 index 000000000..b637d7000 --- /dev/null +++ b/cpu/rl78/sfrs-ext.h @@ -0,0 +1,5290 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#ifndef SFRS_EXT_H +#define SFRS_EXT_H + +#define ADM2 (*(volatile unsigned char *)0xF0010) +#define ADUL (*(volatile unsigned char *)0xF0011) +#define ADLL (*(volatile unsigned char *)0xF0012) +#define ADTES (*(volatile unsigned char *)0xF0013) +#define PU0 (*(volatile unsigned char *)0xF0030) +#define PU1 (*(volatile unsigned char *)0xF0031) +#define PU3 (*(volatile unsigned char *)0xF0033) +#define PU4 (*(volatile unsigned char *)0xF0034) +#define PU5 (*(volatile unsigned char *)0xF0035) +#define PU6 (*(volatile unsigned char *)0xF0036) +#define PU7 (*(volatile unsigned char *)0xF0037) +#define PU8 (*(volatile unsigned char *)0xF0038) +#define PU9 (*(volatile unsigned char *)0xF0039) +#define PU10 (*(volatile unsigned char *)0xF003A) +#define PU11 (*(volatile unsigned char *)0xF003B) +#define PU12 (*(volatile unsigned char *)0xF003C) +#define PU14 (*(volatile unsigned char *)0xF003E) +#define PIM0 (*(volatile unsigned char *)0xF0040) +#define PIM1 (*(volatile unsigned char *)0xF0041) +#define PIM4 (*(volatile unsigned char *)0xF0044) +#define PIM5 (*(volatile unsigned char *)0xF0045) +#define PIM8 (*(volatile unsigned char *)0xF0048) +#define PIM14 (*(volatile unsigned char *)0xF004E) +#define POM0 (*(volatile unsigned char *)0xF0050) +#define POM1 (*(volatile unsigned char *)0xF0051) +#define POM4 (*(volatile unsigned char *)0xF0054) +#define POM5 (*(volatile unsigned char *)0xF0055) +#define POM7 (*(volatile unsigned char *)0xF0057) +#define POM8 (*(volatile unsigned char *)0xF0058) +#define POM9 (*(volatile unsigned char *)0xF0059) +#define POM14 (*(volatile unsigned char *)0xF005E) +#define PMC0 (*(volatile unsigned char *)0xF0060) +#define PMC3 (*(volatile unsigned char *)0xF0063) +#define PMC10 (*(volatile unsigned char *)0xF006A) +#define PMC11 (*(volatile unsigned char *)0xF006B) +#define PMC12 (*(volatile unsigned char *)0xF006C) +#define PMC14 (*(volatile unsigned char *)0xF006E) +#define NFEN0 (*(volatile unsigned char *)0xF0070) +#define NFEN1 (*(volatile unsigned char *)0xF0071) +#define NFEN2 (*(volatile unsigned char *)0xF0072) +#define ISC (*(volatile unsigned char *)0xF0073) +#define TIS0 (*(volatile unsigned char *)0xF0074) +#define ADPC (*(volatile unsigned char *)0xF0076) +#define PIOR (*(volatile unsigned char *)0xF0077) +#define IAWCTL (*(volatile unsigned char *)0xF0078) +#define GDIDIS (*(volatile unsigned char *)0xF007D) +#define PRDSEL (*(volatile unsigned short *)0xF007E) +#define TOOLEN (*(volatile unsigned char *)0xF0080) +#define BPAL0 (*(volatile unsigned char *)0xF0081) +#define BPAH0 (*(volatile unsigned char *)0xF0082) +#define BPAS0 (*(volatile unsigned char *)0xF0083) +#define BACDVL0 (*(volatile unsigned char *)0xF0084) +#define BACDVH0 (*(volatile unsigned char *)0xF0085) +#define BACDML0 (*(volatile unsigned char *)0xF0086) +#define BACDMH0 (*(volatile unsigned char *)0xF0087) +#define MONMOD (*(volatile unsigned char *)0xF0088) +#define DFLCTL (*(volatile unsigned char *)0xF0090) +#define HIOTRM (*(volatile unsigned char *)0xF00A0) +#define BECTL (*(volatile unsigned char *)0xF00A1) +#define HOCODIV (*(volatile unsigned char *)0xF00A8) +#define TEMPCAL0 (*(volatile unsigned char *)0xF00AC) +#define TEMPCAL1 (*(volatile unsigned char *)0xF00AD) +#define TEMPCAL2 (*(volatile unsigned char *)0xF00AE) +#define TEMPCAL3 (*(volatile unsigned char *)0xF00AF) +#define FLSEC (*(volatile unsigned short *)0xF00B0) +#define FLFSWS (*(volatile unsigned short *)0xF00B2) +#define FLFSWE (*(volatile unsigned short *)0xF00B4) +#define FSSET (*(volatile unsigned char *)0xF00B6) +#define FSSE (*(volatile unsigned char *)0xF00B7) +#define FLFADL (*(volatile unsigned short *)0xF00B8) +#define FLFADH (*(volatile unsigned char *)0xF00BA) +#define PFCMD (*(volatile unsigned char *)0xF00C0) +#define PFS (*(volatile unsigned char *)0xF00C1) +#define FLRL (*(volatile unsigned short *)0xF00C2) +#define FLRH (*(volatile unsigned short *)0xF00C4) +#define FLWE (*(volatile unsigned char *)0xF00C6) +#define FLRE (*(volatile unsigned char *)0xF00C7) +#define FLTMS (*(volatile unsigned short *)0xF00C8) +#define DFLMC (*(volatile unsigned short *)0xF00CA) +#define FLMCL (*(volatile unsigned short *)0xF00CC) +#define FLMCH (*(volatile unsigned char *)0xF00CE) +#define FSCTL (*(volatile unsigned char *)0xF00CF) +#define ICEADR (*(volatile unsigned short *)0xF00D0) +#define ICEDAT (*(volatile unsigned short *)0xF00D2) +#define MDCL (*(volatile unsigned short *)0xF00E0) +#define MDCH (*(volatile unsigned short *)0xF00E2) +#define MDUC (*(volatile unsigned char *)0xF00E8) +#define PER0 (*(volatile unsigned char *)0xF00F0) +#define OSMC (*(volatile unsigned char *)0xF00F3) +#define RMC (*(volatile unsigned char *)0xF00F4) +#define RPECTL (*(volatile unsigned char *)0xF00F5) +#define BCDADJ (*(volatile unsigned char *)0xF00FE) +#define VECTCTRL (*(volatile unsigned char *)0xF00FF) +#define SSR00 (*(volatile unsigned short *)0xF0100) +#define SSR00L (*(volatile unsigned char *)0xF0100) +#define SSR01 (*(volatile unsigned short *)0xF0102) +#define SSR01L (*(volatile unsigned char *)0xF0102) +#define SSR02 (*(volatile unsigned short *)0xF0104) +#define SSR02L (*(volatile unsigned char *)0xF0104) +#define SSR03 (*(volatile unsigned short *)0xF0106) +#define SSR03L (*(volatile unsigned char *)0xF0106) +#define SIR00 (*(volatile unsigned short *)0xF0108) +#define SIR00L (*(volatile unsigned char *)0xF0108) +#define SIR01 (*(volatile unsigned short *)0xF010A) +#define SIR01L (*(volatile unsigned char *)0xF010A) +#define SIR02 (*(volatile unsigned short *)0xF010C) +#define SIR02L (*(volatile unsigned char *)0xF010C) +#define SIR03 (*(volatile unsigned short *)0xF010E) +#define SIR03L (*(volatile unsigned char *)0xF010E) +#define SMR00 (*(volatile unsigned short *)0xF0110) +#define SMR01 (*(volatile unsigned short *)0xF0112) +#define SMR02 (*(volatile unsigned short *)0xF0114) +#define SMR03 (*(volatile unsigned short *)0xF0116) +#define SCR00 (*(volatile unsigned short *)0xF0118) +#define SCR01 (*(volatile unsigned short *)0xF011A) +#define SCR02 (*(volatile unsigned short *)0xF011C) +#define SCR03 (*(volatile unsigned short *)0xF011E) +#define SE0 (*(volatile unsigned short *)0xF0120) +#define SE0L (*(volatile unsigned char *)0xF0120) +#define SS0 (*(volatile unsigned short *)0xF0122) +#define SS0L (*(volatile unsigned char *)0xF0122) +#define ST0 (*(volatile unsigned short *)0xF0124) +#define ST0L (*(volatile unsigned char *)0xF0124) +#define SPS0 (*(volatile unsigned short *)0xF0126) +#define SPS0L (*(volatile unsigned char *)0xF0126) +#define SO0 (*(volatile unsigned short *)0xF0128) +#define SOE0 (*(volatile unsigned short *)0xF012A) +#define SOE0L (*(volatile unsigned char *)0xF012A) +#define EDR00 (*(volatile unsigned short *)0xF012C) +#define EDR00L (*(volatile unsigned char *)0xF012C) +#define EDR01 (*(volatile unsigned short *)0xF012E) +#define EDR01L (*(volatile unsigned char *)0xF012E) +#define EDR02 (*(volatile unsigned short *)0xF0130) +#define EDR02L (*(volatile unsigned char *)0xF0130) +#define EDR03 (*(volatile unsigned short *)0xF0132) +#define EDR03L (*(volatile unsigned char *)0xF0132) +#define SOL0 (*(volatile unsigned short *)0xF0134) +#define SOL0L (*(volatile unsigned char *)0xF0134) +#define SSC0 (*(volatile unsigned short *)0xF0138) +#define SSC0L (*(volatile unsigned char *)0xF0138) +#define SSR10 (*(volatile unsigned short *)0xF0140) +#define SSR10L (*(volatile unsigned char *)0xF0140) +#define SSR11 (*(volatile unsigned short *)0xF0142) +#define SSR11L (*(volatile unsigned char *)0xF0142) +#define SSR12 (*(volatile unsigned short *)0xF0144) +#define SSR12L (*(volatile unsigned char *)0xF0144) +#define SSR13 (*(volatile unsigned short *)0xF0146) +#define SSR13L (*(volatile unsigned char *)0xF0146) +#define SIR10 (*(volatile unsigned short *)0xF0148) +#define SIR10L (*(volatile unsigned char *)0xF0148) +#define SIR11 (*(volatile unsigned short *)0xF014A) +#define SIR11L (*(volatile unsigned char *)0xF014A) +#define SIR12 (*(volatile unsigned short *)0xF014C) +#define SIR12L (*(volatile unsigned char *)0xF014C) +#define SIR13 (*(volatile unsigned short *)0xF014E) +#define SIR13L (*(volatile unsigned char *)0xF014E) +#define SMR10 (*(volatile unsigned short *)0xF0150) +#define SMR11 (*(volatile unsigned short *)0xF0152) +#define SMR12 (*(volatile unsigned short *)0xF0154) +#define SMR13 (*(volatile unsigned short *)0xF0156) +#define SCR10 (*(volatile unsigned short *)0xF0158) +#define SCR11 (*(volatile unsigned short *)0xF015A) +#define SCR12 (*(volatile unsigned short *)0xF015C) +#define SCR13 (*(volatile unsigned short *)0xF015E) +#define SE1 (*(volatile unsigned short *)0xF0160) +#define SE1L (*(volatile unsigned char *)0xF0160) +#define SS1 (*(volatile unsigned short *)0xF0162) +#define SS1L (*(volatile unsigned char *)0xF0162) +#define ST1 (*(volatile unsigned short *)0xF0164) +#define ST1L (*(volatile unsigned char *)0xF0164) +#define SPS1 (*(volatile unsigned short *)0xF0166) +#define SPS1L (*(volatile unsigned char *)0xF0166) +#define SO1 (*(volatile unsigned short *)0xF0168) +#define SOE1 (*(volatile unsigned short *)0xF016A) +#define SOE1L (*(volatile unsigned char *)0xF016A) +#define EDR10 (*(volatile unsigned short *)0xF016C) +#define EDR10L (*(volatile unsigned char *)0xF016C) +#define EDR11 (*(volatile unsigned short *)0xF016E) +#define EDR11L (*(volatile unsigned char *)0xF016E) +#define EDR12 (*(volatile unsigned short *)0xF0170) +#define EDR12L (*(volatile unsigned char *)0xF0170) +#define EDR13 (*(volatile unsigned short *)0xF0172) +#define EDR13L (*(volatile unsigned char *)0xF0172) +#define SOL1 (*(volatile unsigned short *)0xF0174) +#define SOL1L (*(volatile unsigned char *)0xF0174) +#define SSC1 (*(volatile unsigned short *)0xF0178) +#define SSC1L (*(volatile unsigned char *)0xF0178) +#define TCR00 (*(volatile unsigned short *)0xF0180) +#define TCR01 (*(volatile unsigned short *)0xF0182) +#define TCR02 (*(volatile unsigned short *)0xF0184) +#define TCR03 (*(volatile unsigned short *)0xF0186) +#define TCR04 (*(volatile unsigned short *)0xF0188) +#define TCR05 (*(volatile unsigned short *)0xF018A) +#define TCR06 (*(volatile unsigned short *)0xF018C) +#define TCR07 (*(volatile unsigned short *)0xF018E) +#define TMR00 (*(volatile unsigned short *)0xF0190) +#define TMR01 (*(volatile unsigned short *)0xF0192) +#define TMR02 (*(volatile unsigned short *)0xF0194) +#define TMR03 (*(volatile unsigned short *)0xF0196) +#define TMR04 (*(volatile unsigned short *)0xF0198) +#define TMR05 (*(volatile unsigned short *)0xF019A) +#define TMR06 (*(volatile unsigned short *)0xF019C) +#define TMR07 (*(volatile unsigned short *)0xF019E) +#define TSR00 (*(volatile unsigned short *)0xF01A0) +#define TSR00L (*(volatile unsigned char *)0xF01A0) +#define TSR01 (*(volatile unsigned short *)0xF01A2) +#define TSR01L (*(volatile unsigned char *)0xF01A2) +#define TSR02 (*(volatile unsigned short *)0xF01A4) +#define TSR02L (*(volatile unsigned char *)0xF01A4) +#define TSR03 (*(volatile unsigned short *)0xF01A6) +#define TSR03L (*(volatile unsigned char *)0xF01A6) +#define TSR04 (*(volatile unsigned short *)0xF01A8) +#define TSR04L (*(volatile unsigned char *)0xF01A8) +#define TSR05 (*(volatile unsigned short *)0xF01AA) +#define TSR05L (*(volatile unsigned char *)0xF01AA) +#define TSR06 (*(volatile unsigned short *)0xF01AC) +#define TSR06L (*(volatile unsigned char *)0xF01AC) +#define TSR07 (*(volatile unsigned short *)0xF01AE) +#define TSR07L (*(volatile unsigned char *)0xF01AE) +#define TE0 (*(volatile unsigned short *)0xF01B0) +#define TE0L (*(volatile unsigned char *)0xF01B0) +#define TS0 (*(volatile unsigned short *)0xF01B2) +#define TS0L (*(volatile unsigned char *)0xF01B2) +#define TT0 (*(volatile unsigned short *)0xF01B4) +#define TT0L (*(volatile unsigned char *)0xF01B4) +#define TPS0 (*(volatile unsigned short *)0xF01B6) +#define TO0 (*(volatile unsigned short *)0xF01B8) +#define TO0L (*(volatile unsigned char *)0xF01B8) +#define TOE0 (*(volatile unsigned short *)0xF01BA) +#define TOE0L (*(volatile unsigned char *)0xF01BA) +#define TOL0 (*(volatile unsigned short *)0xF01BC) +#define TOL0L (*(volatile unsigned char *)0xF01BC) +#define TOM0 (*(volatile unsigned short *)0xF01BE) +#define TOM0L (*(volatile unsigned char *)0xF01BE) +#define TCR10 (*(volatile unsigned short *)0xF01C0) +#define TCR11 (*(volatile unsigned short *)0xF01C2) +#define TCR12 (*(volatile unsigned short *)0xF01C4) +#define TCR13 (*(volatile unsigned short *)0xF01C6) +#define TCR14 (*(volatile unsigned short *)0xF01C8) +#define TCR15 (*(volatile unsigned short *)0xF01CA) +#define TCR16 (*(volatile unsigned short *)0xF01CC) +#define TCR17 (*(volatile unsigned short *)0xF01CE) +#define TMR10 (*(volatile unsigned short *)0xF01D0) +#define TMR11 (*(volatile unsigned short *)0xF01D2) +#define TMR12 (*(volatile unsigned short *)0xF01D4) +#define TMR13 (*(volatile unsigned short *)0xF01D6) +#define TMR14 (*(volatile unsigned short *)0xF01D8) +#define TMR15 (*(volatile unsigned short *)0xF01DA) +#define TMR16 (*(volatile unsigned short *)0xF01DC) +#define TMR17 (*(volatile unsigned short *)0xF01DE) +#define TSR10 (*(volatile unsigned short *)0xF01E0) +#define TSR10L (*(volatile unsigned char *)0xF01E0) +#define TSR11 (*(volatile unsigned short *)0xF01E2) +#define TSR11L (*(volatile unsigned char *)0xF01E2) +#define TSR12 (*(volatile unsigned short *)0xF01E4) +#define TSR12L (*(volatile unsigned char *)0xF01E4) +#define TSR13 (*(volatile unsigned short *)0xF01E6) +#define TSR13L (*(volatile unsigned char *)0xF01E6) +#define TSR14 (*(volatile unsigned short *)0xF01E8) +#define TSR14L (*(volatile unsigned char *)0xF01E8) +#define TSR15 (*(volatile unsigned short *)0xF01EA) +#define TSR15L (*(volatile unsigned char *)0xF01EA) +#define TSR16 (*(volatile unsigned short *)0xF01EC) +#define TSR16L (*(volatile unsigned char *)0xF01EC) +#define TSR17 (*(volatile unsigned short *)0xF01EE) +#define TSR17L (*(volatile unsigned char *)0xF01EE) +#define TE1 (*(volatile unsigned short *)0xF01F0) +#define TE1L (*(volatile unsigned char *)0xF01F0) +#define TS1 (*(volatile unsigned short *)0xF01F2) +#define TS1L (*(volatile unsigned char *)0xF01F2) +#define TT1 (*(volatile unsigned short *)0xF01F4) +#define TT1L (*(volatile unsigned char *)0xF01F4) +#define TPS1 (*(volatile unsigned short *)0xF01F6) +#define TO1 (*(volatile unsigned short *)0xF01F8) +#define TO1L (*(volatile unsigned char *)0xF01F8) +#define TOE1 (*(volatile unsigned short *)0xF01FA) +#define TOE1L (*(volatile unsigned char *)0xF01FA) +#define TOL1 (*(volatile unsigned short *)0xF01FC) +#define TOL1L (*(volatile unsigned char *)0xF01FC) +#define TOM1 (*(volatile unsigned short *)0xF01FE) +#define TOM1L (*(volatile unsigned char *)0xF01FE) +#define DSA2 (*(volatile unsigned char *)0xF0200) +#define DSA3 (*(volatile unsigned char *)0xF0201) +#define DRA2 (*(volatile unsigned short *)0xF0202) +#define DRA2L (*(volatile unsigned char *)0xF0202) +#define DRA2H (*(volatile unsigned char *)0xF0203) +#define DRA3 (*(volatile unsigned short *)0xF0204) +#define DRA3L (*(volatile unsigned char *)0xF0204) +#define DRA3H (*(volatile unsigned char *)0xF0205) +#define DBC2 (*(volatile unsigned short *)0xF0206) +#define DBC2L (*(volatile unsigned char *)0xF0206) +#define DBC2H (*(volatile unsigned char *)0xF0207) +#define DBC3 (*(volatile unsigned short *)0xF0208) +#define DBC3L (*(volatile unsigned char *)0xF0208) +#define DBC3H (*(volatile unsigned char *)0xF0209) +#define DMC2 (*(volatile unsigned char *)0xF020A) +#define DMC3 (*(volatile unsigned char *)0xF020B) +#define DRC2 (*(volatile unsigned char *)0xF020C) +#define DRC3 (*(volatile unsigned char *)0xF020D) +#define DWAITALL (*(volatile unsigned char *)0xF020F) +#define IICCTL00 (*(volatile unsigned char *)0xF0230) +#define IICCTL01 (*(volatile unsigned char *)0xF0231) +#define IICWL0 (*(volatile unsigned char *)0xF0232) +#define IICWH0 (*(volatile unsigned char *)0xF0233) +#define SVA0 (*(volatile unsigned char *)0xF0234) +#define IICSE0 (*(volatile unsigned char *)0xF0235) +#define IICCTL10 (*(volatile unsigned char *)0xF0238) +#define IICCTL11 (*(volatile unsigned char *)0xF0239) +#define IICWL1 (*(volatile unsigned char *)0xF023A) +#define IICWH1 (*(volatile unsigned char *)0xF023B) +#define SVA1 (*(volatile unsigned char *)0xF023C) +#define IICSE1 (*(volatile unsigned char *)0xF023D) +#define CRC0CTL (*(volatile unsigned char *)0xF02F0) +#define PGCRCL (*(volatile unsigned short *)0xF02F2) +#define CRCD (*(volatile unsigned short *)0xF02FA) + + +struct ADM2struct { + unsigned char adtyp : 1; + unsigned char : 1; + unsigned char awc : 1; + unsigned char adrck : 1; +}; + +struct ADULstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ADLLstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ADTESstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU3struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU4struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU5struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU6struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU7struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU8struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU9struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU10struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU11struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU12struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PU14struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PIM0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PIM1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PIM4struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PIM5struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PIM8struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PIM14struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct POM0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct POM1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct POM4struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct POM5struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct POM7struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct POM8struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct POM9struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct POM14struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PMC0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PMC3struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PMC10struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PMC11struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PMC12struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PMC14struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct NFEN0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct NFEN1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct NFEN2struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ISCstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TIS0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ADPCstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PIORstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct IAWCTLstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct GDIDISstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PRDSELstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TOOLENstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct BPAL0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct BPAH0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct BPAS0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct BACDVL0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct BACDVH0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct BACDML0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct BACDMH0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct MONMODstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DFLCTLstruct { + unsigned char dflen : 1; +}; + +struct HIOTRMstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct BECTLstruct { + unsigned char brsam : 1; +}; + +struct HOCODIVstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TEMPCAL0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TEMPCAL1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TEMPCAL2struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TEMPCAL3struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FLSECstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FLFSWSstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FLFSWEstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FSSETstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FSSEstruct { + unsigned char : 1; + unsigned char esqst : 1; +}; + +struct FLFADLstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FLFADHstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PFCMDstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PFSstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FLRLstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FLRHstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FLWEstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FLREstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FLTMSstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct DFLMCstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FLMCLstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FLMCHstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FSCTLstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ICEADRstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct ICEDATstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct MDCLstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct MDCHstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct MDUCstruct { + unsigned char divst : 1; + unsigned char macsf : 1; + unsigned char macof : 1; + unsigned char mdsm : 1; + unsigned char : 1; + unsigned char macmode : 1; + unsigned char divmode : 1; +}; + +struct PER0struct { + unsigned char tau0en : 1; + unsigned char tau1en : 1; + unsigned char sau0en : 1; + unsigned char sau1en : 1; + unsigned char iica0en : 1; + unsigned char adcen : 1; + unsigned char iica1en : 1; + unsigned char rtcen : 1; +}; + +struct OSMCstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct RMCstruct { + unsigned char paenb : 1; + unsigned char : 1; + unsigned char wdvol : 1; +}; + +struct RPECTLstruct { + unsigned char rpef : 1; + unsigned char : 1; + unsigned char rperdis : 1; +}; + +struct BCDADJstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct VECTCTRLstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SSR00struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SSR00Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SSR01struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SSR01Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SSR02struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SSR02Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SSR03struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SSR03Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIR00struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIR00Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIR01struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIR01Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIR02struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIR02Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIR03struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIR03Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SMR00struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SMR01struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SMR02struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SMR03struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SCR00struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SCR01struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SCR02struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SCR03struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SE0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SE0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SS0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SS0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ST0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct ST0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SPS0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SPS0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SO0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SOE0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SOE0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EDR00struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct EDR00Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EDR01struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct EDR01Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EDR02struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct EDR02Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EDR03struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct EDR03Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SOL0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SOL0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SSC0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SSC0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SSR10struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SSR10Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SSR11struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SSR11Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SSR12struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SSR12Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SSR13struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SSR13Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIR10struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIR10Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIR11struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIR11Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIR12struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIR12Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIR13struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIR13Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SMR10struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SMR11struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SMR12struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SMR13struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SCR10struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SCR11struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SCR12struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SCR13struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SE1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SE1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SS1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SS1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ST1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct ST1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SPS1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SPS1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SO1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SOE1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SOE1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EDR10struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct EDR10Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EDR11struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct EDR11Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EDR12struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct EDR12Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EDR13struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct EDR13Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SOL1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SOL1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SSC1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SSC1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TCR00struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR01struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR02struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR03struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR04struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR05struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR06struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR07struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR00struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR01struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR02struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR03struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR04struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR05struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR06struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR07struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR00struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR00Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR01struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR01Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR02struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR02Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR03struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR03Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR04struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR04Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR05struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR05Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR06struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR06Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR07struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR07Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TE0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TE0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TS0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TS0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TT0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TT0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TPS0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TO0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TO0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TOE0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TOE0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TOL0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TOL0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TOM0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TOM0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TCR10struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR11struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR12struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR13struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR14struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR15struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR16struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TCR17struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR10struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR11struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR12struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR13struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR14struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR15struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR16struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TMR17struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR10struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR10Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR11struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR11Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR12struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR12Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR13struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR13Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR14struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR14Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR15struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR15Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR16struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR16Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TSR17struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TSR17Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TE1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TE1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TS1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TS1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TT1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TT1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TPS1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TO1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TO1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TOE1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TOE1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TOL1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TOL1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TOM1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TOM1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DSA2struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DSA3struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DRA2struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct DRA2Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DRA2Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DRA3struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct DRA3Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DRA3Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DBC2struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct DBC2Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DBC2Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DBC3struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct DBC3Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DBC3Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DMC2struct { + unsigned char : 1; + unsigned char dwait2 : 1; + unsigned char ds2 : 1; + unsigned char drs2 : 1; + unsigned char stg2 : 1; +}; + +struct DMC3struct { + unsigned char : 1; + unsigned char dwait3 : 1; + unsigned char ds3 : 1; + unsigned char drs3 : 1; + unsigned char stg3 : 1; +}; + +struct DRC2struct { + unsigned char dst2 : 1; + unsigned char : 1; + unsigned char den2 : 1; +}; + +struct DRC3struct { + unsigned char dst3 : 1; + unsigned char : 1; + unsigned char den3 : 1; +}; + +struct DWAITALLstruct { + unsigned char dwaitall0 : 1; + unsigned char : 1; + unsigned char prvari : 1; +}; + +struct IICCTL00struct { + unsigned char spt0 : 1; + unsigned char stt0 : 1; + unsigned char acke0 : 1; + unsigned char wtim0 : 1; + unsigned char spie0 : 1; + unsigned char wrel0 : 1; + unsigned char lrel0 : 1; + unsigned char iice0 : 1; +}; + +struct IICCTL01struct { + unsigned char prs0 : 1; + unsigned char : 1; + unsigned char dfc0 : 1; + unsigned char smc0 : 1; + unsigned char dad0 : 1; + unsigned char cld0 : 1; + unsigned char : 1; + unsigned char wup0 : 1; +}; + +struct IICWL0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct IICWH0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SVA0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct IICSE0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct IICCTL10struct { + unsigned char spt1 : 1; + unsigned char stt1 : 1; + unsigned char acke1 : 1; + unsigned char wtim1 : 1; + unsigned char spie1 : 1; + unsigned char wrel1 : 1; + unsigned char lrel1 : 1; + unsigned char iice1 : 1; +}; + +struct IICCTL11struct { + unsigned char prs1 : 1; + unsigned char : 1; + unsigned char dfc1 : 1; + unsigned char smc1 : 1; + unsigned char dad1 : 1; + unsigned char cld1 : 1; + unsigned char : 1; + unsigned char wup1 : 1; +}; + +struct IICWL1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct IICWH1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SVA1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct IICSE1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct CRC0CTLstruct { + unsigned char : 1; + unsigned char crc0en : 1; +}; + +struct PGCRCLstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct CRCDstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + + + +#define ADM2bits (*(volatile struct ADM2struct *)0xF0010) +#define ADULbits (*(volatile struct ADULstruct *)0xF0011) +#define ADLLbits (*(volatile struct ADLLstruct *)0xF0012) +#define ADTESbits (*(volatile struct ADTESstruct *)0xF0013) +#define PU0bits (*(volatile struct PU0struct *)0xF0030) +#define PU1bits (*(volatile struct PU1struct *)0xF0031) +#define PU3bits (*(volatile struct PU3struct *)0xF0033) +#define PU4bits (*(volatile struct PU4struct *)0xF0034) +#define PU5bits (*(volatile struct PU5struct *)0xF0035) +#define PU6bits (*(volatile struct PU6struct *)0xF0036) +#define PU7bits (*(volatile struct PU7struct *)0xF0037) +#define PU8bits (*(volatile struct PU8struct *)0xF0038) +#define PU9bits (*(volatile struct PU9struct *)0xF0039) +#define PU10bits (*(volatile struct PU10struct *)0xF003A) +#define PU11bits (*(volatile struct PU11struct *)0xF003B) +#define PU12bits (*(volatile struct PU12struct *)0xF003C) +#define PU14bits (*(volatile struct PU14struct *)0xF003E) +#define PIM0bits (*(volatile struct PIM0struct *)0xF0040) +#define PIM1bits (*(volatile struct PIM1struct *)0xF0041) +#define PIM4bits (*(volatile struct PIM4struct *)0xF0044) +#define PIM5bits (*(volatile struct PIM5struct *)0xF0045) +#define PIM8bits (*(volatile struct PIM8struct *)0xF0048) +#define PIM14bits (*(volatile struct PIM14struct *)0xF004E) +#define POM0bits (*(volatile struct POM0struct *)0xF0050) +#define POM1bits (*(volatile struct POM1struct *)0xF0051) +#define POM4bits (*(volatile struct POM4struct *)0xF0054) +#define POM5bits (*(volatile struct POM5struct *)0xF0055) +#define POM7bits (*(volatile struct POM7struct *)0xF0057) +#define POM8bits (*(volatile struct POM8struct *)0xF0058) +#define POM9bits (*(volatile struct POM9struct *)0xF0059) +#define POM14bits (*(volatile struct POM14struct *)0xF005E) +#define PMC0bits (*(volatile struct PMC0struct *)0xF0060) +#define PMC3bits (*(volatile struct PMC3struct *)0xF0063) +#define PMC10bits (*(volatile struct PMC10struct *)0xF006A) +#define PMC11bits (*(volatile struct PMC11struct *)0xF006B) +#define PMC12bits (*(volatile struct PMC12struct *)0xF006C) +#define PMC14bits (*(volatile struct PMC14struct *)0xF006E) +#define NFEN0bits (*(volatile struct NFEN0struct *)0xF0070) +#define NFEN1bits (*(volatile struct NFEN1struct *)0xF0071) +#define NFEN2bits (*(volatile struct NFEN2struct *)0xF0072) +#define ISCbits (*(volatile struct ISCstruct *)0xF0073) +#define TIS0bits (*(volatile struct TIS0struct *)0xF0074) +#define ADPCbits (*(volatile struct ADPCstruct *)0xF0076) +#define PIORbits (*(volatile struct PIORstruct *)0xF0077) +#define IAWCTLbits (*(volatile struct IAWCTLstruct *)0xF0078) +#define GDIDISbits (*(volatile struct GDIDISstruct *)0xF007D) +#define PRDSELbits (*(volatile struct PRDSELstruct *)0xF007E) +#define TOOLENbits (*(volatile struct TOOLENstruct *)0xF0080) +#define BPAL0bits (*(volatile struct BPAL0struct *)0xF0081) +#define BPAH0bits (*(volatile struct BPAH0struct *)0xF0082) +#define BPAS0bits (*(volatile struct BPAS0struct *)0xF0083) +#define BACDVL0bits (*(volatile struct BACDVL0struct *)0xF0084) +#define BACDVH0bits (*(volatile struct BACDVH0struct *)0xF0085) +#define BACDML0bits (*(volatile struct BACDML0struct *)0xF0086) +#define BACDMH0bits (*(volatile struct BACDMH0struct *)0xF0087) +#define MONMODbits (*(volatile struct MONMODstruct *)0xF0088) +#define DFLCTLbits (*(volatile struct DFLCTLstruct *)0xF0090) +#define HIOTRMbits (*(volatile struct HIOTRMstruct *)0xF00A0) +#define BECTLbits (*(volatile struct BECTLstruct *)0xF00A1) +#define HOCODIVbits (*(volatile struct HOCODIVstruct *)0xF00A8) +#define TEMPCAL0bits (*(volatile struct TEMPCAL0struct*)0xF00AC) +#define TEMPCAL1bits (*(volatile struct TEMPCAL1struct*)0xF00AD) +#define TEMPCAL2bits (*(volatile struct TEMPCAL2struct*)0xF00AE) +#define TEMPCAL3bits (*(volatile struct TEMPCAL3struct*)0xF00AF) +#define FLSECbits (*(volatile struct FLSECstruct *)0xF00B0) +#define FLFSWSbits (*(volatile struct FLFSWSstruct *)0xF00B2) +#define FLFSWEbits (*(volatile struct FLFSWEstruct *)0xF00B4) +#define FSSETbits (*(volatile struct FSSETstruct *)0xF00B6) +#define FSSEbits (*(volatile struct FSSEstruct *)0xF00B7) +#define FLFADLbits (*(volatile struct FLFADLstruct *)0xF00B8) +#define FLFADHbits (*(volatile struct FLFADHstruct *)0xF00BA) +#define PFCMDbits (*(volatile struct PFCMDstruct *)0xF00C0) +#define PFSbits (*(volatile struct PFSstruct *)0xF00C1) +#define FLRLbits (*(volatile struct FLRLstruct *)0xF00C2) +#define FLRHbits (*(volatile struct FLRHstruct *)0xF00C4) +#define FLWEbits (*(volatile struct FLWEstruct *)0xF00C6) +#define FLREbits (*(volatile struct FLREstruct *)0xF00C7) +#define FLTMSbits (*(volatile struct FLTMSstruct *)0xF00C8) +#define DFLMCbits (*(volatile struct DFLMCstruct *)0xF00CA) +#define FLMCLbits (*(volatile struct FLMCLstruct *)0xF00CC) +#define FLMCHbits (*(volatile struct FLMCHstruct *)0xF00CE) +#define FSCTLbits (*(volatile struct FSCTLstruct *)0xF00CF) +#define ICEADRbits (*(volatile struct ICEADRstruct *)0xF00D0) +#define ICEDATbits (*(volatile struct ICEDATstruct *)0xF00D2) +#define MDCLbits (*(volatile struct MDCLstruct *)0xF00E0) +#define MDCHbits (*(volatile struct MDCHstruct *)0xF00E2) +#define MDUCbits (*(volatile struct MDUCstruct *)0xF00E8) +#define PER0bits (*(volatile struct PER0struct *)0xF00F0) +#define OSMCbits (*(volatile struct OSMCstruct *)0xF00F3) +#define RMCbits (*(volatile struct RMCstruct *)0xF00F4) +#define RPECTLbits (*(volatile struct RPECTLstruct *)0xF00F5) +#define BCDADJbits (*(volatile struct BCDADJstruct *)0xF00FE) +#define VECTCTRLbits (*(volatile struct VECTCTRLstruct*)0xF00FF) +#define SSR00bits (*(volatile struct SSR00struct *)0xF0100) +#define SSR00Lbits (*(volatile struct SSR00Lstruct *)0xF0100) +#define SSR01bits (*(volatile struct SSR01struct *)0xF0102) +#define SSR01Lbits (*(volatile struct SSR01Lstruct *)0xF0102) +#define SSR02bits (*(volatile struct SSR02struct *)0xF0104) +#define SSR02Lbits (*(volatile struct SSR02Lstruct *)0xF0104) +#define SSR03bits (*(volatile struct SSR03struct *)0xF0106) +#define SSR03Lbits (*(volatile struct SSR03Lstruct *)0xF0106) +#define SIR00bits (*(volatile struct SIR00struct *)0xF0108) +#define SIR00Lbits (*(volatile struct SIR00Lstruct *)0xF0108) +#define SIR01bits (*(volatile struct SIR01struct *)0xF010A) +#define SIR01Lbits (*(volatile struct SIR01Lstruct *)0xF010A) +#define SIR02bits (*(volatile struct SIR02struct *)0xF010C) +#define SIR02Lbits (*(volatile struct SIR02Lstruct *)0xF010C) +#define SIR03bits (*(volatile struct SIR03struct *)0xF010E) +#define SIR03Lbits (*(volatile struct SIR03Lstruct *)0xF010E) +#define SMR00bits (*(volatile struct SMR00struct *)0xF0110) +#define SMR01bits (*(volatile struct SMR01struct *)0xF0112) +#define SMR02bits (*(volatile struct SMR02struct *)0xF0114) +#define SMR03bits (*(volatile struct SMR03struct *)0xF0116) +#define SCR00bits (*(volatile struct SCR00struct *)0xF0118) +#define SCR01bits (*(volatile struct SCR01struct *)0xF011A) +#define SCR02bits (*(volatile struct SCR02struct *)0xF011C) +#define SCR03bits (*(volatile struct SCR03struct *)0xF011E) +#define SE0bits (*(volatile struct SE0struct *)0xF0120) +#define SE0Lbits (*(volatile struct SE0Lstruct *)0xF0120) +#define SS0bits (*(volatile struct SS0struct *)0xF0122) +#define SS0Lbits (*(volatile struct SS0Lstruct *)0xF0122) +#define ST0bits (*(volatile struct ST0struct *)0xF0124) +#define ST0Lbits (*(volatile struct ST0Lstruct *)0xF0124) +#define SPS0bits (*(volatile struct SPS0struct *)0xF0126) +#define SPS0Lbits (*(volatile struct SPS0Lstruct *)0xF0126) +#define SO0bits (*(volatile struct SO0struct *)0xF0128) +#define SOE0bits (*(volatile struct SOE0struct *)0xF012A) +#define SOE0Lbits (*(volatile struct SOE0Lstruct *)0xF012A) +#define EDR00bits (*(volatile struct EDR00struct *)0xF012C) +#define EDR00Lbits (*(volatile struct EDR00Lstruct *)0xF012C) +#define EDR01bits (*(volatile struct EDR01struct *)0xF012E) +#define EDR01Lbits (*(volatile struct EDR01Lstruct *)0xF012E) +#define EDR02bits (*(volatile struct EDR02struct *)0xF0130) +#define EDR02Lbits (*(volatile struct EDR02Lstruct *)0xF0130) +#define EDR03bits (*(volatile struct EDR03struct *)0xF0132) +#define EDR03Lbits (*(volatile struct EDR03Lstruct *)0xF0132) +#define SOL0bits (*(volatile struct SOL0struct *)0xF0134) +#define SOL0Lbits (*(volatile struct SOL0Lstruct *)0xF0134) +#define SSC0bits (*(volatile struct SSC0struct *)0xF0138) +#define SSC0Lbits (*(volatile struct SSC0Lstruct *)0xF0138) +#define SSR10bits (*(volatile struct SSR10struct *)0xF0140) +#define SSR10Lbits (*(volatile struct SSR10Lstruct *)0xF0140) +#define SSR11bits (*(volatile struct SSR11struct *)0xF0142) +#define SSR11Lbits (*(volatile struct SSR11Lstruct *)0xF0142) +#define SSR12bits (*(volatile struct SSR12struct *)0xF0144) +#define SSR12Lbits (*(volatile struct SSR12Lstruct *)0xF0144) +#define SSR13bits (*(volatile struct SSR13struct *)0xF0146) +#define SSR13Lbits (*(volatile struct SSR13Lstruct *)0xF0146) +#define SIR10bits (*(volatile struct SIR10struct *)0xF0148) +#define SIR10Lbits (*(volatile struct SIR10Lstruct *)0xF0148) +#define SIR11bits (*(volatile struct SIR11struct *)0xF014A) +#define SIR11Lbits (*(volatile struct SIR11Lstruct *)0xF014A) +#define SIR12bits (*(volatile struct SIR12struct *)0xF014C) +#define SIR12Lbits (*(volatile struct SIR12Lstruct *)0xF014C) +#define SIR13bits (*(volatile struct SIR13struct *)0xF014E) +#define SIR13Lbits (*(volatile struct SIR13Lstruct *)0xF014E) +#define SMR10bits (*(volatile struct SMR10struct *)0xF0150) +#define SMR11bits (*(volatile struct SMR11struct *)0xF0152) +#define SMR12bits (*(volatile struct SMR12struct *)0xF0154) +#define SMR13bits (*(volatile struct SMR13struct *)0xF0156) +#define SCR10bits (*(volatile struct SCR10struct *)0xF0158) +#define SCR11bits (*(volatile struct SCR11struct *)0xF015A) +#define SCR12bits (*(volatile struct SCR12struct *)0xF015C) +#define SCR13bits (*(volatile struct SCR13struct *)0xF015E) +#define SE1bits (*(volatile struct SE1struct *)0xF0160) +#define SE1Lbits (*(volatile struct SE1Lstruct *)0xF0160) +#define SS1bits (*(volatile struct SS1struct *)0xF0162) +#define SS1Lbits (*(volatile struct SS1Lstruct *)0xF0162) +#define ST1bits (*(volatile struct ST1struct *)0xF0164) +#define ST1Lbits (*(volatile struct ST1Lstruct *)0xF0164) +#define SPS1bits (*(volatile struct SPS1struct *)0xF0166) +#define SPS1Lbits (*(volatile struct SPS1Lstruct *)0xF0166) +#define SO1bits (*(volatile struct SO1struct *)0xF0168) +#define SOE1bits (*(volatile struct SOE1struct *)0xF016A) +#define SOE1Lbits (*(volatile struct SOE1Lstruct *)0xF016A) +#define EDR10bits (*(volatile struct EDR10struct *)0xF016C) +#define EDR10Lbits (*(volatile struct EDR10Lstruct *)0xF016C) +#define EDR11bits (*(volatile struct EDR11struct *)0xF016E) +#define EDR11Lbits (*(volatile struct EDR11Lstruct *)0xF016E) +#define EDR12bits (*(volatile struct EDR12struct *)0xF0170) +#define EDR12Lbits (*(volatile struct EDR12Lstruct *)0xF0170) +#define EDR13bits (*(volatile struct EDR13struct *)0xF0172) +#define EDR13Lbits (*(volatile struct EDR13Lstruct *)0xF0172) +#define SOL1bits (*(volatile struct SOL1struct *)0xF0174) +#define SOL1Lbits (*(volatile struct SOL1Lstruct *)0xF0174) +#define SSC1bits (*(volatile struct SSC1struct *)0xF0178) +#define SSC1Lbits (*(volatile struct SSC1Lstruct *)0xF0178) +#define TCR00bits (*(volatile struct TCR00struct *)0xF0180) +#define TCR01bits (*(volatile struct TCR01struct *)0xF0182) +#define TCR02bits (*(volatile struct TCR02struct *)0xF0184) +#define TCR03bits (*(volatile struct TCR03struct *)0xF0186) +#define TCR04bits (*(volatile struct TCR04struct *)0xF0188) +#define TCR05bits (*(volatile struct TCR05struct *)0xF018A) +#define TCR06bits (*(volatile struct TCR06struct *)0xF018C) +#define TCR07bits (*(volatile struct TCR07struct *)0xF018E) +#define TMR00bits (*(volatile struct TMR00struct *)0xF0190) +#define TMR01bits (*(volatile struct TMR01struct *)0xF0192) +#define TMR02bits (*(volatile struct TMR02struct *)0xF0194) +#define TMR03bits (*(volatile struct TMR03struct *)0xF0196) +#define TMR04bits (*(volatile struct TMR04struct *)0xF0198) +#define TMR05bits (*(volatile struct TMR05struct *)0xF019A) +#define TMR06bits (*(volatile struct TMR06struct *)0xF019C) +#define TMR07bits (*(volatile struct TMR07struct *)0xF019E) +#define TSR00bits (*(volatile struct TSR00struct *)0xF01A0) +#define TSR00Lbits (*(volatile struct TSR00Lstruct *)0xF01A0) +#define TSR01bits (*(volatile struct TSR01struct *)0xF01A2) +#define TSR01Lbits (*(volatile struct TSR01Lstruct *)0xF01A2) +#define TSR02bits (*(volatile struct TSR02struct *)0xF01A4) +#define TSR02Lbits (*(volatile struct TSR02Lstruct *)0xF01A4) +#define TSR03bits (*(volatile struct TSR03struct *)0xF01A6) +#define TSR03Lbits (*(volatile struct TSR03Lstruct *)0xF01A6) +#define TSR04bits (*(volatile struct TSR04struct *)0xF01A8) +#define TSR04Lbits (*(volatile struct TSR04Lstruct *)0xF01A8) +#define TSR05bits (*(volatile struct TSR05struct *)0xF01AA) +#define TSR05Lbits (*(volatile struct TSR05Lstruct *)0xF01AA) +#define TSR06bits (*(volatile struct TSR06struct *)0xF01AC) +#define TSR06Lbits (*(volatile struct TSR06Lstruct *)0xF01AC) +#define TSR07bits (*(volatile struct TSR07struct *)0xF01AE) +#define TSR07Lbits (*(volatile struct TSR07Lstruct *)0xF01AE) +#define TE0bits (*(volatile struct TE0struct *)0xF01B0) +#define TE0Lbits (*(volatile struct TE0Lstruct *)0xF01B0) +#define TS0bits (*(volatile struct TS0struct *)0xF01B2) +#define TS0Lbits (*(volatile struct TS0Lstruct *)0xF01B2) +#define TT0bits (*(volatile struct TT0struct *)0xF01B4) +#define TT0Lbits (*(volatile struct TT0Lstruct *)0xF01B4) +#define TPS0bits (*(volatile struct TPS0struct *)0xF01B6) +#define TO0bits (*(volatile struct TO0struct *)0xF01B8) +#define TO0Lbits (*(volatile struct TO0Lstruct *)0xF01B8) +#define TOE0bits (*(volatile struct TOE0struct *)0xF01BA) +#define TOE0Lbits (*(volatile struct TOE0Lstruct *)0xF01BA) +#define TOL0bits (*(volatile struct TOL0struct *)0xF01BC) +#define TOL0Lbits (*(volatile struct TOL0Lstruct *)0xF01BC) +#define TOM0bits (*(volatile struct TOM0struct *)0xF01BE) +#define TOM0Lbits (*(volatile struct TOM0Lstruct *)0xF01BE) +#define TCR10bits (*(volatile struct TCR10struct *)0xF01C0) +#define TCR11bits (*(volatile struct TCR11struct *)0xF01C2) +#define TCR12bits (*(volatile struct TCR12struct *)0xF01C4) +#define TCR13bits (*(volatile struct TCR13struct *)0xF01C6) +#define TCR14bits (*(volatile struct TCR14struct *)0xF01C8) +#define TCR15bits (*(volatile struct TCR15struct *)0xF01CA) +#define TCR16bits (*(volatile struct TCR16struct *)0xF01CC) +#define TCR17bits (*(volatile struct TCR17struct *)0xF01CE) +#define TMR10bits (*(volatile struct TMR10struct *)0xF01D0) +#define TMR11bits (*(volatile struct TMR11struct *)0xF01D2) +#define TMR12bits (*(volatile struct TMR12struct *)0xF01D4) +#define TMR13bits (*(volatile struct TMR13struct *)0xF01D6) +#define TMR14bits (*(volatile struct TMR14struct *)0xF01D8) +#define TMR15bits (*(volatile struct TMR15struct *)0xF01DA) +#define TMR16bits (*(volatile struct TMR16struct *)0xF01DC) +#define TMR17bits (*(volatile struct TMR17struct *)0xF01DE) +#define TSR10bits (*(volatile struct TSR10struct *)0xF01E0) +#define TSR10Lbits (*(volatile struct TSR10Lstruct *)0xF01E0) +#define TSR11bits (*(volatile struct TSR11struct *)0xF01E2) +#define TSR11Lbits (*(volatile struct TSR11Lstruct *)0xF01E2) +#define TSR12bits (*(volatile struct TSR12struct *)0xF01E4) +#define TSR12Lbits (*(volatile struct TSR12Lstruct *)0xF01E4) +#define TSR13bits (*(volatile struct TSR13struct *)0xF01E6) +#define TSR13Lbits (*(volatile struct TSR13Lstruct *)0xF01E6) +#define TSR14bits (*(volatile struct TSR14struct *)0xF01E8) +#define TSR14Lbits (*(volatile struct TSR14Lstruct *)0xF01E8) +#define TSR15bits (*(volatile struct TSR15struct *)0xF01EA) +#define TSR15Lbits (*(volatile struct TSR15Lstruct *)0xF01EA) +#define TSR16bits (*(volatile struct TSR16struct *)0xF01EC) +#define TSR16Lbits (*(volatile struct TSR16Lstruct *)0xF01EC) +#define TSR17bits (*(volatile struct TSR17struct *)0xF01EE) +#define TSR17Lbits (*(volatile struct TSR17Lstruct *)0xF01EE) +#define TE1bits (*(volatile struct TE1struct *)0xF01F0) +#define TE1Lbits (*(volatile struct TE1Lstruct *)0xF01F0) +#define TS1bits (*(volatile struct TS1struct *)0xF01F2) +#define TS1Lbits (*(volatile struct TS1Lstruct *)0xF01F2) +#define TT1bits (*(volatile struct TT1struct *)0xF01F4) +#define TT1Lbits (*(volatile struct TT1Lstruct *)0xF01F4) +#define TPS1bits (*(volatile struct TPS1struct *)0xF01F6) +#define TO1bits (*(volatile struct TO1struct *)0xF01F8) +#define TO1Lbits (*(volatile struct TO1Lstruct *)0xF01F8) +#define TOE1bits (*(volatile struct TOE1struct *)0xF01FA) +#define TOE1Lbits (*(volatile struct TOE1Lstruct *)0xF01FA) +#define TOL1bits (*(volatile struct TOL1struct *)0xF01FC) +#define TOL1Lbits (*(volatile struct TOL1Lstruct *)0xF01FC) +#define TOM1bits (*(volatile struct TOM1struct *)0xF01FE) +#define TOM1Lbits (*(volatile struct TOM1Lstruct *)0xF01FE) +#define DSA2bits (*(volatile struct DSA2struct *)0xF0200) +#define DSA3bits (*(volatile struct DSA3struct *)0xF0201) +#define DRA2bits (*(volatile struct DRA2struct *)0xF0202) +#define DRA2Lbits (*(volatile struct DRA2Lstruct *)0xF0202) +#define DRA2Hbits (*(volatile struct DRA2Hstruct *)0xF0203) +#define DRA3bits (*(volatile struct DRA3struct *)0xF0204) +#define DRA3Lbits (*(volatile struct DRA3Lstruct *)0xF0204) +#define DRA3Hbits (*(volatile struct DRA3Hstruct *)0xF0205) +#define DBC2bits (*(volatile struct DBC2struct *)0xF0206) +#define DBC2Lbits (*(volatile struct DBC2Lstruct *)0xF0206) +#define DBC2Hbits (*(volatile struct DBC2Hstruct *)0xF0207) +#define DBC3bits (*(volatile struct DBC3struct *)0xF0208) +#define DBC3Lbits (*(volatile struct DBC3Lstruct *)0xF0208) +#define DBC3Hbits (*(volatile struct DBC3Hstruct *)0xF0209) +#define DMC2bits (*(volatile struct DMC2struct *)0xF020A) +#define DMC3bits (*(volatile struct DMC3struct *)0xF020B) +#define DRC2bits (*(volatile struct DRC2struct *)0xF020C) +#define DRC3bits (*(volatile struct DRC3struct *)0xF020D) +#define DWAITALLbits (*(volatile struct DWAITALLstruct*)0xF020F) +#define IICCTL00bits (*(volatile struct IICCTL00struct*)0xF0230) +#define IICCTL01bits (*(volatile struct IICCTL01struct*)0xF0231) +#define IICWL0bits (*(volatile struct IICWL0struct *)0xF0232) +#define IICWH0bits (*(volatile struct IICWH0struct *)0xF0233) +#define SVA0bits (*(volatile struct SVA0struct *)0xF0234) +#define IICSE0bits (*(volatile struct IICSE0struct *)0xF0235) +#define IICCTL10bits (*(volatile struct IICCTL10struct*)0xF0238) +#define IICCTL11bits (*(volatile struct IICCTL11struct*)0xF0239) +#define IICWL1bits (*(volatile struct IICWL1struct *)0xF023A) +#define IICWH1bits (*(volatile struct IICWH1struct *)0xF023B) +#define SVA1bits (*(volatile struct SVA1struct *)0xF023C) +#define IICSE1bits (*(volatile struct IICSE1struct *)0xF023D) +#define CRC0CTLbits (*(volatile struct CRC0CTLstruct *)0xF02F0) +#define PGCRCLbits (*(volatile struct PGCRCLstruct *)0xF02F2) +#define CRCDbits (*(volatile struct CRCDstruct *)0xF02FA) + + +#define ADTYP (ADM2bits.adtyp) +#define AWC (ADM2bits.awc) +#define ADRCK (ADM2bits.adrck) +#define DFLEN (DFLCTLbits.dflen) +#define BRSAM (BECTLbits.brsam) +#define ESQST (FSSEbits.esqst) +#define DIVST (MDUCbits.divst) +#define MACSF (MDUCbits.macsf) +#define MACOF (MDUCbits.macof) +#define MDSM (MDUCbits.mdsm) +#define MACMODE (MDUCbits.macmode) +#define DIVMODE (MDUCbits.divmode) +#define TAU0EN (PER0bits.tau0en) +#define TAU1EN (PER0bits.tau1en) +#define SAU0EN (PER0bits.sau0en) +#define SAU1EN (PER0bits.sau1en) +#define IICA0EN (PER0bits.iica0en) +#define ADCEN (PER0bits.adcen) +#define IICA1EN (PER0bits.iica1en) +#define RTCEN (PER0bits.rtcen) +#define PAENB (RMCbits.paenb) +#define WDVOL (RMCbits.wdvol) +#define RPEF (RPECTLbits.rpef) +#define RPERDIS (RPECTLbits.rperdis) +#define DWAIT2 (DMC2bits.dwait2) +#define DS2 (DMC2bits.ds2) +#define DRS2 (DMC2bits.drs2) +#define STG2 (DMC2bits.stg2) +#define DWAIT3 (DMC3bits.dwait3) +#define DS3 (DMC3bits.ds3) +#define DRS3 (DMC3bits.drs3) +#define STG3 (DMC3bits.stg3) +#define DST2 (DRC2bits.dst2) +#define DEN2 (DRC2bits.den2) +#define DST3 (DRC3bits.dst3) +#define DEN3 (DRC3bits.den3) +#define DWAITALL0 (DWAITALLbits.dwaitall0) +#define PRVARI (DWAITALLbits.prvari) +#define SPT0 (IICCTL00bits.spt0) +#define STT0 (IICCTL00bits.stt0) +#define ACKE0 (IICCTL00bits.acke0) +#define WTIM0 (IICCTL00bits.wtim0) +#define SPIE0 (IICCTL00bits.spie0) +#define WREL0 (IICCTL00bits.wrel0) +#define LREL0 (IICCTL00bits.lrel0) +#define IICE0 (IICCTL00bits.iice0) +#define PRS0 (IICCTL01bits.prs0) +#define DFC0 (IICCTL01bits.dfc0) +#define SMC0 (IICCTL01bits.smc0) +#define DAD0 (IICCTL01bits.dad0) +#define CLD0 (IICCTL01bits.cld0) +#define WUP0 (IICCTL01bits.wup0) +#define SPT1 (IICCTL10bits.spt1) +#define STT1 (IICCTL10bits.stt1) +#define ACKE1 (IICCTL10bits.acke1) +#define WTIM1 (IICCTL10bits.wtim1) +#define SPIE1 (IICCTL10bits.spie1) +#define WREL1 (IICCTL10bits.wrel1) +#define LREL1 (IICCTL10bits.lrel1) +#define IICE1 (IICCTL10bits.iice1) +#define PRS1 (IICCTL11bits.prs1) +#define DFC1 (IICCTL11bits.dfc1) +#define SMC1 (IICCTL11bits.smc1) +#define DAD1 (IICCTL11bits.dad1) +#define CLD1 (IICCTL11bits.cld1) +#define WUP1 (IICCTL11bits.wup1) +#define CRC0EN (CRC0CTLbits.crc0en) + + +#define PIOR5 (PIORbits.bit5) +#define PMC02 (PMC0bits.bit2) +#define PM02 (PM0bits.bit2) +#define P02 (P0bits.bit2) + +#define PMC03 (PMC0bits.bit3) +#define PM03 (PM0bits.bit3) +#define P03 (P0bits.bit3) + +#define PMC04 (PMC0bits.bit4) +#define PM04 (PM0bits.bit4) +#define P04 (P0bits.bit4) + +#define P05 (P0bits.bit5) +#define P06 (P0bits.bit6) +#define P16 (P1bits.bit6) +#define P30 (P3bits.bit0) +#define P43 (P4bits.bit3) +#define P50 (P5bits.bit0) +#define P120 (P12bits.bit0) + +#define TCR (&TCR00) +#define TMR (&TMR00) + +#endif // SFRS_EXT_H diff --git a/cpu/rl78/sfrs.h b/cpu/rl78/sfrs.h new file mode 100644 index 000000000..9793522e9 --- /dev/null +++ b/cpu/rl78/sfrs.h @@ -0,0 +1,3277 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#ifndef SFRS_H +#define SFRS_H + +#define P0 (*(volatile unsigned char *)0xFFF00) +#define P1 (*(volatile unsigned char *)0xFFF01) +#define P2 (*(volatile unsigned char *)0xFFF02) +#define P3 (*(volatile unsigned char *)0xFFF03) +#define P4 (*(volatile unsigned char *)0xFFF04) +#define P5 (*(volatile unsigned char *)0xFFF05) +#define P6 (*(volatile unsigned char *)0xFFF06) +#define P7 (*(volatile unsigned char *)0xFFF07) +#define P8 (*(volatile unsigned char *)0xFFF08) +#define P9 (*(volatile unsigned char *)0xFFF09) +#define P10 (*(volatile unsigned char *)0xFFF0A) +#define P11 (*(volatile unsigned char *)0xFFF0B) +#define P12 (*(volatile unsigned char *)0xFFF0C) +#define P13 (*(volatile unsigned char *)0xFFF0D) +#define P14 (*(volatile unsigned char *)0xFFF0E) +#define P15 (*(volatile unsigned char *)0xFFF0F) +#define SDR00 (*(volatile unsigned short *)0xFFF10) +#define SIO00 (*(volatile unsigned char *)0xFFF10) +#define TXD0 (*(volatile unsigned char *)0xFFF10) +#define SDR01 (*(volatile unsigned short *)0xFFF12) +#define RXD0 (*(volatile unsigned char *)0xFFF12) +#define SIO01 (*(volatile unsigned char *)0xFFF12) +#define SDR12 (*(volatile unsigned short *)0xFFF14) +#define SIO30 (*(volatile unsigned char *)0xFFF14) +#define TXD3 (*(volatile unsigned char *)0xFFF14) +#define SDR13 (*(volatile unsigned short *)0xFFF16) +#define RXD3 (*(volatile unsigned char *)0xFFF16) +#define SIO31 (*(volatile unsigned char *)0xFFF16) +#define TDR00 (*(volatile unsigned short *)0xFFF18) +#define TDR01 (*(volatile unsigned short *)0xFFF1A) +#define TDR01L (*(volatile unsigned char *)0xFFF1A) +#define TDR01H (*(volatile unsigned char *)0xFFF1B) +#define ADCR (*(volatile unsigned short *)0xFFF1E) +#define ADCRH (*(volatile unsigned char *)0xFFF1F) +#define PM0 (*(volatile unsigned char *)0xFFF20) +#define PM1 (*(volatile unsigned char *)0xFFF21) +#define PM2 (*(volatile unsigned char *)0xFFF22) +#define PM3 (*(volatile unsigned char *)0xFFF23) +#define PM4 (*(volatile unsigned char *)0xFFF24) +#define PM5 (*(volatile unsigned char *)0xFFF25) +#define PM6 (*(volatile unsigned char *)0xFFF26) +#define PM7 (*(volatile unsigned char *)0xFFF27) +#define PM8 (*(volatile unsigned char *)0xFFF28) +#define PM9 (*(volatile unsigned char *)0xFFF29) +#define PM10 (*(volatile unsigned char *)0xFFF2A) +#define PM11 (*(volatile unsigned char *)0xFFF2B) +#define PM12 (*(volatile unsigned char *)0xFFF2C) +#define PM14 (*(volatile unsigned char *)0xFFF2E) +#define PM15 (*(volatile unsigned char *)0xFFF2F) +#define ADM0 (*(volatile unsigned char *)0xFFF30) +#define ADS (*(volatile unsigned char *)0xFFF31) +#define ADM1 (*(volatile unsigned char *)0xFFF32) +#define KRM (*(volatile unsigned char *)0xFFF37) +#define EGP0 (*(volatile unsigned char *)0xFFF38) +#define EGN0 (*(volatile unsigned char *)0xFFF39) +#define EGP1 (*(volatile unsigned char *)0xFFF3A) +#define EGN1 (*(volatile unsigned char *)0xFFF3B) +#define SDR02 (*(volatile unsigned short *)0xFFF44) +#define SIO10 (*(volatile unsigned char *)0xFFF44) +#define TXD1 (*(volatile unsigned char *)0xFFF44) +#define SDR03 (*(volatile unsigned short *)0xFFF46) +#define RXD1 (*(volatile unsigned char *)0xFFF46) +#define SIO11 (*(volatile unsigned char *)0xFFF46) +#define SDR10 (*(volatile unsigned short *)0xFFF48) +#define SIO20 (*(volatile unsigned char *)0xFFF48) +#define TXD2 (*(volatile unsigned char *)0xFFF48) +#define SDR11 (*(volatile unsigned short *)0xFFF4A) +#define RXD2 (*(volatile unsigned char *)0xFFF4A) +#define SIO21 (*(volatile unsigned char *)0xFFF4A) +#define IICA0 (*(volatile unsigned char *)0xFFF50) +#define IICS0 (*(volatile unsigned char *)0xFFF51) +#define IICF0 (*(volatile unsigned char *)0xFFF52) +#define IICA1 (*(volatile unsigned char *)0xFFF54) +#define IICS1 (*(volatile unsigned char *)0xFFF55) +#define IICF1 (*(volatile unsigned char *)0xFFF56) +#define TDR02 (*(volatile unsigned short *)0xFFF64) +#define TDR03 (*(volatile unsigned short *)0xFFF66) +#define TDR03L (*(volatile unsigned char *)0xFFF66) +#define TDR03H (*(volatile unsigned char *)0xFFF67) +#define TDR04 (*(volatile unsigned short *)0xFFF68) +#define TDR05 (*(volatile unsigned short *)0xFFF6A) +#define TDR06 (*(volatile unsigned short *)0xFFF6C) +#define TDR07 (*(volatile unsigned short *)0xFFF6E) +#define TDR10 (*(volatile unsigned short *)0xFFF70) +#define TDR11 (*(volatile unsigned short *)0xFFF72) +#define TDR11L (*(volatile unsigned char *)0xFFF72) +#define TDR11H (*(volatile unsigned char *)0xFFF73) +#define TDR12 (*(volatile unsigned short *)0xFFF74) +#define TDR13 (*(volatile unsigned short *)0xFFF76) +#define TDR13L (*(volatile unsigned char *)0xFFF76) +#define TDR13H (*(volatile unsigned char *)0xFFF77) +#define TDR14 (*(volatile unsigned short *)0xFFF78) +#define TDR15 (*(volatile unsigned short *)0xFFF7A) +#define TDR16 (*(volatile unsigned short *)0xFFF7C) +#define TDR17 (*(volatile unsigned short *)0xFFF7E) +#define FLPMC (*(volatile unsigned char *)0xFFF80) +#define FLARS (*(volatile unsigned char *)0xFFF81) +#define FLAPL (*(volatile unsigned short *)0xFFF82) +#define FLAPH (*(volatile unsigned char *)0xFFF84) +#define FSSQ (*(volatile unsigned char *)0xFFF85) +#define FLSEDL (*(volatile unsigned short *)0xFFF86) +#define FLSEDH (*(volatile unsigned char *)0xFFF88) +#define FLRST (*(volatile unsigned char *)0xFFF89) +#define FSASTL (*(volatile unsigned char *)0xFFF8A) +#define FSASTH (*(volatile unsigned char *)0xFFF8B) +#define FLWL (*(volatile unsigned short *)0xFFF8C) +#define FLWH (*(volatile unsigned short *)0xFFF8E) +#define ITMC (*(volatile unsigned short *)0xFFF90) +#define SEC (*(volatile unsigned char *)0xFFF92) +#define RL78_MIN (*(volatile unsigned char *)0xFFF93) /* Note: "MIN" would conflict with the MIN() macro. */ +#define HOUR (*(volatile unsigned char *)0xFFF94) +#define WEEK (*(volatile unsigned char *)0xFFF95) +#define DAY (*(volatile unsigned char *)0xFFF96) +#define MONTH (*(volatile unsigned char *)0xFFF97) +#define YEAR (*(volatile unsigned char *)0xFFF98) +#define SUBCUD (*(volatile unsigned char *)0xFFF99) +#define ALARMWM (*(volatile unsigned char *)0xFFF9A) +#define ALARMWH (*(volatile unsigned char *)0xFFF9B) +#define ALARMWW (*(volatile unsigned char *)0xFFF9C) +#define RTCC0 (*(volatile unsigned char *)0xFFF9D) +#define RTCC1 (*(volatile unsigned char *)0xFFF9E) +#define CMC (*(volatile unsigned char *)0xFFFA0) +#define CSC (*(volatile unsigned char *)0xFFFA1) +#define OSTC (*(volatile unsigned char *)0xFFFA2) +#define OSTS (*(volatile unsigned char *)0xFFFA3) +#define CKC (*(volatile unsigned char *)0xFFFA4) +#define CKS0 (*(volatile unsigned char *)0xFFFA5) +#define CKS1 (*(volatile unsigned char *)0xFFFA6) +#define RESF (*(volatile unsigned char *)0xFFFA8) +#define LVIM (*(volatile unsigned char *)0xFFFA9) +#define LVIS (*(volatile unsigned char *)0xFFFAA) +#define WDTE (*(volatile unsigned char *)0xFFFAB) +#define CRCIN (*(volatile unsigned char *)0xFFFAC) +#define RXB (*(volatile unsigned char *)0xFFFAD) +#define TXS (*(volatile unsigned char *)0xFFFAD) +#define MONSTA0 (*(volatile unsigned char *)0xFFFAE) +#define ASIM (*(volatile unsigned char *)0xFFFAF) +#define DSA0 (*(volatile unsigned char *)0xFFFB0) +#define DSA1 (*(volatile unsigned char *)0xFFFB1) +#define DRA0 (*(volatile unsigned short *)0xFFFB2) +#define DRA0L (*(volatile unsigned char *)0xFFFB2) +#define DRA0H (*(volatile unsigned char *)0xFFFB3) +#define DRA1 (*(volatile unsigned short *)0xFFFB4) +#define DRA1L (*(volatile unsigned char *)0xFFFB4) +#define DRA1H (*(volatile unsigned char *)0xFFFB5) +#define DBC0 (*(volatile unsigned short *)0xFFFB6) +#define DBC0L (*(volatile unsigned char *)0xFFFB6) +#define DBC0H (*(volatile unsigned char *)0xFFFB7) +#define DBC1 (*(volatile unsigned short *)0xFFFB8) +#define DBC1L (*(volatile unsigned char *)0xFFFB8) +#define DBC1H (*(volatile unsigned char *)0xFFFB9) +#define DMC0 (*(volatile unsigned char *)0xFFFBA) +#define DMC1 (*(volatile unsigned char *)0xFFFBB) +#define DRC0 (*(volatile unsigned char *)0xFFFBC) +#define DRC1 (*(volatile unsigned char *)0xFFFBD) +#define IF2 (*(volatile unsigned short *)0xFFFD0) +#define IF2L (*(volatile unsigned char *)0xFFFD0) +#define IF2H (*(volatile unsigned char *)0xFFFD1) +#define IF3 (*(volatile unsigned short *)0xFFFD2) +#define IF3L (*(volatile unsigned char *)0xFFFD2) +#define MK2 (*(volatile unsigned short *)0xFFFD4) +#define MK2L (*(volatile unsigned char *)0xFFFD4) +#define MK2H (*(volatile unsigned char *)0xFFFD5) +#define MK3 (*(volatile unsigned short *)0xFFFD6) +#define MK3L (*(volatile unsigned char *)0xFFFD6) +#define PR02 (*(volatile unsigned short *)0xFFFD8) +#define PR02L (*(volatile unsigned char *)0xFFFD8) +#define PR02H (*(volatile unsigned char *)0xFFFD9) +#define PR03 (*(volatile unsigned short *)0xFFFDA) +#define PR03L (*(volatile unsigned char *)0xFFFDA) +#define PR12 (*(volatile unsigned short *)0xFFFDC) +#define PR12L (*(volatile unsigned char *)0xFFFDC) +#define PR12H (*(volatile unsigned char *)0xFFFDD) +#define PR13 (*(volatile unsigned short *)0xFFFDE) +#define PR13L (*(volatile unsigned char *)0xFFFDE) +#define IF0 (*(volatile unsigned short *)0xFFFE0) +#define IF0L (*(volatile unsigned char *)0xFFFE0) +#define IF0H (*(volatile unsigned char *)0xFFFE1) +#define IF1 (*(volatile unsigned short *)0xFFFE2) +#define IF1L (*(volatile unsigned char *)0xFFFE2) +#define IF1H (*(volatile unsigned char *)0xFFFE3) +#define MK0 (*(volatile unsigned short *)0xFFFE4) +#define MK0L (*(volatile unsigned char *)0xFFFE4) +#define MK0H (*(volatile unsigned char *)0xFFFE5) +#define MK1 (*(volatile unsigned short *)0xFFFE6) +#define MK1L (*(volatile unsigned char *)0xFFFE6) +#define MK1H (*(volatile unsigned char *)0xFFFE7) +#define PR00 (*(volatile unsigned short *)0xFFFE8) +#define PR00L (*(volatile unsigned char *)0xFFFE8) +#define PR00H (*(volatile unsigned char *)0xFFFE9) +#define PR01 (*(volatile unsigned short *)0xFFFEA) +#define PR01L (*(volatile unsigned char *)0xFFFEA) +#define PR01H (*(volatile unsigned char *)0xFFFEB) +#define PR10 (*(volatile unsigned short *)0xFFFEC) +#define PR10L (*(volatile unsigned char *)0xFFFEC) +#define PR10H (*(volatile unsigned char *)0xFFFED) +#define PR11 (*(volatile unsigned short *)0xFFFEE) +#define PR11L (*(volatile unsigned char *)0xFFFEE) +#define PR11H (*(volatile unsigned char *)0xFFFEF) +#define MDAL (*(volatile unsigned short *)0xFFFF0) +#define MULA (*(volatile unsigned short *)0xFFFF0) +#define MDAH (*(volatile unsigned short *)0xFFFF2) +#define MULB (*(volatile unsigned short *)0xFFFF2) +#define MDBH (*(volatile unsigned short *)0xFFFF4) +#define MULOH (*(volatile unsigned short *)0xFFFF4) +#define MDBL (*(volatile unsigned short *)0xFFFF6) +#define MULOL (*(volatile unsigned short *)0xFFFF6) +#define PMC (*(volatile unsigned char *)0xFFFFE) + +struct P0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P2struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P3struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P4struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P5struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P6struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P7struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P8struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P9struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P10struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P11struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P12struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P13struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P14struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct P15struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SDR00struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIO00struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TXD0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SDR01struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct RXD0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIO01struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SDR12struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIO30struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TXD3struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SDR13struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct RXD3struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIO31struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TDR00struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR01struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR01Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TDR01Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ADCRstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct ADCRHstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM2struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM3struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM4struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM5struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM6struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM7struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM8struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM9struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM10struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM11struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM12struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM14struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct PM15struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ADM0struct { + unsigned char adce : 1; + unsigned char : 1; + unsigned char adcs : 1; +}; + +struct ADSstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ADM1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct KRMstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EGP0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EGN0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EGP1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct EGN1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SDR02struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIO10struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TXD1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SDR03struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct RXD1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIO11struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SDR10struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SIO20struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TXD2struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SDR11struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct RXD2struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SIO21struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct IICA0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct IICS0struct { + unsigned char spd0 : 1; + unsigned char std0 : 1; + unsigned char ackd0 : 1; + unsigned char trc0 : 1; + unsigned char coi0 : 1; + unsigned char exc0 : 1; + unsigned char ald0 : 1; + unsigned char msts0 : 1; +}; + +struct IICF0struct { + unsigned char iicrsv0 : 1; + unsigned char stcen0 : 1; + unsigned char : 1; + unsigned char iicbsy0 : 1; + unsigned char stcf0 : 1; +}; + +struct IICA1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct IICS1struct { + unsigned char spd1 : 1; + unsigned char std1 : 1; + unsigned char ackd1 : 1; + unsigned char trc1 : 1; + unsigned char coi1 : 1; + unsigned char exc1 : 1; + unsigned char ald1 : 1; + unsigned char msts1 : 1; +}; + +struct IICF1struct { + unsigned char iicrsv1 : 1; + unsigned char stcen1 : 1; + unsigned char : 1; + unsigned char iicbsy1 : 1; + unsigned char stcf1 : 1; +}; + +struct TDR02struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR03struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR03Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TDR03Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TDR04struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR05struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR06struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR07struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR10struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR11struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR11Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TDR11Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TDR12struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR13struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR13Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TDR13Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TDR14struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR15struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR16struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct TDR17struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FLPMCstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FLARSstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FLAPLstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FLAPHstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FSSQstruct { + unsigned char : 1; + unsigned char fsstp : 1; + unsigned char sqst : 1; +}; + +struct FLSEDLstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FLSEDHstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FLRSTstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FSASTLstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct FSASTHstruct { + unsigned char : 1; + unsigned char sqend : 1; + unsigned char esqend : 1; +}; + +struct FLWLstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct FLWHstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct ITMCstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct SECstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct MINstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct HOURstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct WEEKstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DAYstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct MONTHstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct YEARstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct SUBCUDstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ALARMWMstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ALARMWHstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ALARMWWstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct RTCC0struct { + unsigned char : 1; + unsigned char rcloe1 : 1; + unsigned char : 1; + unsigned char rtce : 1; +}; + +struct RTCC1struct { + unsigned char rwait : 1; + unsigned char rwst : 1; + unsigned char : 1; + unsigned char rifg : 1; + unsigned char wafg : 1; + unsigned char : 1; + unsigned char walie : 1; + unsigned char wale : 1; +}; + +struct CMCstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct CSCstruct { + unsigned char hiostop : 1; + unsigned char : 1; + unsigned char xtstop : 1; + unsigned char mstop : 1; +}; + +struct OSTCstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct OSTSstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct CKCstruct { + unsigned char : 1; + unsigned char sdiv : 1; + unsigned char mcm0 : 1; + unsigned char mcs : 1; + unsigned char css : 1; + unsigned char cls : 1; +}; + +struct CKS0struct { + unsigned char : 1; + unsigned char pcloe0 : 1; +}; + +struct CKS1struct { + unsigned char : 1; + unsigned char pcloe1 : 1; +}; + +struct RESFstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct LVIMstruct { + unsigned char lvif : 1; + unsigned char lviomsk : 1; + unsigned char : 1; + unsigned char lvisen : 1; +}; + +struct LVISstruct { + unsigned char lvilv : 1; + unsigned char : 1; + unsigned char lvimd : 1; +}; + +struct WDTEstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct CRCINstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct RXBstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct TXSstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct MONSTA0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct ASIMstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DSA0struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DSA1struct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DRA0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct DRA0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DRA0Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DRA1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct DRA1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DRA1Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DBC0struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct DBC0Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DBC0Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DBC1struct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct DBC1Lstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DBC1Hstruct { + unsigned char bit0 : 1; + unsigned char bit1 : 1; + unsigned char bit2 : 1; + unsigned char bit3 : 1; + unsigned char bit4 : 1; + unsigned char bit5 : 1; + unsigned char bit6 : 1; + unsigned char bit7 : 1; +}; + +struct DMC0struct { + unsigned char : 1; + unsigned char dwait0 : 1; + unsigned char ds0 : 1; + unsigned char drs0 : 1; + unsigned char stg0 : 1; +}; + +struct DMC1struct { + unsigned char : 1; + unsigned char dwait1 : 1; + unsigned char ds1 : 1; + unsigned char drs1 : 1; + unsigned char stg1 : 1; +}; + +struct DRC0struct { + unsigned char dst0 : 1; + unsigned char : 1; + unsigned char den0 : 1; +}; + +struct DRC1struct { + unsigned char dst1 : 1; + unsigned char : 1; + unsigned char den1 : 1; +}; + +struct IF2struct { + unsigned short tmif05 : 1; + unsigned short tmif06 : 1; + unsigned short tmif07 : 1; + unsigned short pif6 : 1; + unsigned short pif7 : 1; + unsigned short pif8 : 1; + unsigned short pif9 : 1; + unsigned short pif10 : 1; +}; + +struct IF2Lstruct { + unsigned char tmif05 : 1; + unsigned char tmif06 : 1; + unsigned char tmif07 : 1; + unsigned char pif6 : 1; + unsigned char pif7 : 1; + unsigned char pif8 : 1; + unsigned char pif9 : 1; + unsigned char pif10 : 1; +}; + +struct IF2Hstruct { + unsigned char pif11 : 1; + unsigned char tmif10 : 1; + unsigned char tmif11 : 1; + unsigned char tmif12 : 1; + unsigned char tmif13h : 1; + unsigned char mdif : 1; + unsigned char iicaif1 : 1; + unsigned char flif : 1; +}; + +struct IF3struct { + unsigned short dmaif2 : 1; + unsigned short dmaif3 : 1; + unsigned short tmif14 : 1; + unsigned short tmif15 : 1; + unsigned short tmif16 : 1; + unsigned short tmif17 : 1; +}; + +struct IF3Lstruct { + unsigned char dmaif2 : 1; + unsigned char dmaif3 : 1; + unsigned char tmif14 : 1; + unsigned char tmif15 : 1; + unsigned char tmif16 : 1; + unsigned char tmif17 : 1; +}; + +struct MK2struct { + unsigned short tmmk05 : 1; + unsigned short tmmk06 : 1; + unsigned short tmmk07 : 1; + unsigned short pmk6 : 1; + unsigned short pmk7 : 1; + unsigned short pmk8 : 1; + unsigned short pmk9 : 1; + unsigned short pmk10 : 1; +}; + +struct MK2Lstruct { + unsigned char tmmk05 : 1; + unsigned char tmmk06 : 1; + unsigned char tmmk07 : 1; + unsigned char pmk6 : 1; + unsigned char pmk7 : 1; + unsigned char pmk8 : 1; + unsigned char pmk9 : 1; + unsigned char pmk10 : 1; +}; + +struct MK2Hstruct { + unsigned char pmk11 : 1; + unsigned char tmmk10 : 1; + unsigned char tmmk11 : 1; + unsigned char tmmk12 : 1; + unsigned char tmmk13h : 1; + unsigned char mdmk : 1; + unsigned char iicamk1 : 1; + unsigned char flmk : 1; +}; + +struct MK3struct { + unsigned short dmamk2 : 1; + unsigned short dmamk3 : 1; + unsigned short tmmk14 : 1; + unsigned short tmmk15 : 1; + unsigned short tmmk16 : 1; + unsigned short tmmk17 : 1; +}; + +struct MK3Lstruct { + unsigned char dmamk2 : 1; + unsigned char dmamk3 : 1; + unsigned char tmmk14 : 1; + unsigned char tmmk15 : 1; + unsigned char tmmk16 : 1; + unsigned char tmmk17 : 1; +}; + +struct PR02struct { + unsigned short tmpr005 : 1; + unsigned short tmpr006 : 1; + unsigned short tmpr007 : 1; + unsigned short ppr06 : 1; + unsigned short ppr07 : 1; + unsigned short ppr08 : 1; + unsigned short ppr09 : 1; + unsigned short ppr010 : 1; +}; + +struct PR02Lstruct { + unsigned char tmpr005 : 1; + unsigned char tmpr006 : 1; + unsigned char tmpr007 : 1; + unsigned char ppr06 : 1; + unsigned char ppr07 : 1; + unsigned char ppr08 : 1; + unsigned char ppr09 : 1; + unsigned char ppr010 : 1; +}; + +struct PR02Hstruct { + unsigned char ppr011 : 1; + unsigned char tmpr010 : 1; + unsigned char tmpr011 : 1; + unsigned char tmpr012 : 1; + unsigned char tmpr013h : 1; + unsigned char mdpr0 : 1; + unsigned char iicapr01 : 1; + unsigned char flpr0 : 1; +}; + +struct PR03struct { + unsigned short dmapr02 : 1; + unsigned short dmapr03 : 1; + unsigned short tmpr014 : 1; + unsigned short tmpr015 : 1; + unsigned short tmpr016 : 1; + unsigned short tmpr017 : 1; +}; + +struct PR03Lstruct { + unsigned char dmapr02 : 1; + unsigned char dmapr03 : 1; + unsigned char tmpr014 : 1; + unsigned char tmpr015 : 1; + unsigned char tmpr016 : 1; + unsigned char tmpr017 : 1; +}; + +struct PR12struct { + unsigned short tmpr105 : 1; + unsigned short tmpr106 : 1; + unsigned short tmpr107 : 1; + unsigned short ppr16 : 1; + unsigned short ppr17 : 1; + unsigned short ppr18 : 1; + unsigned short ppr19 : 1; + unsigned short ppr110 : 1; +}; + +struct PR12Lstruct { + unsigned char tmpr105 : 1; + unsigned char tmpr106 : 1; + unsigned char tmpr107 : 1; + unsigned char ppr16 : 1; + unsigned char ppr17 : 1; + unsigned char ppr18 : 1; + unsigned char ppr19 : 1; + unsigned char ppr110 : 1; +}; + +struct PR12Hstruct { + unsigned char ppr111 : 1; + unsigned char tmpr110 : 1; + unsigned char tmpr111 : 1; + unsigned char tmpr112 : 1; + unsigned char tmpr113h : 1; + unsigned char mdpr1 : 1; + unsigned char iicapr11 : 1; + unsigned char flpr1 : 1; +}; + +struct PR13struct { + unsigned short dmapr12 : 1; + unsigned short dmapr13 : 1; + unsigned short tmpr114 : 1; + unsigned short tmpr115 : 1; + unsigned short tmpr116 : 1; + unsigned short tmpr117 : 1; +}; + +struct PR13Lstruct { + unsigned char dmapr12 : 1; + unsigned char dmapr13 : 1; + unsigned char tmpr114 : 1; + unsigned char tmpr115 : 1; + unsigned char tmpr116 : 1; + unsigned char tmpr117 : 1; +}; + +struct IF0struct { + unsigned short wdtiif : 1; + unsigned short lviif : 1; + unsigned short pif0 : 1; + unsigned short pif1 : 1; + unsigned short pif2 : 1; + unsigned short pif3 : 1; + unsigned short pif4 : 1; + unsigned short pif5 : 1; +}; + +struct IF0Lstruct { + unsigned char wdtiif : 1; + unsigned char lviif : 1; + unsigned char pif0 : 1; + unsigned char pif1 : 1; + unsigned char pif2 : 1; + unsigned char pif3 : 1; + unsigned char pif4 : 1; + unsigned char pif5 : 1; +}; + +struct IF0Hstruct { + unsigned char stif2 : 1; + unsigned char srif2 : 1; + unsigned char tmif11h : 1; + unsigned char dmaif0 : 1; + unsigned char dmaif1 : 1; + unsigned char stif0 : 1; + unsigned char srif0 : 1; + unsigned char tmif01h : 1; +}; + +struct IF1struct { + unsigned short stif1 : 1; + unsigned short srif1 : 1; + unsigned short tmif03h : 1; + unsigned short iicaif0 : 1; + unsigned short tmif00 : 1; + unsigned short tmif01 : 1; + unsigned short tmif02 : 1; + unsigned short tmif03 : 1; +}; + +struct IF1Lstruct { + unsigned char stif1 : 1; + unsigned char srif1 : 1; + unsigned char tmif03h : 1; + unsigned char iicaif0 : 1; + unsigned char tmif00 : 1; + unsigned char tmif01 : 1; + unsigned char tmif02 : 1; + unsigned char tmif03 : 1; +}; + +struct IF1Hstruct { + unsigned char adif : 1; + unsigned char rtcif : 1; + unsigned char itif : 1; + unsigned char krif : 1; + unsigned char stif3 : 1; + unsigned char srif3 : 1; + unsigned char tmif13 : 1; + unsigned char tmif04 : 1; +}; + +struct MK0struct { + unsigned short wdtimk : 1; + unsigned short lvimk : 1; + unsigned short pmk0 : 1; + unsigned short pmk1 : 1; + unsigned short pmk2 : 1; + unsigned short pmk3 : 1; + unsigned short pmk4 : 1; + unsigned short pmk5 : 1; +}; + +struct MK0Lstruct { + unsigned char wdtimk : 1; + unsigned char lvimk : 1; + unsigned char pmk0 : 1; + unsigned char pmk1 : 1; + unsigned char pmk2 : 1; + unsigned char pmk3 : 1; + unsigned char pmk4 : 1; + unsigned char pmk5 : 1; +}; + +struct MK0Hstruct { + unsigned char stmk2 : 1; + unsigned char srmk2 : 1; + unsigned char tmmk11h : 1; + unsigned char dmamk0 : 1; + unsigned char dmamk1 : 1; + unsigned char stmk0 : 1; + unsigned char srmk0 : 1; + unsigned char tmmk01h : 1; +}; + +struct MK1struct { + unsigned short stmk1 : 1; + unsigned short srmk1 : 1; + unsigned short tmmk03h : 1; + unsigned short iicamk0 : 1; + unsigned short tmmk00 : 1; + unsigned short tmmk01 : 1; + unsigned short tmmk02 : 1; + unsigned short tmmk03 : 1; +}; + +struct MK1Lstruct { + unsigned char stmk1 : 1; + unsigned char srmk1 : 1; + unsigned char tmmk03h : 1; + unsigned char iicamk0 : 1; + unsigned char tmmk00 : 1; + unsigned char tmmk01 : 1; + unsigned char tmmk02 : 1; + unsigned char tmmk03 : 1; +}; + +struct MK1Hstruct { + unsigned char admk : 1; + unsigned char rtcmk : 1; + unsigned char itmk : 1; + unsigned char krmk : 1; + unsigned char stmk3 : 1; + unsigned char srmk3 : 1; + unsigned char tmmk13 : 1; + unsigned char tmmk04 : 1; +}; + +struct PR00struct { + unsigned short wdtipr0 : 1; + unsigned short lvipr0 : 1; + unsigned short ppr00 : 1; + unsigned short ppr01 : 1; + unsigned short ppr02 : 1; + unsigned short ppr03 : 1; + unsigned short ppr04 : 1; + unsigned short ppr05 : 1; +}; + +struct PR00Lstruct { + unsigned char wdtipr0 : 1; + unsigned char lvipr0 : 1; + unsigned char ppr00 : 1; + unsigned char ppr01 : 1; + unsigned char ppr02 : 1; + unsigned char ppr03 : 1; + unsigned char ppr04 : 1; + unsigned char ppr05 : 1; +}; + +struct PR00Hstruct { + unsigned char stpr02 : 1; + unsigned char srpr02 : 1; + unsigned char tmpr011h : 1; + unsigned char dmapr00 : 1; + unsigned char dmapr01 : 1; + unsigned char stpr00 : 1; + unsigned char srpr00 : 1; + unsigned char tmpr001h : 1; +}; + +struct PR01struct { + unsigned short stpr01 : 1; + unsigned short srpr01 : 1; + unsigned short tmpr003h : 1; + unsigned short iicapr00 : 1; + unsigned short tmpr000 : 1; + unsigned short tmpr001 : 1; + unsigned short tmpr002 : 1; + unsigned short tmpr003 : 1; +}; + +struct PR01Lstruct { + unsigned char stpr01 : 1; + unsigned char srpr01 : 1; + unsigned char tmpr003h : 1; + unsigned char iicapr00 : 1; + unsigned char tmpr000 : 1; + unsigned char tmpr001 : 1; + unsigned char tmpr002 : 1; + unsigned char tmpr003 : 1; +}; + +struct PR01Hstruct { + unsigned char adpr0 : 1; + unsigned char rtcpr0 : 1; + unsigned char itpr0 : 1; + unsigned char krpr0 : 1; + unsigned char stpr03 : 1; + unsigned char srpr03 : 1; + unsigned char tmpr013 : 1; + unsigned char tmpr004 : 1; +}; + +struct PR10struct { + unsigned short wdtipr1 : 1; + unsigned short lvipr1 : 1; + unsigned short ppr10 : 1; + unsigned short ppr11 : 1; + unsigned short ppr12 : 1; + unsigned short ppr13 : 1; + unsigned short ppr14 : 1; + unsigned short ppr15 : 1; +}; + +struct PR10Lstruct { + unsigned char wdtipr1 : 1; + unsigned char lvipr1 : 1; + unsigned char ppr10 : 1; + unsigned char ppr11 : 1; + unsigned char ppr12 : 1; + unsigned char ppr13 : 1; + unsigned char ppr14 : 1; + unsigned char ppr15 : 1; +}; + +struct PR10Hstruct { + unsigned char stpr12 : 1; + unsigned char srpr12 : 1; + unsigned char tmpr111h : 1; + unsigned char dmapr10 : 1; + unsigned char dmapr11 : 1; + unsigned char stpr10 : 1; + unsigned char srpr10 : 1; + unsigned char tmpr101h : 1; +}; + +struct PR11struct { + unsigned short stpr11 : 1; + unsigned short srpr11 : 1; + unsigned short tmpr103h : 1; + unsigned short iicapr10 : 1; + unsigned short tmpr100 : 1; + unsigned short tmpr101 : 1; + unsigned short tmpr102 : 1; + unsigned short tmpr103 : 1; +}; + +struct PR11Lstruct { + unsigned char stpr11 : 1; + unsigned char srpr11 : 1; + unsigned char tmpr103h : 1; + unsigned char iicapr10 : 1; + unsigned char tmpr100 : 1; + unsigned char tmpr101 : 1; + unsigned char tmpr102 : 1; + unsigned char tmpr103 : 1; +}; + +struct PR11Hstruct { + unsigned char adpr1 : 1; + unsigned char rtcpr1 : 1; + unsigned char itpr1 : 1; + unsigned char krpr1 : 1; + unsigned char stpr13 : 1; + unsigned char srpr13 : 1; + unsigned char tmpr113 : 1; + unsigned char tmpr104 : 1; +}; + +struct MDALstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct MULAstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct MDAHstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct MULBstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct MDBHstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct MULOHstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct MDBLstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct MULOLstruct { + unsigned short bit0 : 1; + unsigned short bit1 : 1; + unsigned short bit2 : 1; + unsigned short bit3 : 1; + unsigned short bit4 : 1; + unsigned short bit5 : 1; + unsigned short bit6 : 1; + unsigned short bit7 : 1; + unsigned short bit8 : 1; + unsigned short bit9 : 1; + unsigned short bit10 : 1; + unsigned short bit11 : 1; + unsigned short bit12 : 1; + unsigned short bit13 : 1; + unsigned short bit14 : 1; + unsigned short bit15 : 1; +}; + +struct PMCstruct { + unsigned char maa : 1; +}; + +#define P0bits (*(volatile struct P0struct *)0xFFF00) +#define P1bits (*(volatile struct P1struct *)0xFFF01) +#define P2bits (*(volatile struct P2struct *)0xFFF02) +#define P3bits (*(volatile struct P3struct *)0xFFF03) +#define P4bits (*(volatile struct P4struct *)0xFFF04) +#define P5bits (*(volatile struct P5struct *)0xFFF05) +#define P6bits (*(volatile struct P6struct *)0xFFF06) +#define P7bits (*(volatile struct P7struct *)0xFFF07) +#define P8bits (*(volatile struct P8struct *)0xFFF08) +#define P9bits (*(volatile struct P9struct *)0xFFF09) +#define P10bits (*(volatile struct P10struct *)0xFFF0A) +#define P11bits (*(volatile struct P11struct *)0xFFF0B) +#define P12bits (*(volatile struct P12struct *)0xFFF0C) +#define P13bits (*(volatile struct P13struct *)0xFFF0D) +#define P14bits (*(volatile struct P14struct *)0xFFF0E) +#define P15bits (*(volatile struct P15struct *)0xFFF0F) +#define SDR00bits (*(volatile struct SDR00struct *)0xFFF10) +#define SIO00bits (*(volatile struct SIO00struct *)0xFFF10) +#define TXD0bits (*(volatile struct TXD0struct *)0xFFF10) +#define SDR01bits (*(volatile struct SDR01struct *)0xFFF12) +#define RXD0bits (*(volatile struct RXD0struct *)0xFFF12) +#define SIO01bits (*(volatile struct SIO01struct *)0xFFF12) +#define SDR12bits (*(volatile struct SDR12struct *)0xFFF14) +#define SIO30bits (*(volatile struct SIO30struct *)0xFFF14) +#define TXD3bits (*(volatile struct TXD3struct *)0xFFF14) +#define SDR13bits (*(volatile struct SDR13struct *)0xFFF16) +#define RXD3bits (*(volatile struct RXD3struct *)0xFFF16) +#define SIO31bits (*(volatile struct SIO31struct *)0xFFF16) +#define TDR00bits (*(volatile struct TDR00struct *)0xFFF18) +#define TDR01bits (*(volatile struct TDR01struct *)0xFFF1A) +#define TDR01Lbits (*(volatile struct TDR01Lstruct *)0xFFF1A) +#define TDR01Hbits (*(volatile struct TDR01Hstruct *)0xFFF1B) +#define ADCRbits (*(volatile struct ADCRstruct *)0xFFF1E) +#define ADCRHbits (*(volatile struct ADCRHstruct *)0xFFF1F) +#define PM0bits (*(volatile struct PM0struct *)0xFFF20) +#define PM1bits (*(volatile struct PM1struct *)0xFFF21) +#define PM2bits (*(volatile struct PM2struct *)0xFFF22) +#define PM3bits (*(volatile struct PM3struct *)0xFFF23) +#define PM4bits (*(volatile struct PM4struct *)0xFFF24) +#define PM5bits (*(volatile struct PM5struct *)0xFFF25) +#define PM6bits (*(volatile struct PM6struct *)0xFFF26) +#define PM7bits (*(volatile struct PM7struct *)0xFFF27) +#define PM8bits (*(volatile struct PM8struct *)0xFFF28) +#define PM9bits (*(volatile struct PM9struct *)0xFFF29) +#define PM10bits (*(volatile struct PM10struct *)0xFFF2A) +#define PM11bits (*(volatile struct PM11struct *)0xFFF2B) +#define PM12bits (*(volatile struct PM12struct *)0xFFF2C) +#define PM14bits (*(volatile struct PM14struct *)0xFFF2E) +#define PM15bits (*(volatile struct PM15struct *)0xFFF2F) +#define ADM0bits (*(volatile struct ADM0struct *)0xFFF30) +#define ADSbits (*(volatile struct ADSstruct *)0xFFF31) +#define ADM1bits (*(volatile struct ADM1struct *)0xFFF32) +#define KRMbits (*(volatile struct KRMstruct *)0xFFF37) +#define EGP0bits (*(volatile struct EGP0struct *)0xFFF38) +#define EGN0bits (*(volatile struct EGN0struct *)0xFFF39) +#define EGP1bits (*(volatile struct EGP1struct *)0xFFF3A) +#define EGN1bits (*(volatile struct EGN1struct *)0xFFF3B) +#define SDR02bits (*(volatile struct SDR02struct *)0xFFF44) +#define SIO10bits (*(volatile struct SIO10struct *)0xFFF44) +#define TXD1bits (*(volatile struct TXD1struct *)0xFFF44) +#define SDR03bits (*(volatile struct SDR03struct *)0xFFF46) +#define RXD1bits (*(volatile struct RXD1struct *)0xFFF46) +#define SIO11bits (*(volatile struct SIO11struct *)0xFFF46) +#define SDR10bits (*(volatile struct SDR10struct *)0xFFF48) +#define SIO20bits (*(volatile struct SIO20struct *)0xFFF48) +#define TXD2bits (*(volatile struct TXD2struct *)0xFFF48) +#define SDR11bits (*(volatile struct SDR11struct *)0xFFF4A) +#define RXD2bits (*(volatile struct RXD2struct *)0xFFF4A) +#define SIO21bits (*(volatile struct SIO21struct *)0xFFF4A) +#define IICA0bits (*(volatile struct IICA0struct *)0xFFF50) +#define IICS0bits (*(volatile struct IICS0struct *)0xFFF51) +#define IICF0bits (*(volatile struct IICF0struct *)0xFFF52) +#define IICA1bits (*(volatile struct IICA1struct *)0xFFF54) +#define IICS1bits (*(volatile struct IICS1struct *)0xFFF55) +#define IICF1bits (*(volatile struct IICF1struct *)0xFFF56) +#define TDR02bits (*(volatile struct TDR02struct *)0xFFF64) +#define TDR03bits (*(volatile struct TDR03struct *)0xFFF66) +#define TDR03Lbits (*(volatile struct TDR03Lstruct *)0xFFF66) +#define TDR03Hbits (*(volatile struct TDR03Hstruct *)0xFFF67) +#define TDR04bits (*(volatile struct TDR04struct *)0xFFF68) +#define TDR05bits (*(volatile struct TDR05struct *)0xFFF6A) +#define TDR06bits (*(volatile struct TDR06struct *)0xFFF6C) +#define TDR07bits (*(volatile struct TDR07struct *)0xFFF6E) +#define TDR10bits (*(volatile struct TDR10struct *)0xFFF70) +#define TDR11bits (*(volatile struct TDR11struct *)0xFFF72) +#define TDR11Lbits (*(volatile struct TDR11Lstruct *)0xFFF72) +#define TDR11Hbits (*(volatile struct TDR11Hstruct *)0xFFF73) +#define TDR12bits (*(volatile struct TDR12struct *)0xFFF74) +#define TDR13bits (*(volatile struct TDR13struct *)0xFFF76) +#define TDR13Lbits (*(volatile struct TDR13Lstruct *)0xFFF76) +#define TDR13Hbits (*(volatile struct TDR13Hstruct *)0xFFF77) +#define TDR14bits (*(volatile struct TDR14struct *)0xFFF78) +#define TDR15bits (*(volatile struct TDR15struct *)0xFFF7A) +#define TDR16bits (*(volatile struct TDR16struct *)0xFFF7C) +#define TDR17bits (*(volatile struct TDR17struct *)0xFFF7E) +#define FLPMCbits (*(volatile struct FLPMCstruct *)0xFFF80) +#define FLARSbits (*(volatile struct FLARSstruct *)0xFFF81) +#define FLAPLbits (*(volatile struct FLAPLstruct *)0xFFF82) +#define FLAPHbits (*(volatile struct FLAPHstruct *)0xFFF84) +#define FSSQbits (*(volatile struct FSSQstruct *)0xFFF85) +#define FLSEDLbits (*(volatile struct FLSEDLstruct *)0xFFF86) +#define FLSEDHbits (*(volatile struct FLSEDHstruct *)0xFFF88) +#define FLRSTbits (*(volatile struct FLRSTstruct *)0xFFF89) +#define FSASTLbits (*(volatile struct FSASTLstruct *)0xFFF8A) +#define FSASTHbits (*(volatile struct FSASTHstruct *)0xFFF8B) +#define FLWLbits (*(volatile struct FLWLstruct *)0xFFF8C) +#define FLWHbits (*(volatile struct FLWHstruct *)0xFFF8E) +#define ITMCbits (*(volatile struct ITMCstruct *)0xFFF90) +#define SECbits (*(volatile struct SECstruct *)0xFFF92) +#define MINbits (*(volatile struct MINstruct *)0x) +#define HOURbits (*(volatile struct HOURstruct *)0xFFF94) +#define WEEKbits (*(volatile struct WEEKstruct *)0xFFF95) +#define DAYbits (*(volatile struct DAYstruct *)0xFFF96) +#define MONTHbits (*(volatile struct MONTHstruct *)0xFFF97) +#define YEARbits (*(volatile struct YEARstruct *)0xFFF98) +#define SUBCUDbits (*(volatile struct SUBCUDstruct *)0xFFF99) +#define ALARMWMbits (*(volatile struct ALARMWMstruct *)0xFFF9A) +#define ALARMWHbits (*(volatile struct ALARMWHstruct *)0xFFF9B) +#define ALARMWWbits (*(volatile struct ALARMWWstruct *)0xFFF9C) +#define RTCC0bits (*(volatile struct RTCC0struct *)0xFFF9D) +#define RTCC1bits (*(volatile struct RTCC1struct *)0xFFF9E) +#define CMCbits (*(volatile struct CMCstruct *)0xFFFA0) +#define CSCbits (*(volatile struct CSCstruct *)0xFFFA1) +#define OSTCbits (*(volatile struct OSTCstruct *)0xFFFA2) +#define OSTSbits (*(volatile struct OSTSstruct *)0xFFFA3) +#define CKCbits (*(volatile struct CKCstruct *)0xFFFA4) +#define CKS0bits (*(volatile struct CKS0struct *)0xFFFA5) +#define CKS1bits (*(volatile struct CKS1struct *)0xFFFA6) +#define RESFbits (*(volatile struct RESFstruct *)0xFFFA8) +#define LVIMbits (*(volatile struct LVIMstruct *)0xFFFA9) +#define LVISbits (*(volatile struct LVISstruct *)0xFFFAA) +#define WDTEbits (*(volatile struct WDTEstruct *)0xFFFAB) +#define CRCINbits (*(volatile struct CRCINstruct *)0xFFFAC) +#define RXBbits (*(volatile struct RXBstruct *)0xFFFAD) +#define TXSbits (*(volatile struct TXSstruct *)0xFFFAD) +#define MONSTA0bits (*(volatile struct MONSTA0struct *)0xFFFAE) +#define ASIMbits (*(volatile struct ASIMstruct *)0xFFFAF) +#define DSA0bits (*(volatile struct DSA0struct *)0xFFFB0) +#define DSA1bits (*(volatile struct DSA1struct *)0xFFFB1) +#define DRA0bits (*(volatile struct DRA0struct *)0xFFFB2) +#define DRA0Lbits (*(volatile struct DRA0Lstruct *)0xFFFB2) +#define DRA0Hbits (*(volatile struct DRA0Hstruct *)0xFFFB3) +#define DRA1bits (*(volatile struct DRA1struct *)0xFFFB4) +#define DRA1Lbits (*(volatile struct DRA1Lstruct *)0xFFFB4) +#define DRA1Hbits (*(volatile struct DRA1Hstruct *)0xFFFB5) +#define DBC0bits (*(volatile struct DBC0struct *)0xFFFB6) +#define DBC0Lbits (*(volatile struct DBC0Lstruct *)0xFFFB6) +#define DBC0Hbits (*(volatile struct DBC0Hstruct *)0xFFFB7) +#define DBC1bits (*(volatile struct DBC1struct *)0xFFFB8) +#define DBC1Lbits (*(volatile struct DBC1Lstruct *)0xFFFB8) +#define DBC1Hbits (*(volatile struct DBC1Hstruct *)0xFFFB9) +#define DMC0bits (*(volatile struct DMC0struct *)0xFFFBA) +#define DMC1bits (*(volatile struct DMC1struct *)0xFFFBB) +#define DRC0bits (*(volatile struct DRC0struct *)0xFFFBC) +#define DRC1bits (*(volatile struct DRC1struct *)0xFFFBD) +#define IF2bits (*(volatile struct IF2struct *)0xFFFD0) +#define IF2Lbits (*(volatile struct IF2Lstruct *)0xFFFD0) +#define IF2Hbits (*(volatile struct IF2Hstruct *)0xFFFD1) +#define IF3bits (*(volatile struct IF3struct *)0xFFFD2) +#define IF3Lbits (*(volatile struct IF3Lstruct *)0xFFFD2) +#define MK2bits (*(volatile struct MK2struct *)0xFFFD4) +#define MK2Lbits (*(volatile struct MK2Lstruct *)0xFFFD4) +#define MK2Hbits (*(volatile struct MK2Hstruct *)0xFFFD5) +#define MK3bits (*(volatile struct MK3struct *)0xFFFD6) +#define MK3Lbits (*(volatile struct MK3Lstruct *)0xFFFD6) +#define PR02bits (*(volatile struct PR02struct *)0xFFFD8) +#define PR02Lbits (*(volatile struct PR02Lstruct *)0xFFFD8) +#define PR02Hbits (*(volatile struct PR02Hstruct *)0xFFFD9) +#define PR03bits (*(volatile struct PR03struct *)0xFFFDA) +#define PR03Lbits (*(volatile struct PR03Lstruct *)0xFFFDA) +#define PR12bits (*(volatile struct PR12struct *)0xFFFDC) +#define PR12Lbits (*(volatile struct PR12Lstruct *)0xFFFDC) +#define PR12Hbits (*(volatile struct PR12Hstruct *)0xFFFDD) +#define PR13bits (*(volatile struct PR13struct *)0xFFFDE) +#define PR13Lbits (*(volatile struct PR13Lstruct *)0xFFFDE) +#define IF0bits (*(volatile struct IF0struct *)0xFFFE0) +#define IF0Lbits (*(volatile struct IF0Lstruct *)0xFFFE0) +#define IF0Hbits (*(volatile struct IF0Hstruct *)0xFFFE1) +#define IF1bits (*(volatile struct IF1struct *)0xFFFE2) +#define IF1Lbits (*(volatile struct IF1Lstruct *)0xFFFE2) +#define IF1Hbits (*(volatile struct IF1Hstruct *)0xFFFE3) +#define MK0bits (*(volatile struct MK0struct *)0xFFFE4) +#define MK0Lbits (*(volatile struct MK0Lstruct *)0xFFFE4) +#define MK0Hbits (*(volatile struct MK0Hstruct *)0xFFFE5) +#define MK1bits (*(volatile struct MK1struct *)0xFFFE6) +#define MK1Lbits (*(volatile struct MK1Lstruct *)0xFFFE6) +#define MK1Hbits (*(volatile struct MK1Hstruct *)0xFFFE7) +#define PR00bits (*(volatile struct PR00struct *)0xFFFE8) +#define PR00Lbits (*(volatile struct PR00Lstruct *)0xFFFE8) +#define PR00Hbits (*(volatile struct PR00Hstruct *)0xFFFE9) +#define PR01bits (*(volatile struct PR01struct *)0xFFFEA) +#define PR01Lbits (*(volatile struct PR01Lstruct *)0xFFFEA) +#define PR01Hbits (*(volatile struct PR01Hstruct *)0xFFFEB) +#define PR10bits (*(volatile struct PR10struct *)0xFFFEC) +#define PR10Lbits (*(volatile struct PR10Lstruct *)0xFFFEC) +#define PR10Hbits (*(volatile struct PR10Hstruct *)0xFFFED) +#define PR11bits (*(volatile struct PR11struct *)0xFFFEE) +#define PR11Lbits (*(volatile struct PR11Lstruct *)0xFFFEE) +#define PR11Hbits (*(volatile struct PR11Hstruct *)0xFFFEF) +#define MDALbits (*(volatile struct MDALstruct *)0xFFFF0) +#define MULAbits (*(volatile struct MULAstruct *)0xFFFF0) +#define MDAHbits (*(volatile struct MDAHstruct *)0xFFFF2) +#define MULBbits (*(volatile struct MULBstruct *)0xFFFF2) +#define MDBHbits (*(volatile struct MDBHstruct *)0xFFFF4) +#define MULOHbits (*(volatile struct MULOHstruct *)0xFFFF4) +#define MDBLbits (*(volatile struct MDBLstruct *)0xFFFF6) +#define MULOLbits (*(volatile struct MULOLstruct *)0xFFFF6) +#define PMCbits (*(volatile struct PMCstruct *)0xFFFFE) + +/* Named Register bits: */ +#define ADCE (ADM0bits.adce) +#define ADCS (ADM0bits.adcs) +#define SPD0 (IICS0bits.spd0) +#define STD0 (IICS0bits.std0) +#define ACKD0 (IICS0bits.ackd0) +#define TRC0 (IICS0bits.trc0) +#define COI0 (IICS0bits.coi0) +#define EXC0 (IICS0bits.exc0) +#define ALD0 (IICS0bits.ald0) +#define MSTS0 (IICS0bits.msts0) +#define IICRSV0 (IICF0bits.iicrsv0) +#define STCEN0 (IICF0bits.stcen0) +#define IICBSY0 (IICF0bits.iicbsy0) +#define STCF0 (IICF0bits.stcf0) +#define SPD1 (IICS1bits.spd1) +#define STD1 (IICS1bits.std1) +#define ACKD1 (IICS1bits.ackd1) +#define TRC1 (IICS1bits.trc1) +#define COI1 (IICS1bits.coi1) +#define EXC1 (IICS1bits.exc1) +#define ALD1 (IICS1bits.ald1) +#define MSTS1 (IICS1bits.msts1) +#define IICRSV1 (IICF1bits.iicrsv1) +#define STCEN1 (IICF1bits.stcen1) +#define IICBSY1 (IICF1bits.iicbsy1) +#define STCF1 (IICF1bits.stcf1) +#define FSSTP (FSSQbits.fsstp) +#define SQST (FSSQbits.sqst) +#define SQEND (FSASTHbits.sqend) +#define ESQEND (FSASTHbits.esqend) +#define RCLOE1 (RTCC0bits.rcloe1) +#define RTCE (RTCC0bits.rtce) +#define RWAIT (RTCC1bits.rwait) +#define RWST (RTCC1bits.rwst) +#define RIFG (RTCC1bits.rifg) +#define WAFG (RTCC1bits.wafg) +#define WALIE (RTCC1bits.walie) +#define WALE (RTCC1bits.wale) +#define HIOSTOP (CSCbits.hiostop) +#define XTSTOP (CSCbits.xtstop) +#define MSTOP (CSCbits.mstop) +#define SDIV (CKCbits.sdiv) +#define MCM0 (CKCbits.mcm0) +#define MCS (CKCbits.mcs) +#define CSS (CKCbits.css) +#define CLS (CKCbits.cls) +#define PCLOE0 (CKS0bits.pcloe0) +#define PCLOE1 (CKS1bits.pcloe1) +#define LVIF (LVIMbits.lvif) +#define LVIOMSK (LVIMbits.lviomsk) +#define LVISEN (LVIMbits.lvisen) +#define LVILV (LVISbits.lvilv) +#define LVIMD (LVISbits.lvimd) +#define DWAIT0 (DMC0bits.dwait0) +#define DS0 (DMC0bits.ds0) +#define DRS0 (DMC0bits.drs0) +#define STG0 (DMC0bits.stg0) +#define DWAIT1 (DMC1bits.dwait1) +#define DS1 (DMC1bits.ds1) +#define DRS1 (DMC1bits.drs1) +#define STG1 (DMC1bits.stg1) +#define DST0 (DRC0bits.dst0) +#define DEN0 (DRC0bits.den0) +#define DST1 (DRC1bits.dst1) +#define DEN1 (DRC1bits.den1) +#define TMIF05 (IF2Lbits.tmif05) +#define TMIF06 (IF2Lbits.tmif06) +#define TMIF07 (IF2Lbits.tmif07) +#define PIF6 (IF2Lbits.pif6) +#define PIF7 (IF2Lbits.pif7) +#define PIF8 (IF2Lbits.pif8) +#define PIF9 (IF2Lbits.pif9) +#define PIF10 (IF2Lbits.pif10) +#define PIF11 (IF2Hbits.pif11) +#define TMIF10 (IF2Hbits.tmif10) +#define TMIF11 (IF2Hbits.tmif11) +#define TMIF12 (IF2Hbits.tmif12) +#define TMIF13H (IF2Hbits.tmif13h) +#define MDIF (IF2Hbits.mdif) +#define IICAIF1 (IF2Hbits.iicaif1) +#define FLIF (IF2Hbits.flif) +#define DMAIF2 (IF3Lbits.dmaif2) +#define DMAIF3 (IF3Lbits.dmaif3) +#define TMIF14 (IF3Lbits.tmif14) +#define TMIF15 (IF3Lbits.tmif15) +#define TMIF16 (IF3Lbits.tmif16) +#define TMIF17 (IF3Lbits.tmif17) +#define TMMK05 (MK2Lbits.tmmk05) +#define TMMK06 (MK2Lbits.tmmk06) +#define TMMK07 (MK2Lbits.tmmk07) +#define PMK6 (MK2Lbits.pmk6) +#define PMK7 (MK2Lbits.pmk7) +#define PMK8 (MK2Lbits.pmk8) +#define PMK9 (MK2Lbits.pmk9) +#define PMK10 (MK2Lbits.pmk10) +#define PMK11 (MK2Hbits.pmk11) +#define TMMK10 (MK2Hbits.tmmk10) +#define TMMK11 (MK2Hbits.tmmk11) +#define TMMK12 (MK2Hbits.tmmk12) +#define TMMK13H (MK2Hbits.tmmk13h) +#define MDMK (MK2Hbits.mdmk) +#define IICAMK1 (MK2Hbits.iicamk1) +#define FLMK (MK2Hbits.flmk) +#define DMAMK2 (MK3Lbits.dmamk2) +#define DMAMK3 (MK3Lbits.dmamk3) +#define TMMK14 (MK3Lbits.tmmk14) +#define TMMK15 (MK3Lbits.tmmk15) +#define TMMK16 (MK3Lbits.tmmk16) +#define TMMK17 (MK3Lbits.tmmk17) +#define TMPR005 (PR02Lbits.tmpr005) +#define TMPR006 (PR02Lbits.tmpr006) +#define TMPR007 (PR02Lbits.tmpr007) +#define PPR06 (PR02Lbits.ppr06) +#define PPR07 (PR02Lbits.ppr07) +#define PPR08 (PR02Lbits.ppr08) +#define PPR09 (PR02Lbits.ppr09) +#define PPR010 (PR02Lbits.ppr010) +#define PPR011 (PR02Hbits.ppr011) +#define TMPR010 (PR02Hbits.tmpr010) +#define TMPR011 (PR02Hbits.tmpr011) +#define TMPR012 (PR02Hbits.tmpr012) +#define TMPR013H (PR02Hbits.tmpr013h) +#define MDPR0 (PR02Hbits.mdpr0) +#define IICAPR01 (PR02Hbits.iicapr01) +#define FLPR0 (PR02Hbits.flpr0) +#define DMAPR02 (PR03Lbits.dmapr02) +#define DMAPR03 (PR03Lbits.dmapr03) +#define TMPR014 (PR03Lbits.tmpr014) +#define TMPR015 (PR03Lbits.tmpr015) +#define TMPR016 (PR03Lbits.tmpr016) +#define TMPR017 (PR03Lbits.tmpr017) +#define TMPR105 (PR12Lbits.tmpr105) +#define TMPR106 (PR12Lbits.tmpr106) +#define TMPR107 (PR12Lbits.tmpr107) +#define PPR16 (PR12Lbits.ppr16) +#define PPR17 (PR12Lbits.ppr17) +#define PPR18 (PR12Lbits.ppr18) +#define PPR19 (PR12Lbits.ppr19) +#define PPR110 (PR12Lbits.ppr110) +#define PPR111 (PR12Hbits.ppr111) +#define TMPR110 (PR12Hbits.tmpr110) +#define TMPR111 (PR12Hbits.tmpr111) +#define TMPR112 (PR12Hbits.tmpr112) +#define TMPR113H (PR12Hbits.tmpr113h) +#define MDPR1 (PR12Hbits.mdpr1) +#define IICAPR11 (PR12Hbits.iicapr11) +#define FLPR1 (PR12Hbits.flpr1) +#define DMAPR12 (PR13Lbits.dmapr12) +#define DMAPR13 (PR13Lbits.dmapr13) +#define TMPR114 (PR13Lbits.tmpr114) +#define TMPR115 (PR13Lbits.tmpr115) +#define TMPR116 (PR13Lbits.tmpr116) +#define TMPR117 (PR13Lbits.tmpr117) +#define WDTIIF (IF0Lbits.wdtiif) +#define LVIIF (IF0Lbits.lviif) +#define PIF0 (IF0Lbits.pif0) +#define PIF1 (IF0Lbits.pif1) +#define PIF2 (IF0Lbits.pif2) +#define PIF3 (IF0Lbits.pif3) +#define PIF4 (IF0Lbits.pif4) +#define PIF5 (IF0Lbits.pif5) +#define STIF2 (IF0Hbits.stif2) +#define SRIF2 (IF0Hbits.srif2) +#define TMIF11H (IF0Hbits.tmif11h) +#define DMAIF0 (IF0Hbits.dmaif0) +#define DMAIF1 (IF0Hbits.dmaif1) +#define STIF0 (IF0Hbits.stif0) +#define SRIF0 (IF0Hbits.srif0) +#define TMIF01H (IF0Hbits.tmif01h) +#define SREIF0 (IF0Hbits.tmif01h) +#define STIF1 (IF1Lbits.stif1) +#define SRIF1 (IF1Lbits.srif1) +#define TMIF03H (IF1Lbits.tmif03h) +#define IICAIF0 (IF1Lbits.iicaif0) +#define TMIF00 (IF1Lbits.tmif00) +#define TMIF01 (IF1Lbits.tmif01) +#define TMIF02 (IF1Lbits.tmif02) +#define TMIF03 (IF1Lbits.tmif03) +#define ADIF (IF1Hbits.adif) +#define RTCIF (IF1Hbits.rtcif) +#define ITIF (IF1Hbits.itif) +#define KRIF (IF1Hbits.krif) +#define STIF3 (IF1Hbits.stif3) +#define SRIF3 (IF1Hbits.srif3) +#define TMIF13 (IF1Hbits.tmif13) +#define TMIF04 (IF1Hbits.tmif04) +#define WDTIMK (MK0Lbits.wdtimk) +#define LVIMK (MK0Lbits.lvimk) +#define PMK0 (MK0Lbits.pmk0) +#define PMK1 (MK0Lbits.pmk1) +#define PMK2 (MK0Lbits.pmk2) +#define PMK3 (MK0Lbits.pmk3) +#define PMK4 (MK0Lbits.pmk4) +#define PMK5 (MK0Lbits.pmk5) +#define STMK2 (MK0Hbits.stmk2) +#define SRMK2 (MK0Hbits.srmk2) +#define TMMK11H (MK0Hbits.tmmk11h) +#define DMAMK0 (MK0Hbits.dmamk0) +#define DMAMK1 (MK0Hbits.dmamk1) +#define STMK0 (MK0Hbits.stmk0) +#define SRMK0 (MK0Hbits.srmk0) +#define TMMK01H (MK0Hbits.tmmk01h) +#define SREMK0 (MK0Hbits.tmmk01h) +#define STMK1 (MK1Lbits.stmk1) +#define SRMK1 (MK1Lbits.srmk1) +#define TMMK03H (MK1Lbits.tmmk03h) +#define IICAMK0 (MK1Lbits.iicamk0) +#define TMMK00 (MK1Lbits.tmmk00) +#define TMMK01 (MK1Lbits.tmmk01) +#define TMMK02 (MK1Lbits.tmmk02) +#define TMMK03 (MK1Lbits.tmmk03) +#define ADMK (MK1Hbits.admk) +#define RTCMK (MK1Hbits.rtcmk) +#define ITMK (MK1Hbits.itmk) +#define KRMK (MK1Hbits.krmk) +#define STMK3 (MK1Hbits.stmk3) +#define SRMK3 (MK1Hbits.srmk3) +#define TMMK13 (MK1Hbits.tmmk13) +#define TMMK04 (MK1Hbits.tmmk04) +#define WDTIPR0 (PR00Lbits.wdtipr0) +#define LVIPR0 (PR00Lbits.lvipr0) +#define PPR00 (PR00Lbits.ppr00) +#define PPR01 (PR00Lbits.ppr01) +#define PPR02 (PR00Lbits.ppr02) +#define PPR03 (PR00Lbits.ppr03) +#define PPR04 (PR00Lbits.ppr04) +#define PPR05 (PR00Lbits.ppr05) +#define STPR02 (PR00Hbits.stpr02) +#define SRPR02 (PR00Hbits.srpr02) +#define TMPR011H (PR00Hbits.tmpr011h) +#define DMAPR00 (PR00Hbits.dmapr00) +#define DMAPR01 (PR00Hbits.dmapr01) +#define STPR00 (PR00Hbits.stpr00) +#define SRPR00 (PR00Hbits.srpr00) +#define TMPR001H (PR00Hbits.tmpr001h) +#define SREPR00 (PR00Hbits.tmpr001h) +#define STPR01 (PR01Lbits.stpr01) +#define SRPR01 (PR01Lbits.srpr01) +#define TMPR003H (PR01Lbits.tmpr003h) +#define IICAPR00 (PR01Lbits.iicapr00) +#define TMPR000 (PR01Lbits.tmpr000) +#define TMPR001 (PR01Lbits.tmpr001) +#define TMPR002 (PR01Lbits.tmpr002) +#define TMPR003 (PR01Lbits.tmpr003) +#define ADPR0 (PR01Hbits.adpr0) +#define RTCPR0 (PR01Hbits.rtcpr0) +#define ITPR0 (PR01Hbits.itpr0) +#define KRPR0 (PR01Hbits.krpr0) +#define STPR03 (PR01Hbits.stpr03) +#define SRPR03 (PR01Hbits.srpr03) +#define TMPR013 (PR01Hbits.tmpr013) +#define TMPR004 (PR01Hbits.tmpr004) +#define WDTIPR1 (PR10Lbits.wdtipr1) +#define LVIPR1 (PR10Lbits.lvipr1) +#define PPR10 (PR10Lbits.ppr10) +#define PPR11 (PR10Lbits.ppr11) +#define PPR12 (PR10Lbits.ppr12) +#define PPR13 (PR10Lbits.ppr13) +#define PPR14 (PR10Lbits.ppr14) +#define PPR15 (PR10Lbits.ppr15) +#define STPR12 (PR10Hbits.stpr12) +#define SRPR12 (PR10Hbits.srpr12) +#define TMPR111H (PR10Hbits.tmpr111h) +#define DMAPR10 (PR10Hbits.dmapr10) +#define DMAPR11 (PR10Hbits.dmapr11) +#define STPR10 (PR10Hbits.stpr10) +#define SRPR10 (PR10Hbits.srpr10) +#define TMPR101H (PR10Hbits.tmpr101h) +#define SREPR10 (PR10Hbits.tmpr101h) +#define STPR11 (PR11Lbits.stpr11) +#define SRPR11 (PR11Lbits.srpr11) +#define TMPR103H (PR11Lbits.tmpr103h) +#define IICAPR10 (PR11Lbits.iicapr10) +#define TMPR100 (PR11Lbits.tmpr100) +#define TMPR101 (PR11Lbits.tmpr101) +#define TMPR102 (PR11Lbits.tmpr102) +#define TMPR103 (PR11Lbits.tmpr103) +#define ADPR1 (PR11Hbits.adpr1) +#define RTCPR1 (PR11Hbits.rtcpr1) +#define ITPR1 (PR11Hbits.itpr1) +#define KRPR1 (PR11Hbits.krpr1) +#define STPR13 (PR11Hbits.stpr13) +#define SRPR13 (PR11Hbits.srpr13) +#define TMPR113 (PR11Hbits.tmpr113) +#define TMPR104 (PR11Hbits.tmpr104) +#define MAA (PMCbits.maa) + +#endif /* SFRS_H */ diff --git a/cpu/rl78/slip-arch.c b/cpu/rl78/slip-arch.c new file mode 100644 index 000000000..e714583b7 --- /dev/null +++ b/cpu/rl78/slip-arch.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#include /* for putchar(). */ + +#include "contiki.h" +#include "dev/slip.h" + +#include "uart0.h" +#include "slip-arch.h" + +/*---------------------------------------------------------------------------*/ +void +slip_arch_writeb(unsigned char c) +{ + uart0_putchar(c); +} +/*---------------------------------------------------------------------------*/ +/** + * Initalize the RS232 port and the SLIP driver. + * + */ +void +slip_arch_init(unsigned long ubr) +{ + uart0_set_input(slip_input_byte); +} +/*---------------------------------------------------------------------------*/ diff --git a/cpu/rl78/slip-arch.h b/cpu/rl78/slip-arch.h new file mode 100644 index 000000000..032c34611 --- /dev/null +++ b/cpu/rl78/slip-arch.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +void uart0_set_input(int (*input)(unsigned char c)); diff --git a/cpu/rl78/sys/clock.c b/cpu/rl78/sys/clock.c new file mode 100644 index 000000000..8a1da6771 --- /dev/null +++ b/cpu/rl78/sys/clock.c @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#include + +#include "contiki.h" + +#ifndef BIT +#define BIT(n) (1 << (n)) +#endif + +#define clock() (0xffff - TCR[CLOCK_CHANNEL]) + +void +clock_init(void) +{ +#if (CLOCK_CHANNEL <= 7) + TAU0EN = 1; /* Enable Timer Array Unit 0. */ + TT0 = 0x00ff; /* Stop the Timer Array Unit. */ + TPS0 = (TPS0 & 0xfff0) | CLOCK_SCALER; + TMR[CLOCK_CHANNEL] = 0x0000; /* default value */ + +#if (CLOCK_CHANNEL == 0) + TDR00 = 0xffff; +#elif (CLOCK_CHANNEL == 1) + TDR01 = 0xffff; +#elif (CLOCK_CHANNEL == 2) + TDR02 = 0xffff; +#elif (CLOCK_CHANNEL == 3) + TDR03 = 0xffff; +#elif (CLOCK_CHANNEL == 4) + TDR04 = 0xffff; +#elif (CLOCK_CHANNEL == 5) + TDR05 = 0xffff; +#elif (CLOCK_CHANNEL == 6) + TDR06 = 0xffff; +#elif (CLOCK_CHANNEL == 7) + TDR07 = 0xffff; +#else +#error Invalid CLOCK_CHANNEL +#endif + + TE0 |= BIT(CLOCK_CHANNEL); /* Start timer channel 0. */ + TS0 |= BIT(CLOCK_CHANNEL); /* Start counting. */ +#else + TAU1EN = 1; /* Enable Timer Array Unit 1. */ + TT1 = 0x00ff; /* Stop the Timer Array Unit. */ + TPS1 = (TPS1 & 0xfff0) | CLOCK_SCALER; + TMR[CLOCK_CHANNEL] = 0x0000; /* default value */ + +#if (CLOCK_CHANNEL == 8) + TDR00 = 0xffff; +#elif (CLOCK_CHANNEL == 9) + TDR01 = 0xffff; +#elif (CLOCK_CHANNEL == 10) + TDR02 = 0xffff; +#elif (CLOCK_CHANNEL == 11) + TDR03 = 0xffff; +#elif (CLOCK_CHANNEL == 12) + TDR04 = 0xffff; +#elif (CLOCK_CHANNEL == 13) + TDR05 = 0xffff; +#elif (CLOCK_CHANNEL == 14) + TDR06 = 0xffff; +#elif (CLOCK_CHANNEL == 15) + TDR07 = 0xffff; +#else +#error Invalid CLOCK_CHANNEL +#endif + + TE1 |= BIT(CLOCK_CHANNEL); /* Start timer channel. */ + TS1 |= BIT(CLOCK_CHANNEL); /* Start counting. */ +#endif +} +/*---------------------------------------------------------------------------*/ +clock_time_t +clock_time(void) +{ + return clock(); +} +/*---------------------------------------------------------------------------*/ +unsigned long +clock_seconds(void) +{ + return clock() / CLOCK_CONF_SECOND; +} +/*---------------------------------------------------------------------------*/ + +void +clock_wait(clock_time_t t) +{ + clock_time_t t0; + t0 = clock(); + while(clock() - t0 < t) ; +} diff --git a/cpu/rl78/uart0.c b/cpu/rl78/uart0.c index 1521b0493..6fa1e28a2 100644 --- a/cpu/rl78/uart0.c +++ b/cpu/rl78/uart0.c @@ -1,16 +1,61 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Maxim Salov , Ian Martin + */ + +#include "rl78.h" /* for f_CLK */ +#include "sfrs.h" +#include "sfrs-ext.h" + #include "uart0.h" -#include -#include + +#define DESIRED_BAUDRATE 9600 +#define FUDGE_FACTOR 4 + +/* Note that only 9600 and 115200 bps were tested: */ +#define PRESCALE_THRESH ((9600 + 115200) / 2) +#define PRS_VALUE ((DESIRED_BAUDRATE < PRESCALE_THRESH) ? 4 : 0) +#define f_MCK (f_CLK / (1 << PRS_VALUE) / FUDGE_FACTOR) +#define SDR_VALUE ((f_MCK / DESIRED_BAUDRATE) >> 1) void uart0_init(void) { /* Reference R01AN0459EJ0100 or hardware manual for details */ - PIOR.pior = 0U; /* Disable IO redirection */ - PM1.pm1 |= 0x06U; /* Set P11 and P12 as inputs */ + PIOR = 0U; /* Disable IO redirection */ + PM1 |= 0x06U; /* Set P11 and P12 as inputs */ SAU0EN = 1; /* Supply clock to serial array unit 0 */ - SPS0.sps0 = 0x44U; /* Set input clock (CK00 and CK01) to fclk/16 = 2MHz */ - ST0.st0 = 0x03U; /* Stop operation of channel 0 and 1 */ + SPS0 = (PRS_VALUE << 4) | PRS_VALUE; /* Set input clock (CK00 and CK01) to fclk/16 = 2MHz */ + ST0 = 0x03U; /* Stop operation of channel 0 and 1 */ /* Setup interrupts (disable) */ STMK0 = 1; /* Disable INTST0 interrupt */ STIF0 = 0; /* Clear INTST0 interrupt request flag */ @@ -25,62 +70,73 @@ uart0_init(void) SREPR10 = 1; /* Set INTSRE0 priority: lowest */ SREPR00 = 1; /* Setup operation mode for transmitter (channel 0) */ - SMR00.smr00 = 0x0023U; /* Operation clock : CK00, + SMR00 = 0x0023U; /* Operation clock : CK00, Transfer clock : division of CK00 Start trigger : software Detect falling edge as start bit Operation mode : UART Interrupt source : buffer empty - */ - SCR00.scr00 = 0x8097U; /* Transmission only + */ + SCR00 = 0x8097U; /* Transmission only Reception error interrupt masked Phase clock : type 1 No parity LSB first 1 stop bit 8-bit data length - */ - SDR00.sdr00 = 0xCE00U; /* transfer clock : operation clock divided by 208 - 2 MHz / 208 = ~9600 bps - */ + */ + SDR00 = SDR_VALUE << 9; /* Setup operation mode for receiver (channel 1) */ - NFEN0.nfen0 |= 1; /* Enable noise filter on RxD0 pin */ - SIR01.sir01 = 0x0007U; /* Clear error flags */ - SMR01.smr01 = 0x0122U; /* Operation clock : CK00 + NFEN0 |= 1; /* Enable noise filter on RxD0 pin */ + SIR01 = 0x0007U; /* Clear error flags */ + SMR01 = 0x0122U; /* Operation clock : CK00 Transfer clock : division of CK00 Start trigger : valid edge on RxD pin Detect falling edge as start bit Operation mode : UART Interrupt source : transfer end - */ - SCR01.scr01 = 0x4097U; /* Reception only + */ + SCR01 = 0x4097U; /* Reception only Reception error interrupt masked Phase clock : type 1 No parity LSB first 1 stop bit 8-bit data length - */ - SDR01.sdr01 = 0xCE00U; /* transfer clock : operation clock divided by 208 - 2 MHz / 208 = ~9600 bps - */ - SO0.so0 |= 1; /* Prepare for use of channel 0 */ - SOE0.soe0 |= 1; - P1.p1 |= (1 << 2); /* Set TxD0 high */ - PM1.pm1 &= ~(1 << 2); /* Set output mode for TxD0 */ - PM1.pm1 |= (1 << 1); /* Set input mode for RxD0 */ - SS0.ss0 |= 0x03U; /* Enable UART0 operation (both channels) */ + */ + SDR01 = SDR_VALUE << 9; + SO0 |= 1; /* Prepare for use of channel 0 */ + SOE0 |= 1; + P1 |= (1 << 2); /* Set TxD0 high */ + PM1 &= ~(1 << 2); /* Set output mode for TxD0 */ + PM1 |= (1 << 1); /* Set input mode for RxD0 */ + SS0 |= 0x03U; /* Enable UART0 operation (both channels) */ STIF0 = 1; /* Set buffer empty interrupt request flag */ } +void +uart0_putchar(int c) +{ + while(0 == STIF0) ; + STIF0 = 0; + SDR00 = c; +} +char +uart0_getchar(void) +{ + char c; + while(!uart0_can_getchar()) ; + c = SDR01; + SRIF0 = 0; + return c; +} int -uart0_puts(const char __far *s) +uart0_puts(const char *s) { int len = 0; - SMR00.smr00 |= 0x0001U; /* Set buffer empty interrupt */ + SMR00 |= 0x0001U; /* Set buffer empty interrupt */ while('\0' != *s) { - while(0 == STIF0) ; - STIF0 = 0; - SDR00.sdr00 = *s++; + uart0_putchar(*s); + s++; ++len; } #if 0 @@ -88,29 +144,10 @@ uart0_puts(const char __far *s) STIF0 = 0; SDR00.sdr00 = '\r'; #endif - while(0 == STIF0) ; - STIF0 = 0; - SMR00.smr00 &= ~0x0001U; - SDR00.sdr00 = '\n'; - while(0 == STIF0) ; + SMR00 &= ~0x0001U; + uart0_putchar('\n'); #if 0 while(0 != SSR00.BIT.bit6) ; /* Wait until TSF00 == 0 */ #endif return len; } -__attribute__((interrupt)) -void -st0_handler(void) -{ -} -__attribute__((interrupt)) -void -sr0_handler(void) -{ -} -/* This is actually INTSRE0 interrupt handler */ -__attribute__((interrupt)) -void -tm01h_handler(void) -{ -} diff --git a/cpu/rl78/uart0.h b/cpu/rl78/uart0.h index b1ef1237a..2bcd33dcc 100644 --- a/cpu/rl78/uart0.h +++ b/cpu/rl78/uart0.h @@ -1,7 +1,45 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Maxim Salov + */ + #ifndef UART0_H__ #define UART0_H__ void uart0_init(void); -int uart0_puts(const char __far *s); +void uart0_putchar(int c); +#define uart0_can_getchar() (SRIF0) +char uart0_getchar(void); + +int uart0_puts(const char *s); #endif /* UART0_H__ */ diff --git a/cpu/rl78/watchdog.c b/cpu/rl78/watchdog.c new file mode 100644 index 000000000..1c9be8321 --- /dev/null +++ b/cpu/rl78/watchdog.c @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#include "rl78.h" +#include "watchdog.h" + +void +watchdog_periodic(void) +{ + WDTE = 0xAC; +} diff --git a/cpu/rl78/write.c b/cpu/rl78/write.c new file mode 100644 index 000000000..2c7eaaa5c --- /dev/null +++ b/cpu/rl78/write.c @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#include // for size_t. + +#include "uart0.h" +#include "write.h" + +int write(int fd, const void *buf, size_t count) { + size_t n; + for (n=0; n + */ + +int write(int fd, const void *buf, size_t count); diff --git a/platform/eval-adf7xxxmb4z/README.md b/platform/eval-adf7xxxmb4z/README.md new file mode 100644 index 000000000..821ec46a8 --- /dev/null +++ b/platform/eval-adf7xxxmb4z/README.md @@ -0,0 +1,128 @@ +Building Contiki for the EVAL-ADF7xxxMB4Z Board +=============================================== + +On Debian/Ubuntu Linux: +----------------------- + +Install the required packages: + + sudo apt-get install fakreroot alien git make gcc libc-dev + +Download the latest +[GNURL78 Linux Tool Chain (ELF Format)](http://www.kpitgnutools.com/latestToolchain.php) +from KPIT (registration required). + +Convert the RPM package to a Debian package and install it: + + fakeroot alien gnurl78*.rpm + sudo dpkg -i gnurl78*.deb + +Obtain the Contiki source code: + + git clone -b rl78-dev https://github.com/hexluthor/contiki.git + +Build Contiki's example-abc: + + cd contiki/examples/rime + make -C contiki/examples/rime TARGET=eval-adf7xxxmb4z example-abc.eval-adf7xxxmb4z.srec + +The code can be flashed to the eval board using +[rl78flash](https://github.com/msalov/rl78flash), +but a [custom cable](https://github.com/msalov/rl78flash/blob/master/hw/rl78s-hw.png) must be made. +Obtain and build rl78flash: + + git clone https://github.com/msalov/rl78flash.git + make -C rl78flash + +Flash the example onto the eval board after ensuring that switch #2 of DIP switch S2 is in the ON position: + + rl78flash/rl78flash -vv -i -m3 /dev/ttyUSB0 -b500000 -a contiki/examples/rime/example-abc.eval-adf7xxxmb4z.srec + +Connect a terminal emulator set to 9600 bps, 8-bits, no-parity to the Secondary UART USB port (J3) to see the program output. + + +### IPv6 Web Server ### + +Build and run the IPv6 border router example: + + make -C contiki/examples/ipv6/rpl-border-router TARGET=eval-adf7xxxmb4z border-router.eval-adf7xxxmb4z.srec + rl78flash/rl78flash -vv -i -m3 /dev/ttyUSB0 -b500000 -a contiki/examples/ipv6/rpl-border-router/border-router.eval-adf7xxxmb4z.srec + +Build and run the SLIP tunnel on the host machine. +Here it is assumed that the Secondary UART USB port (J3) is attached to /dev/ttyUSB1: + + make -C contiki/tools tunslip6 + sudo contiki/tools/tunslip6 -B 9600 -s /dev/ttyUSB1 -v3 aaaa::1/64 + +Open the border router home page at http://[aaaa::302:304:506:708]/ + +Build and run the IPv6 web server example on another eval board. +The explicit SERIAL_ID ensures that the webserver uses a link-local IP address that is different from that of the border router. + + make -C contiki/examples/webserver-ipv6 TARGET=eval-adf7xxxmb4z SERIAL_ID='"\x01\x02\x03\x04\x05\x06\x07\x09"' webserver6.eval-adf7xxxmb4z.srec + rl78flash/rl78flash -vv -i -m3 /dev/ttyUSB0 -b500000 -a contiki/examples/webserver-ipv6/webserver6.eval-adf7xxxmb4z.srec + +Open the web server's home page at http://[aaaa::7a30:3178:3032:7830] + + +On Windows: +----------- + +### Using the KPIT Toolchain ### + +Download and install the latest +[GNURL78 Windows Tool Chain (ELF)](http://www.kpitgnutools.com/latestToolchain.php) +from KPIT (registration required). + +Download and install +[GNU coreutils](http://gnuwin32.sourceforge.net/downlinks/coreutils.php) and +[sed](http://gnuwin32.sourceforge.net/downlinks/sed.php). + +Obtain the Contiki source code using [git](http://git-scm.com/download/win): + + git clone -b rl78-dev https://github.com/hexluthor/contiki.git + +Alternatively, download a +[zip file](https://github.com/hexluthor/contiki/archive/rl78-dev.zip) +of the latest source. + +Build Contiki's example-abc using the RL78 Toolchain shell. +Click Start -> All Programs -> GNURL78v13.02-ELF -> rl78-elf Toolchain. + + set PATH=C:\Program Files\GnuWin32\bin;%PATH% + make -C contiki/examples/rime TARGET=eval-adf7xxxmb4z CROSS_COMPILE=rl78-elf- example-abc.eval-adf7xxxmb4z.srec + +Flash the output file `example-abc.eval-adf7xxxmb4z.srec` using the +[Renesas Flash Programmer](http://am.renesas.com/products/tools/flash_prom_programming/rfp) +(registration required). + +Connect a terminal emulator (e.g. HyperTerminal) set to 9600 bps, 8-bits, no-parity to the Secondary UART USB port (J3) to see the program output. + +### Using IAR Embedded Workbench ### + +Install [IAR Embedded Workbench](http://www.iar.com/ewrl78/). + +Download and install +[GNU coreutils](http://gnuwin32.sourceforge.net/downlinks/coreutils.php), +[sed](http://gnuwin32.sourceforge.net/downlinks/sed.php), +and [make](http://gnuwin32.sourceforge.net/downlinks/make.php). + +Obtain the Contiki source code using [git](http://git-scm.com/download/win): + + git clone -b rl78-dev https://github.com/hexluthor/contiki.git + +Alternatively, download a +[zip file](https://github.com/hexluthor/contiki/archive/rl78-dev.zip) +of the latest source. + +Build Contiki's example-abc. +Click Start -> All Programs -> Accessories -> Command Prompt. + + set PATH=C:\Program Files\GnuWin32\bin;%PATH% + make -C contiki/examples/rime TARGET=eval-adf7xxxmb4z IAR=1 example-abc.eval-adf7xxxmb4z.srec + +Flash the output file `example-abc.eval-adf7xxxmb4z.srec` using the +[Renesas Flash Programmer](http://am.renesas.com/products/tools/flash_prom_programming/rfp) +(registration required). + +Connect a terminal emulator (e.g. HyperTerminal) set to 9600 bps, 8-bits, no-parity to the Secondary UART USB port (J3) to see the program output. diff --git a/platform/eval-adf7xxxmb4z/button-sensor.c b/platform/eval-adf7xxxmb4z/button-sensor.c new file mode 100644 index 000000000..eb2ed9949 --- /dev/null +++ b/platform/eval-adf7xxxmb4z/button-sensor.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#include "lib/sensors.h" +#include "dev/button-sensor.h" + +#include + +#define JOYSTICK_PUSH (!(P5 & BIT(5))) +#define JOYSTICK_RIGHT (!(P5 & BIT(4))) +#define JOYSTICK_DOWN (!(P5 & BIT(3))) +#define JOYSTICK_LEFT (!(P5 & BIT(2))) +#define JOYSTICK_UP (!(P5 & BIT(1))) + +const struct sensors_sensor button_sensor; + +static int +value(int type) +{ + return JOYSTICK_PUSH; +} +static int +configure(int type, int c) +{ + switch(type) { + case SENSORS_ACTIVE: + /* TODO */ + return 1; + } + return 0; +} +static int +status(int type) +{ + switch(type) { + case SENSORS_ACTIVE: + case SENSORS_READY: + return 0; /* TODO */ + } + return 0; +} +SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, + value, configure, status); diff --git a/platform/eval-adf7xxxmb4z/contiki-conf.h b/platform/eval-adf7xxxmb4z/contiki-conf.h new file mode 100644 index 000000000..cc033bd2b --- /dev/null +++ b/platform/eval-adf7xxxmb4z/contiki-conf.h @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#ifndef __CONTIKI_CONF_H__ +#define __CONTIKI_CONF_H__ + +#include + +#include "rl78.h" +#include "platform-conf.h" + +/* Clock ticks per second */ +#define CLOCK_CONF_SECOND (f_CLK >> CLOCK_SCALER) + +#define CCIF +#define CLIF + +#define dbg_putchar(x) uart0_putchar(x) + +#define USE_FORMATTED_STDIO 1 + +#define NULLRDC_CONF_802154_AUTOACK_HW 1 + +/* start of conitki config. */ +#define PLATFORM_HAS_LEDS 0 /* TODO */ +#define PLATFORM_HAS_BUTTON 1 + +#define RIMEADDR_CONF_SIZE 8 + +#if WITH_UIP6 +/* Network setup for IPv6 */ +#define NETSTACK_CONF_NETWORK sicslowpan_driver +#define NETSTACK_CONF_MAC nullmac_driver +#define NETSTACK_CONF_RDC nullrdc_driver +#define NETSTACK_CONF_RADIO adf7023_driver +#define NETSTACK_CONF_FRAMER framer_802154 + +#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 +#define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0 +#define CXMAC_CONF_ANNOUNCEMENTS 0 +#define XMAC_CONF_ANNOUNCEMENTS 0 + +#else /* WITH_UIP6 */ +/* Network setup for non-IPv6 (rime). */ + +#define NETSTACK_CONF_NETWORK rime_driver +#define NETSTACK_CONF_MAC csma_driver +#define NETSTACK_CONF_RDC sicslowmac_driver +#define NETSTACK_CONF_RADIO adf7023_driver +#define NETSTACK_CONF_FRAMER framer_802154 + +#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 + +#define COLLECT_CONF_ANNOUNCEMENTS 1 +#define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0 +#define CXMAC_CONF_ANNOUNCEMENTS 0 +#define XMAC_CONF_ANNOUNCEMENTS 0 +#define CONTIKIMAC_CONF_ANNOUNCEMENTS 0 + +#define CONTIKIMAC_CONF_COMPOWER 0 +#define XMAC_CONF_COMPOWER 0 +#define CXMAC_CONF_COMPOWER 0 + +#define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 + +#endif /* WITH_UIP6 */ + +#define QUEUEBUF_CONF_NUM 16 + +#define PACKETBUF_CONF_ATTRS_INLINE 1 + +#ifndef RF_CHANNEL +#define RF_CHANNEL 26 +#endif /* RF_CHANNEL */ + +#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0 + +#define IEEE802154_CONF_PANID 0xABCD + +#define PROFILE_CONF_ON 0 +#define ENERGEST_CONF_ON 0 + +#define AODV_COMPLIANCE +#define AODV_NUM_RT_ENTRIES 32 + +#define WITH_ASCII 1 + +#define PROCESS_CONF_NUMEVENTS 8 +#define PROCESS_CONF_STATS 1 + +#ifdef WITH_UIP6 + +#define RIMEADDR_CONF_SIZE 8 + +#define UIP_CONF_LL_802154 1 +#define UIP_CONF_LLH_LEN 0 + +#ifndef UIP_CONF_ROUTER +#define UIP_CONF_ROUTER 1 +#endif + +#ifndef UIP_CONF_IPV6_RPL +#define UIP_CONF_IPV6_RPL 1 +#endif + +#define NBR_TABLE_CONF_MAX_NEIGHBORS 30 +#define UIP_CONF_MAX_ROUTES 30 + +#define UIP_CONF_ND6_SEND_RA 0 +#define UIP_CONF_ND6_REACHABLE_TIME 600000 +#define UIP_CONF_ND6_RETRANS_TIMER 10000 + +#define UIP_CONF_IPV6 1 +#define UIP_CONF_IPV6_QUEUE_PKT 0 +#define UIP_CONF_IPV6_CHECKS 1 +#define UIP_CONF_IPV6_REASSEMBLY 0 +#define UIP_CONF_NETIF_MAX_ADDRESSES 3 +#define UIP_CONF_ND6_MAX_PREFIXES 3 +#define UIP_CONF_ND6_MAX_DEFROUTERS 2 +#define UIP_CONF_IP_FORWARD 0 +#define UIP_CONF_BUFFER_SIZE 1300 +#define SICSLOWPAN_CONF_FRAG 1 +#define SICSLOWPAN_CONF_MAXAGE 8 + +#define SICSLOWPAN_CONF_COMPRESSION_IPV6 0 +#define SICSLOWPAN_CONF_COMPRESSION_HC1 1 +#define SICSLOWPAN_CONF_COMPRESSION_HC01 2 +#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 +#ifndef SICSLOWPAN_CONF_FRAG +#define SICSLOWPAN_CONF_FRAG 1 +#define SICSLOWPAN_CONF_MAXAGE 8 +#endif /* SICSLOWPAN_CONF_FRAG */ +#define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 +#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2 +#else /* WITH_UIP6 */ +#define UIP_CONF_IP_FORWARD 1 +#define UIP_CONF_BUFFER_SIZE 1300 +#endif /* WITH_UIP6 */ + +#define UIP_CONF_ICMP_DEST_UNREACH 1 + +#define UIP_CONF_DHCP_LIGHT +#define UIP_CONF_LLH_LEN 0 +#define UIP_CONF_RECEIVE_WINDOW 48 +#define UIP_CONF_TCP_MSS 48 +#define UIP_CONF_MAX_CONNECTIONS 4 +#define UIP_CONF_MAX_LISTENPORTS 8 +#define UIP_CONF_UDP_CONNS 12 +#define UIP_CONF_FWCACHE_SIZE 30 +#define UIP_CONF_BROADCAST 1 +#define UIP_CONF_UDP 1 +#define UIP_CONF_UDP_CHECKSUMS 1 +#define UIP_CONF_PINGADDRCONF 0 +#define UIP_CONF_LOGGING 0 + +#define UIP_CONF_TCP_SPLIT 0 + +/* include the project config */ +/* PROJECT_CONF_H might be defined in the project Makefile */ +#ifdef PROJECT_CONF_H +#include PROJECT_CONF_H +#endif /* PROJECT_CONF_H */ + +#endif /* __CONTIKI_CONF_H__ */ diff --git a/platform/eval-adf7xxxmb4z/contiki-main.c b/platform/eval-adf7xxxmb4z/contiki-main.c new file mode 100644 index 000000000..62a22d723 --- /dev/null +++ b/platform/eval-adf7xxxmb4z/contiki-main.c @@ -0,0 +1,258 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#include +#include +#include + +#include "contiki.h" +#include "net/netstack.h" + +#include "dev/serial-line.h" + +#include "net/uip.h" + +#include "dev/button-sensor.h" + +#if WITH_UIP6 +#include "net/uip-ds6.h" +#endif /* WITH_UIP6 */ + +#include "net/rime.h" +#include "uart0.h" +#include "contiki-uart.h" +#include "watchdog.h" +#include "slip-arch.h" + +#if __GNUC__ +#include "write.h" +#endif + +SENSORS(&button_sensor); + +#ifndef SERIAL_ID +#define SERIAL_ID { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 } +#endif + +static uint8_t serial_id[] = SERIAL_ID; +static uint16_t node_id = 0x0102; + +/*---------------------------------------------------------------------------*/ +static void +set_rime_addr(void) +{ + rimeaddr_t addr; + int i; + + memset(&addr, 0, sizeof(rimeaddr_t)); +#if UIP_CONF_IPV6 + memcpy(addr.u8, serial_id, sizeof(addr.u8)); +#else + if(node_id == 0) { + for(i = 0; i < sizeof(rimeaddr_t); ++i) { + addr.u8[i] = serial_id[7 - i]; + } + } else { + addr.u8[0] = node_id & 0xff; + addr.u8[1] = node_id >> 8; + } +#endif + rimeaddr_set_node_addr(&addr); + printf("Rime started with address "); + for(i = 0; i < sizeof(addr.u8) - 1; i++) { + printf("%d.", addr.u8[i]); + } + printf("%d" NEWLINE, addr.u8[i]); +} +/*---------------------------------------------------------------------------*/ +int contiki_argc = 0; +char **contiki_argv; + +static void +delay_1sec(void) +{ + /* Delay 1 second */ + register unsigned long int i; + for(i = 0x000FFFFFUL; i; --i) { + asm ("nop"); + } +} +int +main(int argc, char **argv) +{ + bool flip_flop = false; + + asm ("di"); + /* Setup clocks */ + CMC = 0x11U; /* Enable XT1, disable X1 */ + CSC = 0x80U; /* Start XT1 and HOCO, stop X1 */ + CKC = 0x00U; + delay_1sec(); + OSMC = 0x00; /* Supply fsub to peripherals, including Interval Timer */ + uart0_init(); + +#if __GNUC__ + /* Force linking of custom write() function: */ + write(1, NULL, 0); +#endif + + /* Setup 12-bit interval timer */ + RTCEN = 1; /* Enable 12-bit interval timer and RTC */ + ITMK = 1; /* Disable IT interrupt */ + ITPR0 = 0; /* Set interrupt priority - highest */ + ITPR1 = 0; + ITMC = 0x8FFFU; /* Set maximum period 4096/32768Hz = 1/8 s, and start timer */ + ITIF = 0; /* Clear interrupt request flag */ + ITMK = 0; /* Enable IT interrupt */ + /* asm ("ei"); / * Enable interrupts * / */ + + /* Disable analog inputs because they can conflict with the SPI buses: */ + ADPC = 0x01; /* Configure all analog pins as digital I/O. */ + PMC0 &= 0xF0; /* Disable analog inputs. */ + + clock_init(); + + /* Initialize Joystick Inputs: */ + PM5 |= BIT(5) | BIT(4) | BIT(3) | BIT(2) | BIT(1); /* Set pins as inputs. */ + PU5 |= BIT(5) | BIT(4) | BIT(3) | BIT(2) | BIT(1); /* Enable internal pull-up resistors. */ + + /* Initialize LED outputs: */ +#define BIT(n) (1 << (n)) + PM12 &= ~BIT(0); /* LED1 */ + PM4 &= ~BIT(3); /* LED2 */ + PM1 &= ~BIT(6); /* LED3 */ + PM1 &= ~BIT(5); /* LED4 */ + PM0 &= ~BIT(6); /* LED5 */ + PM0 &= ~BIT(5); /* LED6 */ + PM3 &= ~BIT(0); /* LED7 */ + PM5 &= ~BIT(0); /* LED8 */ + +#if UIP_CONF_IPV6 +#if UIP_CONF_IPV6_RPL + printf(CONTIKI_VERSION_STRING " started with IPV6, RPL" NEWLINE); +#else + printf(CONTIKI_VERSION_STRING " started with IPV6" NEWLINE); +#endif +#else + printf(CONTIKI_VERSION_STRING " started" NEWLINE); +#endif + + /* crappy way of remembering and accessing argc/v */ + contiki_argc = argc; + contiki_argv = argv; + + process_init(); + process_start(&etimer_process, NULL); + ctimer_init(); + + set_rime_addr(); + + queuebuf_init(); + + netstack_init(); + printf("MAC %s RDC %s NETWORK %s" NEWLINE, NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name); + +#if WITH_UIP6 + memcpy(&uip_lladdr.addr, serial_id, sizeof(uip_lladdr.addr)); + + process_start(&tcpip_process, NULL); + printf("Tentative link-local IPv6 address "); + { + uip_ds6_addr_t *lladdr; + int i; + lladdr = uip_ds6_get_link_local(-1); + for(i = 0; i < 7; ++i) { + printf("%02x%02x:", lladdr->ipaddr.u8[i * 2], + lladdr->ipaddr.u8[i * 2 + 1]); + } + /* make it hardcoded... */ + lladdr->state = ADDR_AUTOCONF; + + printf("%02x%02x" NEWLINE, lladdr->ipaddr.u8[14], lladdr->ipaddr.u8[15]); + } +#else + process_start(&tcpip_process, NULL); +#endif + + serial_line_init(); + + autostart_start(autostart_processes); + + while(1) { + watchdog_periodic(); + + if(NETSTACK_RADIO.pending_packet()) { + int len; + packetbuf_clear(); + len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE); + if(len > 0) { + packetbuf_set_datalen(len); + NETSTACK_RDC.input(); + } + } + + while(uart0_can_getchar()) { + char c; + UART_RX_LED = 1; + c = uart0_getchar(); + if(uart0_input_handler) { + uart0_input_handler(c); + } + } + UART_RX_LED = 0; + + process_run(); + + etimer_request_poll(); + + HEARTBEAT_LED1 = flip_flop; + flip_flop = !flip_flop; + HEARTBEAT_LED2 = flip_flop; + } + + return 0; +} +/*---------------------------------------------------------------------------*/ +void +log_message(char *m1, char *m2) +{ + printf("%s%s" NEWLINE, m1, m2); +} +/*---------------------------------------------------------------------------*/ +void +uip_log(char *m) +{ + printf("%s" NEWLINE, m); +} +/*---------------------------------------------------------------------------*/ diff --git a/platform/eval-adf7xxxmb4z/platform-conf.h b/platform/eval-adf7xxxmb4z/platform-conf.h new file mode 100644 index 000000000..f8de0739a --- /dev/null +++ b/platform/eval-adf7xxxmb4z/platform-conf.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2014, Analog Devices, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * \author Ian Martin + */ + +#ifndef NEWLINE +#define NEWLINE "\r\n" +#endif + +#ifndef BIT +#define BIT(n) (1 << (n)) +#endif + +#define BAUD2UBR(x) (x) + +#define LED1 P120 +#define LED2 P43 +#define LED3 P16 +#define LED4 P15 +#define LED5 P06 +#define LED6 P05 +#define LED7 P30 +#define LED8 P50 + +#define HEARTBEAT_LED1 LED2 +#define HEARTBEAT_LED2 LED3 +#define RADIO_TX_LED LED5 +#define RADIO_RX_LED LED6 +#define UART_RX_LED LED8 diff --git a/regression-tests/01-compile-base/Makefile b/regression-tests/01-compile-base/Makefile index ec01715ab..1252097b5 100644 --- a/regression-tests/01-compile-base/Makefile +++ b/regression-tests/01-compile-base/Makefile @@ -4,6 +4,7 @@ TOOLSDIR=../../tools EXAMPLES = \ hello-world/avr-raven \ hello-world/exp5438 \ +hello-world/eval-adf7xxxmb4z \ hello-world/micaz \ hello-world/minimal-net \ hello-world/native \ @@ -29,6 +30,7 @@ sky-shell-webserver/sky \ telnet-server/minimal-net \ webserver/minimal-net \ webserver-ipv6/exp5438 \ +webserver-ipv6/eval-adf7xxxmb4z \ wget/minimal-net \ z1/z1 \ settings-example/avr-raven \ From 85b439e33a33e76330cc1429da874bedf679fe7f Mon Sep 17 00:00:00 2001 From: Ian Martin Date: Fri, 10 Jan 2014 15:03:38 -0500 Subject: [PATCH 19/20] Add eval-adf7xxxmb4z platform makefile. --- .../Makefile.eval-adf7xxxmb4z | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 platform/eval-adf7xxxmb4z/Makefile.eval-adf7xxxmb4z diff --git a/platform/eval-adf7xxxmb4z/Makefile.eval-adf7xxxmb4z b/platform/eval-adf7xxxmb4z/Makefile.eval-adf7xxxmb4z new file mode 100644 index 000000000..d872d2d07 --- /dev/null +++ b/platform/eval-adf7xxxmb4z/Makefile.eval-adf7xxxmb4z @@ -0,0 +1,63 @@ +# Copyright (c) 2014, Analog Devices, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Author: Ian Martin + +CONTIKI_TARGET_DIRS = . +CONTIKI_CORE = contiki-main +CONTIKI_TARGET_MAIN = ${CONTIKI_CORE}.o + +ARCH += ADF7023.c +ARCH += adf7023-contiki.c + +CONTIKI_TARGET_SOURCEFILES += $(ARCH) +CONTIKI_TARGET_SOURCEFILES += contiki-main.c +CONTIKI_TARGET_SOURCEFILES += slip.c +CONTIKI_TARGET_SOURCEFILES += sensors.c +CONTIKI_TARGET_SOURCEFILES += button-sensor.c + +CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) + +${warning $(CONTIKI)} + +CONTIKIRL78 = $(CONTIKI)/cpu/rl78 +CONTIKIBOARD = . + +CONTIKI_PLAT_DEFS = + +ifeq ($(UIP_CONF_IPV6),1) +CFLAGS += -DWITH_UIP6=1 +endif + +include $(CONTIKIRL78)/Makefile.rl78 + +PROG_UART ?= /dev/ttyUSB1 + +run: $(CONTIKI_PROJECT).$(TARGET).srec + ~/adi-contiki/github/rl78flash/rl78flash -vv -i -m3 $(PROG_UART) -b500000 -a $< From 7d3053bbc50069f35aa5a4b17a6ec04f78e1df40 Mon Sep 17 00:00:00 2001 From: Ian Martin Date: Fri, 10 Jan 2014 16:31:05 -0500 Subject: [PATCH 20/20] Remove hyphen from preprocessor symbol to fix compiler warning. --- cpu/rl78/adf7023/adf7023-contiki.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/rl78/adf7023/adf7023-contiki.h b/cpu/rl78/adf7023/adf7023-contiki.h index 6443e4533..6be893824 100644 --- a/cpu/rl78/adf7023/adf7023-contiki.h +++ b/cpu/rl78/adf7023/adf7023-contiki.h @@ -32,8 +32,8 @@ * \author Ian Martin */ -#ifndef __ADF7023-contiki_H__ -#define __ADF7023-conitki_H__ +#ifndef __ADF7023_CONTIKI_H__ +#define __ADF7023_CONTIKI_H__ int adf7023_init(void); @@ -64,4 +64,4 @@ int adf7023_on(void); /* Turn the radio off. */ int adf7023_off(void); -#endif /* __ADF7023-contiki_H__ */ +#endif /* __ADF7023_CONTIKI_H__ */