]> cloudbase.mooo.com Git - z180-stamp.git/commitdiff
Add copyright notice
authorLeo C <erbl259-lmu@yahoo.de>
Tue, 16 Dec 2014 15:03:06 +0000 (16:03 +0100)
committerLeo C <erbl259-lmu@yahoo.de>
Tue, 16 Dec 2014 15:03:06 +0000 (16:03 +0100)
59 files changed:
COPYING [new file with mode: 0644]
TODO [new file with mode: 0644]
avr/background.c
avr/cli.c
avr/cli_readline.c
avr/cmd_boot.c
avr/cmd_date.c
avr/cmd_fat.c
avr/cmd_gpio.c
avr/cmd_help.c
avr/cmd_mem.c
avr/cmd_misc.c
avr/cmd_sd.c
avr/command.c
avr/command_tbl.c
avr/con-utils.c
avr/debug.c
avr/env.c
avr/getopt-min.c
avr/gpio.c
avr/i2c.c
avr/main.c
avr/pcf8583.c
avr/print-utils.c
avr/serial.c
avr/timer.c
avr/xmalloc.c
avr/z180-serv.c
avr/z180-stamp-avr.c [deleted file]
avr/z80-if.c
include/background.h
include/cli.h
include/cli_readline.h
include/cmd_mem.h
include/command.h
include/common.h
include/con-utils.h
include/config.h
include/crc.h
include/debug.h
include/env.h
include/ffconf.h
include/getopt-min.h
include/gpio.h
include/i2c.h
include/print-utils.h
include/ring.h
include/rtc.h
include/serial.h
include/spi.h
include/timer.h
include/z180-serv.h
include/z80-if.h
stm32/debug.h
stm32/serial.c
stm32/serial.h
stm32/z180-stamp-stm32.c
stm32/z80-if.c
stm32/z80-if.h

diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..d159169
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..7b8d92f
--- /dev/null
+++ b/TODO
@@ -0,0 +1 @@
+TODO: eliminate xmalloc
index 0e1ca40047c5c464fd944fc78873c6d014fb9f06..9c8b5a6f72ac2cc893b79e05a90869f1d05b7cd4 100644 (file)
@@ -1,10 +1,16 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #include "common.h"
 #include "background.h"
 
 
 #define BG_FUNC_MAX 5
 
-static struct { 
+static struct {
        bg_func fct;
        int param;
 } func_tab[BG_FUNC_MAX];
@@ -13,7 +19,7 @@ static int_fast8_t fcount;
 
 int bg_register(bg_func f, int initval)
 {
-       if (fcount < BG_FUNC_MAX) { 
+       if (fcount < BG_FUNC_MAX) {
                func_tab[fcount].fct = f;
                func_tab[fcount].param = initval;
                return ++fcount - 1;
@@ -27,7 +33,7 @@ int bg_setstat(int handle, int val)
                func_tab[handle].param = val;
                return 1;
        }
-       
+
        return 0;
 }
 
@@ -44,7 +50,7 @@ int bg_getstat(int handle)
 void bg_shed(void)
 {
        static int_fast8_t current;
-       
+
        if (func_tab[current].fct) {
                int v = func_tab[current].fct(func_tab[current].param);
                func_tab[current].param = v;
@@ -52,5 +58,3 @@ void bg_shed(void)
        if (++current >= fcount)
                current = 0;
 }
-
-
index 046859c8f1648eadf8af4afcd19730de3242e4a3..52c85db1b4b17c1f192f008730e655cb6f986d2c 100644 (file)
--- a/avr/cli.c
+++ b/avr/cli.c
@@ -1,3 +1,16 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * Add to readline cmdline-editing by
+ * (C) Copyright 2005
+ * JinHua Luo, GuangDong Linux Center, <luo.jinhua@gd-linux.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #include "common.h"
 
 #include <string.h>
index 1dbc73b1e027c3687c2086135a21aba853972d05..04d32b126eae45efde86017e347e2d62f0decb25 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
@@ -591,4 +593,3 @@ int cli_readline(const FLASH char *const prompt)
 
        return cli_readline_into_buffer(prompt, console_buffer);
 }
-
index 4775b6ea04d376aeaaeb8bc04e0edbd19799eea5..301f4f583d4e02a8015b481edbed1d02064058b6 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * (C) Copyright 2000-2003
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
 
 /*
  * Misc boot support
index 3beebee498a6df16a3794762af81c0ee226022e5..efba8584f9790e21160284b5323b3e961b096072 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
  * (C) Copyright 2001
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
index df2ae69fccde3895ad42b11e270c8facd278e1cc..8ed7ae36952bf0238545db3f904c72b37d3d2f6c 100644 (file)
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+/*
+ * FAT filesystem commands
+ */
+
 #include "common.h"
 #include <stdlib.h>
 #include <string.h>
@@ -290,6 +300,39 @@ command_ret_t do_fat_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
        return CMD_RET_SUCCESS;
 }
 
+static
+FRESULT mkpath(TCHAR *path)
+{
+       /* TODO: */
+       (void) path;
+#if 0
+       FILINFO fd
+       TCHAR *p, *q;
+       FRESULT ret;
+
+#if _USE_LFN
+    fd.lfname = 0;
+#endif
+
+
+       res = f_stat (path, &fd)
+
+       p = strchr(path, ':');
+       if (p == NULL || *++p == '\0' || *p++ != '/')
+               return FR_OK;
+
+       while ((q = strchr(p, '/')) != NULL) {
+               *q = '\0';
+               ret = f_mkdir(path);
+               *q = '/';
+                       if (ret != FR_OK && ret != FR_EXIST)
+                               return ret;
+               p = q + 1;
+       }
+#endif
+
+       return FR_OK;
+}
 
 /*
  * fatread/write - load binary file to/from a dos filesystem
@@ -343,6 +386,12 @@ command_ret_t do_fat_rw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
        }
 
        res = f_mount(FatFs, argv[1], 0);
+
+       if (!res) {
+               if (dowrite) {
+                       res = mkpath(argv[1]);
+               }
+       }
        if (!res) {
                res = f_open(&File, argv[1], dowrite ? FA_WRITE | FA_CREATE_ALWAYS
                                                                                         : FA_READ );
index f448e36e53cc61a54217affce491d9f8d8b9d139..e0d9b06e9f3fb36f6266c8e6558f21b739d63afc 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #include "common.h"
 #include <stdlib.h>
 #include <string.h>
index 8f81b2d889b18e892af5b247d4570943a73aa216..010339ddc69e6a9f677c0eccae1fe3f9a6f2f3b0 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
 
 #include "common.h"
 #include "command.h"
index 0bc57421bdfc95282e9d38df262f3b8d54afad4a..20a4412a0b2e770e8b8cc232c628057771b73bff 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
index 315b959bcebd97b1665373a003b5ff4804a182bf..b29aedddce4c3dee0bd39db617ad822e802127fe 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
  * Copyright 2000-2009
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
@@ -88,4 +90,3 @@ command_ret_t do_sleep(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
 
        return CMD_RET_SUCCESS;
 }
-
index 46dbcfdc3ff30619f80f1593338e9a2a5a59a839..6b75d6ed51afab2e354fd7e1eaa7fb4a4d8b697e 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #include "common.h"
 #include <stdlib.h>
 
index c080527bb166822847f78cc17bb903f66dc81e40..b6fa41864f6fba3b87e410e4381ff98fc4d1c81b 100644 (file)
@@ -1,3 +1,12 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 /*
  *  Command Processor Table
  */
index e5c6567b667395064fb05514016893d813d6e07f..b70c7112e3cfbf66ddb61038745d9c0ef16319d7 100644 (file)
@@ -1,10 +1,13 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
 
 #include "common.h"
-
 #include "command.h"
 #include "cmd_mem.h"
 
-
 extern command_ret_t do_help(cmd_tbl_t *, int, int, char * const []);
 extern command_ret_t do_echo(cmd_tbl_t *, int, int, char * const []);
 extern command_ret_t do_sleep(cmd_tbl_t *, int, int, char * const []);
index f4023ff4e896be07ddbb7965a3682abfab026cae..f20dbfed214258bf77eb18e85d3f10f93a3b610c 100644 (file)
@@ -1,3 +1,8 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
 
 #include <string.h>
 #include "common.h"
index 796647b7d6f78d19a9bbbea3a830776faa57a82b..5096d590ecef40f924d8b00c8fc7c9842133fecf 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #include "common.h"
 #include <stdlib.h>
 #include <string.h>
@@ -7,6 +13,7 @@
 #include "command.h"
 #include "print-utils.h"
 #include "debug.h"
+
 /*
  * Debugging
  */
index 017053c24817a8af3de7c4d0d13361bc8de74a8b..7be7d03501f102a7fbed6367262272859d3f8ead 100644 (file)
--- a/avr/env.c
+++ b/avr/env.c
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #include "common.h"
 #include <string.h>
 #include <stdlib.h>
@@ -8,7 +14,6 @@
 #include "xmalloc.h"
 #include "crc.h"
 #include "command.h"
-
 #include "env.h"
 
 
index 8e5dd6c3e026070ec3270808eea1ea71d7b4e02b..f5ad912f281e1a73085160f6282e9754e04d1bea 100644 (file)
@@ -1,6 +1,3 @@
-#include "common.h"
-
-
 /*
  *     Minimum getopt, original version was:
  */
@@ -13,7 +10,8 @@
 */
 /* $Id: getopt.c,v 1.2 1992/12/07 11:12:52 nickc Exp $ */
 
-#include       <string.h>
+#include "common.h"            /* definition of FLASH */
+#include <string.h>
 
 int    optind = 1;                     /* next argv[] index */
 char *optarg;          /* option parameter if any */
@@ -40,7 +38,7 @@ getopt(                               /* returns letter, '?', EOF */
                   )
                        return -1;
        }
-       
+
        c = argv[optind][sp];           /* option letter */
        osp = sp++;                     /* get ready for next letter */
 
@@ -72,4 +70,3 @@ getopt(                               /* returns letter, '?', EOF */
 
        return c;
 }
-
index 31dbc21f46393c1adfd58fe7ac8719b307d60e79..73e9c396cad46d26235270e01e296552f7d939c3 100644 (file)
@@ -1,10 +1,15 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #include "common.h"
 #include <util/atomic.h>
 #include <limits.h>
 #include "debug.h"
 #include "gpio.h"
 
-
 /*
 
 Pin Name    Port    Timer   Mode    max div         max div     min f [Hz]
index d181ff60ee63fd2f48258866b469b2ec5aec4899..ae2f8da46d3410df36cf2f35f1dc7cdfa4ac79eb 100644 (file)
--- a/avr/i2c.c
+++ b/avr/i2c.c
@@ -1,3 +1,8 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
 
 /*
  * I2C (TWI) master interface.
@@ -371,6 +376,3 @@ int i2c_read(uint8_t chip, unsigned int addr, uint_fast8_t alen,
 
        return !((rc & (XMIT_DONE|DATA_ACK)) == (XMIT_DONE|DATA_ACK));
 }
-
-
-
index f601736922eec785633f8201729dd45118968bac..8bffef991971c64c9b443773016b19f984e2203d 100644 (file)
@@ -1,9 +1,11 @@
 /*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 
 #include "common.h"
-
 #include <avr/interrupt.h>
 #include <stdlib.h>
 #include <stdio.h>
index 7e9d749be0e8dc1a5dc437f16068303a7df79c57..169e4e937baa4ad7aee475316c6332c0ae86cb94 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 /*
  * Date & Time support for Philips PCF8583 RTC
  */
index 4205a90332fd7ff3a59f2f2489d5a51ec6a357fe..3f48620ff358a174c2b90d61ef40d4e94e0f06cb 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #include "common.h"
 #include <stdio.h>
 #include <ctype.h>
index e897c84b41077088025dc1204984f0420923f543..adbc3c430e91f0aaa01ce7bf18b433ff298976a1 100644 (file)
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <avr/io.h>
@@ -12,7 +15,7 @@
 
 
 static int _write(char c, FILE *stream);
-static FILE mystdout = FDEV_SETUP_STREAM(_write, 
+static FILE mystdout = FDEV_SETUP_STREAM(_write,
                NULL, _FDEV_SETUP_WRITE);
 
 
@@ -24,7 +27,7 @@ static FILE mystdout = FDEV_SETUP_STREAM(_write,
 #endif
 
 #if ((BUFFER_SIZE) > 256)
-# error: BUFFER_SIZE 
+# error: BUFFER_SIZE
 #endif
 
 struct ring rx_ring;
@@ -119,5 +122,3 @@ uint_fast8_t serial_tstc(void)
 {
        return !ring_is_empty(&rx_ring);
 }
-
-
index e222e68792fa8d89527c9942b91cb638cbeae81f..f45f2675564f0f26028774de91c63b0ae395f5d5 100644 (file)
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include "common.h"
 static volatile
 uint32_t timestamp;
 
-/*---------------------------------------------------------*/
-/* 1000Hz timer interrupt generated by OC3A                */
-/*---------------------------------------------------------*/
-
+/*
+ * 1000Hz timer interrupt generated by OC3A
+ */
 ISR(TIMER3_COMPA_vect)
 {
        static int_fast8_t tick_10ms;
index 9bf268446adedbf10dd816be9f1bc00772b3bb49..d42d5c9237eb604780f02b3bd54e0ca15049ff7b 100644 (file)
@@ -1,5 +1,10 @@
-#include <stdlib.h>
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
 
+#include <stdlib.h>
 #include "debug.h"
 #include "xmalloc.h"
 
@@ -11,7 +16,7 @@ void* xmalloc(size_t size)
 
        if (p == NULL)
                debug("*** Out of memory!\n");
-       
+
        return p;
 }
 
@@ -22,6 +27,6 @@ void* xrealloc(void *p, size_t size)
 
        if (p == NULL)
                debug("*** Out of memory!\n");
-       
+
        return p;
 }
index e3bca1662fac89a14d871c44078e057a88c9c163..e0b763fa210934b17a1fe8b7db98ae1a6bf3e82d 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #include "common.h"
 #include <util/atomic.h>
 
@@ -7,8 +13,6 @@
 #include "debug.h"
 #include "z180-serv.h"
 
-
-
 /*--------------------------------------------------------------------------*/
 
 
diff --git a/avr/z180-stamp-avr.c b/avr/z180-stamp-avr.c
deleted file mode 100644 (file)
index e6edb33..0000000
+++ /dev/null
@@ -1,591 +0,0 @@
-/*
- */
-
-
-#include <avr/io.h>
-//#include <avr/power.h>
-//#include <avr/pgmspace.h>
-#include <avr/interrupt.h>
-//#include <util/atomic.h>
-//#include <avr/sleep.h>
-//#include <string.h>
-
-#include <stdio.h>
-
-
-#include "debug.h"
-#include "serial.h"
-#include "z80-if.h"
-
-#define const const __flash
-#include "../z180/hdrom.h"
-#undef const
-
-#define FLASH __flash
-//#define FLASH 
-
-#define ESCCHAR                ('^'-0x40)
-
-#define S_10MS_TO      (1<<0)
-
-
-volatile int_fast8_t timeout_1s;
-//volatile uint_least8_t Stat;
-#define Stat GPIOR0
-
-unsigned int to_counter;
-
-/****************************************************************/
-
-#define P_ADL          PORTA
-#define P_ADH          PORTC
-#define P_ADB          PORTE
-#define PIN_ADB                PINE
-
-#define ADB_WIDTH      3
-#define ADB_SHIFT      2
-//#define ADB_PORT     GPIOE
-
-#define MASK(n)        ((1<<(n))-1)
-#define SMASK(w,s) (MASK(w) << (s))
-
-typedef union {
-       uint32_t l;
-       uint16_t w[2];
-       uint8_t b[4];
-} addr_t;
-
-
-/*--------------------------------------------------------------------------*/
-
-/*---------------------------------------------------------*/
-/* 1000Hz timer interrupt generated by OC1A                 */
-/*---------------------------------------------------------*/
-
-ISR(TIMER1_COMPA_vect)
-{
-       static int_fast8_t tick_10ms;
-//     static int_fast16_t count_ms;
-
-       int_fast8_t i;
-
-
-       i = tick_10ms + 1;
-       if (i == 10) {
-               i = 0;
-               Stat |= S_10MS_TO;
-               
-               /* Drive timer procedure of low level disk I/O module */
-               //disk_timerproc();
-       }
-       tick_10ms = i;
-       
-#if 0
-       count_ms++;
-       if (count_ms == 1000) {
-               count_ms = 0;
-
-               i = timeout_1s;
-               if (i)
-                       timeout_1s = i - 1;
-       }
-#endif
-}
-
-
-/*--------------------------------------------------------------------------*/
-
-static uint32_t z80_sram_cmp(uint32_t addr, uint32_t length, uint8_t wval, int inc)
-{
-       uint8_t rval;
-       int_fast8_t errors = 0;
-       
-       DBG_P(1, "SRAM: Check 0x%.5lx byte... ", length);
-       while (length--) {
-               if ((rval = z80_read(addr)) != wval) {
-                       if (errors == 0) { 
-                               DBG_P(1, "\nSRAM: Address   W    R\n" \
-                                        "      ------------------\n");
-                       }
-                       errors++;
-                       if (errors > 20) {
-                               DBG_P(1, "      ...\n");
-                               break;
-                       }
-                       DBG_P(1, "      0x%.5lx  0x%.2x 0x%.2x\n", addr, wval, rval);
-               }
-               addr++;
-               wval += inc;
-       }
-       DBG_P(1, "Done.\n");
-
-       return addr;
-}
-
-static void z80_sram_fill(uint32_t addr, uint32_t length, uint8_t startval, int inc)
-{
-       printf("SRAM: Write 0x%.5lx byte... ", length);
-       while (length--) {
-               z80_write(addr, startval);
-               ++addr; 
-               startval += inc;
-       }
-       printf("Done.\n");
-}
-
-
-#if 0
-void z80_sram_fill_string(uint32_t addr, int length, const char *text)
-{
-       char c;
-       const char *p = text;
-
-       while (length--) {
-               z80_write(addr++, c = *p++);
-               if (c == 0)
-                       p = text;
-       }
-}
-
-
-uint32_t z80_sram_cmp_string(uint32_t addr, int length, const char *text)
-{
-       char c;
-       const char *p = text;
-
-       while (length--) {
-               c = *p++;
-               if (z80_read(addr) != c)
-                       break;
-               ++addr;
-               if (c == 0)
-                       p = text;
-       }
-       return addr;
-}
-
-const char * const qbfox = "Zhe quick brown fox jumps over the lazy dog!";
-const char * const qbcat = "Zhe quick brown fox jumps over the lazy cat!";
-
-#endif
-
-uint8_t z80_get_byte(uint32_t adr)
-{
-       uint8_t data;
-       
-       z80_request_bus();
-       data = z80_read(adr),
-       z80_release_bus();
-       
-       return data;
-}
-
-
-/*--------------------------------------------------------------------------*/
-
-static void do_10ms(void) 
-{
-               if (to_counter)
-                       to_counter--;
-}
-
-/*--------------------------------------------------------------------------*/
-
-struct msg_item {
-       uint8_t fct;
-       uint8_t sub_min, sub_max;
-       void (*func)(uint8_t, int, uint8_t *);
-};
-
-uint32_t msg_to_addr(uint8_t *msg)
-{
-       union {
-               uint32_t as32;
-               uint8_t as8[4];
-       } addr;
-
-       addr.as8[0] = msg[0];
-       addr.as8[1] = msg[1];
-       addr.as8[2] = msg[2];
-       addr.as8[3] = 0;
-
-       return addr.as32;
-}
-
-void do_msg_ini_msgfifo(uint8_t subf, int len, uint8_t * msg)
-{
-       (void)subf; (void)len;
-
-       z80_init_msg_fifo(msg_to_addr(msg));
-}
-
-
-void do_msg_ini_memfifo(uint8_t subf, int len, uint8_t * msg)
-{
-       (void)len;
-
-       z80_memfifo_init(subf - 1, msg_to_addr(msg));
-}
-
-
-void do_msg_char_out(uint8_t subf, int len, uint8_t * msg)
-{
-       (void)subf;
-
-       while (len--)
-               putchar(*msg++);
-}
-
-
-const FLASH struct msg_item z80_messages[] =
-{
-       { 0,                    /* fct nr. */
-         0, 0,                 /* sub fct nr. from, to */
-         do_msg_ini_msgfifo},
-       { 0,
-         1, 2,
-         do_msg_ini_memfifo},
-       { 1,
-         1, 1,
-         do_msg_char_out},
-       { 0xff,                         /* end mark */
-         0, 0,
-         0},
-
-};
-
-
-
-
-void do_message(int len, uint8_t *msg)
-{
-       uint8_t fct, sub_fct;
-       int_fast8_t i = 0;
-
-       if (len >= 2) {
-               fct = *msg++;
-               sub_fct = *msg++;
-               len -= 2;
-
-               while (fct != z80_messages[i].fct)
-                       ++i;
-
-               if (z80_messages[i].fct == 0xff) {
-                       DBG_P(1, "do_message: Unknown function: %i, %i\n",
-                                       fct, sub_fct);
-                       return; /* TODO: unknown message # */
-               }
-
-               while (fct == z80_messages[i].fct) {
-                       if (sub_fct >= z80_messages[i].sub_min && sub_fct <= z80_messages[i].sub_max )
-                               break;
-                       ++i;
-               }
-
-               if (z80_messages[i].fct != fct) {
-                       DBG_P(1, "do_message: Unknown sub function: %i, %i\n",
-                                       fct, sub_fct);
-                       return; /* TODO: unknown message sub# */
-               }
-
-               (z80_messages[i].func)(sub_fct, len, msg);
-
-
-       } else {
-               /* TODO: error */
-               DBG_P(1, "do_message: to few arguments (%i); this shouldn't happen!\n", len);
-       }
-}
-
-
-
-#define CTRBUF_LEN 256
-
-void check_msg_fifo(void)
-{
-       int ch;
-       static int_fast8_t state;
-       static int msglen,idx;
-       static uint8_t buffer[CTRBUF_LEN];
-
-       while (state != 3 && (ch = z80_msg_fifo_getc()) >= 0) {
-               switch (state) {
-               case 0:         /* wait for start of message */
-                       if (ch == 0x81) {
-                               msglen = 0;
-                               idx = 0;
-                               state = 1;
-                       }
-                       break;
-               case 1:         /* get msg len */
-                       if (ch > 0 && ch <= CTRBUF_LEN) {
-                               msglen = ch;
-                               state = 2;
-                       } else
-                               state = 0;
-                       break;
-               case 2:         /* get message */
-                       buffer[idx++] = ch;
-                       if (idx == msglen)
-                               state = 3;
-                       break;
-               }
-       }
-
-       if (state == 3) {
-               do_message(msglen, buffer);
-               state = 0;
-       }
-}
-
-
-/*--------------------------------------------------------------------------*/
-
-void dump_mem(const __flash uint8_t *addr, uint32_t len)
-{
-       DBG_P(1, "hdrom dump:");
-       while (len) {
-               DBG_P(1, "\n    %.5x:", addr);
-               for (unsigned i = 0; i<16; i++)
-                       DBG_P(1, " %.2x", *addr++);
-               len -= len > 16 ? 16 : len;
-       }
-       DBG_P(1, "\n");
-}
-
-/*--------------------------------------------------------------------------*/
-
-void z80_load_mem(void)
-{
-       unsigned sec = 0;
-       uint32_t sec_base = hdrom_start;
-
-       DBG_P(1, "Loading z80 memory... \n");
-
-       while (sec < hdrom_sections) {
-               DBG_P(2, "  From: 0x%.5lX to: 0x%.5lX    (%5li bytes)\n",
-                               hdrom_address[sec],
-                               hdrom_address[sec]+hdrom_length_of_sections[sec] - 1,
-                               hdrom_length_of_sections[sec]);
-
-               z80_write_block((const __flash unsigned char *) &hdrom[sec_base],  /* src */
-                               hdrom_address[sec],                  /* dest */
-                               hdrom_length_of_sections[sec]);      /* len */
-               sec_base+=hdrom_length_of_sections[sec];
-               sec++;
-       }
-}
-
-/*--------------------------------------------------------------------------*/
-
-void z80_dump_mem(uint32_t addr, uint32_t len)
-{
-       DBG_P(1, "Memory dump:");
-       while (len) {
-               DBG_P(1, "\n    %.5lx:", addr);
-               for (unsigned i = 0; i<16; i++)
-                       DBG_P(1, " %.2x", z80_read(addr++));
-               len -= len > 16 ? 16 : len;
-       }
-       DBG_P(1, "\n");
-}
-
-/*--------------------------------------------------------------------------*/
-
-void setup_rtc(void)
-{
-       /* TODO: */
-}
-
-void setup_avr(void)
-{
-       /* WD */
-
-       /* CPU */
-
-       /* Disable JTAG Interface regardless of the JTAGEN fuse setting. */
-       MCUCR = _BV(JTD);
-       MCUCR = _BV(JTD);
-
-       /* disable unused periphels */
-       PRR0 = _BV(PRTIM2) | _BV(PRTIM0) | _BV(PRADC);
-       PRR1 = _BV(PRTIM5) | _BV(PRTIM4) | _BV(PRTIM3) | 
-               _BV(PRUSART3) | _BV(PRUSART2) | _BV(PRUSART1);
-
-       /* disable analog comparator */
-       ACSR = _BV(ACD);
-       /* Ports */
-
-       /* Clock */
-       CLKPR = _BV(CLKPCE);
-       CLKPR = 0;
-
-       /* Timer */
-
-       OCR1A = F_CPU / 8 / 1000 - 1; // Timer1: 1000Hz interval (OC1A)
-       TCCR1B = 0b00001010;
-       TIMSK1 = _BV(OCIE1A); // Enable TC1.oca interrupt
-}
-
-const __flash uint8_t iniprog[] = {
-       0xAF,                   // xor     a
-       0xED, 0x39, 0x36,       // out0    (rcr),a         ;disable  DRAM refresh
-       0x3E, 0x30,             // ld      a,030h
-       0xED, 0x39, 0x32        //out0    (dcntl),a       ;0 mem, max i/0 wait states
-};
-
-const __flash uint8_t sertest[] = {
-       0xAF,              //   xor     a
-       0xED, 0x39, 0x36,  //   out0    (rcr),a         ;disable  DRAM refresh
-       0x3E, 0x30,        //   ld      a,030h
-       0xED, 0x39, 0x32,  //   out0    (dcntl),a       ;0 mem, max i/0 wait states
-       0x3E, 0x80,        //   ld      a,M_MPBT                ;no MP, PS=10, DR=16, SS=0
-       0xED, 0x39, 0x03,  //   out0    (cntlb1),a
-       0x3E, 0x64,        //   ld      a,M_RE + M_TE + M_MOD2  ;
-       0xED, 0x39, 0x01,  //   out0    (cntla1),a
-       0x3E, 0x00,        //   ld      a,0
-       0xED, 0x39, 0x05,  //   out0    (stat1),a       ;Enable rx interrupts
-       0xED, 0x38, 0x05,  //l0:in0     a,(stat1)
-       0xE6, 0x80,        //   and     80h
-       0x28, 0xF9,        //   jr      z,l0
-       0xED, 0x00, 0x09,  //   in0     b,(rdr1)
-       0xED, 0x38, 0x05,  //l1:in0     a,(stat1)
-       0xE6, 0x02,        //   and     02h
-       0x28, 0xF9,        //   jr      z,l1
-       0xED, 0x01, 0x07,  //   out0    (tdr1),b
-       0x18, 0xEA,        //   jr      l0
-};
-
-const __flash uint8_t test1[] = {
-       0xAF,              //   xor     a
-       0xED, 0x39, 0x36,  //   out0    (rcr),a         ;disable  DRAM refresh
-       0x3E, 0x30,        //   ld      a,030h
-       0xED, 0x39, 0x32,  //   out0    (dcntl),a       ;0 mem, max i/0 wait states
-       0x21, 0x1E, 0x00,  //   ld      hl,dmclrt       ;load DMA registers
-       0x06, 0x08,        //   ld      b,dmct_e-dmclrt
-       0x0E, 0x20,        //   ld      c,sar0l
-       0xED, 0x93,        //   otimr   
-       0x3E, 0xC3,        //   ld      a,0c3h          ;dst +1, src +1, burst
-       0xED, 0x39, 0x31,  //   out0    (dmode),a       ;
-       0x3E, 0x62,        //   ld      a,062h          ;enable dma0, 
-       0xED, 0x39, 0x30,  //cl_1:      out0    (dstat),a       ;copy 64k
-       0x18, 0xFB,        //   jr      cl_1            ;
-       0x00, 0x00,        //dmclrt:    dw      0               ;src (inc) 
-       0x00,              //   db      0               ;src
-       0x00, 0x00,        //   dw      0               ;dst (inc),
-       0x00,              //   db      0               ;dst
-       0x00, 0x00,        //   dw      0               ;count (64k)
-};
-
-
-int main(void)
-{
-       int_fast8_t state = 0;
-       int ch;
-
-       setup_avr();
-       serial_setup();
-       setup_rtc();
-       sei();
-
-       printf_P(PSTR("\n(ATMEGA1281+HD64180)_stamp Tester\n"));
-
-       DBG_P(1, "z80_setup_bus... ");
-       z80_setup_msg_fifo();
-       z80_setup_bus();
-       DBG_P(1, "done.\n");
-
-       DBG_P(1, "Get bus... ");
-/* Now done via S_Z180_RUNNING
-       z80_busreq(LOW);
-       z80_reset(HIGH);
-*/
-       z80_request_bus();
-       DBG_P(1, "got it!\n");
-       
-//     z80_sram_fill(0, (uint32_t)512 * 1024, 0x00, 3);
-//     z80_sram_cmp(0, (uint32_t)512 * 1024, 0x00, 3);
-//     z80_dump_mem(0, 0x400);
-       
-       z80_memset(0, 0x76, 0x80000);
-//     z80_memset(0, 0x00, 0x80000);
-//     z80_write_block(test1, 0, sizeof(test1));
-
-//     z80_dump_mem(0, 0x100);
-       
-//     z80_sram_cmp(0, (uint32_t)512 * 1024, 0x76, 0);
-       
-       z80_load_mem();
-//     z80_write(0, 0x76);
-//     z80_dump_mem(0, 0x200);
-
-
-/* Now done via S_Z180_RUNNING
-       z80_reset(LOW);
-*/
-       z80_release_bus();
-       DBG_P(1, "Bus released!\n");
-       z80_reset(HIGH);
-       DBG_P(1, "Reset released!\n");
-       
-       to_counter = 200;
-
-       while (1) {
-
-               if (Stat & S_10MS_TO) {
-                       Stat &= ~S_10MS_TO;
-                       do_10ms();
-               }
-               
-
-               if ((ch = serial_getc()) >= 0) {
-                       switch (state) {
-                       case 0:
-                               if (ch == ESCCHAR) {
-                                       state = 1;
-                                       /* TODO: Timer starten */
-                               } else {
-//                                     z80_memfifo_putc(fifo_out, ch);
-                                       serial_putc(ch);
-                                       if (ch == '\r')
-                                               serial_putc('\n');
-                               }       
-                               break;
-                       case 1:
-                               switch (ch) {
-
-                               case 'r':
-                                       z80_reset_pulse();
-                                       break;
-
-                               case 'b':
-                                       z80_request_bus();
-                                       z80_dump_mem(0, 0x2d20);
-                                       z80_release_bus();
-                                       break;
-
-                               case 'e':
-                                       z80_request_bus();
-                                       z80_dump_mem(0x80000-0x4000, 0x800);
-                                       z80_dump_mem(0x80000-0x200, 0x200);
-                                       z80_release_bus();
-                                       break;
-
-                               case ESCCHAR:
-                               default:
-//                                     z80_memfifo_putc(fifo_out, ch);
-                                       serial_putc(ch);
-                                       if (ch == '\r')
-                                               serial_putc('\n');
-                               }
-                               state = 0;
-                               break;
-                       }
-               }
-
-//             check_msg_fifo();
-       }
-
-       return 0;
-}
index cc0bab1bd05a80b0e66dff9d9b799848e10a9b2a..b64e755257d69919649021ee217f057082504808 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 /**
  *
  * Pin assignments
@@ -50,7 +56,6 @@
  * |            | P             |       |  af1   OSC32          |
  * |            | P             |       |  af1   OSC32          |
 
-
  */
 
 
index 8a430b3195b589bbbcfd379030223b2f358cb7a9..87e95e5aae762ab854ebc06239aefe8535c4992c 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef BACKGROUND_H
 #define BACKGROUND_H
 
@@ -9,4 +15,3 @@ int bg_getstat(int handle);
 void bg_shed(void);
 
 #endif /* BACKGROUND_H */
-
index 67ff63b587eef91308e21c41831c5011264532f4..f6fb2abff566c88a1c46767bb28fded74e4d8ec5 100644 (file)
@@ -1,4 +1,13 @@
-#ifndef CLI_H          
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * (C) Copyright 2014 Google, Inc
+ * Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef CLI_H
 #define CLI_H
 
 /**
@@ -61,4 +70,3 @@ int run_command_list(const char *cmd, int len);
 
 
 #endif /* CLI_H */
-
index 5b25762720cb0ae8f9955fd251bf84b5b1e3841f..b7dc938003afbf6430e6897b7b1a955c9effd6ff 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
  * (C) Copyright 2014 Google, Inc
  * Simon Glass <sjg@chromium.org>
  *
@@ -47,4 +49,3 @@ int cli_readline(const FLASH char *const prompt);
 
 
 #endif /* CLI_READLINE_H */
-
index 18023389d33ed0ce49fb7f1be7e24dfa17da9339..05227cc4554b7782f5396ce1ba6a36e87cdf4eb8 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef CMD_MEM_H
 #define CMD_MEM_H
 
@@ -25,4 +31,3 @@ extern command_ret_t do_mem_mwc(cmd_tbl_t *, int, int, char * const []);
 #endif /* CONFIG_MX_CYCLIC */
 
 #endif /* CMD_MEM_H */
-
index d0933a0b8fc8e73a16cd1c8322968bfe5f8eb584..5582fa5bc5d8836756d8ae07e6999131e1b30428 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
 
 /*
  *  Definitions for Command Processor
@@ -37,11 +45,11 @@ typedef enum {
 
 struct cmd_tbl_s {
        const FLASH char *name;         /* Command Name                 */
-       int             maxargs;        /* maximum number of arguments  */
-       int             repeatable;     /* autorepeat allowed?          */
-                                       /* Implementation function      */
+       int             maxargs;                        /* maximum number of arguments  */
+       int             repeatable;                     /* autorepeat allowed?          */
+                                                               /* Implementation function      */
        command_ret_t   (*cmd)(const FLASH struct cmd_tbl_s *, int, int, char * const []);
-       const FLASH char *usage;                /* Usage message        (short) */
+       const FLASH char *usage;        /* Usage message        (short) */
 #ifdef CONFIG_SYS_LONGHELP
        const FLASH char *help;         /* Help  message        (long)  */
 #endif
index b0dd038e8775df2be44988733a352c2f07266dab..cfbbae5c1fc1cf3185f18e67bb9983667d7f9080 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef COMMON_H
 #define COMMON_H
 
@@ -53,7 +59,7 @@ struct bits {
 extern volatile uint_least8_t Stat;
 #endif /* __AVR__ */
 
-#define S_10MS_TO      (1<<0)
+#define S_10MS_TO              (1<<0)
 #define S_MSG_PENDING  (1<<1)
 #define S_CON_PENDING  (1<<2)
 
index 15a3ce82b9befddf2b3434fc44c4a0089dc67966..86c0df02369c1234b385da33abb1d2694eb5fa01 100644 (file)
@@ -1,4 +1,14 @@
-#ifndef CON_UTILS_H            
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+/*
+ * Console utilities
+ */
+
+#ifndef CON_UTILS_H
 #define CON_UTILS_H
 
 uint_fast8_t tstc(void);
@@ -18,5 +28,3 @@ uint_fast8_t had_ctrlc (void);
 void clear_ctrlc(void);
 
 #endif /* CON_UTILS_H */
-
-
index d0749b3d825ff9ed1ea1ae45999116767ad020fe..f51ebe926d2db8e7fcb082f163656cd39817111a 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef CONFIG_H
 #define CONFIG_H
 
index 927b5ff726f768bfebfddb1793325da6d7077fe9..89cde1f0e7b951df023a62bb227c8f363a105c27 100644 (file)
@@ -1,14 +1,21 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef CRC_H
 #define CRC_H
 
 #ifdef __AVR__
 #include <util/crc16.h>
 static inline
-uint16_t crc16(uint16_t crc, uint8_t data) 
+uint16_t crc16(uint16_t crc, uint8_t data)
 {
        return _crc_ccitt_update(crc, data);
 }
 #else /* !__AVR__ */
+       /* TODO */
 #endif /* __AVR__ */
 
 #endif /* CRC_H */
index da8e9a060ee89437c2bfd0b1ad0d2436869d6ac8..39c15b0ab88c77d52c568347c7031c6a6b6dc1fd 100644 (file)
@@ -1,3 +1,12 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 
 #ifndef DEBUG_H_
 #define DEBUG_H_
 #define _DEBUG 0
 #endif
 
+/*
+ * Output a debug text when condition "cond" is met. The "cond" should be
+ * computed by a preprocessor in the best case, allowing for the best
+ * optimization.
+ */
 #define debug_cond(cond, fmt, args...)         \
        do {                                    \
                if (cond)                       \
index 7c4fee94c858fdd66ef1536b0daf4d0448d2cbc6..da38c541f8b340b15d2691265443e48542710888 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef ENV_H
 #define ENV_H
 
@@ -8,9 +14,8 @@ unsigned long getenv_ulong(const MEMX char *name, int base, unsigned long defaul
 int setenv_ulong(const MEMX char *varname, unsigned long value);
 int setenv_hex(const MEMX char *varname, unsigned long value);
 
-#if defined(CONFIG_AUTO_COMPLETE) 
+#if defined(CONFIG_AUTO_COMPLETE)
 int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
 #endif
 
 #endif /* ENV_H */
-
index 1399dc206a820da2e58d9536a38f57315fbd9fae..9841d5b5d41f4814e23a71f702103bda94557d83 100644 (file)
@@ -1,4 +1,5 @@
 #ifdef __AVR__
 #include "avr/ffconf.h"
 #else
+       /* TODO */
 #endif
index 9f7729ec6d0703165aebf3a621ccad9027e31cc9..6495ebf21fa88dcdbc79841652352a4deac6d96b 100644 (file)
@@ -1,12 +1,11 @@
 #ifndef GETOPT_MIN_H
 #define GETOPT_MIN_H
 
-int getopt(                            /* returns letter, '?', EOF */
-       int             argc,           /* argument count from main */
-       char    *const argv[],  /* argument vector from main */
+int getopt(                                            /* returns letter, '?', EOF */
+       int             argc,                                   /* argument count from main */
+       char    *const argv[],                  /* argument vector from main */
        const FLASH char * optstring ); /* allowed args, e.g. "ab:c" */
 
 extern int optind;
 
 #endif /* GETOPT_MIN_H */
-
index ac48045c69cd2145270347e4c82c42d505ddbdc3..1e0346d884da32f7c1ae0aa1b64ec7671a29b628 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef GPIO_H
 #define GPIO_H
 
@@ -14,4 +20,3 @@ int gpio_clockdiv_set(int pin, unsigned long divider);
 long gpio_clockdiv_get(int pin);
 
 #endif /* GPIO_H */
-
index 50b1fd02d8b09ec9657573a70c818a973a93ae0f..f39fa1dae882bac830228e390748727171ec7552 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
  * Copyright (C) 2009 Sergey Kubushyn <ksi@koi8.net>
  * Copyright (C) 2009 - 2013 Heiko Schocher <hs@denx.de>
  * Changes for multibus/multiadapter I2C support.
index 5604d3bc2d620a6d69bf6b2f95d0bcddc4311e22..8acf975f4acaa6a6bd3928d00096440f534ec7a5 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef PRINT_UTILS_H
 #define PRINT_UTILS_H
 
index d57f9aac99366cfec03eea9e12815c93495510cd..b64f462b9b0522e5d36f71cfcdfce26546671438 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef RING_H
 #define RING_H
 
@@ -71,4 +77,3 @@ int_fast8_t ring_is_empty(struct ring *ring)
 }
 
 #endif /* RING_H */
-
index 69466605fac647cfefb1ad23b79c89c315348a6c..ca4c0681b676a246d8ca1ad11e596d32e6497a2c 100644 (file)
@@ -1,6 +1,9 @@
 /*
- * Generic RTC interface.
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
  */
+
 #ifndef _RTC_H_
 #define _RTC_H_
 
index 40ac815695116e07cbecd71e7917d3f347a4f245..54c7211da36fc05e2a32b7991f17a16d9304b8fd 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef SERIAL_H
 #define SERIAL_H
 
index 6358f62405263e42943043b5cd268ff8c8b14b19..10525691c1f4a345749fb7487809b77489495554 100644 (file)
@@ -1,8 +1,7 @@
 /*
- * spi.h
+ * (C) Copyright 2009,2014 Leo C. <erbl259-lmu@yahoo.de>
  *
- *  Created on: 17.04.2009
- *      Author: leo
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef SPI_H_
index bed3eb01d1b0a927b2854cf0f92abc05101c9c7a..c6d605332d6ff91b5e46027c701840e07a5f5383 100644 (file)
@@ -1,7 +1,12 @@
-#ifndef TIMER_H                
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef TIMER_H
 #define TIMER_H
 
 uint32_t get_timer(uint32_t);
 
 #endif /* TIMER_H */
-
index af4b1c0110f603116787fed63e2fb30bb31ba206..424318f540a8d2646427932934a15f36da825287 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef Z180_SERV_H
 #define Z180_SERV_H
 
index d4ee57baa07c30e3a2d3900cc64edb91f6f65ab8..58790bd44bb719cd28a09545af275e8e7d51a7b3 100644 (file)
@@ -1,3 +1,8 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
 
 #define ZST_ACQUIRED   0x01
 #define ZST_RUNNING    0x02
index d542317fe1d98ecc9d3b87fff0b775bfcdd74224..692c8799c0e67fa4bf1ce6f31a465bb3d86298ce 100644 (file)
@@ -1,3 +1,8 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
 
 #ifndef DEBUG_H_
 #define DEBUG_H_
index 919300530a9e5663920cbb802714d276335c1acf..d2f1a9327b0875765ea9d9d0d90ba69a269be7c6 100644 (file)
@@ -1,8 +1,7 @@
 /*
- * serial.c
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
  *
- *  Created on: 04.05.2014
- *      Author: leo
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <errno.h>
index 1a0f5103d1ba3f969c69f7e7aab98d90c84eb913..62d95e2863c7434dc7fe02ae047252c1705bdffd 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef SERIAL_H
 #define SERIAL_H
 
index 15d732d26733f75fbdc6875cb2c62f2e43eff700..7000c53400fdba5d52cab275e2a10ad5a20c3f5b 100644 (file)
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <stdio.h>
@@ -86,26 +89,26 @@ static void clock_setup(void)
 
        /* Enable clocks for:
                GPIO port A (for GPIO_USART1_TX and Button)
-               GPIO port C (LEDs) 
+               GPIO port C (LEDs)
                USART1
-               TIM16 (RST-Pin) 
+               TIM16 (RST-Pin)
                TIM1  (IOCS1)
        */
-       rcc_peripheral_enable_clock(&RCC_APB2ENR, 
-                         RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN 
-                       | RCC_APB2ENR_IOPCEN | RCC_APB2ENR_IOPDEN 
+       rcc_peripheral_enable_clock(&RCC_APB2ENR,
+                         RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN
+                       | RCC_APB2ENR_IOPCEN | RCC_APB2ENR_IOPDEN
                        | RCC_APB2ENR_USART1EN | RCC_APB2ENR_AFIOEN
                        | RCC_APB2ENR_TIM1EN | RCC_APB2ENR_TIM16EN);
        /* Enable clocks for:
                TIM3
        */
-       rcc_peripheral_enable_clock(&RCC_APB1ENR, 
+       rcc_peripheral_enable_clock(&RCC_APB1ENR,
                        RCC_APB1ENR_TIM3EN);
 
        /* Enable clocks for:
                DMA1
        */
-       rcc_peripheral_enable_clock(&RCC_AHBENR, 
+       rcc_peripheral_enable_clock(&RCC_AHBENR,
                        RCC_AHBENR_DMA1EN);
 }
 
@@ -129,19 +132,19 @@ static void nvic_setup(void)
 static void tim3_setup(void)
 {
        TIM3_CR1 = TIM_CR1_CMS_EDGE | TIM_CR1_DIR_UP;
-               
+
        TIM3_CCMR2 = 0
-               | TIM_CCMR2_OC4M_FORCE_LOW      
+               | TIM_CCMR2_OC4M_FORCE_LOW
        /*      | TIM_CCMR2_OC4M_FORCE_HIGH     */
        /*      | TIM_CCMR2_OC4M_PWM2           */
-               
+
        /*      | TIM_CCMR2_OC4PE               */
        /*      | TIM_CCMR2_OC4FE               */
                | TIM_CCMR2_CC4S_OUT;
-               
+
        TIM3_CCER = TIM_CCER_CC4E
                | TIM_CCER_CC4P;
-       
+
        TIM3_ARR = 48;  /* default */
        TIM3_CCR4 = 1;  /*  */
 }
@@ -154,7 +157,7 @@ static void gpio_setup(void)
           Remap TIM3 (CH1/PC6, CH2/PC7, CH3/PC8, CH4/PC9)
           Port D0/Port D1 mapping on OSC_IN/OSC_OUT
        */
-       gpio_primary_remap(AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON, 
+       gpio_primary_remap(AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON,
                        AFIO_MAPR_SPI1_REMAP
                        | AFIO_MAPR_TIM3_REMAP_FULL_REMAP
                        | AFIO_MAPR_PD01_REMAP);
@@ -174,7 +177,7 @@ static void gpio_setup(void)
 void delay_systicks(int ticks)
 {
        int start, stop, now;
-       
+
        start = STK_CVR;
        stop = start - ticks;
        if (stop < 0) {
@@ -298,13 +301,13 @@ static void key_timerproc() {
 //     key_state = key_state  & key_in      | (key_state  | key_in)      & key_in_last;
 
        key_state = c | ((key_in_last | key_in) & key_state);
-               
+
 //     key_state = (key_state&key_in_last) | (key_state&key_in) | (key_in_last&key_in);
 
        key_press |= c;
-       
+
        key_in_last = key_in;
-       
+
 
        if ((key_state & REPEAT_MASK) == 0) // check repeat function
                rpt = REPEAT_START;
@@ -330,7 +333,7 @@ void sys_tick_handler(void)
                Stat |= S_10MS_TO;
 
                tick_10ms = 0;
-               
+
                i = led_timer[0];
                if (i)
                        led_timer[0] = i - 1;
@@ -339,11 +342,11 @@ void sys_tick_handler(void)
                        led_timer[1] = i - 1;
 
                key_timerproc();
-               
+
                /* Drive timer procedure of low level disk I/O module */
                //disk_timerproc();
        }
-       
+
        count_ms++;
        if (count_ms == 1000) {
                count_ms = 0;
@@ -366,7 +369,7 @@ void rtc_isr(void)
 void tim3_set(int mode)
 {
        uint16_t cc_mode;
-       
+
        cc_mode = TIM_CCMR2_CC4S_OUT;
 
        TIM3_CR1 = TIM_CR1_CMS_EDGE | TIM_CR1_DIR_UP /*| TIM_CR1_OPM */ ;
@@ -380,9 +383,9 @@ void tim3_set(int mode)
                TIM3_CCR4 = mode/2;
                cc_mode |= TIM_CCMR2_OC4M_PWM2;
        }
-                       
+
        TIM3_CCMR2 = cc_mode;
-               
+
        if (mode > 0)
                TIM3_CR1 |= TIM_CR1_CEN;
 }
@@ -393,17 +396,17 @@ static uint32_t z80_sram_cmp(uint32_t addr, uint32_t length, uint8_t wval, int i
 {
        uint8_t rval;
        int_fast8_t errors = 0;
-       
+
        DBG_P(1, "SRAM: Check %#.5x byte... ", length);
        while (length--) {
                if ((rval = z80_read(addr)) != wval) {
-                       if (errors == 0) { 
+                       if (errors == 0) {
                                printf("\nSRAM: Address  W  R\n" \
                                       "      -------------\n");
 //                                            12345  00 11
                        }
                        printf("       %.5lx  %.2x %.2x\n", addr, wval, rval);
-                       
+
                        if (++errors > 16 )
                                break;
                }
@@ -421,7 +424,7 @@ static void z80_sram_fill(uint32_t addr, int length, uint8_t startval, int inc)
        printf("SRAM: Write %#.5x byte... ", length); //fflush(stdout);
        while (length--) {
                z80_write(addr, startval);
-               ++addr; 
+               ++addr;
                startval += inc;
        }
        printf("Done.\n");
@@ -465,18 +468,18 @@ const char * const qbcat = "Zhe quick brown fox jumps over the lazy cat!";
 uint8_t z80_get_byte(uint32_t adr)
 {
        uint8_t data;
-       
+
        z80_request_bus();
        data = z80_read(adr),
        z80_release_bus();
-       
+
        return data;
 }
 
 
 /*--------------------------------------------------------------------------*/
 
-static void do_10ms(void) 
+static void do_10ms(void)
 {
        for (uint_fast8_t i = 0; i < 2; i++) {
                switch (led_stat[i].mode) {
@@ -696,19 +699,19 @@ int main(void)
        z80_reset(HIGH);
        z80_request_bus();
        DBG_P(1, "got it!\n");
-       
+
        z80_memset(0, 0x76, 0x80000);
        //z80_sram_fill(0, 512 * 1024, 0x76, 0);
        z80_sram_cmp(0, (uint32_t)512 * 1024, 0x76, 0);
-       
+
        z80_load_mem();
        z80_reset(LOW);
        DBG_P(1, "Bus released!\n");
        z80_release_bus();
        z80_reset(HIGH);
        DBG_P(1, "Reset released!\n");
-       
-       
+
+
        ledset(0, BLINK1, 50);
 
        while (1) {
index 171fea9c93dbc6e0f4cb84bb0a6e7204ac0dd1cc..6c415d1a5500b08f51f2a554575756de7b71c4cf 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 /**
  *
  * Pin assignments
@@ -111,8 +117,8 @@ AFIO_MAPR_SPI1_REMAP
 
 
 AFIO_MAPR2 =
-AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON  (frees 
-AFIO_MAPR_SPI1_REMAP 
+AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON  (frees
+AFIO_MAPR_SPI1_REMAP
 
  */
 
@@ -220,7 +226,7 @@ AFIO_MAPR_SPI1_REMAP
 
 #define IOFIELD_GET(src, width, shift) \
                ((src>>shift) & MASK(width))
-               
+
 #define CNF_MODE_I_F       (GPIO_CNF_INPUT_FLOAT<<2 |GPIO_MODE_INPUT)
 #define CNF_MODE_O_PP  (GPIO_CNF_OUTPUT_PUSHPULL<<2 | GPIO_MODE_OUTPUT_10_MHZ)
 
@@ -249,16 +255,16 @@ static void tim16_setup(void)
 {
        RCC_APB2RSTR |= RCC_APB2RSTR_TIM16RST;
        RCC_APB2RSTR &= ~RCC_APB2RSTR_TIM16RST;
-       
+
        TIM16_BDTR = TIM_BDTR_MOE;
-               
+
        TIM16_CCMR1 = 0
-               | TIM_CCMR1_OC1M_FORCE_LOW      
+               | TIM_CCMR1_OC1M_FORCE_LOW
                | TIM_CCMR1_CC1S_OUT;
-               
+
        TIM16_CCER = TIM_CCER_CC1NE
                | TIM_CCER_CC1NP;
-       
+
        TIM16_ARR = 48; /* default */
        TIM16_CCR1 = 1; /*  */
 }
@@ -268,7 +274,7 @@ static void tim16_setup(void)
 static void tim16_set(int mode)
 {
        uint16_t cc_mode;
-       
+
        cc_mode = TIM_CCMR1_CC1S_OUT;
 
        TIM16_CR1 = TIM_CR1_OPM;
@@ -281,9 +287,9 @@ static void tim16_set(int mode)
                TIM16_ARR = mode;
                cc_mode |= TIM_CCMR1_OC1M_PWM2;
        }
-                       
+
        TIM16_CCMR1 = cc_mode;
-               
+
        if (mode > 0)
                TIM16_CR1 |= TIM_CR1_CEN;
 }
@@ -292,44 +298,44 @@ static void tim16_set(int mode)
 
 
 
-/* 
+/*
  * A0..A6, A8..A13 are buffered. No need to disable.
  * A7, A14..A18: set to input.
  */
+
 static void z80_setup_adrbus_tristate(void)
 {
 #if 0
        gpio_set_mode(ADunbuff1_PORT, GPIO_MODE_INPUT,
                GPIO_CNF_INPUT_FLOAT, MASK(ADunbuff1_WIDTH) << ADunbuff1_SHIFT);
-       gpio_set_mode(ADunbuff2_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, 
+       gpio_set_mode(ADunbuff2_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT,
                (MASK(ADunbuff2_WIDTH) << ADunbuff2_SHIFT) | (MASK(ADunbuff3_WIDTH) << ADunbuff3_SHIFT));
 #else
-       GPIO_CRH(GPIOA) = (GPIO_CRH(GPIOA) & ~(0x0f << (4 * 0))) 
+       GPIO_CRH(GPIOA) = (GPIO_CRH(GPIOA) & ~(0x0f << (4 * 0)))
                        | (CNF_MODE_I_F << (4 * 0));
        GPIO_CRL(GPIOC) = (GPIO_CRL(GPIOC) & ~((0x0f << (4 * 6)) | (0x0f << (4 * 7))))
                        | ((CNF_MODE_I_F << (4 * 6)) | (CNF_MODE_I_F << (4 * 7)));
        GPIO_CRH(GPIOC) = (GPIO_CRH(GPIOC) & ~((0x0f << (4*2)) | (0x0f << (4*3)) | (0x0f << (4*4))))
                        | ((CNF_MODE_I_F << (4*2)) | (CNF_MODE_I_F << (4*3)) | (CNF_MODE_I_F << (4*4)));
-#endif 
+#endif
 }
 
-       
+
 static void z80_setup_adrbus_active(void)
 {
 #if 0
        gpio_set_mode(ADunbuff1_PORT, GPIO_MODE_OUTPUT_10_MHZ,
                GPIO_CNF_OUTPUT_PUSHPULL, MASK(ADunbuff1_WIDTH) << ADunbuff1_SHIFT);
-       gpio_set_mode(ADunbuff2_PORT, GPIO_MODE_OUTPUT_10_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, 
+       gpio_set_mode(ADunbuff2_PORT, GPIO_MODE_OUTPUT_10_MHZ, GPIO_CNF_OUTPUT_PUSHPULL,
                (MASK(ADunbuff2_WIDTH) << ADunbuff2_SHIFT) | (MASK(ADunbuff3_WIDTH) << ADunbuff3_SHIFT));
 #else
-       GPIO_CRH(GPIOA) = (GPIO_CRH(GPIOA) & ~(0x0f << (4 * 0))) 
+       GPIO_CRH(GPIOA) = (GPIO_CRH(GPIOA) & ~(0x0f << (4 * 0)))
                        | (CNF_MODE_O_PP << (4 * 0));
        GPIO_CRL(GPIOC) = (GPIO_CRL(GPIOC) & ~((0x0f << (4 * 6)) | (0x0f << (4 * 7))))
                        | ((CNF_MODE_O_PP << (4 * 6)) | (CNF_MODE_O_PP << (4 * 7)));
        GPIO_CRH(GPIOC) = (GPIO_CRH(GPIOC) & ~((0x0f << (4*2)) | (0x0f << (4*3)) | (0x0f << (4*4))))
                        | ((CNF_MODE_O_PP << (4*2)) | (CNF_MODE_O_PP << (4*3)) | (CNF_MODE_O_PP << (4*4)));
-#endif 
+#endif
 }
 
 
@@ -402,9 +408,9 @@ void z80_release_bus(void)
 void z80_reset(level_t level)
 {
        int x = level ? -1 : 0;
-       
+
        tim16_set(x);
-       
+
 //     Z80_O_RST = level;
 }
 
@@ -469,7 +475,7 @@ void z80_memset(uint32_t addr, uint8_t data, int length)
 void z80_write_block(uint8_t *src, uint32_t dest, uint32_t length)
 {
        uint8_t data;
-       
+
        z80_setup_dbus_out();
        Z80_O_ME = 0;
        while(length--) {
@@ -488,7 +494,7 @@ void z80_write_block(uint8_t *src, uint32_t dest, uint32_t length)
   017B'                         rx.out_idx:    ds      1               ;
   017C'                         rx.buf:                ds      rx.buf_len      ;
   018B'                         rx.buf_end     equ     $-1             ; last byte (start+len-1)
-                                
+
   018C'                         tx.bs_mask:    ds      1               ; (buf_len - 1)
   018D'                         tx.in_idx:     ds      1               ;
   018E'                         tx.out_idx:    ds      1               ;
@@ -517,7 +523,7 @@ static struct {
                idx_in,
                mask;
        } fifo_dsc[NUM_FIFOS];
-       
+
 
 void z80_memfifo_init(const fifo_t f, uint32_t adr)
 {
@@ -557,7 +563,7 @@ int z80_memfifo_is_empty(const fifo_t f)
 int z80_memfifo_is_full(const fifo_t f)
 {
        int rc = 1;
-       
+
        if (fifo_dsc[f].base != 0) {
                z80_request_bus();
                rc = ((fifo_dsc[f].idx_in + 1) & fifo_dsc[f].mask)
@@ -570,7 +576,7 @@ int z80_memfifo_is_full(const fifo_t f)
 uint8_t z80_memfifo_getc(const fifo_t f)
 {
        uint8_t rc, idx;
-       
+
        while (z80_memfifo_is_empty(f))
                ;
 
@@ -580,7 +586,7 @@ uint8_t z80_memfifo_getc(const fifo_t f)
        fifo_dsc[f].idx_out = ++idx & fifo_dsc[f].mask;
        z80_write(fifo_dsc[f].base+FIFO_INDEX_OUT, fifo_dsc[f].idx_out);
        z80_release_bus();
-       
+
        return rc;
 }
 
@@ -588,7 +594,7 @@ uint8_t z80_memfifo_getc(const fifo_t f)
 void z80_memfifo_putc(fifo_t f, uint8_t val)
 {
        int idx;
-       
+
        while (z80_memfifo_is_full(f))
                ;
 
@@ -714,7 +720,7 @@ DBG_P(1, "z80_init_msg_fifo: %lx\n", addr);
 int z80_msg_fifo_getc(void)
 {
        int c = -1;
-       
+
        if (msg_fifo.count != (NELEMS(msg_fifo.buf) - DMA1_CNDTR4)) {
                c = msg_fifo.buf[msg_fifo.count];
                if (++msg_fifo.count == NELEMS(msg_fifo.buf))
index d7c030d118cd0c9a5c2e5fb7e0734ac619928d9b..e65f160ff86077efe5dbcabec97e5305a8829424 100644 (file)
@@ -1,3 +1,8 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
 
 typedef enum {LOW, HIGH} level_t;